My code works on my own compiler but getting WA on CodeChef. Any help is appreciated!

#include

#include

#include

#include

int main() {

int tc = 0;

std::cin >> tc;

while(tc–) {

int N = 0;

std::cin >> N;

```
int K = 0;
std::cin >> K;
std::deque<int> a(N);
for (int i = 0; i < N; ++i) {
std::cin >> a[i];
}
std::sort(a.begin(), a.end());
for (int i = 0; i < K; ++i) {
a.pop_front();
a.pop_back();
}
int sum = 0;
for (int i = 0; i < a.size(); ++i) {
sum += a[i];
}
int avg = sum / a.size();
std::cout << std::setprecision(6) << avg << std::endl;
```

}

}