Slope Hack -

priority_queue<long long> left; // max-heap priority_queue<long long, vector<long long>, greater<long long>> right; // min-heap long long ans = 0;

Slope trick code (C++):

#include <bits/stdc++.h> using namespace std; int main() int n; cin >> n; slope hack