Runtime Error NZEC


#1

I’m solving problem - https://www.codechef.com/submit/MEDIC.
I’m getting error -
Exception in thread “main” java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.parseInt(Integer.java:615)
at Codechef.main(Main.java:16)

I’m beginner in codechef & facing this error frequently. When I try with custom input its working fine.
Please help me to find the problem.

Please find my code here -

/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

static int[] maxDayOfMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
public static void main (String[] args) throws java.lang.Exception
{
    int tests = Integer.parseInt(in.readLine());
    while (tests-- > 0){
        String[] dateParts = in.readLine().split(":");
        int year = Integer.parseInt(dateParts[0]);
        int month = Integer.parseInt(dateParts[1]);
        int day = Integer.parseInt(dateParts[2]);
        
        if (isLeapYear(year)){
            maxDayOfMonth[1] = 29;
        }
        int count = 1;
        while ((addDays(day, month, 1)[0] & 1) == 0){
            int[] arr = addDays(day, month, 2);
            day = arr[0];
            month = arr[1];
            count++;
        }
        out.write(count + "\n");
    }
    out.flush();
    out.close();
    in.close();
}

static int[] addDays(int day, int month, int inc){
    day += inc;
    int maxDay = maxDayOfMonth[month - 1];
    if (day > maxDay){
        day -= maxDay;
        month = (month + 1) % 12;
    }
    int[] arr = {day, month};
    return arr;
}

static boolean isLeapYear(int year){
    if (year % 4 != 0){
        return false;
    }else if (year % 100 != 0){
        return true;
    }else if (year % 400 != 0){
        return false;
    }else{
        return true;
    }
}

}
}