Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03000 (python)

Fixed submission:
N, X = map(int,input().split())
Ln = list(map(int,input().split()))
 
cnt = 1
sum = 0
 
for i in range(0, N):
  sum += Ln[i]
  if sum > X:
    break
  cnt += 1
 
print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())
Ln = list(map(int,input().split()))
 
cnt = 1
sum = 0
 
for i in range(1, N+1):
  sum += Ln[i]
  if sum > X:
    break
  cnt += 1
 
print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())
Ln = list(map(int,input().split()))
cnt = 1
sum = 0
 for i in range(1, N):
  sum += Ln[i]
  if sum > X:
    break
  cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())
Ln = map(int,input().split())
cnt = 1
sum = 0
 for i in range(1, N):
  sum += Ln[i]
  if sum > X:
    break
  cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())
Ln = map(int,input().split())
cnt = 1
sum = 0
 for i in range(1, N):
    sum += Ln[i]
    if sum > X:
        break
    cnt += 1
print(cnt)
Problem p02783 (python)

Fixed submission:
import math
H, A = input().split()
H = int(H)
A = int(A)
print(math.ceil(H/A))

Buggy submission (verdict: Runtime Error):
H, A = input().split()
import math
print(math.ceil(H/A))
Problem p02784 (python)

Fixed submission:
H, N = input().split()
A = list(input().split())
H = int(H)
N = int(N)
A = [int(a) for a in A]
if H > sum(A):
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
H, N = input().split()
A = list(int(input().split()))
A = [int(a) for a in A]
if H > sum(A):
    print('No')
else:
    print('Yes')
Problem p02911 (python)

Fixed submission:
import numpy as np
N, K, Q = map(int, input().split())
A = []
for q in range(Q):
    a = int(input())
    A.append(a)
points2 = np.zeros(N)
for a in A:
    points2[a-1] += 1
results = []
for p in points2:
    if K - (Q - p) > 0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = []
for q in range(Q):
    a = int(input())
    A.append(a)
points = np.array([K for i in range(N)])
for a in A:
    points -= 1
    points[a-1] += 1
for p in points:
    if p > 0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = []
for q in range(Q):
    a = int(input())
    A.append(a)
points = np.array([K for i in range(N)])
for a in A:
    points -= 1
    points[a-1] += 1
print(points)
for p in points:
    if p > 0:
        print('Yes')
    else:
        print('No')
Problem p02945 (python)

Fixed submission:
A,B = map(int,input().split())
a = max(A+B, A-B, A*B)
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
S=[]
for n in range(N):
    S.append(input())
Slist = []
for s in S:
    lists = list(s)
    listss = sorted(lists)
    Slist.append(listss)
def isAna2(Sl,sl):
    boolcount = True
    for i,Sli in enumerate(Sl):
        if Sli != sl[i]:
            boolcount = False
            break
    return boolcount
count = 0
for i,Sl in enumerate(Slist):
    for sl in Slist[i+1:]:
        if isAna2(Sl,sl) == True:
            count+=1
print(count)
Problem p02947 (python)

Fixed submission:
N = int(input())
S=[]
for n in range(N):
    S.append(input())
Sdict = {}
for s in S:
    lists = list(s)
    listss = sorted(lists)
    listsss = ''.join(listss)
    if Sdict.get(listsss) == None:
        Sdict[listsss] = 1
    else:
        Sdict[listsss] += 1
count = 0
for value in Sdict.values():
    count += int(value*(value-1)/2)
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S=[]
for n in range(N):
    S.append(input())
Slist = []
for s in S:
    lists = list(s)
    listss = sorted(lists)
    Slist.append(listss)
def isAna2(Sl,sl):
    boolcount = True
    for i,Sli in enumerate(Sl):
        if Sli != sl[i]:
            boolcount = False
            break
    return boolcount
import copy
def countAna(Slist):
    if len(Slist) == 1:
        return 0
    else:
        groupcount = 1
        Sl = Slist[0]
        del Slist[0]
        newSlist = copy.deepcopy(Slist)
        for i,sl in enumerate(Slist):
            if isAna2(Sl, sl) == True:
                groupcount += 1
                del newSlist[i]
        if groupcount == 1:
            count = 0
        else:
            count = int(groupcount*(groupcount-1)/2)
        return count + countAna(newSlist)
