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

stdin

00001101
00000001
00001010
00010101
00000011
01100010
01101011
00010010
10011000
11100010
00010011
00001111
10001000
00111101
01000010
01111000
00000110
11101101
10101100
00110111
00010001
00100100
10011001
10111110
10110110
11010111
00000100
01101001
11011000
00100111
11110110
01001110
10000010
10011011
00110011
11111101
10011010
01011011
11100111
10100101
00000000
00101101
01101101
01000101
11001001
00000011
11010010
00011100
10101011
10011001

stdout

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

stderr

strace