Hello guys, I was uploading my solution on this problem: https://codeforces.me/problemset/problem/120/C but it gave me run time error on test 1 , I don't know why? and here is my code in java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int n,k,a,time,sum=0; boolean bool; n =read.nextInt(); k = read.nextInt(); for(int i=1;i<=n;i++){ a = read.nextInt(); time=0; bool = true; while(bool){ if(a<k||time==3){ sum = sum+a; bool = false; continue; } time++; a=a-k; } } System.out.println(sum); } }



