```#include<bits/stdc++.h>#define x first#define y secondusing namespace std;typedef long long ll;typedef pair<double,double> pdd;const int maxn=5e5+23;int a[maxn],tot,idx,cnt;int flag[maxn][5],coin[maxn][5];void dfs(int x,int y,int n){ if(x==n&&y==3){// cout<<x<<' '<<...