hello codeforces
i was wondering why do i have to use int while long long is more useful
today i found the answer :
using long long :http://codeforces.net/contest/543/submission/22092332
using int : http://codeforces.net/contest/543/submission/22092593
hope this help
thanks
Auto comment: topic has been updated by AnasAbbas (previous revision, new revision, compare).
See this. He struggled so hard for days. Told me his algorithm I was amazed. Finally I saw his code and felt so poor for him. I remember how much frustrated he was :P . int vs long long
int is much quicker than long long
Time Limit
First int is much quicker than long long, second long long use more memory.
Another reason: it's good to build the habit of thinking about the limits of the data type you are using. In some problems even long long may overflow if you don't handle operations properly. If you are in the habit of using long long always and never considering overflow, it's likely you won't realize it.
However, http://codeforces.net/contest/543/submission/20381152
The probability of RTE due to integer overflow is far higher than MLE/TLE due to using long long instead of int unless you're doing a later div1 problem. Thus #define int long long or #define int int64_t should always be used IMO.
Additionally, on a 64 bit compiler, calculations done with 64 bit integers can actually speed up the program, as time doesn't need to be wasted casting 32-bit integers to 64-bit and vice versa.