Doubt in codechef

https://www.codechef.com/LTIME95C/problems/EQUINOX

My python code was accepted but c++ one wasn’t ! Please tell what is the bug in c++ code ??

hello @prerak_semwal

use long long in place of int

@aman212yadav
I did that only initially !
I used long long int but as it wasn’t accepted so I changed it to int !
This happened to me in past contests too…when I coded the same program in Python my answer was accepted !

Also still not accepted…

check now->

@aman212yadav

So if
<= 10^9 then, long long
10^9<= and <=10^18 then long long int ?

bro long long and long long int is same thing.

here in ur code u are taking summation due to which the overall result might exceed the range of int.
so to avoid it we use long long

@aman212yadav

but shouldn’t be, long long int > long long , as there is extra int

there is no such logic.

but are same

@aman212yadav

ok then for CP can you please specify what datatype for integers shall I choose for different constraints ?

if data can exceed 10^9 range the use long long otherwise int is fine

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.