Result

AC

Code [DL]

import std.stdio;
import std.array;
import std.math;
import std.conv;

bool issq(int a) {
    return cast(int)sqrt(cast(real)a)*cast(int)sqrt(cast(real)a) == a;
}

bool tri(int a) {
    return issq(8*a+1) && (cast(int)sqrt(8.0*a+1) % 2);
}
void main() {
    string s;
    while ((s = readln()).length > 3) {
        int i = to!int(split(s)[0],2);
        if(tri(i)) {
            writeln("1");
        } else {
            writeln("0");
        }
    }
}

stdin

00011110
00110111
00010111
01011101
01000010
11111101
00000110
01111000
11100111
10011100
10011001
10010100
11010010
00001010
10100101
00100100
01101001
00101001
10111110
11001100
00010101
01101011
00011100
10000001
00000000
01011011
01001010
10101011
01101101
01001001
10001000
00000011
01001110
11010010
10111111
00010001
00000001
01110101
10001011
11111000
01001011
10000011
10001010
00101101
01000001
00001111
11100111
00001011
10110111
11011111

stdout

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

stderr

strace