#include #include #define XMAX 4000000 #define PMAX 500000 #define FMAX 50 using namespace std; //FILE * fin=fopen("mpf.in","r"); //FILE * fout=fopen("mpf.out","w"); //ifstream fin("308.in"); //ofstream fout("mpf.out"); bool ciur[XMAX]; int prime[PMAX]; int nrp, nrx, nry, nrmin; int fx[FMAX]; int mx[FMAX]; int fy[FMAX]; int my[FMAX]; void eratostene(); void desc(int x, int&nrx, int fx[], int mx[]); int rezolva(); int main() {int i, q, x, y; ios_base :: sync_with_stdio(false); cin.tie(nullptr); //cin>>q; scanf("%d", &q); eratostene(); for (i=0; i>x>>y; scanf("%d %d", &x, &y); desc(x,nrx,fx,mx); desc(y,nry,fy,my); nrmin=rezolva(); //cout<1) {++nrx; fx[nrx]=x; mx[nrx]=1;} } int rezolva() {int rez=0; int i, j, unde; if (nrx==0) {for (i=1; i<=nry; i++) rez+=my[i]; return rez;} if (nry==0) {for (i=1; i<=nrx; i++) rez+=mx[i]; return rez;} unde=nrx; if (nry