Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8
N = 0
C = []
S = []
F = []

# i駅での到着時間を指定すると、次の乗車時間が帰ってくる
def getNextTrain(i, time):
  t = S[i]
  while(1):
    if time <= 0:
      break
    if t >= time:
      break
    t += F[i]

  return t

# 入力部分
N = int(raw_input())
for i in range(N-1):
  c, s, f = map(int, raw_input().split())
  C.append(c)
  S.append(s)
  F.append(f)

# 処理部分
for k in range(N):
  arrive = 0
  for p in range(k, N-1): 
    # p駅から出発して
    arrive = getNextTrain(p, arrive)
    #print str(arrive) + '-> ' + str(p),
    arrive += C[p]
    #print '->' + str(arrive)
  print arrive

# 出力部分

Fixed submission:
# -*- coding: utf-8
N = 0
C = []
S = []
F = []

# i駅での到着時間を指定すると、次の乗車時間が帰ってくる
def getNextTrain(i, time):
  # t = S[i]
  if time <= S[i]:
    return S[i]
  else:
    n = time / F[i]
    m = time % F[i]
    t = F[i] * n
    if m != 0:
      t += F[i]
    # while(1):
    #   if t >= time:
    #     break
    #   t += F[i]

    return t

# 入力部分
N = int(raw_input())
for i in range(N-1):
  c, s, f = map(int, raw_input().split())
  C.append(c)
  S.append(s)
  F.append(f)

# 処理部分
for k in range(N):
  arrive = 0
  for p in range(k, N-1): 
    # p駅から出発して
    arrive = getNextTrain(p, arrive)
    #print str(arrive) + '-> ' + str(p),
    arrive += C[p]
    #print '->' + str(arrive)
  print arrive

# 出力部分

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8
N = 0
C = []
S = []
F = []

# i駅での到着時間を指定すると、次の乗車時間が帰ってくる
def getNextTrain(i, time):
  t = S[i]
  while(1):
    if t >= time:
      break
    t += F[i]

  return t

# 入力部分
N = int(raw_input())
for i in range(N-1):
  c, s, f = map(int, raw_input().split())
  C.append(c)
  S.append(s)
  F.append(f)

# 処理部分
for k in range(N):
  arrive = 0
  for p in range(k, N-1): 
    # p駅から出発して
    arrive = getNextTrain(p, arrive)
    #print str(arrive) + '-> ' + str(p),
    arrive += C[p]
    #print '->' + str(arrive)
  print arrive

# 出力部分

Fixed submission:
# -*- coding: utf-8
N = 0
C = []
S = []
F = []

# i駅での到着時間を指定すると、次の乗車時間が帰ってくる
def getNextTrain(i, time):
  # t = S[i]
  if time <= S[i]:
    return S[i]
  else:
    n = time / F[i]
    m = time % F[i]
    t = F[i] * n
    if m != 0:
      t += F[i]
    # while(1):
    #   if t >= time:
    #     break
    #   t += F[i]

    return t

# 入力部分
N = int(raw_input())
for i in range(N-1):
  c, s, f = map(int, raw_input().split())
  C.append(c)
  S.append(s)
  F.append(f)

# 処理部分
for k in range(N):
  arrive = 0
  for p in range(k, N-1): 
    # p駅から出発して
    arrive = getNextTrain(p, arrive)
    #print str(arrive) + '-> ' + str(p),
    arrive += C[p]
    #print '->' + str(arrive)
  print arrive

# 出力部分
Buggy python submission (verdict: Runtime Error):
a,b = map(int,raw_input().split())
if s[a+1] == "-" and len(s.strip("-")) == len(s) - 1:
    print "Yes"
else: print "No"    



Fixed submission:
a,b = map(int,raw_input().split())
valid = True
s = raw_input()
for ind in range(len(s)):
        if ind == a:
            if s[ind] != "-":
                valid = False
        else:
            if s[ind].isalpha() or s[ind] == "-":
                valid = False        
if valid: print "Yes"
else: print "No"
Buggy python submission (verdict: Runtime Error):
import sys
x = sys.argv[0]
t = sys.argv[1]
print x - t


