My issue
My code
#include <iostream>
#include<string>
#include <vector>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n, k;
bool flag = false;
int sum = 0;
cin >> n >> k;
vector<int> belok;
for(int i = 0; i < n; i++){
int a;
cin >> a;
belok.push_back(a);
}
for(int i = 0; i < n; i++){
if(belok[i] >= k){
belok[i] -= k;
belok[i + 1] += belok[i];
}
else{
cout << "NO " << i + 1 << endl;
flag = true;
}
}
if(flag == false){
cout << "YES" << endl;
}
}
return 0;
}
Problem Link: DIET Problem - CodeChef