ZhenlongDai/ACPR huggingface dataset:
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
ans = ""
N = int(input())

while N != 0:
    if N % 2 != 0:
        ans = "0" + ans
        N -= 1
    else:
        ans = "1" + ans
    N /= -2
print("".join(ans))


Failing test case input:
214271744

Expected output:
11101110110101001101100000000


Actual output:
00010001001010110010011111111


Fixed submission (verdict: Accepted):
ans = ""
N = int(input())

while N != 0:
    if N % 2 != 0:
        ans = "1" + ans
        N -= 1
    else:
        ans = "0" + ans
    N /= -2
if ans == "": ans = "0"
print("".join(ans))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
if N >= 0:
  if N == 0:
    print(0)
  elif N == 1:
    print(1)
  else:
    s = 2
    j = 2
    i = 1
    while s + j**2 <= N:
      i += 1
      s += j**2
      j*= 2
  
    k = 2 * i + 1
    print('1' + bin(int('10'*i, 2)^(N-s))[2:])
else:
  s = -1
  j = -2
  i = 1
  while N <= s + j:
    s += j
    j *= 4
    i += 1
  k = 2 * i
  print(bin(int('10'*i, 2)^(N-(s+j)-1))[2:])

Failing test case input:
4778586

Expected output:
10110010011111110101110


Actual output:
1110010011111110101110


Fixed submission (verdict: Accepted):
N = int(input())
if N >= 0:
  if N == 0:
    print(0)
  elif N == 1:
    print(1)
  else:
    s = 2
    j = 2
    i = 1
    while s + j**2 <= N:
      i += 1
      s += j**2
      j*= 2
  
    k = 2 * i + 1
    a  = bin(int('10'*i, 2)^(N-s))[2:]
    if len(a) < k-1:
      a = '0'*(k-1-len(a)) + a
    print('1' + a)
else:
  s = -1
  j = -2
  i = 1
  while N <= s + j:
    s += j
    j *= 4
    i += 1
  k = 2 * i
  print(bin(int('10'*i, 2)^(N-(s+j)-1))[2:])

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s=""
t=-2
while n != 0:
  z = 0 if n % t ==0 else 1
  s = s + str(z)
  n = n - z*t/(-2)
  t = t*(-2)
print(s)


Failing test case input:
-86

Expected output:
11111110


Actual output:
01111111


Fixed submission (verdict: Accepted):
n = int(input())
if n==0:
  print("0")
  exit()
s=""
t=-2
while n != 0:
  z = 0 if n % t ==0 else 1
  s = str(z)+s
  n = n - z*t/(-2)
  t = t*(-2)
print(s)

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ans = []
i=2
j=0
k = 0
while True:
    if k==n:
        break
    if (n-k)%i==0:
        ans.append(0)
    else:
        k += i>>1 if j%2==0 else -i>>1
        ans.append(1)
    print(k)
    i = i<<1
    j+=1
for i in ans[::-1]:
    print(i,end='')
print()

Failing test case input:
240699

Expected output:
1001111110001001111


Actual output:
1
-1
3
-5
-5
-5
59
59
59
59
1083
-965
3131
-5061
11323
-21445
-21445
-21445
240699
1001111110001001111


Fixed submission (verdict: Accepted):
n = int(input())
ans = []
i=2
j=0
k = 0
while True:
    if k==n:
        break
    if (n-k)%i==0:
        ans.append(0)
    else:
        k += i>>1 if j%2==0 else -i>>1
        ans.append(1)
    i = i<<1
    j+=1

if n==0:
    print(0)
else:
    for i in ans[::-1]:
        print(i,end='')
    print()
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def mainusbin(num):
    base = -2
    dst = ""
    i = 0
    if abs(base) > num:
        return num
    while abs(base**i) <= num:
        i += 1
        amari = num % base**i
        if amari:
            dst = "1" + dst
            num -= base**(i-1)
        else:
            dst = "0" + dst
    return dst
src = int(input())
dst = mainusbin(src)
print(dst)


Failing test case input:
-86

Expected output:
11111110


Actual output:
-86


Fixed submission (verdict: Accepted):
def mainusbin(num):
    base = -2
    dst = ""
    i = 0
    if abs(base) > abs(num):
        return num
    while abs(base**i) <= abs(num):
        i += 1
        amari = num % base**i
        if amari:
            dst = "1" + dst
            num -= base**(i-1)
        else:
            dst = "0" + dst
    return dst
src = int(input())
dst = mainusbin(src)
print(dst)

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
if n == 0:
    print(0)
else:
    d = 0
    pows = [(0, 1)]
    for i in range(1, 40):
        a, b = pows[i-1]
        if i%2 == 1:
            min_ = b-2**(i+1)+1
            pows.append((min_, min_+2**i-1))
        else:
            max_ = a+2**(i+1)-1
            pows.append((max_-2**i+1, max_))
    

    ans = ''
    d = len(pows)-1
    for p in pows[::-1]:
        pmin, pmax = p
        if n >= pmin and n <= pmax:
            ans += '1'
            n -= (-2)**d
            
        else:
            ans += '0'

        d -= 1
    print(ans.lstrip('0'))

Failing test case input:
907016

Expected output:
100100010101100011000


Actual output:
100100010101100011001


Fixed submission (verdict: Accepted):
n = int(input())
if n == 0:
    print(0)
else:
    d = 0
    pows = [(0, 1)]
    for i in range(1, 50):
        a, b = pows[i-1]
        if i%2 == 1:
            min_ = b-2**(i+1)+1
            pows.append((min_, min_+2**i-1))
        else:
            max_ = a+2**(i+1)-1
            pows.append((max_-2**i+1, max_))
    pows[0] = (1, 1)
    

    ans = ''
    d = len(pows)-1
    for p in pows[::-1]:
        pmin, pmax = p
        if n >= pmin and n <= pmax:
            ans += '1'
            n -= (-2)**d
            
        else:
            ans += '0'

        d -= 1
    print(ans.lstrip('0'))
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

ans = ''

while n != 0:
    r = n % 2 
    print(r)

    if r < 0:
        r = r + 2
    
    n = (n-r) / (-2)

    ans = ans + str(int(r))

ans = list(ans)    
print(ans)
ans.reverse()
print(''.join(ans))

Failing test case input:
4778586

Expected output:
10110010011111110101110


