title: BufferedReader giving non-zero exit code
body: <p><strong>Problem</strong>
  A simple programming <a href="http://www.codechef.com/problems/MUFFINS3" rel="nofollow">question</a>, involves reading a number N, T times from console and perform simple calculation on it.</p>
  
  <p><strong>Constraints:</strong></p>
  
  <p>1 ≤ T ≤ 1000</p>
  
  <p>2 ≤ N ≤ 100000000</p>
  
  <p>As BufferedReader is usually faster than Scanner, I used it but the program exited with Non-Zero Exit code whereas using Scanner resolved the issue.</p>
  
  <p>Since both work fine on my computer, I suspect this is a memory issue.</p>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>Is my assumption that BufferedReader is faster than Scanner correct?</li>
  <li>Does BufferedReader use more memory? If yes, is it the reason for the error?</li>
  </ol>
  
  <p><strong>Code:</strong></p>
  
  <p>Using BufferedReader, throws error</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  
  public class Main {
      public static void main(String[] args) throws IOException{
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          int T = Integer.parseInt(br.readLine());
          for (int i=0; i&lt;T; i++) {
              int N = Integer.parseInt(br.readLine());
              int res = (N/2)+1;
              System.out.println(res);
          }
          br.close();
      }
  }
  </code></pre>
  
  <p>The code using Scanner that returned correct output:</p>
  
  <pre><code>import java.io.IOException;
  import java.util.Scanner;
  
  public class Main {
      public static void main(String[] args) throws IOException{
          Scanner sc = new Scanner(System.in);
          int T = Integer.parseInt(sc.nextLine());
          for (int i=0; i&lt;T; i++) {
              int N = Integer.parseInt(sc.nextLine());
              int res = (N/2)+1;
              System.out.println(res);
          }
          sc.close();
      }
  }
  </code></pre>