No Such Element Exception in JAVA

does not have enough karma ,so asking here: why my code for NEO01(chef and feast) gives this error-- Exception in thread “main” java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextInt(Scanner.java:2117) at java.util.Scanner.nextInt(Scanner.java:2076) at Codechef.main(Main.java:15)

@manoj09 in ur code, u have declared result variable as int type…it should be declared as long
lets take a sample case as
1
10^5
-10^8 -10^8 -10^8 … so on upto 10^5 terms in regard of 30 points…

logically our result will be correct if we make subset of individual element
so
1* (-10^8)+1* (-10^8)+1* (-10^8)+1* (-10^8)+1* (-10^8)+1* (-10^8)+… upto 10^5 terms

on solving we are getting -10^13 as result which is out of range of int… so declare result variable as long type and if problem persist… just ping me again