print(countAna(Slist))
Problem p02993 (python)

Fixed submission:
a = input()
lena = len(a)
bad = False
aft = 0

for i in a:
    bef = i
    if bef==aft:
        bad = True
        break
    else:
        aft=bef
if bad==True:
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

 #最小公倍数
def lcm(a,b):
    return a*b/gcd(a,b)
  
A,B,C,D=map(int,input().split())

if A%C == 0:
    AC = int(A/C) - 1
else:
    AC = int(A/C)
if A%D == 0:
    AD = int(A/D) - 1
else:
    AD = int(A/D)
    
lcmCD = lcm(C,D)
if A%(lcmCD) == 0:
    ACD = int(A/(lcmCD)) - 1
else:
    ACD = int(A/(lcmCD))
    
print((B - A + 1) - (int(B/C) - AC + int(B/D) - AD - int(B/(lcmCD) + ACD)))
Problem p03029 (python)

Fixed submission:
a, p = map(int, input().split())

print(int((a * 3 + p)/ 2))

Buggy submission (verdict: Runtime Error):
n = input()
print(int((int(n[0]) * 3 + int(n[2])) / 2))
Problem p03071 (python)

Fixed submission:
A,B = map(int, input().split())
count=0
for i in range(2):
    if A >= B:
        count+=A
        A-=1
    else:
        count+=B
        B-=1
print(count)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = (input())
a = S.split('1')
a = [len(i) for i in a if len(i)!=0]

b = S.split('0')
b = [len(i) for i in b if len(i)!=0]
m = 0
c = [0]
for i in range(len(a)+len(b)):
    if S[0] == '0':
        if i%2==0:
            m+=a[int(i/2)]
        else:
            m+=b[int(i/2)]
        c.append(m)
    else:
        if i%2==0:
            m+=b[int(i/2)]
        else:
            m+=a[int(i/2)]
        c.append(m)
mc=0
try:
    if S[0]=='0':
        if 1+2*K-1 >len(c) -1:
            mc = 1
    else:
        if 1+2*K > len(c) -1:
            mc =1
    for i in range(1,len(c)):
        d=0
        if S[0]=='0':
            if i%2!=0:
                d=c[i+2*K-1] - c[i-1]
            else:
                d=c[i+2*K] - c[i-1]
        else:
            if i%2==0:
                d=c[i+2*K-1] - c[i-1]
            else:
                d=c[i+2*K] - c[i-1]
        if mc < d:
            mc = d
except:        
    print(mc)
else:
   
    print(mc)
Problem p03471 (python)

Fixed submission:
N,Y = map(int,input().split())
count=0
for x in range(N+1):
    for y in range(N+1):
        if x+y >N:
            break
        else:
            money = 10000*x + 5000*y + 1000*(N-x-y)
            if money == Y:
                count=1
                print('{} {} {}'.format(x,y,N-x-y))
                break
    if count == 1:
        break
if count == 0:
    print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
count=0
for x in range(N+1):
    for y in range(N+1):
        if x+y >N:
            break
        else:
            money = 10000*x + 5000*y + 1000*(N-x-y)
            if money == Y:
                count=1
                print('{} {} {}'.format(x,y,N-x-y)
                break
    else:
        continue
    break
if count == 0:
    print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())
count=0
for x in range(N+1):
    for y in range(N+1):
        if x+y >N:
            break
        else:
            money = 10000*x + 5000*y + 1000*(N-x-y)
            if money == Y:
                count=1
                print(f'{x} {y} {N-x-y}')
                break
    else:
        continue
    break
if count == 0:
    print('-1 -1 -1')
Problem p02937 (python)

Fixed submission:
import sys
s = input()
t = input()

check = [False]*30
for c in s:
    i = ord(c) - ord("a")
    check[i] = True

for c in t:
    i = ord(c) - ord("a")
    if not check[i]:
        print(-1)
        sys.exit()