Fixed submission:
l = raw_input().split()
x = l[0]
t = l[1]
if int(x) - int(t) > 0:
    print int(x) - int(t)
else:
    print 0

Buggy python submission (verdict: Runtime Error):
import sys
x = sys.argv[0]
t = sys.argv[1]
print X - t


Fixed submission:
l = raw_input().split()
x = l[0]
t = l[1]
if int(x) - int(t) > 0:
    print int(x) - int(t)
else:
    print 0

Buggy python submission (verdict: Runtime Error):
X,t = map(int,rawinput().split)
return X-t


Fixed submission:
l = raw_input().split()
x = l[0]
t = l[1]
if int(x) - int(t) > 0:
    print int(x) - int(t)
else:
    print 0
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
while 2**n > n
	n-=1
ans = 2**n
print(ans)


Fixed submission:
n = int(input())
pow = n
ans = 0
while 2**pow > n:
    pow-=1
print(2**pow)
Buggy python submission (verdict: Runtime Error):
a = int(raw_input())
if a < 1200:
  	print('ABC')
else:
  	print('ARC)
          

Fixed submission:
a = int(input())
if a < 1200:
	print("ABC")
else: print("ARC")
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]

C = []
max_A = max(A)
max_idx = A.index(max_A)
min_A = min(A)
min_idx = A.index(min_A)

if abs(max_A) >= abs(min_A):
    for i in range(n):
        A[i] += max_A
        C.append([max_idx+1, i+1])
    for i in range(1, n):
        A[i] += A[i-1]
        C.append([i, i+1])
else:
    for i in range(n):
        A[i] += min_A
        C.append([min_idx+1, i+1])
    for i in range(n-1):
        A[n-i+2] += A[n-i+1]
        C.append([n-i+2, n-i+3])

print(len(C))
for i, j in C:
    print('{0} {1}'.format(i, j))


Fixed submission:
n = int(input())
A = [int(i) for i in input().split()]

C = []
max_A = max(A)
max_idx = A.index(max_A)
min_A = min(A)
min_idx = A.index(min_A)

if abs(max_A) >= abs(min_A):
    for i in range(n):
        #A[i] += max_A
        C.append([max_idx+1, i+1])
    for i in range(1, n):
        #A[i] += A[i-1]
        C.append([i, i+1])
else:
    for i in range(n):
        #A[i] += min_A
        C.append([min_idx+1, i+1])
    for i in range(n, 1, -1):
        #A[n-i+2] += A[n-i+1]
        #C.append([n-i+2, n-i+3])
        C.append([i, i-1])

print(len(C))
for i, j in C:
    print('{0} {1}'.format(i, j))
Buggy python submission (verdict: Runtime Error):
n = input('input N: ')

c, s, f = [], [], []
for i in range(int(n) - 1):
    tmp = input('input C, S, F: ').split()
    c.append(tmp[0])
    s.append(tmp[1])
    f.append(tmp[2])

# n = 3
# c = [6, 1]
# s = [5, 10]
# f = [1, 1]
# n = 4
# c = [12, 52, 99]
# s = [24, 16, 2]
# f = [6, 4, 2]
# n = 4
# c = [12, 44, 66]
# s = [13, 17, 4096]
# f = [1, 17, 64]

a = [None] * n
for i in reversed(range(int(n))):

    if i == n - 1:
        a[i] = 0
        continue

    ta = s[i] + c[i]
    if i == n - 2:
        a[i] = ta
        continue

    for j in range(i, n - 2):
        nn = j + 1
        if ta <= s[nn]:
            ta = a[nn]
        else:
            yo = ta % f[nn]
            add = 0 if yo == 0 else f[nn] - yo
            ta += add + c[nn]
    a[i] = ta


[print(aa) for aa in a]


