#include <iostream> #include <utility> #include <vector> #include <stack> using namespace std; int main() { int m; cin>>m; vector<int> fash(m, 0); for(int i=0; i<m; i++) { cin>>fash[i]; } stack<pair<int, int>...