Actual output:
0
1.0
1.0
1.0
0.0
1.0
0.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
0.0
0.0
1.0
0.0
0.0
1.0
1.0
0.0
1.0
['0', '1', '1', '1', '0', '1', '0', '1', '1', '1', '1', '1', '1', '1', '0', '0', '1', '0', '0', '1', '1', '0', '1']
10110010011111110101110


Fixed submission (verdict: Accepted):
n = int(input())

ans = ''

if n == 0:
    print('0')

while n != 0:
    r = n % 2 

    if r < 0:
        r = r + 2
    
    n = (n-r) / (-2)

    ans = ans + str(int(r))

ans = list(ans)    
ans.reverse()
print(''.join(ans))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

ma = 100
result=[]
for i in range(ma):
  if n==(-2**i):
    result.append("1")
    break
  
  if (n%(2**(i+1)))==0:
    result.append("0")
  else:
    result.append("1")
    n-=((-2)**i)

result.reverse()
print("".join(result))


Failing test case input:
1838994

Expected output:
11011000001000010010110


Actual output:
0000000000000000000000000000000000000000000000000000000000000000000000000000011011000001000010010110


Fixed submission (verdict: Accepted):
n = int(input())

ma = 50
result=[]
for i in range(ma):
  if n==((-2)**i):
    result.append("1")
    break
  
  if (n%(2**(i+1)))==0:
    result.append("0")
  else:
    result.append("1")
    n-=((-2)**i)

result.reverse()
head=0
for x in result:
  if x=="1":
    break
  if x=="0" and (len(result)-1)>head:
    head+=1

print("".join(result[head:]))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = []
div = -2
i = 0
while n!=0:
    r = n % div
    if r == 0:
        s.append(0)
    else:
        s.append(1)
        n -= (-2) ** i
    div *= 2
    i += 1
ans = ""
for i in range(len(s)):
    ans =  str(s[i]) + ans
if n != 0:
    print(ans)
else:
    print(0)

Failing test case input:
-63

Expected output:
11000001


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
s = []
div = -2
i = 0
while n!=0:
    r = n % div
    if r == 0:
        s.append(0)
    else:
        s.append(1)
        n -= (-2) ** i
    div *= 2
    i += 1
ans = ""
for i in range(len(s)):
    ans =  str(s[i]) + ans
if ans != "":
    print(ans)
else:
    print(0)
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
if n == 0:
    print(0)
else:
    d = 0
    pows = [(0, 1)]
    for i in range(1, 50):
        a, b = pows[i-1]
        if i%2 == 1:
            min_ = b-2**(i+1)+1
            pows.append((min_, min_+2**i-1))
        else:
            max_ = a+2**(i+1)-1
            pows.append((max_-2**i+1, max_))
    

    ans = ''
    d = len(pows)-1
    for p in pows[::-1]:
        pmin, pmax = p
        if n >= pmin and n <= pmax:
            ans += '1'
            n -= (-2)**d
            
        else:
            ans += '0'

        d -= 1
    print(ans.lstrip('0'))

Failing test case input:
214271744

Expected output:
11101110110101001101100000000


Actual output:
11101110110101001101100000001


Fixed submission (verdict: Accepted):
n = int(input())
if n == 0:
    print(0)
else:
    d = 0
    pows = [(0, 1)]
    for i in range(1, 50):
        a, b = pows[i-1]
        if i%2 == 1:
            min_ = b-2**(i+1)+1
            pows.append((min_, min_+2**i-1))
        else:
            max_ = a+2**(i+1)-1
            pows.append((max_-2**i+1, max_))
    pows[0] = (1, 1)
    

    ans = ''
    d = len(pows)-1
    for p in pows[::-1]:
        pmin, pmax = p
        if n >= pmin and n <= pmax:
            ans += '1'
            n -= (-2)**d
            
        else:
            ans += '0'

        d -= 1
    print(ans.lstrip('0'))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
i = 1
ans = []
while N != 0:
    if N % (-2 ** i) == 0:
        ans.append(0)
    else:
        ans.append(1)
        N -= ((-2)**(i-1))
    i += 1
print("".join(map(str, ans)))

Failing test case input:
907016

Expected output:
100100010101100011000


Actual output:
000110001101010001001


Fixed submission (verdict: Accepted):
N = int(input())
i = 1
ans = [0 for i in range(1) if N == 0]
while N != 0:
    if N % (-2 ** i) == 0:
        ans.append(0)
    else:
        ans.append(1)
        N -= ((-2)**(i-1))
    i += 1
print("".join(map(str, ans))[::-1])
Problem: p03286
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
s = []
for i in range(100):
    if N % (2 ** (i+1)) != 0:
        N -= (-2) ** i
        s.append('1')
    else:
        s.append('0')

s.reverse()
print(s)
t = ''.join(s)
print(int(t))


Failing test case input:
907016

Expected output:
100100010101100011000


Actual output:
['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '1', '0', '0', '0', '1', '0', '1', '0', '1', '1', '0', '0', '0', '1', '1', '0', '0', '0']
100100010101100011000


Fixed submission (verdict: Accepted):
N = int(input())
s = []
for i in range(100):
    if N % (2 ** (i+1)) != 0:
        N -= (-2) ** i
        s.append('1')
    else:
        s.append('0')

s.reverse()
t = ''.join(s)
print(int(t))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
ans=""
while n!=0:
  if (n%2)!=0:
    n-=1
    ans="1"+ans
  else:
    ans="1"+ans
  n/=-2
if ans=="":
  ans="0"
print(ans)

Failing test case input:
34009

Expected output:
11000010100101001


Actual output:
11111111111111111


Fixed submission (verdict: Accepted):
n=int(input())
ans=""
while n!=0:
  if (n%2)!=0:
    n-=1
    ans="1"+ans
  else:
    ans="0"+ans
  n/=-2
if ans=="":
  ans="0"
print(ans)

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())

print(n%2)
ans=[]
while n!=0:
    r=n%2
    ans.append(r)
    n=int((n-r)/(-2))

ans.reverse()

for i in ans:
    print(i,end='')



Failing test case input:
26689

Expected output:
11011100001000001


Actual output:
1
11011100001000001

Fixed submission (verdict: Accepted):
n=int(input())

ans=[]
if(n==0):
    print(0)
    exit()


while n!=0:
    r=n%2
    ans.append(r)
    n=int((n-r)/(-2))

ans.reverse()

