#include <functional> #include <iostream> #include <queue> using namespace std; int main() { int n; long long a; cin >> n; long long num1,num2; long long res= 0; priority_queue<long long,vector<long long>,greater<>> stack; while ...