https://pintia.cn/problem-sets/994805260223102976/problems/994805262303477760
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
for(int i = 0; i < N; i++){
int tmp, score[500] = {0}, cnt = 0;
double G1 = 0.0, G2;
cin >> G2;
for(int j = 1; j < N; j++){
cin >> tmp;
if(tmp >= 0 && tmp <= M)
score[cnt++] = tmp;
}
sort(score, score+cnt);
for(int i = 1; i < cnt-1; i++)
G1 += score[i];
cnt -= 2;
cout << (int)((G1/cnt + G2)/2.0+0.5) << endl;
}
return 0;
}