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", "0");
		    end else begin
		    	$write("%c\n", "1");
		    end
		end
	end
endmodule

stdin

01010010
00010110
00101100
01111000
11100111
10001010
01001110
00110111
01000010
01110010
01111101
00110011
00001010
00000000
10011001
00000110
00101011
00010101
00000001
10000011
00000101
11111101
10001000
10111001
01011011
10111110
11000100
11011000
00011000
00110101
01111001
01101000
10011001
00001110
00001111
00100100
00110010
00011110
01101001
11110111
10101011
00101110
11100111
00011100
00101111
11001010
00000011
10111000
11010010
00101101

stdout

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

stderr

strace