My issue
Can someone please help me with this code to rectify it.
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
vector<int> brr(n);
for (int i = 0; i < n; i++) {
if (arr[i] <= m / 2) {
brr[i] = m;
} else {
brr[i] = 1;
}
}
int a = 0;
for (int i = 0; i < n; i++) {
a += abs(arr[i] - brr[i]);
}
cout << a << endl;
}
}
Problem Link: Far Away Practice Coding Problem