Fixed submission:
def c_SpecialTrains(N, STATION):
    ans = []
    for i in range(N):
        t = 0  # 駅iからNまでにかかる時間
        for j in range(i, N - 1):
            c, s, f = STATION[j]
            if t < s:
                t = s  # まだ運行していないので、運行するまで待つ必要がある
            elif t % f == 0:
                # tがfで割り切れるなら、すぐに鉄道に乗ればよい
                # sはfで割り切れることが保証されているので、この条件式でよい
                pass
            else:
                t += f - (t % f)  # この分だけ駅で待つ必要がある
            t += c  # 次の駅までかかる時間
        ans.append(t)
    return '\n'.join(map(str, ans))
 
N = int(input())
STATION = [[int(i) for i in input().split()] for j in range(N-1)]
print(c_SpecialTrains(N, STATION))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

_list = []
for _ in range(n - 1):
    a, b, c = map(int, input().split())
    _list.append([a, b, c])

for i in range(n - 1):
    num = i
    time = 0

    while num < n - 1:
        c, s, f = _list[num]

        if num == i:
            time += s + c
            num += 1
            continue

        while True:
            wait = s - time
            if wait >= 0:
                time += wait + c
                break

            s += f

        num += 1

    print(time)


print(0)


Fixed submission:
n = int(input())

_list = []
for _ in range(n - 1):
    a, b, c = map(int, input().split())
    _list.append([a, b, c])


for i in range(n - 1):
    num = i
    time = 0

    while num < n - 1:
        c, s, f = _list[num]

        if num == i:
            time += s + c
            num += 1
            continue

        while True:
            wait = s - time

            if wait >= 0:
                time += wait + c
                break

            test = (wait * -1) // f
            s += int(f * test)

            if s - time < 0:
                s += f

        num += 1

    print(time)


print(0)
Buggy python submission (verdict: Runtime Error):
a = list(input())
b = list(input())
c = list(input())
# print('a',a)
# print('b',b)
# print('c',c)
# exit()
ptr = 'a'
while (True):
	if ptr == 'a':
		ptr = a.pop(0)
	if ptr == 'b':
		ptr = b.pop(0)
	if ptr == 'c':
		ptr = c.pop(0)

	if ptr == 'a' and a == []:
		print('A')
		break
	elif ptr == 'b' and  b == []:
		print('B')
		break
	elif ptr == 'c' and c == []:
		print('C')
		break

Fixed submission:
a = list(input())
b = list(input())
c = list(input())
# print('a',a)
# print('b',b)
# print('c',c)
# exit()
ptr = 'a'
while (True):
	if ptr == 'a':
		if a == []:
			print('A')
			break
		ptr = a.pop(0)
	if ptr == 'b':
		if b == []:
			print('B')
			break
		ptr = b.pop(0)
	if ptr == 'c':
		if c == []:
			print('C')
			break
		ptr = c.pop(0)
Buggy python submission (verdict: Runtime Error):
C,D=map(int,input().split())
print("Left" if A+B > C+D else "Balanced" if A+B == C+D else "Right")

Fixed submission:
A,B,C,D=map(int,input().split())
print("Left" if A+B > C+D else "Balanced" if A+B == C+D else "Right")
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
data = np.array([int(i) for i in input().split()])
cout = 0
while 1:
    index = np.where(data%2 == 0)
    data_even = data[index]
    # print(data_even)
    # print(len(data_even) == len(data))
    if len(data_even) == len(data):
        cout += 1
        data = data_even / 2
    else:
        break


print(cout)

Fixed submission:
S = input()

cout = 0
for i in range(0,len(S)):
    if S[i] == '1':
        cout += 1

print(cout)

Buggy python submission (verdict: Runtime Error):
S = input()

cout = 0
for i in range(0,len(S)):
    if S[i] == '1':
        cout += 1

return cout

Fixed submission:
S = input()

cout = 0
for i in range(0,len(S)):
    if S[i] == '1':
        cout += 1

print(cout)
Buggy python submission (verdict: Runtime Error):
li_a=list(input())
li_b=list(input())
li_a.reverse()
if li_a==li_b:
    print(YES)
else:
    print(NO)


Fixed submission:
li_a=list(input())
li_b=list(input())
li_a.reverse()
if li_a == li_b:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
N = int((input()))

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

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

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

