Submitting solution with Input/Output from external file

While submitting solutions to Online Judges like CC, CF, or any other coding competitions online like Facebook Hacker Cup, Google Code Jam, should I put the following code in comments or leave it as it is in C++?


    freopen("input.txt", "r", stdin);

    freopen("output.txt", "w", stdout);


Also in Java, if use FileReader and PrintWriter to read and write from external files, and to print should I change

BufferedReader br = new BufferedReader( new FileReader("input.txt")); 
PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); 


BufferedReader br = new BufferedReader( new InputStreamReader(;

and also change    pw.wrtie()    to    System.out.print()    ?