for i in ans:
    print(i,end='')

Problem: p03286
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())

if N >= 0:
  n = N
  b = bin(N)[2:]
  for i in range(len(b)):
    if i%2==1 and b[-i-1]=='1':
      n += 2**(i+1)
  print(bin(n)[2:])
  
else:
  n = -N
  b = bin(-N)[2:]
  for i in range(len(b)):
    if i%2==0 and b[-i-1]=='1':
      n += 2**(i+1)
  print(bin(n)[2:])

Failing test case input:
120641

Expected output:
1100010101101000001


Actual output:
101101101101000001


Fixed submission (verdict: Accepted):
N=int(input())

if N >= 0:
  n = N
  i = 0
  while 1:
    b = bin(n)[2:]
    if i >= len(b):
      break
    if i % 2 == 1 and b[-i-1]=='1':
      n += 2**(i+1)
    i += 1
  print(bin(n)[2:])
  
else:
  n = -N
  i = 0
  while 1:
    b = bin(n)[2:]
    if i >= len(b):
      break
    if i % 2 == 0 and b[-i-1]=='1':
      n += 2**(i+1)
    i += 1
  print(bin(n)[2:])
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def determine_digit(digit_num, acm, n):
    mod = 2 ** (digit_num + 1)
    if (n - acm) % mod:
        return 1
    else:
        return 0


def convert(n):
    result = ''
    acm = 0
    digit_num = 0
    
    while n != acm:
        
        d = determine_digit(digit_num, acm, n)
        

        
        acm += d * (-2)**digit_num
        digit_num += 1
        result += str(d)

        
        if digit_num > 20:
            break

    return result[::-1]


if __name__ == "__main__":
    n = int(input())

    print(convert(n))


Failing test case input:
4778586

Expected output:
10110010011111110101110


Actual output:
110010011111110101110


Fixed submission (verdict: Accepted):
def determine_digit(digit_num, acm, n):
    mod = 2 ** (digit_num + 1)
    if (n - acm) % mod:
        return 1
    else:
        return 0


def convert(n):
    if n == 0:
        return '0'

    result = ''
    acm = 0
    digit_num = 0
    
    while n != acm:
        
        d = determine_digit(digit_num, acm, n)
        

        
        acm += d * (-2)**digit_num
        digit_num += 1
        result += str(d)

    return result[::-1]


if __name__ == "__main__":
    n = int(input())

    print(convert(n))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

t = 0
ans = ''
while N != 0:
    a = N%2
    if t % 2 == 0:
        ans = str(int(a)) + ans
        N -= a
        N /= 2
    else:
        ans = str(int(a)) + ans
        N += a
        N /= 2
    t +=1
    print(N)
if ans == '':
    ans = '0'
print(ans)

Failing test case input:
-86

Expected output:
11111110


Actual output:
-43.0
-21.0
-11.0
-5.0
-3.0
-1.0
-1.0
0.0
11111110


Fixed submission (verdict: Accepted):
N = int(input())

t = 0
ans = ''
while N != 0:
    a = N%2
    if t % 2 == 0:
        ans = str(int(a)) + ans
        N -= a
        N /= 2
    else:
        ans = str(int(a)) + ans
        N += a
        N /= 2
    t +=1
if ans == '':
    ans = '0'
print(ans)

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

S = ""
while N != 0:
    if N %2 != 0:
        S = "1" + S
        N -= 1
    else:
        S = "0" + S
    N /= -2
if N == 0:
    print("0")
else:
    print(S)

Failing test case input:
55104

Expected output:
10010101101000000


Actual output:
0


Fixed submission (verdict: Accepted):
N=int(input())
if N == 0:
    print("0")

else:
    S = ""
    while N != 0:
        if N %2 != 0:
            S = "1" + S
            N -= 1
        else:
            S = "0" + S
        N /= -2
    print(S)
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(input())

if n == 0:
    print(0)

else:
    s = ''
    cnt = 1
    while n > 0:
        s += str(1) if n % (-2)**cnt != 0 else str(0)
        n -= (-2)**(cnt - 1) if n % (-2)**cnt != 0 else 0
        cnt += 1
    print(s[::-1])


Failing test case input:
-44

Expected output:
11010100


Actual output:

Fixed submission (verdict: Accepted):

n = int(input())

if n == 0:
    print(0)

else:
    s = ''
    cnt = 1
    while n != 0:
        s += str(1) if n % (-2)**cnt != 0 else str(0)
        n -= (-2)**(cnt - 1) if n % (-2)**cnt != 0 else 0
        cnt += 1
    print(s[::-1])

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

if N == 0:
    print('0')
else:
    ans, d = '', 2
    while abs(N) > 0:
        ans = '0' + ans if N % d == 0 else '1' + ans
        N, d = N - N % d, d * (-2)

        print(ans)


Failing test case input:
1595137

Expected output:
11010011010101100000001


Actual output:
1
01
001
0001
00001
000001
0000001
00000001
100000001
1100000001
01100000001
101100000001
0101100000001
10101100000001
010101100000001
1010101100000001
11010101100000001
011010101100000001
0011010101100000001
10011010101100000001
010011010101100000001
1010011010101100000001
11010011010101100000001


Fixed submission (verdict: Accepted):
N = int(input())

n, ans, d = N, '', 2
while abs(n) > 0:
    ans = '0' + ans if n % d == 0 else '1' + ans
    n, d = n - n % d, d * (-2)
print('0' if N == 0 else ans)
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

if N == 0:
    print('0')
    exit(0)

idx = 0
while True:
    idx += 1
    left = sum([(-2)**i for i in range(idx+1) if i%2==1])
    right = sum([(-2)**i for i in range(idx+1) if i%2==0])
    if left <= N <= right:
        break
        
max_idx = idx
coeff = [0 for _ in range(max_idx+1)]
for idx in range(max_idx, 0-1, -1):
    left = sum([(-2)**i for i in range(idx) if i%2==1])
    right = sum([(-2)**i for i in range(idx) if i%2==0])
    print(left, N, right)
    if not left <= N <= right:
        N -= (-2)**(idx)
        coeff[idx] = 1


print(''.join(map(str, reversed(coeff))))

Failing test case input:
175198680

Expected output:
11111101100010101011000101000


