#include <bits/stdc++.h> #define int long long using namespace std; struct node{ int a = 0, b = 0; }fri[200005]; int h[200005]; bool cmp(node a, node b){ return a.a <= b.a; } signed main() { int n, k, sum = 0; cin >> n >> k; for(int i = 1; i <= n; i++){ ...