Result

WA

Code [DL]

#include<stdio.h>
int m(int x) {
    int lb = 0;
    int ub = x;
    while((ub - lb) > 1) {
        int mb = (ub + lb) / 2;
        if (mb * mb > x)ub = mb;
        else lb = mb;
    }
    return lb;
}

main() {
    char s[8];
    for(int i=0;i<50;i++) {
        gets(s);
        int x=0;
        for(int j=0; j<8;j++)
        {
         x *= 2; x += (s[j]=='1');
        }
        int y = 1 + 8 * x;
        int z =m(y);
        printf("%d", z * z / y);
    }
}

stdin

00000001
11101111
10011001
01101001
10111011
00100100
01111010
00001111
10101011
00010001
10111110
00101101
10101101
00011000
00010000
10000011
10001000
00010010
01001110
11010000
10110110
11100111
11011000
00110111
01111101
11111010
01101100
10011101
00011100
00000000
00001010
00000011
01100101
00000001
01001011
00101011
01011011
01111000
01000010
11111101
11110010
00000110
00010101
01000000
11100011
11011101
11010010
10111110
01110110
10110010

stdout

stderr

/tmp/code.c:13:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main() {
 ^
/tmp/code.c: In function ‘main’:
/tmp/code.c:16:9: warning: ‘gets’ is deprecated [-Wdeprecated-declarations]
         gets(s);
         ^
In file included from /usr/include/stdio.h:936:0,
                 from /tmp/code.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:233:1: note: declared here
 gets (char *__str)
 ^
/tmp/code.c:16:9: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result [-Wunused-result]
         gets(s);
         ^
/tmp/cct0IHG9.o: In function `main':
code.c:(.text.startup+0x29): warning: the `gets' function is dangerous and should not be used.
*** buffer overflow detected ***: /tmp/code terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fb9357847e5]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7fb93582611c]
/lib/x86_64-linux-gnu/libc.so.6(+0x117120)[0x7fb935824120]
/lib/x86_64-linux-gnu/libc.so.6(__gets_chk+0x1a2)[0x7fb9358240b2]
/tmp/code[0x40053d]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fb93572d830]
/tmp/code[0x4005f9]
======= Memory map: ========
00400000-00401000 r-xp 00000000 00:22 144                                /tmp/code
00600000-00601000 r--p 00000000 00:22 144                                /tmp/code
00601000-00602000 rw-p 00001000 00:22 144                                /tmp/code
00c52000-00c74000 rw-p 00000000 00:00 0                                  [heap]
7fb9354f7000-7fb93550d000 r-xp 00000000 00:22 151                        /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb93550d000-7fb93570c000 ---p 00016000 00:22 151                        /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb93570c000-7fb93570d000 rw-p 00015000 00:22 151                        /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb93570d000-7fb9358cd000 r-xp 00000000 00:22 44                         /lib/x86_64-linux-gnu/libc-2.23.so
7fb9358cd000-7fb935acd000 ---p 001c0000 00:22 44                         /lib/x86_64-linux-gnu/libc-2.23.so
7fb935acd000-7fb935ad1000 r--p 001c0000 00:22 44                         /lib/x86_64-linux-gnu/libc-2.23.so
7fb935ad1000-7fb935ad3000 rw-p 001c4000 00:22 44                         /lib/x86_64-linux-gnu/libc-2.23.so
7fb935ad3000-7fb935ad7000 rw-p 00000000 00:00 0 
7fb935ad7000-7fb935afd000 r-xp 00000000 00:22 37                         /lib/x86_64-linux-gnu/ld-2.23.so
7fb935cec000-7fb935cef000 rw-p 00000000 00:00 0 
7fb935cf9000-7fb935cfc000 rw-p 00000000 00:00 0 
7fb935cfc000-7fb935cfd000 r--p 00025000 00:22 37                         /lib/x86_64-linux-gnu/ld-2.23.so
7fb935cfd000-7fb935cfe000 rw-p 00026000 00:22 37                         /lib/x86_64-linux-gnu/ld-2.23.so
7fb935cfe000-7fb935cff000 rw-p 00000000 00:00 0 
7fff5bacb000-7fff5baec000 rw-p 00000000 00:00 0                          [stack]
7fff5bbbe000-7fff5bbc0000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
/home/esolang/bin/c-gcc: line 6:    13 Done                    cat -
        14 Aborted                 (core dumped) | /tmp/code

strace