Actual output:
-178956970 175198680 89478485
-44739242 -93236776 89478485
-44739242 40980952 22369621
-11184810 -26127912 22369621
-11184810 7426520 5592405
-2796202 -9350696 5592405
-2796202 -962088 1398101
-699050 -962088 1398101
-699050 1135064 349525
-174762 86488 349525
-174762 86488 87381
-43690 86488 87381
-43690 86488 21845
-10922 20952 21845
-10922 20952 5461
-2730 4568 5461
-2730 4568 1365
-682 472 1365
-682 472 341
-170 -552 341
-170 -40 85
-42 -40 85
-42 -40 21
-10 -40 21
-10 -8 5
-2 -8 5
-2 0 1
0 0 1
0 0 0
11111101100010101011000101000


Fixed submission (verdict: Accepted):

N = int(input())

if N == 0:
    print('0')
else:

    idx = 0
    while True:
        idx += 1
        left = sum([(-2)**i for i in range(idx+1) if i%2==1])
        right = sum([(-2)**i for i in range(idx+1) if i%2==0])
        if left <= N <= right:
            break

    max_idx = idx
    coeff = [0 for _ in range(max_idx+1)]
    for idx in range(max_idx, 0-1, -1):
        left = sum([(-2)**i for i in range(idx) if i%2==1])
        right = sum([(-2)**i for i in range(idx) if i%2==0])

        if not left <= N <= right:
            N -= (-2)**(idx)
            coeff[idx] = 1
    
    
    print(''.join(map(str, reversed(coeff))))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

n = int(input())
res = []

if n==0:
    print(0)
    sys.exit()
    
while n!=0:
    if n%2 == 1:
        res.append(1)
        n = (n-1)/(-2)
    else:
        res.append(0)
        n = n/(-2)

reversed(res)

for i in res:
    print(i, end="")

Failing test case input:
1595137

Expected output:
11010011010101100000001


Actual output:
10000000110101011001011

Fixed submission (verdict: Accepted):
import sys

n = int(input())
res = []

if n==0:
    print(0)
    sys.exit()
    
while n!=0:
    if n%2 == 1:
        res.append(1)
        n = (n-1)/(-2)
    else:
        res.append(0)
        n = n/(-2)


for i in reversed(res):
    print(i, end="")
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)


def input(): return sys.stdin.readline().rstrip()


N = int(input())
l = deque()
while N != 0:
    x = (-2) ** len(l)
    y = (-2) * x
    if abs(N) % abs(y) != 0:
        N -= x
        l.appendleft('1')
    else:
        l.appendleft('0')
print(0 if N == 0 else ''.join(l))

Failing test case input:
2408233

Expected output:
11001011100001101111001


Actual output:
0


Fixed submission (verdict: Accepted):
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)


def input(): return sys.stdin.readline().rstrip()


N = int(input())
l = deque()
if N == 0:
    print(0)
else:
    while N != 0:
        x = (-2) ** len(l)
        y = (-2) * x
        if abs(N) % abs(y) != 0:
            N -= x
            l.appendleft('1')
        else:
            l.appendleft('0')
    print(''.join(l))

Problem: p03286
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())

if N == 0:
    print(0)
    exit()
elif N == 1:
    print(1)
    exit()
DP = [(0,1)]
num = 0
start = 0
end = 1
while True:
    num += 1
    a = end - start + 1
    if num % 2 == 0:
        start_ = end + 1
        end_ = start_ + a - 1
        end = end_
    else:
        end_ = start - 1
        start_ = end_ - a + 1
        start = start_
    DP.append((start_, end_))
    if start <= N <= end:
        break

Ans = ''
for i, (start, end) in enumerate(DP[::-1]):
    if start <= N <= end:
        Ans += '1'
        N -= (-2) ** (num-i)
    else:
        Ans += '0'

print(Ans)


Failing test case input:
1347846

Expected output:
101011001000100011010


Actual output:
101011001000100011011


Fixed submission (verdict: Accepted):
N = int(input())

if N == 0:
    print(0)
    exit()
elif N == 1:
    print(1)
    exit()
DP = [(0,1)]
num = 0
start = 0
end = 1
while True:
    num += 1
    a = end - start + 1
    if num % 2 == 0:
        start_ = end + 1
        end_ = start_ + a - 1
        end = end_
    else:
        end_ = start - 1
        start_ = end_ - a + 1
        start = start_
    DP.append((start_, end_))
    if start <= N <= end:
        break

Ans = ''
DP[0] = (1, 1)
for i, (start, end) in enumerate(DP[::-1]):
    if start <= N <= end:
        Ans += '1'
        N -= (-2) ** (num-i)
    else:
        Ans += '0'

print(Ans)

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
L=[]
M=""
while N!=0:
  M=int((-1)*(N%(-2)))
  if N<0:
    N=int((N-1)/(-2))
  else:
    N=int(N/(-2))
  L.insert(0,str(M))
if N==0:
  print(0)
else:
  print("".join(L))

Failing test case input:
55104

Expected output:
10010101101000000


Actual output:
0


Fixed submission (verdict: Accepted):
N=int(input())
L=[]
M=""
while N!=0:
  M=int((-1)*(N%(-2)))
  if N<0:
    N=int((N-1)/(-2))
  else:
    N=int(N/(-2))
  L.insert(0,str(M))
if len(L)==0:
  L=["0"]
print("".join(L))
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import ceil

n=int(input())
if n==0:
    print(0)
    exit()

ans=''

while n!=0:
    ans+=str(abs(n)%2)
    n=ceil(n/-2)
    print(n)
print(ans[::-1])

Failing test case input:
3681228

Expected output:
10010000111110011011100


Actual output:
-1840614
920307
-460153
230077
-115038
57519
-28759
14380
-7190
3595
-1797
899
-449
225
-112
56
-28
14
-7
4
-2
1
0
10010000111110011011100


Fixed submission (verdict: Accepted):
from math import ceil

n=int(input())
if n==0:
    print(0)
    exit()

ans=''

while n!=0:
    ans+=str(abs(n)%2)
    n=ceil(n/-2)
print(ans[::-1])

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
i=0
q=n
ans=""
b=[]

while 1:
  r=q%(-2)
  q=int(q/(-2))


  if r==0:
    b.append(0)
    if q==0:
      break
  else:
    
    b.append(1)
    if q==0:
      break
    if q>0:
      q=q+1

  i=i+1

b.reverse()
for j in range(i+1):
  ans=ans+str(b[j])

