Problem Lecandy

Whats the difference between these two codes :

(For the problem http://www.codechef.com/problems/LECANDY/,)
http://ideone.com/VP6XPQ
and
http://ideone.com/deupgo

in 1 code there is some sum input and the other there is no input…i.e. stdin is empty…hence it is giving a RE as “test” gets a garbage value…leading to a very large output…giving rise to RE(SIGXFSZ)!!

Its(i/p) however there in both the test cases, I was getting Wa but figured out now why…
I used NO(uppercase) in my solution and didnt notice “No”(lowercase) in solution of someone that was correct. Thats y got confused and wasted so much of time.

//