My issue
My code
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
while (t--){
int n,m, count = 0;
float sum = 0;
cin >> n >> m;
int a[m];
for(int i = 0; i<m; i++){
cin >> a[i];
sum+=a[i];
}
sort(a, a+m);
for(int i = 0; i<a[0]; i++){
if (float(sum/n)>m-1){
sum = sum-m;
n--;
count++;
}
else{
break;
}
}
cout << count << endl;
}
return 0;
}
Problem Link: BLDST Problem - CodeChef