can_make = 0
for upp in range(N):
    for midd in range(N):
        for loww in range(N):
            if A[upp] < B[midd] < C[loww]:
                can_make += 1

print　can_make

Fixed submission:
a = input()
b = input()

a_list = list(a)
b_list = list(b)

if a_list[0] == b_list[2] and a_list[1] == b_list[1] and a_list[2] == b_list[0]:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
N = int((input()))

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

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

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

can_make = 0
for upp in range(N):
    for midd in range(N):
        for loww in range(N):
            if A[upp] < B[midd] < C[loww]:
                can_make += 1

print(can_make)

Fixed submission:
a = input()
b = input()

a_list = list(a)
b_list = list(b)

if a_list[0] == b_list[2] and a_list[1] == b_list[1] and a_list[2] == b_list[0]:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
N = int((input()))

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

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

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

can_make = 0
for upp in range(N):
    for midd in range(N):
        for loww in range(N):
            if A[upp] < B[midd] < C[loww]:
                can_make += 1

print(can_make)

Fixed submission:
a = input()
b = input()

a_list = list(a)
b_list = list(b)

if a_list[0] == b_list[2] and a_list[1] == b_list[1] and a_list[2] == b_list[0]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = slist[2] + slist[3]

if left > right:
	print("left")
	
elif left == right:
	print("Balanced")
	
else:
	print("right")


Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")

Buggy python submission (verdict: Runtime Error):
s = input()

slist = s.split(' ')

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right')

Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")

Buggy python submission (verdict: Runtime Error):
s = input()

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right')

Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")

Buggy python submission (verdict: Runtime Error):
s = input()

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right)

Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")

Buggy python submission (verdict: Runtime Error):
s = input()

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right

Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")

Buggy python submission (verdict: Runtime Error):
str = args[1]
print(str)

Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")

Buggy python submission (verdict: Runtime Error):
str = raw_inpur()
print(str)

Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")
Buggy python submission (verdict: Runtime Error):
#!/user/bin/python
# coding: UTF-8

N = int(raw_input())

L = [2, 1]
flag = 0
i = 0
while flag == 0:
    l = 0
    l = L[i] + L[i + 1]
    L.append(l)
    i = i + 1
    print l
    if l > 86:
        flag = flag + 1

print L[N]

Fixed submission:
#!/user/bin/python
# coding: UTF-8

N = int(raw_input())

L = [2, 1, 3, 4,
7,
11,
18,
29,
47,
76,
123,
199,
322,
521,
843,
1364,
2207,
3571,
5778,
9349,
15127,
24476,
39603,
64079,
103682,
167761,
271443,
439204,
710647,
1149851,
1860498,
3010349,
4870847,
7881196,
12752043,
20633239,
33385282,
54018521,
87403803,
141422324,
228826127,
370248451,
599074578,
969323029,
1568397607,
2537720636,
4106118243,
6643838879,
10749957122,
17393796001,
28143753123,
45537549124,
73681302247,
119218851371,
192900153618,
312119004989,
505019158607,
817138163596,
1322157322203,
2139295485799,
3461452808002,
5600748293801,
9062201101803,
14662949395604,
23725150497407,
38388099893011,
62113250390418,
100501350283429,
162614600673847,
263115950957276,
425730551631123,
688846502588399,
1114577054219522,
1803423556807921,
2918000611027443,
4721424167835364,
7639424778862807,
12360848946698171,
20000273725560978,
32361122672259149,
52361396397820127,
84722519070079276,
137083915467899403,
221806434537978679,
358890350005878082,
580696784543856761,
939587134549734843]

print L[N]
Buggy python submission (verdict: Runtime Error):
#!/user/bin/python
# coding: UTF-8

N = int(raw_input())
A = map(int, raw_input().split())
B = map(int, raw_input().split())
C = map(int, raw_input().split())

A.sort()
B.sort()
C.sort()

n = 0
for i in range(N):
    for j in range(N):
        if A[i] < B[j]:
            for k in range(N):
                if B[j] < C[k]:
                    n = n + 1

