Result

WA

Code [DL]

`define EOF 32'hFFFF_FFFF
`define STDIN 32'h8000_0000

module cat;
	integer c,i,d;
	initial begin
	c = 48;
		while (c != `EOF) begin
			c = $fgetc(`STDIN);
			d = 0;
			i = 1;
			while ( c == 48 || c == 49)begin
				d = d * 2;
				d = d + c - 48; 
				c = $fgetc(`STDIN);
			end
		    // $write("%d\n", d);
			i = 1;

			while(d > 0)begin 
				d = d - i;
				i = i + 1;
			end

			if ( d == 0 )begin
				$write("%c\n", "1");
		    end else begin
		    	$write("%c\n", "0");
		    end
		end
	end
endmodule

stdin

01001010
00100100
10101010
00011100
10100001
00100100
01001110
01111000
00010010
10100111
00011111
00011000
11101001
10001000
00001101
01101001
00000000
01110001
00000101
11100100
01101010
10011001
00110111
00001010
10010101
10111101
00100001
01011011
11100111
10101011
00000110
00101101
10000011
01110000
00001111
01101101
00001111
10111110
11001101
00000011
11111101
00000001
11010010
00010101
00110100
01111110
00100000
01011001
01000010
00101111

stdout

0
1
0
1
0
1
1
1
0
0
0
0
0
1
0
1
1
0
0
0
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
1
0
1
1
1
1
1
0
0
0
0
1
0
1

stderr

strace