#include <bits/stdc++.h> #include <sys/types.h> using namespace std; typedef pair<long long int, long long int> line; #define x first #define y second line arr[1005]; bool cmp( line a, line b){ if( a.x != b.x) return a.x < b.x; else return a.y <= b.y; } int main() {...