Result

AC

Code [DL]

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

module cat;
	integer c,i,d;
	initial begin
	c = 48;
			c = $fgetc(`STDIN);

		while (c != `EOF) begin
			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
			c = $fgetc(`STDIN);

		end
	end
endmodule

stdin

01010001
00001111
01011011
01110111
10001110
10001100
00100100
00110111
00101101
00100010
11100000
01001110
10000000
01111000
01001111
00000110
00000001
00000011
10010000
00001010
10111110
11010110
00010100
10100101
01101001
01000010
01001110
00010101
00110100
11111010
10011001
10111111
00011100
11101111
00010011
10111010
00000111
10101011
10001000
01000011
00001111
11111101
11100111
00000000
11110110
10101111
11010010
10100011
00000010
11110100

stdout

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

stderr

strace