Invitation to CodeChef January Cook-Off 2020

Greetings CodeChef community!

CodeChef invites you all to join us at CodeChef’s January serving of the Cookoff. Crafted out of the very best ideas, our set of curated problems will take your code buds for a delightful trip. This 2.5 hours contest will have five challenging problems.

Further, the January Cookoff will be the perfect opportunity to improve your CodeChef ratings and rankings. Also if you have some original and engaging problem ideas, and you’re interested in them being used in the CodeChef’s contests, you can share them here:

I hope you will participate with your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

I hope you will enjoy solving them. Please give your feedback on the problem set in the comments below, after the contest.

#Contest Details:

Time: 19th January 2020 (2130 hrs) to 19th January 2020 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.

Contest link:

Registration: You just need to have a CodeChef handle to participate. For all those who are interested and do not have a CodeChef handle, are requested to register in order to participate.


Top 10 performers in Global and top 10 performers in the Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: How do I win a CodeChef Goodie?.

Good Luck!
Hope to see you participating!!
Happy Programming !!


Are there any prizes for school students for being in top 5 school students or something ??
@admin @vijju123 @radoslav192

Only for ltime i guess.

I’m thinking of doing a post-contest stream discussing the problems. I don’t know if people are interested. If you are, fill out the poll below.


Hope to remain 4* this cookoff

I don’t know why my solution to PRT gives WA. Can someone please check it? Code

I was doing it exactly like you. I was able to find an issue with this.

You are sorting the values after taking mod


I don’t think that the only issue is sorting after taking mod. The way of counting doesn’t seem correct. I couldn’t get an AC with that code without the mod either. That certainly is an error many people did tho. I was able to correct this error during the contest but couldn’t figure out the complementary counting here.

you seem to be counting every undirected path more than once i.e. over counting the number of paths, also the sorting after modding part.

Mod was the only issue :
After removing mod from the function you should add it back in the loop for the variable ans as the multiplication will overflow.


You’re right. Thanks!

Oh okay. Yes. I’m sorry, I overlooked the way of adding. It is equivalent to the summation of squares.

oh yes, me too sorry i missed the division by tow part in the code

1 Like