In today's kickstart problem, https://codejam.withgoogle.com/codejam/contest/6304486/dashboard#s=p1
I am getting wrong answer on big input but smaller input works fine and gives correct answer. Here is my code: https://ideone.com/7Ffer4
I tried with bigger input and answer is coming mostly as 0.
I can't find the error. Can someone tell the error and how to correct it.