dp = [[-1 for i in range(26)] for j in range(len(s))]

s = s + s

#
def ser(string :str,target :str,s :int):
    for i in range(s,len(string)):
        if string[i] == target:
            return i % (len(string)//2),i-1

# 指定した範囲に数字を埋める
def dig(ls,c,v,s,t):
    for i in range(s,t+1):
        ls[i][c] = v

for c in range(len(dp[0])):
    if not check[c]:continue
    i = 0
    while i < len(dp):
        start = i
        v,i = ser(s,chr(c+ord("a")),i+1)
        dig(dp,c,v,start,min(i,len(dp)-1))
        i += 1

# 最初にうまいことやるために
import copy
ls = [0 if s[0] == chr(i + ord("a")) else dp[0][i] for i in range(len(dp[0]))]
dp.append(ls)

ans = 0
i = -1
for char in t:
    ikari = dp[i][ord(char) - ord("a")]
    if i >= ikari:
        ans += 1
    i = ikari
print(ans * (len(dp)-1) + 1 + i)

Buggy submission (verdict: Runtime Error):
import sys
s = input()
t = input()

check = [False]*30
for c in s:
    i = ord(c) - ord("a")
    check[i] = True

for c in t:
    i = ord(c) - ord("a")
    if not check[i]:
        print(-1)
        sys.exit()

dp = [[0 for i in range(26)] for j in range(len(s))]

s = s + s

#
def ser(string :str,target :str,s :int):
    for i in range(s,len(string)):
        if string[i] == target:
            return i % (len(string)//2),i-1

# 指定した範囲に数字を埋める
def dig(ls,c,v,s,t):
    for i in range(s,t+1):
        ls[i][c] = v

for c in range(len(dp[0])):
    i = 0
    while i < len(dp):
        start = i
        print(i)
        v,i = ser(s,chr(c+ord("a")),i+1)
        dig(dp,c,v,start,min(i,len(dp)-1))
        i += 1

print(dp)
Problem p03085 (python)

Fixed submission:
ls = {'A':'T','C':'G','T':'A','G':'C'}
print(ls[input()])

Buggy submission (verdict: Runtime Error):
dgthd

Buggy submission (verdict: Runtime Error):
t

Buggy submission (verdict: Runtime Error):
d

Buggy submission (verdict: Runtime Error):
a

Buggy submission (verdict: Runtime Error):
a

Buggy submission (verdict: Runtime Error):
a
Problem p03160 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
check = [0,abs(h[0]-h[1])] + [None]*(n-2)
for i in range(n-2):
    check[i+2] = min(check[i]+abs(h[i]-h[i+2]),check[i+1]+abs(h[i+1]-h[i+2]))
print(check[-1])

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000000000000000000000000000000)
s = [x for x in input()]
t = [x for x in input()]
dp = [['' for i in range(len(s))] for j in range(len(t))]
def dppp(ns,nt):
    global dp,s,t
    if ns == len(s) or nt == len(t):return ''
    if dp[nt][ns] != '':return dp[nt][ns]
    if s[ns] == t[nt]:
        get = s[ns] + dppp(ns+1,nt+1)
    else:
        get = ''
    sgo = dppp(ns+1,nt)
    tgo = dppp(ns,nt+1)
    if len(sgo) >= len(tgo) and len(sgo) >= len(get):
        dp[nt][ns] = sgo
        return sgo
    elif len(tgo) >= len(sgo) and len(tgo) >= len(get):
        dp[nt][ns] = tgo
        return tgo
    else:
        dp[nt][ns] = get
        return get
ans = dppp(0,0)
print(ans)
Problem p03238 (python)

Fixed submission:
n = int(input())
for i in range(n-1):
    a = int(input())
    b = int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
for i in range(n,10000000000000000):
    if m%i == 0:
        n=i
        break
print(int(m/i))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
if n == 1:
    print('Hello World')
else:
    print(a+b)
Problem p03254 (python)

Fixed submission:
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in a:
    x -= i
    if x >= 0:
        b += 1
        N -= 1
    else:
        break
if x == 0:
    print(b)
else:
    if N == 0:
        print(b-1)
    else:
        print(b)

Buggy submission (verdict: Runtime Error):
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in a:
    x -= i
    if x => 0:
        b += 1
    else:
        break
if x == 0:
    print(b)
else:
    print(b-1)

Buggy submission (verdict: Runtime Error):
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in a:
    x -= i
    if x => 0:
        b += 1
    else:
        break
print(b)

Buggy submission (verdict: Runtime Error):
N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in a:
    x -= I
    if x => 0:
        b += 1
    else:
        break
print(b)
Problem p03261 (python)

Fixed submission:
def is_unique(seq):
    return len(seq) == len(set(seq))

N = int(input())
words = []
for i in range(N):
    words.append(input())
hantei = 0
for i in range(N-1):
    a = [x for x in words[i]]
    b = [x for x in words[i+1]]
    if a[len(a)-1] == b[0]:
        pass
    else:
        hantei += 1
        break
if hantei == 0 and is_unique(words) == True:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def is_unique(seq):
    return len(seq) == len(set(seq))

N = int(input())
words = []
for i in range(N):
    words.append(input())
hantei = 0
for i in range(N-1):
    a = [x for x in words[i]]
    b = [x for x in words[i+1]]
    if a[len(a)-1] == b[1]:
        pass
    else:
        hantei += 1
        break
if hantei == 0 and is_unique(words) == True:
    print("Yes")
else:
    print("No")
Problem p03262 (python)

Fixed submission:
N,X = map(int,input().split())
u = list(map(int,input().split()))
def gcd_list(numbers):
    gct = numbers[0]
    for i in range(len(numbers)-1):
        r = numbers[i+1] % gct
        while r != 0:
            ka = r
            r = gct
            gct = ka
            r = r % gct
    return gct
u.append(X)
u.sort()
sa = []
for i in range(len(u)-1):
    sa.append(u[i+1]-u[i])
if len(sa) > 1:
    print(gcd_list(sa))
else:
    print(sa[0])

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
u = list(map(int,input().split()))
def gcd_list(numbers):
    gct = numbers[0]
    for i in range(len(numbers)-1):
        r = numbers[i+1] % gct
        while r != 0:
            ka = r
            r = gct
            gct = ka
            r = r % gct
    return gct
u.append(X)
u.sort()
sa = []
for i in range(len(u)-2):
    sa.append(u[i+1]-u[i])
print(gcd_list(sa))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N,X = map(int,input().split())
u = list(map(int,input().split()))
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
u.append(X)
u.sort()
sa = []
for i in range(len(u)-1):
    sa.append(u[i+1]-u[i])
print(gcd_list(sa))
Problem p03280 (python)

Fixed submission:
a = list(input().split())
a = list(int(x) for x in a)
print((a[0]-1)*(a[1]-1))

Buggy submission (verdict: Runtime Error):
a = list(int(input().split()))
print((a[0]-1)*(a[1]-1))
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
if s[0] != '1':
    print(s[0])
else:
    ans = 1
    for i in range(k):
        if s[i] != '1':
            ans = s[i]
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
S = int(input())
K = int(input())
numbers = (int(x) for x in str(S))
for i in range(5*(10**15)):
    times = 0
    temporary = []
    while times <= K:
        for a in numbers:
            times += a
            for j in renge(a):
                temporary.append(a)
    numbers = temporary
print(numbers[K-1])
Problem p03287 (python)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
check = {};ios = [a[0]%m]*n
for i in range(n-1):
    ios[i+1] = (a[i+1] + ios[i])%m
    check[ios[i]] = 0
check[ios[n-1]] = 0
for i in range(len(ios)):
    check[ios[i]%m] += 1
ans = 0
for i in range(n):
    num = check[ios[i]];check[ios[i]] = 'finish'
    if num == 'finish':continue
    if ios[i] % m == 0:ans += num
    ans += (num * (num - 1))//2
print(ans)

Buggy submission (verdict: Runtime Error):
#おかしの問題
n,m = map(int,input().split())
number = list(int(input().split()))
a = []
#ここから書きかえ
for i in range(n):
    for j in range(n-i):
            b=[]
            for k range(i+1):
                b.append(number[j+k-1])
            if sum(b)%m == 0:
                a.append(1)
            else:
                pass
print(len(a))

Buggy submission (verdict: Runtime Error):
#おかしの問題
n,m = map(int,input().split())
number = list(int(input().split()))
a = []
#ここから書きかえ
for i in range(n):
    for j in range(n-i):
            b=[]
            for k range(n):
                b.append(number[j+k+1])
            if sum(b)%m == 0:
                a.append(1)
            else:
                pass
print(len(a))

Buggy submission (verdict: Runtime Error):
#おかしの問題
n,m = int(input().split())
number = list(int(input().split()))
a = []
#ここから書きかえ
for i in range(n):
    for j in range(n-i):
            b=[]
            for k range(n):
                b.append(number[j+k+1])
            if sum(b)%m == 0:
                a.append(1)
            else:
                pass
print(len(a))

#
Problem p03309 (python)

Fixed submission:
from statistics import median 
n = int(input())
a = list(map(int,input().split()))
ls = []
for i in range(n):
    ls.append(a[i] - i - 1)
b = median(ls)
if b % 1 == 0:
    ans = 0
    b = int(b)
    for i in range(n):
        ans += abs(a[i] - (b + i + 1))
    print(ans)
else:
    bigans = smallans = 0
    for i in range(n):
        bigans += abs(a[i] - (int(b) + i + 2))
        smallans += abs(a[i] - (int(b) + i + 1))
    print(min(bigans,smallans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(1,n+1):
    b.append(a[i-1] - i)
b.sort
if n % 2 != 0:
    B = b[int((n+1)/2)]
    ans = 0
    for i in range(n):
        ans += abs(a[i]-i-1-B)
    print(ans)
else:
    big = b[int((n+2)/2)]
    smo = b[int(n/2)]
    smoB = int((big+smo)/2)
    bigB = smoB + 1
    big = smo = 0
    for i in range(n):
        big += abs(a[i]-i-1-bigB)
    for i in range(n):
        smo += abs(a[i]-i-1-smoB)
    print(min(big,smo))
Problem p03363 (python)

Fixed submission:
from numpy import cumsum
from collections import Counter
import math
def count(n,r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
a = list(map(int,input().split()))
wa = list(cumsum(a))
wa.append(0)
c = Counter(wa)
keys = set(wa)
ans = 0
for i in keys:
    num = c[i]
    if num >= 2:
        ans += count(num,2)
    else:
        pass
print(ans)

Buggy submission (verdict: Runtime Error):
from numpy import cumsum
from collections import Counter
import math
def count(n,r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
a = list(map(int,input().split()))
wa = list(cumsum(a))
wa.append(0)
c = Counter(wa)
keys = set(wa)
ans = 0
for i in keys:
    num = c[i]
    if num >= 2:
        ans += count(num,2)
    else:
        pass
print(ans)
Problem p03387 (python)

Fixed submission:
a,b,c = map(int,input().split())
if max(a,b,c) % 2 == (a + b + c) % 2:
	print((3 * max(a,b,c) - (a + b + c)) // 2)
else:
	print((3 * (max(a,b,c) + 1) - (a + b + c)) // 2)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().input())
if max(a,b,c) % 2 == (a + b + c) % 2:
	print((3 * max(a,b,c) - (a + b + c)) // 2)
else:
	print((3 * (max(a,b,c) + 1) - (a + b + c)) // 2)
Problem p03404 (python)

Fixed submission:
a,b = list(map(int,input().split()))
ls = [['#']*99 for i in range(49)] + [['.']*99 for i in range(49)]
i,j = 0,0
for c in range(a - 1):
    ls[i][j] = '.'
    if j >= 97:
        j = 0;i += 2
    else:
        j += 2
i,j = 51,0
for c in range(b - 1):
    ls[i][j] = '#'
    if j >= 97:
        j = 0;i += 2
    else:
        j += 2
print(98,99)
for j in range(98):
    print(''.join(ls[j]))

Buggy submission (verdict: Runtime Error):
a,b = list(map(int,input().split()))
ls = [['#']*100 for i in range(50)] + [['.']*100 for i in range(50)]
i,j = 0,0
for c in range(a - 1):
    ls[i][j] = '.'
    if i >= 98:
        j = 0;i += 2
    else:
        j += 2
i,j = 51,0
for c in range(b - 1):
    ls[i][j] = '#'
    if i >= 98:
        j = 0;i += 2
    else:
        j += 2
print(100,100)
for j in range(100):
    print(''.join(ls[j]))

Buggy submission (verdict: Runtime Error):
a,b = list(map(int,input().split()))
ls = [['#']*100 for i in range(50)] + [['.']*100 for i in range(50)]
i,j = 0,0
for c in range(a - 1):
    ls[i][j] = '.'
    if i >= 98:
        j = 0;i += 2
    else:
        j += 2
i,j = 51,0
for c in range(b - 1):
    ls[i][j] = '#'
    if i >= 98:
        j = 0;i += 2
    else:
        j += 2

for j in range(100):
    print(''.join(ls[j]))
Problem p03427 (python)

Fixed submission:
n = int(input())
strs = [int(x) for x in str(n)]
kijyun = [9]*(len(strs)-1)
if strs[1:] == kijyun:
    print((len(strs)-1)*9+strs[0])
else:
    print((len(strs)-1)*9+strs[0]-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
strs = [int(x) for x in str(n)]
kijyun = [9]*(len(strs)-1)
if strs[1:] == kijyun:
    print((len(strs)-1)*9+strs[1])
else:
    print((len(strs)-1)*9+strs[1]-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
strs = [int(x) for x in str(n)]
kijyun = [9]*(len(strs)-1)
if strs[1:] == kijyun:
    print((n-1)*9+strs[1])
else:
    print((n-1)*9+strs[1]-1)
Problem p03435 (python)

Fixed submission:
c = []
for i in range(3):
    c.append(list(int(x) for x in input().split()))
c[1][0] -= c[0][0]
c[2][0] -= c[0][0]
if c[1][1] == c[0][1] + c[1][0] and c[1][2] == c[0][2] + c[1][0] and c[2][1] == c[0][1] + c[2][0] and c[2][2] == c[0][2] + c[2][0]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
c = []
for i in range(3):
    c.append(list(int(x) for x in input().split()))
c[1][0] -= c[0][0]
c[2][0] -= c[0][0]
if c[1][1] == c[0][1] + c[1][0] and c[1][2] == c[0][2] + c[1][0] and c[2][1] == c[0][1] + c[2][0] and c[2][2] == c[0][2] + c[2][0]:
    print(‘Yes’)
else:
    print(‘No’)
Problem p03503 (python)

Fixed submission:
ls = []
def onoff(n):
    global ls
    if len(n) == 10:
        ls.append(n)
    else:
        onoff(n + '0')
        onoff(n + '1')
onoff('0')
onoff('1')
del ls[0]
n = int(input())
f = [list(map(str,input().split())) for x in range(n)]
p = [list(map(int,input().split())) for x in range(n)]
ans = -99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
for i in range(1023):
    check = 0
    for j in range(n):
        count = 0
        for k in range(10):
            if ls[i][k] == f[j][k] and ls[i][k] == '1':
                count += 1
        check += p[j][count]
    ans = max(ans,check)
print(ans)

Buggy submission (verdict: Runtime Error):
ls = []
def onoff(n):
    global ls
    if len(n) == 10:
        ls.append(n)
    else:
        onoff(n + '0')
        onoff(n + '1')
onoff('0')
onoff('1')
del ls[0]
n = int(input())
f = [list(map(str,input().split())) for x in range(n)]
p = [list(map(int,input().split())) for x in range(n)]
ans = -99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
for i in range(1024):
    check = 0
    for j in range(n):
        count = 0
        for k in range(10):
            if ls[i][k] == f[j][k] and ls[i][k] == '1':
                count += 1
        check += p[j][count]
    ans = max(ans,check)
print(ans)