print(ans)
    
    


Failing test case input:
98235

Expected output:
1101000000011001111


Actual output:
101000000011001111


Fixed submission (verdict: Accepted):
n=int(input())
i=0
b=[]
q=n
ans=""

while 1:
  r=q%(-2)
  if q==0:
    b.append(0)
    break
 
  if r==0:
    b.append(0)
    q=int(q/(-2))
  else:
    b.append(1)
    q=int(q/(-2)+0.5)
    if q==0:
      break
  i=i+1

b.reverse()
for j in range(i+1):
  ans=ans+str(b[j])
  
print(ans)

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
Z = int(input())
n = (-2)

ans = ""

while abs(Z) >= 1:
  r = Z % n
  if r < 0:
    r = r + 2
  Z = int((Z - r) / n)
  ans += str(r)

ans = "".join(list(reversed(ans)))

if Z == 0:
  print(0)
else:
  print(int(ans))

Failing test case input:
-86

Expected output:
11111110


Actual output:
0


Fixed submission (verdict: Accepted):
Z = int(input())

if Z == 0:
  print(0)

else:
  n = (-2)

  ans = ""

  while abs(Z) >= 1:
    r = Z % n
    if r < 0:
      r = r + 2
    Z = int((Z - r) / n)
    ans += str(r)

  ans = "".join(list(reversed(ans)))


  print(int(ans))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = int(input())
m=n
answer = []

def kenzan(ans):
    val = 0
    for i in range(len(ans)):
        val += answer[i]*(-2)**i
    return int(val)

i = 1
while(n != 0):
    print(n)
    if n % (2**i) == 0:
        answer.append(0)
    else:
        answer.append(1)
        n = n-((-2)**(i-1))
    i += 1
answer.reverse()
print("".join(str(i) for i in answer))

Failing test case input:
38694

Expected output:
11110101101111010


Actual output:
38694
38694
38696
38696
38704
38688
38720
38656
38656
38400
38912
38912
40960
40960
49152
32768
65536
11110101101111010


Fixed submission (verdict: Accepted):


n = int(input())
m=n
answer = []

def kenzan(ans):
    val = 0
    ans.reverse()
    for i in range(len(ans)):
        val += answer[i]*(-2)**i
    return int(val)

i = 1
while(n != 0):
    
    if n % (2**i) == 0:
        answer.append(0)
    else:
        answer.append(1)
        n = n-((-2)**(i-1))
    i += 1
answer.reverse()
if answer == []:
    answer.append(0)
print("".join(str(i) for i in answer))
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
b=[]
if a==0:
	print(0)
while a:
	b.append(a&1)
	a-=a&1
	a=int(a/-2)
print(''.join(map(str,b)))

Failing test case input:
3681228

Expected output:
10010000111110011011100


Actual output:
00111011001111100001001


Fixed submission (verdict: Accepted):
a=int(input())
b=[]
if a==0:
	print(0)
while a:
	b.append(a&1)
	a-=a&1
	a=int(a/-2)

print(''.join(map(str,b[::-1])))

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s = ''

while N != 0:
    print(N, s, N % (-2) == 0)
    if N % (-2) == 0:
        s = '0' + s
    else:
        s = '1' + s
        N -= 1
    N /= (-2)

if s =='':
    s = '0'
print(s)

Failing test case input:
1595137

Expected output:
11010011010101100000001


Actual output:
1595137  False
-797568.0 1 True
398784.0 01 True
-199392.0 001 True
99696.0 0001 True
-49848.0 00001 True
24924.0 000001 True
-12462.0 0000001 True
6231.0 00000001 False
-3115.0 100000001 False
1558.0 1100000001 True
-779.0 01100000001 False
390.0 101100000001 True
-195.0 0101100000001 False
98.0 10101100000001 True
-49.0 010101100000001 False
25.0 1010101100000001 False
-12.0 11010101100000001 True
6.0 011010101100000001 True
-3.0 0011010101100000001 False
2.0 10011010101100000001 True
-1.0 010011010101100000001 False
1.0 1010011010101100000001 False
11010011010101100000001


Fixed submission (verdict: Accepted):
N = int(input())
s = ''

while N != 0:

    if N % (-2) == 0:
        s = '0' + s
    else:
        s = '1' + s
        N -= 1
    N /= (-2)

if s =='':
    s = '0'
print(s)

Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import math
y = int(input().split()[0])
result = ""
i = 0
while True:
    print(i)
    z = (-2) ** (i+1)
    x = y % z
    print(x)
    if x != 0:
        y = y + x
        result = "1" + result
    else:
        result = "0" + result
    if y == 0:
        break
    i = i + 1
print(result)

Failing test case input:
2643092

Expected output:
11110000101010110010100


Actual output:
0
0
1
0
2
-4
3
0
4
-16
5
0
6
0
7
128
8
-256
9
0
10
-1024
11
0
12
-4096
13
0
14
-16384
15
0
16
0
17
0
18
0
19
524288
20
-1048576
21
2097152
22
-4194304
11110000101010110010100


Fixed submission (verdict: Accepted):
import sys
import math
y = int(input().split()[0])
result = ""
i = 0
while True:
    z = (-2) ** (i+1)
    x = y % z
    if x != 0:
        y = y + x
        result = "1" + result
    else:
        result = "0" + result
    if y == 0:
        break
    i = i + 1
print(result)
Problem: p03286
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = ''

if n == 0:
    print(0)
    exit()

i = 0
while n != 0:
    if n % (2 ** (i+1)) != 0:
        s += '1'
        n -= (-2) ** i
    else:
        s += '0'
    print(s)
    i += 1
print(s[::-1])

Failing test case input:
208967441

Expected output:
11101101101011110101100010001


Actual output:
1
10
100
1000
10001
100010
1000100
10001000
100010001
1000100011
10001000110
100010001101
1000100011010
10001000110101
100010001101011
1000100011010111
10001000110101111
100010001101011110
1000100011010111101
10001000110101111010
100010001101011110101
1000100011010111101011
10001000110101111010110
100010001101011110101101
1000100011010111101011011
10001000110101111010110110
100010001101011110101101101
1000100011010111101011011011
10001000110101111010110110111
11101101101011110101100010001


Fixed submission (verdict: Accepted):
n = int(input())
s = ''
 
if n == 0:
    print(0)
    exit()
 
