How do I optimize my code with increasing run time efficiency?
This is a codechef problem (link given above).
Also few of the subtasks have been achieved but few are not
The following is the link to my code:

wow, see the constraints, its 1e18 which wont fit in int. Write #define int long long (and u will also have to change int main() to signed main() )
On the top and try submitting it, if ur code is write then it should work

1 Like

Or you can write like this:

#define int long long int

    int32_t main()
     return 0;
1 Like

yup that too can be a way

1 Like

Haha that’s what i do as well :laughing:

sorry by mistake. @vijju123 I take my flag back.

did you think this was from current long challenge too? :stuck_out_tongue:

1 Like

yup author playing with us. KS1 comes after KS2
@kartik_354 very bad. XD

1 Like

LOL i also thought that for a moment but then i clicked the solution link and it showed me his solution so no way it was from on going contest

1 Like

Same here :joy::joy: \hspace{0mm}

@codenameghost can you explain why use signed instead of int main. Thanks.

Because he is replacing int with long long int.
Now int main will be replaced with long long int main. And that won’t work.

Becoz there is no such thing as long long int main() , it has to have a return type of int and since u declared int as long long , the other way to have int return type u can used signed keyword


giving me a runtime error SIGCONT
how do i fix that?
same error with @saurabhshadow 's code
the logic of the code is fine

SIGCONT error occurs when you exceed the printing time limit of IDE.

how to reduce the printing time limit?