Does standard I/O differ from File I/O?

I wrote a code to solve this problem “USACO” so my code worked with Standard I/O and the example was correct , but when I switched to File I/O the answer was 1 wich is not correct ! Can anyone explain why is it changing ? Its the exact same code but I used “freopen” function above .
// Sorry for bad english

Please post both your code with and without file I/O here. Make sure to also format them correctly.
Reading from files should not change the output, so maybe something else is causing this to happen.

1 Like