i = 0
while n != 0:
    if n % (2 ** (i+1)) != 0:
        s += '1'
        n -= (-2) ** i
    else:
        s += '0'
    i += 1
print(s[::-1])
Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
N_d = int(N/2)
X1 = list(map(int,input().split()))
X = X1[:]
X1.sort()

def getMed(i):
  if i  < X[N_d]:
    print(X[N_d])
  else:
    print( X[N_d -1])

for i in X:
  getMed(i)
 

Failing test case input:
2
17 -1

Expected output:
-1
17


Actual output:
17
17


Fixed submission (verdict: Accepted):
N = int(input())
N_d = int(N/2)
X1 = list(map(int,input().split()))
X = X1[:]
X1.sort()

def getMed(i):
  if i  < X1[N_d]:
    print(X1[N_d])
  else:
    print( X1[N_d -1])

for i in X:
  getMed(i)

Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
inp=list(map(int, input().strip().split(' ')))
Xsort=sorted(inp)
med = int(N/2)
for i in range(N):
  if Xsort[med-1] > inp[i]:
    print(Xsort[med])
  else:
    print(Xsort[med-1])

Failing test case input:
2
156 3

Expected output:
3
156


Actual output:
3
3


Fixed submission (verdict: Accepted):
N=int(input())
inp=list(map(int, input().strip().split(' ')))
Xsort=sorted(inp)
med = int(N/2)
for i in range(N):
  if Xsort[med-1] >= inp[i] :
    print(Xsort[med])
  else:
    print(Xsort[med-1])

Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

a = list(map(int,input().split(' ')))

sorted_a = sorted(a)


for i in range(int(N/2)):
    print(sorted_a[int(N/2)])
for i in range(int(N/2)):
    print(sorted_a[int(N/2)-1])

Failing test case input:
2
31 1

Expected output:
1
31


Actual output:
31
1


Fixed submission (verdict: Accepted):
N = int(input())

a = list(map(int,input().split(' ')))

sorted_a = sorted(a)

for i in range(N):
    if a[i] < sorted_a[int(N/2)]:
        print(sorted_a[int(N/2)])
    else:
        print(sorted_a[int(N/2)-1])

Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

a = list(map(int,input().split(' ')))

sorted_a = sorted(a)

if N > 2:
    for i in range(int(N/2)):
        print(sorted_a[int(N/2)])
    for i in range(int(N/2)):
        print(sorted_a[int(N/2)-1])
else:
    print(a[0])


Failing test case input:
2
15 2

Expected output:
2
15


Actual output:
15


Fixed submission (verdict: Accepted):
N = int(input())

a = list(map(int,input().split(' ')))

sorted_a = sorted(a)

for i in range(N):
    if a[i] < sorted_a[int(N/2)]:
        print(sorted_a[int(N/2)])
    else:
        print(sorted_a[int(N/2)-1])
Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy

N = int(input())
X = []
X = [int(i) for i in input().split()]

Y = copy.deepcopy(X)
Y.sort()

largeMedian = Y[int(N / 2)]
smallMedian = Y[int(N / 2)-1]


print(X)
print(Y)
print(smallMedian)
print(largeMedian)

for i in range(N):
    if X[i] <= smallMedian:
        X[i] = largeMedian
    else:
        X[i] = smallMedian

for i in range(N):
    print(X[i])


Failing test case input:
6
5 -1 -1 -1 13 0

Expected output:
-1
0
0
0
-1
-1


Actual output:
[5, -1, -1, -1, 13, 0]
[-1, -1, -1, 0, 5, 13]
-1
0
-1
0
0
0
-1
-1


Fixed submission (verdict: Accepted):
import copy

N = int(input())
X = []
X = [int(i) for i in input().split()]

Y = copy.deepcopy(X)
Y.sort()

largeMedian = Y[int(N / 2)]
smallMedian = Y[int(N / 2)-1]

for i in range(N):
    if X[i] <= smallMedian:
        X[i] = largeMedian
    else:
        X[i] = smallMedian

for i in range(N):
    print(X[i])

Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

a = list(map(int,input().split(' ')))

sorted_a = sorted(a)

for i in range(int(N/2)):
    print(sorted_a[int(N/2)-1])

for i in range(int(N/2)):
    print(sorted_a[int(N/2)])

Failing test case input:
6
4 4 0 0 4 -7

Expected output:
0
0
4
4
0
4


Actual output:
0
0
0
4
4
4


Fixed submission (verdict: Accepted):
N = int(input())

a = list(map(int,input().split(' ')))

sorted_a = sorted(a)

for i in range(N):
    if a[i] < sorted_a[int(N/2)]:
        print(sorted_a[int(N/2)])
    else:
        print(sorted_a[int(N/2)-1])

Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
x = []
x = list(map(int,input().split(' ')))
y = []
for i in range(len(x)):
    y.append(x[i])

y.sort()




b = int(n/2)
s = int(n/2)-1

if n == 2:
    print(x[1])
    print(x[0])
else:
    for i in range(n):
        if x[i] == y[b]:
            print(y[s])
        else:
            print(y[b])


Failing test case input:
4
4 1 -1 -1

Expected output:
-1
-1
1
1


Actual output:
1
-1
1
1


Fixed submission (verdict: Accepted):
n = int(input())
x = []
x = list(map(int,input().split(' ')))
y = []
for i in range(len(x)):
    y.append(x[i])

y.sort()




b = int(n/2)
s = int(n/2)-1

if n == 2:
    print(x[1])
    print(x[0])
else:
    for i in range(n):
        if x[i] >= y[b]:
            print(y[s])
        else:
            print(y[b])
Problem: p03381
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy

N = int(input())
X = []
X = [int(i) for i in input().split()]

Y = copy.deepcopy(X)
Y.sort()

largeMedian = Y[int(N / 2)]
smallMedian = Y[int(N / 2)-1]


print(X)
print(Y)
print(smallMedian)
print(largeMedian)

for i in range(N):
    if X[i] <= smallMedian:
        X[i] = largeMedian
    else:
        X[i] = smallMedian

for i in range(N):
    print(X[i], end=' ')


Failing test case input:
4
0 5 1 0

Expected output:
1
0
0
1


Actual output:
[0, 5, 1, 0]
[0, 0, 1, 5]
0
1
1 0 0 1 

Fixed submission (verdict: Accepted):
import copy

N = int(input())
X = []
X = [int(i) for i in input().split()]

