# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1216884 | takoshanava | Boxes with souvenirs (IOI15_boxes) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fs first
#define sc second
using namespace std;
signed main(){
int n, k, l;
cin >> n >> k >> l;
int x[n];
int ans = 0;
for(int i = 0; i < n; i++){
cin >> x[i];
ans += min(l - x[i], x[i]);
}
cout << ans << endl;
}