need help in understanding the given code piece

// your code goes here

#ifdef JUDGE
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);

When I submit my solutions I comment the filling part . I want to know what is the #ifdef Judge ? the guy who has submitted the code has not removed or commented these lines ??

This command just makes your code read from and write into files.

I usually code on codechef IDE instead of local IDE, and one of the places i code specifically requires us to make code “read” from input file and “write” into output file (its an edx course for competitive coding). So, I saved it default template :slight_smile:

[These things are done automatically in codechef etc, so you need not bother about that]

O_O . Who’s code are you talking about? When you read about these functions, you realize that freopen is used to read and write in file.

@vijju yours you always write this . is this any specific method or what does it do ??

I kinda guessed that :stuck_out_tongue: . Looks like I got stalkers on my code XD. Feels good tho :stuck_out_tongue:

I know you are reading from and writing to files . but what is the purpose of #ifdef JUDGE . AND IS THE course you are talking about from ITMO university on edx ?


Yup, I think that was right. I remember enrolling but never opening that course (college :frowning: ). I will start it sometime soon (hopefully)