Y = copy.deepcopy(X)
Y.sort()

largeMedian = Y[int(N / 2)]
smallMedian = Y[int(N / 2)-1]

for i in range(N):
    if X[i] <= smallMedian:
        X[i] = largeMedian
    else:
        X[i] = smallMedian

for i in range(N):
    print(X[i])
Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = input()
B = input()
C = input()
ans = 0

for i in range(N):
    if A[i] == B[i] and B[i] == C[i]:
        continue
    elif A[i] != B[i] and B[i] != C[i]:
        ans += 2
    else:
        ans += 1

print(ans)

Failing test case input:
4
wesu
east
w`it

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
N = int(input())
A = input()
B = input()
C = input()
ans = 0

for i in range(N):
    if A[i] == B[i] and B[i] == C[i]:
        continue
    elif A[i] != B[i] and B[i] != C[i] and C[i] != A[i]:
        ans += 2
    else:
        ans += 1

print(ans)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

N = int(stdin.readline().rstrip())
A =  stdin.readline().rstrip()
B =  stdin.readline().rstrip()
C =  stdin.readline().rstrip()

str_len = len(A)

count = 0


for i in range(str_len):
    if A[i]==B[i]:
        if C[i]==B[i]:
            continue
        else:
            count = count + 1
    elif A[i]==C[i]:
        count = count + 1
    else:
        count = count + 2



Failing test case input:
7
nezjokt
tjuosss
gromrp`

Expected output:
14


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
A =  input()
B =  input()
C =  input()

str_len = len(A)

count = 0


for i in range(str_len):
    
    if A[i]==B[i]:
        if C[i]==B[i]:
            continue
        else:
            count = count + 1
    elif A[i]==C[i]:
        count = count + 1
    elif B[i]==C[i]:
        count = count + 1
    else:
        count = count + 2
print(str(count))

Problem: p03140
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = input()
b = input()
c = input()
cnt=0
for i in range(n):
        if a[i]==b[i] and b[i]==c[i]:
            pass
        elif a[i]==b[i] or a[i]==c[i] or b[i]==c[i]:
            cnt+=1
        else:
            cnt+=2


Failing test case input:
9
tneredgia
cifreefnt
difsefent

Expected output:
11


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
a = input()
b = input()
c = input()
cnt=0
for i in range(n):
        if a[i]==b[i] and b[i]==c[i]:
            pass
        elif a[i]==b[i] or a[i]==c[i] or b[i]==c[i]:
            cnt+=1
        else:
            cnt+=2
print(cnt)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = str(input())
b = str(input())
c = str(input())
ans = 0
list1 = []
for i in range(n):
    list1.append(a[i])
    list1.append(b[i])
    list1.append(c[i])
    set1 = set(list1)
    ans += len(set1)-1
    list = []
print(ans)


Failing test case input:
7
ukoknez
tiuotss
pro`rgm

Expected output:
13


Actual output:
52


Fixed submission (verdict: Accepted):
n = int(input())
a = str(input())
b = str(input())
c = str(input())
ans = 0
list1 = []
for i in range(n):
    list1.append(a[i])
    list1.append(b[i])
    list1.append(c[i])
    set1 = set(list1)
    ans += len(set1)-1
    list1 = []
print(ans)
Problem: p03140
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
  if (a[i] == b[i]) & (b[i] == c[i]):
    continue
  if (a[i] == b[i]) | (b[i] == c[i]):
    ans += 1
    continue
  ans += 2
print(ans)

Failing test case input:
9
tnereffjc
cifferent
tnereffid

Expected output:
10


Actual output:
16


Fixed submission (verdict: Accepted):
n = int(input())
a = input()
b = input()
c = input()
ans = 0
for i in range(n):
  if (a[i] == b[i]) & (b[i] == c[i]):
    continue
  if (a[i] == b[i]) | (b[i] == c[i]) | (c[i] == a[i]):
    ans += 1
    continue
  ans += 2
print(ans)

Problem: p03140
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=input()
b=input()
c=input()
d=0
for i in range(n):
  if a[i]==b[i] and b[i]==c[i]:
    continue
  elif a[i]==b[i] or b[i]==c[i]:
    d+=1
  else:
    d+=2
print(d)


Failing test case input:
9
tnereffjc
different
tnereffid

Expected output:
10


Actual output:
16


Fixed submission (verdict: Accepted):
n=int(input())
a=input()
b=input()
c=input()
d=0
for i in range(n):
  if a[i]==b[i]==c[i]:
    continue
  elif a[i]==b[i] or b[i]==c[i] or a[i]==c[i]:
    d+=1
  else:
    d+=2
print(d)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = input()
B = input()
C = input()
count = 0
for num in range(N) :
    count += len(list(set(list( [ A[num], B[num], C[num] ] ) ) )) - 1

Failing test case input:
9
tnereffic
cifferent
different

Expected output:
9


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
A = input()
B = input()
C = input()
count = 0
for num in range(N) :
    count += len(list(set(list( [ A[num], B[num], C[num] ] ) ) )) - 1
print(count)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = input()
B = input()
C = input()
cnt = 0

for idx in range(N):
    if A[idx] == B[idx] and A[idx] == C[idx] and B[idx] == C[idx]:
        print(0)
        continue
    elif A[idx] == B[idx]:
        C = C[:idx] + A[idx] + C[idx+1:]
        cnt += 1
    elif A[idx] == C[idx]:
        B = B[:idx] + A[idx] + B[idx+1:]
        cnt += 1
    elif B[idx] == C[idx]:
        A = A[:idx] + B[idx] + A[idx+1:]
        cnt += 1
    else:
        B = B[:idx] + A[idx] + B[idx+1:]
        C = C[:idx] + A[idx] + C[idx+1:]
        cnt += 2

print(cnt)

Failing test case input:
9
tnereffjc
cifferent
tnereffid

Expected output:
10


Actual output:
0
10


Fixed submission (verdict: Accepted):
N = int(input())
A = input()
B = input()
C = input()
cnt = 0

for idx in range(N):
    if A[idx] == B[idx] and A[idx] == C[idx] and B[idx] == C[idx]:
        continue
    elif A[idx] == B[idx]:
        C = C[:idx] + A[idx] + C[idx+1:]
        cnt += 1
    elif A[idx] == C[idx]:
        B = B[:idx] + A[idx] + B[idx+1:]
        cnt += 1
    elif B[idx] == C[idx]:
        A = A[:idx] + B[idx] + A[idx+1:]
        cnt += 1
    else:
        B = B[:idx] + A[idx] + B[idx+1:]
        C = C[:idx] + A[idx] + C[idx+1:]
        cnt += 2

print(cnt)
Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=input()
B=input()
C=input()

AL=[x for x in A]
BL=[x for x in B]
CL=[x for x in C]

c=0
for i in range(N):
    if AL[i]==BL[i] and BL[i]==CL[i]:
        break
    if AL[i]==BL[i] or BL[i]==CL[i] or CL[i]==AL[i]:
        c+=1
    else:
        c+=2
print(c) 


Failing test case input:
9
tneredfic
ciffeernt
different

Expected output:
11


Actual output:
5


Fixed submission (verdict: Accepted):
N=int(input())
A=input()
B=input()
C=input()


c=0
for i in range(N):
    if A[i]==B[i] and B[i]==C[i]:
        continue
    if A[i]==B[i] or B[i]==C[i] or C[i]==A[i]:
        c+=1
    else:
        c+=2
print(c)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input()
b = input()
c = input()

cnt = 0
for i in range(n):
    if a[i] == b[i] == c[i]:
        cnt += 1

print(n-cnt)


Failing test case input:
4
tewv
`ftt
wjas