print n


Fixed submission:
#!/user/bin/python
# coding: UTF-8

c1 = str(raw_input())
c2 = str(raw_input())

c1_list = list(c1)
c1_list.reverse()
if list(c2) == c1_list :
    print 'YES'
else :
    print 'NO'
Buggy python submission (verdict: Runtime Error):
import sys
x, y = map(int,sys.stdin.readline().split())
cnt = 0
while x <= y:
    cnt += 1
    x *= 2
print(cnt)


Fixed submission:
import sys
a, b, c, d = map(int, sys.stdin.readline().split())
if a+b > c+d:
    print('Left')
elif a+b == c+d:
    print('Balanced')
else:
    print('Right')
Buggy python submission (verdict: Runtime Error):
nums = input().split()
print(nums[0][0].upper()+nums[1][0].upper()+nums[2][0].upper

Fixed submission:
nums = input().split()
print(nums[0][0].upper()+nums[1][0].upper()+nums[2][0].upper())
Buggy python submission (verdict: Runtime Error):
import sys
a, b = sys.stdin.readline().split()

print((a+b)%24)

Fixed submission:
import sys
a, b = map(int, sys.stdin.readline().split())

print((a+b)%24)
Buggy python submission (verdict: Runtime Error):
import sys
nums = [for i in map(int, sys.stdin.readline().split())]
counted = []
cnt = 0
for item in nums:
    if item in counted:
        continue
    else:
        cnt += 1
        counted.append(item)

print(cnt)

Fixed submission:
import sys
a, b, c = map(int, sys.stdin.readline().split())
nums = []
nums.append(a)
nums.append(b)
nums.append(c)

counted = []
cnt = 0
for item in nums:
    if item in counted:
        continue
    else:
        cnt += 1
        counted.append(item)
print(cnt)
Buggy python submission (verdict: Runtime Error):
import collections
import itertools

s = list(map(str, input()))
g = list(map(lambda x: int(x),input().split()))

seq = ('R', 'L')

ans = False

count_dict = collections.Counter(s)

g_sum = abs(g[0])+abs(g[1])
if g_sum > count_dict['F']:
    print('No')
else:
    patterns = list(itertools.product(seq, repeat=count_dict['T']))

    for _p in patterns:
        i = 0
        m = [0, 0]
        n = 3
        for _s in s:
            if _s == 'F':
                if n == 3:
                    m[0] = m[0] + 1
                elif n == 1:
                    m[0] = m[0] - 1
                elif n == 0:
                    m[1] = m[1] + 1
                elif n == 2:
                    m[1] = m[1] - 1
            else:
                i = i + 1
                if _p[i-1] == 'R':
                    if n == 0:
                        n = 3
                    else:
                        n = n - 1
                elif _p[i-1] == 'L':
                    if n == 3:
                        n = 0
                    else:
                        n = n + 1

        if m[0] == g[0] and m[1] == g[1]:
            ans = True
            break

    if ans:
        print('Yes')
    else:
        print('No')


Fixed submission:
import math

a = list(map(lambda x: int(x),input().split()))
s = sum(a)
ave = math.ceil(sum(a)/len(a))

print(ave)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

def main():
    N = int(input())
    for i in reversed(range(N)):
        int_sqrt = int(math.sqrt(i))
        if i == int_sqrt ** 2:
            print(i)
            return None

if __name__ == "__main__":
    main()

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

str1 = input()
str2 = input()
c11, c12, c13 = [i for i in str1]
c21, c22, c23 = [i for i in str2]

if c11 == c23 and c12 == c22 and c13 == c21:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()
len_s = len(s)
l_index = 0
r_index = s - 1
counter = 0
while l_index < r_index:
    if s[l_index] == s[r_index]:
        l_index += 1
        r_index -= 1
    elif s[l_index] == "x":
        counter += 1
        l_index += 1
    elif s[r_index] == "x":
        counter += 1
        r_index -=1
    else:
        counter = -1
        break
print(counter)

Fixed submission:
s = input()
len_s = len(s)
l_index = 0
r_index = len_s - 1
counter = 0
while l_index < r_index:
    if s[l_index] == s[r_index]:
        l_index += 1
        r_index -= 1
    elif s[l_index] == "x":
        counter += 1
        l_index += 1
    elif s[r_index] == "x":
        counter += 1
        r_index -=1
    else:
        counter = -1
        break
print(counter)
Buggy python submission (verdict: Runtime Error):
n = input()
xs = input().split(' ')
xs = [int(x) for x in xs]
xs = set(xs)
xs = list(xs)
xs.sort()
a = [x for x in xs if x % 2 == 1]
if len(a) > 0:
    print(0)
else:
    m = 10 ** 9
    for x, y in zip(xs[:-1], xs[1:]):
        q = y - x
        if q < m:
            m = q
    if m > xs[0]:
        m = xs[0]
    count = 0
    while m % 2 == 0:
        count += 1
        m = m / 2
    print(count)

Fixed submission:
xs = input()
count = 0
for x in xs:
    if x == '1':
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):

