Cod sursa(job #328920)
Program Hashuri2;
Const
p1 = 15485863;{2097593;}
p8 = p1*8;
Var
a: Array[0..p1] of Byte;
f, g: Text;
i, n, v: Longint; o: Byte;
Procedure Sb(l: LongInt; vv: Byte);
Var b, p: LongInt;
Begin
b:=l div 8;
p:=l mod 8;
Case p of
0: If vv = 0 then a[b]:=a[b] and 254 Else a[b]:=a[b] or 1;
1: If vv = 0 then a[b]:=a[b] and 253 Else a[b]:=a[b] or 2;
2: If vv = 0 then a[b]:=a[b] and 251 Else a[b]:=a[b] or 4;
3: If vv = 0 then a[b]:=a[b] and 247 Else a[b]:=a[b] or 8;
4: If vv = 0 then a[b]:=a[b] and 239 Else a[b]:=a[b] or 16;
5: If vv = 0 then a[b]:=a[b] and 223 Else a[b]:=a[b] or 32;
6: If vv = 0 then a[b]:=a[b] and 191 Else a[b]:=a[b] or 64;
7: If vv = 0 then a[b]:=a[b] and 127 Else a[b]:=a[b] or 128;
End;
End;
Function Rb(l: LongInt): Boolean;
Var b, p: LongInt; ret: Boolean;
Begin
b:=l div 8;
p:=l mod 8;
ret:=false;
Case p of
0: If (a[b] and 1) > 0 then ret:=true;
1: If (a[b] and 2) > 0 then ret:=true;
2: If (a[b] and 4) > 0 then ret:=true;
3: If (a[b] and 8) > 0 then ret:=true;
4: If (a[b] and 16) > 0 then ret:=true;
5: If (a[b] and 32) > 0 then ret:=true;
6: If (a[b] and 64) > 0 then ret:=true;
7: If (a[b] and 128) > 0 then ret:=true;
End;
Rb:=ret;
End;
BEGIN
{for i:=1 to p do h[i]:=false;}
Assign(f,'hashuri.in'); Reset(f);
Assign(g,'hashuri.out'); ReWrite(g);
ReadLn(f,n);
For i:=1 to n do
Begin
ReadLn(f,o,v);
Case o of
1: Sb(v mod p8,1);
2: Sb(v mod p8,0);
3: If Rb(v mod p8) then WriteLn(g,'1') Else WriteLn(g,'0');
End;
End;
Close(f); Close(g);
END.