Expected output:
8


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
a = input()
b = input()
c = input()

cnt = 0
for i in range(n):
    s = [a[i], b[i], c[i]]
    cnt += (len(set(s))-1)
print(cnt)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
I = int(input())
A = input()
B = input()
C = input()

count = 0
for i in range(I):
  if not (A[i]==B[i]==C[i]):
    count += 1

print(count)

Failing test case input:
9
tneredgib
ciffeernt
different

Expected output:
11


Actual output:
8


Fixed submission (verdict: Accepted):
I = int(input())
A = input()
B = input()
C = input()

count = 0
for i in range(I):
  if not (A[i]==B[i]==C[i]):
    count += 1 if A[i]==B[i] or B[i]== C[i] or A[i]==C[i] else 2

print(count)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
    if (A[i] is B[i]) & (A[i] is C[i]):
        ans += 0
    elif (A[i] is B[i]) | (B[i] is C[i]) | (A[i] is C[i]):
        ans += 1
    else:
        print(A[i],B[i],C[i]," ")
        ans += 2
print(ans) 

Failing test case input:
4
vewt
`sgt
vjsb

Expected output:
6


Actual output:
e s j  
w g s  
6


Fixed submission (verdict: Accepted):
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for i in range(N):
    if (A[i] is B[i]) & (A[i] is C[i]):
        ans += 0
    elif (A[i] is B[i]) | (B[i] is C[i]) | (A[i] is C[i]):
        ans += 1
    else:
        ans += 2
print(ans)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = input()
b = input()
c = input()
count = 0 
for i in range(n):
    if a[i] != b[i]:
        count += 1
    if b[i] != c[i]:
        count += 1
    if a[i] == c[i]:
        count -= 1
print(count)

Failing test case input:
9
tnereffic
cifferent
different

Expected output:
9


Actual output:
8


Fixed submission (verdict: Accepted):
n = int(input())
a = input()
b = input()
c = input()
count = 0 
for i in range(n):
    if a[i] == b[i]:
        if b[i] != c[i]:
            count += 1
    else:
        if a[i] == c[i] or b[i] == c[i]:
            count += 1
        else:
            count += 2
print(count)
Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n = int(input())
a,b,c = sys.stdin
count = 0
for i in range(n):
  if a[i] == b[i] == c[i]:
    continue
  elif a[i] == b[i] or a[i] == b[i] or b[i] == c[i]:
    count += 1
  else:
    count += 2
print(count)

Failing test case input:
7
tkojzen
tjuosss
gromrp`

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
import sys
n = int(input())
a,b,c = sys.stdin
count = 0
for i in range(n):
  if a[i] == b[i] == c[i]:
    continue
  elif a[i] == b[i] or a[i] == c[i] or b[i] == c[i]:
    count += 1
  else:
    count += 2
print(count)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=input()
b=input()
c=input()
d=0
for i in range(n):
	if a[i]!=b[i]!=c[i]:
		d+=2
	elif not a[i]==b[i]==c[i]:
		d+=1
print(d)

Failing test case input:
9
tnedeqgib
bifrfegnt
tcdfmtfge

Expected output:
16


Actual output:
17


Fixed submission (verdict: Accepted):
n=int(input())
a=input()
b=input()
c=input()
d=0
for i in range(n):
	if a[i]!=b[i] and b[i]!=c[i] and a[i]!=c[i]:
		d+=2
	elif not a[i]==b[i]==c[i]:
		d+=1
print(d)

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = input()
B = input()
C = input()
target_list = []
for a, b, c in zip(A, B, C):
    if a==b and b==c:
        target_list.append(3)
    elif a==b or a==c:
        target_list.append(2)
    else:
        target_list.append(1)
print(N*3 - sum(target_list))

Failing test case input:
9
tnedergia
bifreefnt
difsmfeet

Expected output:
14


Actual output:
17


Fixed submission (verdict: Accepted):
N = int(input())
A = input()
B = input()
C = input()
target_list = []
for a, b, c in zip(A, B, C):
    if a==b and b==c and c==a:
        target_list.append(3)
    elif a==b or b==c or c==a: 
        target_list.append(2)
    else:
        target_list.append(1)
print(N*3 - sum(target_list))

Problem: p03140
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = []
for i in range(3):
    a.append(input())

ans = 0
for i in range(N):
    if a[0][i] != a[1][i] and a[1][i] != a[2][i]:
        ans += 2
    elif a[0][i] != a[1][i] or a[1][i] != a[2][i]:
        ans += 1
print(ans)

Failing test case input:
7
ukoknez
tiuotst
pro`rgm

Expected output:
13


Actual output:
14


Fixed submission (verdict: Accepted):
N = int(input())
a = []
for i in range(3):
    a.append(input())

ans = 0
for i in range(N):
    if a[0][i] != a[1][i] and a[1][i] != a[2][i] and a[0][i] != a[2][i]:
        ans += 2
    elif a[0][i] == a[1][i] and a[1][i] == a[2][i] and a[0][i] == a[2][i]:
        continue
    else:
        ans += 1
print(ans)