def binarize(txt):
    xs = txt.split(' ')
    xs = [int(x) for x in xs]
    b = 0
    for i in range(10):
        b += xs[i] * (2 ** i)
    return b


def count1(b):
    b = b[2:]
    count = 0
    for i in range(len(b)):
        if b[i] == '1':
            count += 1
    return count


N = input()
N = int(N)

F = [0 for i in range(N)]

for i in range(N):
    txt = input()
    F[i] = binarize(txt)


P = [[] for i in range(N)]

for i in range(N):
    xs = input().split(' ')
    P[i] = [int(x) for x in xs]


m = - 10 ** 11

for i in range(1, 2**10):

    score = 0

    for j in range(N):
        b = bin(i & F[j])
        count = count1(b)
        score += P[j][count]

    if score > m:
        m = score

print(m)


Fixed submission:
xs = input().split(' ')
[N, A, B] = [int(x) for x in xs]

a = N * A
b = B
if a > b:
    print(b)
else:
    print(a)
Buggy python submission (verdict: Runtime Error):
import numpy as np
from copy import deepcopy


def dijkstra(N, matrix, s):
    d = [np.inf for _ in range(N)]
    d[s] = 0
    prev = [-1 for _ in range(N)]
    Q = set([i for i in range(N)])

    def min_index():
        mi = np.inf
        mii = 0
        for i in Q:
            if d[i] < mi:
                mii = i
        return mii

    while Q:
        u = min_index()
        Q.remove(u)
        for v in range(N):
            if matrix[u][v] >= 0:
                alt = d[u] + matrix[u][v]
                if d[v] > alt:
                    d[v] = alt
                    prev[v] = u
    return d


H, W = map(int, input().split())

c = []
for _ in range(10):
    c.append([int(x) for x in input().split()])

c_tmp = deepcopy(c)

for i in range(10):
    for j in range(10):
        c_tmp[i][j] = c[j][i]

c = c_tmp

k = [0 for _ in range(10)]
for i in range(H):
    xs = [int(x) for x in input().split()]
    for x in xs:
        if x > 0:
            k[x] += 1

d = dijkstra(10, c, 1)

count = 0
for i in range(10):
    if i != 1:
        count += d[i] * k[i]

print(count)



Fixed submission:
N = int(input())

counter = 0
current = 11
flag = False
while N > 0:
    tmp = N % 10
    if tmp == current:
        counter += 1
    else:
        counter = 0
        current = tmp
    if counter > 1:
        flag = True
    N = N // 10
if flag is True:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())

Lx = 2
Ly = 1

if N == 1:
    print(Ly)
else:
    for i in range(N-1):
        tmp = Lx + Ly
        Lx = Ly
        Ly = tmp

print(tmp)


Fixed submission:
N = int(input())

Lx = 2
Ly = 1

if N == 1:
    print(Ly)
else:
    for i in range(N - 1):
        tmp = Lx + Ly
        Lx = Ly
        Ly = tmp
    print(Ly)