This code ran sucessfully on ideone.com and http://www.compileonline.com ( http://ideone.com/Lb4YIl )but for some reason giving SIGSEGV error please suggest any modification that i should do .Thanks in advance.

Use long long int instead of int and you get AC

The input begins with two positive integers n k (n, k<=10^7). The next n lines of input contain one positive integer ti, not greater than 10^9, each, that’s why you require long long int.

Your AC code after replacing int with long long int–>AC code

3 Likes

You didn’t used nextInt() to get Fast input.

Then what was the use of writing that class FastRead??

2 Likes