Source Code
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
#define ll long long 
using namespace std;
int main() {  
    ll n, k, arr[200005];
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    } 
    sort(arr, arr + n);
    cout << arr[n - 1] - k << '\n';
return 0;
}
Copy
Cutting Trees Walaa Abd Elhady
GNU G++17
37 ms
1.7 MB
Wrong Answer