Cod sursa(job #710747)
#include<cstdio>
using namespace std;
const int M1 = 45007, M2 = 45013; int H1[M1], H2[M2];
int Cauta(int x){
return H1[x % M1] && H2[x % M2] ? 1 : 0;
}
int main(){
freopen ("hashuri.in", "r", stdin), freopen("hashuri.out", "w", stdout);
int i, n, x, op;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d %d", &op, &x);
if (op == 1)
if (Cauta(x) == 0) H1[x % M1]++, H2[x % M2]++;
if (op == 2)
if (Cauta(x) == 1) H1[x % M1]--, H2[x % M2]--;
if (op == 3) printf("%d\n", Cauta(x));
}
return 0;
}