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

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))

chofuku_dict = {}
chofuku = []

for a in A:
    if a not in chofuku_dict:
        chofuku_dict[a] = 1
    else:
        chofuku.append(a)
        
chofuku = set(chofuku)

A = list(set(A))
A.sort()

bl = np.array([0] + [1]*A[-1])

ans = 0
for a in A:
    if bl[a] == 0:
        continue
    if a not in chofuku:
        ans += 1
    bl[2*a::a] = 0
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))

chofuku_dict = {}
chofuku = []

for a in A:
    if a not in chofuku_dict:
        chofuku_dict[a] = 1
    else:
        chofuku.append(a)
        
chofuku = set(chofuku)

A = list(set(A))
A.sort()

bl = np.array([0] + [1]*A[-1])
ans = 0
for a in A:
    if a in chofuku:
        continue
    if bl[a] == 1:
        bl[a] = 0
        ans += 1
        bl[2*a::a] = 0
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int,input().split()))
    A.sort()
    ans = 0
    #print(A)
    for i in range(N):
        flag = True
        now = A[i]
        for j in range(0,i):
            if now/A[j] == now//A[j]:
                flag = False
                break
        if i == 0:
            if now == A[1]:
                flag = False
        if flag:
           ans += 1
    print(ans)
if __name__ == '__main__':
    main()
Problem p02647 (python)

Fixed submission:
import sys
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import copy
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    lighted = np.array([0]*N)
    for i,a in enumerate(A):
        area = len(lighted[max(0,i-a):min(i+a,N-1)+1])
        lighted[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
    print(*A)
    print(lighted)
    
    for _ in range(K-1):
        tmp = np.array([0]*N)
        for i,a in enumerate(lighted):
            area = len(tmp[max(0,i-a):min(i+a,N-1)+1])
            tmp[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
        lighted = copy.deepcopy(tmp)
        if lighted[0] == N:
            break
        print(lighted)
    print(lighted)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import copy
input = sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    lighted = np.array([0]*N)
    for i,a in enumerate(A):
        area = len(lighted[max(0,i-a):min(i+a,N-1)+1])
        lighted[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
    
    for _ in range(K-1):
        tmp = np.array([0]*N)
        for i,a in enumerate(lighted):
            area = len(tmp[max(0,i-a):min(i+a,N-1)+1])
            tmp[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
        lighted = copy.deepcopy(tmp)
        if lighted[0] == N:
            break
    print(lighted)
if __name__ == '__main__':
    main()
Problem p02658 (python)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 1

for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        print(ans)
        break
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
#B
import numpy as np
import sys
n = int(input())
A = np.array(list(map(int,input().split())))
ans = 1
flag = True
for i in A:
    if flag:
        ans *= i
        if ans > 10**18:
            ans = -1
            flag = False
    else:
    if i == 0:
        ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
#B
import numpy as np
import sys
n = int(input())
A = np.array(list(map(int,input().split())))
ans = 1
flag = True
for i in A:
    if flag:
	    ans *= i
		if ans > 10**18:
    		ans = -1
            flag = False
	else:
		if i == 0:
          ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
#B
import numpy as np
import sys
n = int(input())
A = np.array(list(map(int,input().split())))
ans = 1.0e0
for i in A:
    ans *= i
if ans > 10**18:
    ans = -1
print(int(ans))

Buggy submission (verdict: Runtime Error):
#B
import numpy as np
n = int(input())
A = np.array(list(map(int,input().split())))
ans = 1
for i in A:
    ans *= i
if ans > 10**18:
    ans = -1
print(ans)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
if S == T[:len(S)]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#D
N, K = map(int,input().split())
A = list(map(int,input().split()))

now = 0
visited = [0]
visited_set = set([0])

for i in range(K):
    now = A[now] - 1
    if now in visited_set:
        roop_start = now
        break
    visited.append(now)
    visited_set.add(now)
    
ind = visited.index(roop_start)
roop = visited[ind:]

if len(roop) != 0:
    print(roop[(K-ind)%len(roop)]+1)
else:
    print(visited[K-1]+1)
Problem p02684 (python)

Fixed submission:
#D
N, K = map(int,input().split())
A = list(map(int,input().split()))

now = 0
visited = [0]
visited_set = set([0])

for i in range(K):
    now = A[now] - 1
    if now in visited_set:
        break
    visited.append(now)
    visited_set.add(now)
if len(visited) == N:
    print(visited[K-1]+1)
else:    
    ind = visited.index(now)
    roop = visited[ind:]
    print(roop[(K-ind)%len(roop)]+1)

Buggy submission (verdict: Runtime Error):
#D
N, K = map(int,input().split())
A = list(map(int,input().split()))

now = 0
visited = [0]
visited_set = set([0])

for i in range(K):
    now = A[now] - 1
    if now in visited_set:
        roop_start = now
        break
    visited.append(now)
    visited_set.add(now)
    
ind = visited.index(roop_start)
roop = visited[ind:]

if len(roop) != 0:
    print(roop[(K-ind)%len(roop)]+1)
else:
    print(visited[K-1]+1)

Buggy submission (verdict: Runtime Error):
#D
N, K = map(int,input().split())
A = list(map(int,input().split()))

now = 0
visited = [0]
visited_set = set([0])

for i in range(K):
    now = A[now] - 1
    if now in visited_set:
        roop_start = now
        break
    visited.append(now)
    visited_set.add(now)
    
ind = visited.index(roop_start)
roop = visited[ind:]

if len(roop) != 0:
    print(roop[(K-ind)%len(roop)]+1)
else:
    print(visited[K]+1)

Buggy submission (verdict: Runtime Error):
#D
N, K = map(int,input().split())
A = list(map(int,input().split()))

now = 0
visited = [0]
visited_set = set([0])

for i in range(K):
    now = A[now] - 1
    if now in visited_set:
        roop_start = now
        break
    visited.append(now)
    visited_set.add(now)
    
ind = visited.index(roop_start)
roop = visited[ind:]

print(roop[(K-ind)%len(roop)]+1)
Problem p02811 (python)

Fixed submission:
k,x = map(int,input().split())
if k*500 >= x:  
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
k,x = map(int,input().split())
if k*500 >= X:  
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
k,x = map(int,input().split())
if k*500 >= X:
  print('Yes')
else:
  print('No')
Problem p02900 (python)

Fixed submission:
def make_divisors(n):
    from collections import deque
    divisors = deque([])
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    lst_divisors = list(divisors)
    lst_divisors.sort()
    return lst_divisors

a, b = map(int,input().split())

ya = set(make_divisors(a))
yb = set(make_divisors(b))

cand = list(ya&yb)
cand.sort()

#print(cand)

ans = []
if len(cand) > 1:
    for n in cand[1:]:
        if ans:
            for n in cand[1:]:
                for waru in ans:
                    if n%waru == 0:
                        break
                else:
                    ans.append(n)
        else:
            ans.append(n)
#print(ans)
print(len(ans)+1)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    from collections import deque
    divisors = deque([])
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    lst_divisors = list(divisors)
    lst_divisors.sort()
    return lst_divisors

a, b = map(int,input().split())

ya = set(make_divisors(a))
yb = set(make_divisors(b))

cand = list(ya&yb)
cand.sort()

#print(cand)

num = [0]*(cand[-1]+1)

ans = 0
for n in cand[1:]:
    if n > cand[-1]:
        break
    if num[n]:
        continue
    num[2*n::n] = list(map(lambda x:1,num[2*n::n]))
    ans += 1
    #print(n)

print(ans+1)#1の分

Buggy submission (verdict: Runtime Error):
import numpy as np

def make_divisors(n):
    from collections import deque
    divisors = deque([])
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    lst_divisors = list(divisors)
    lst_divisors.sort()
    return lst_divisors

a, b = map(int,input().split())

ya = set(make_divisors(a))
yb = set(make_divisors(b))

cand = list(ya&yb)
cand.sort()

#print(cand)

num = np.array([0]*(cand[-1]+1))

ans = 0
for n in cand[1:]:
    if num[n]:
        continue
    #print(n)
    ans += 1
    num[2*n::n] = 1
#print(num)
print(ans+1)#1の分
Problem p02969 (python)

Fixed submission:
a = int(input())
print(3*a**2)

Buggy submission (verdict: Runtime Error):
print(a*int(input())**2)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
A = np.array(list(map(int,input().split())))

balls = np.array([0]*(n+1))

for i in range(1,n+1):
    s = sum(balls[n+1-i::n+1-i])
    if s%2 != A[-i]:
        balls[-i] += 1

#print(balls)

ans = np.where(balls==1)[0].tolist()
if sum(balls):
    print(sum(balls))
    print(*ans)
else:
    print(0)
Problem p03014 (python)

Fixed submission:
import numpy as np
H ,W = map(int,input().split())

maze = [[] for _ in range(H)]
for i in range(H):
    maze[i] = np.array(list(input())) == "."
maze = np.array(maze)

up = np.zeros((H, W), dtype=int)
down = np.zeros((H, W), dtype=int)
right = np.zeros((H, W), dtype=int)
left = np.zeros((H, W), dtype=int)

for i in range(H):
    up[i] = (up[i-1] + 1)*maze[i]
    down[-(i+1)] = (down[-i] + 1)*maze[-(i+1)] 
    
#print(up)
#print(down)

for i in range(W):
    right[:, i] = (right[:, i-1] + 1)*maze[:, i]
    left[:, -(i+1)] = (left[:, -i] + 1)*maze[:, -(i+1)]

print(np.max(up+down+right+left)-3)

Buggy submission (verdict: Runtime Error):
import numpy as np
H ,W = map(int,input().split())

maze = [[] for _ in range(H)]
for i in range(H):
    maze[i] = np.array(list(input())) == "."
maze = np.array(maze)

up = np.zeros((H, W), dtype=int)
down = np.zeros((H, W), dtype=int)
right = np.zeros((H, W), dtype=int)
left = np.zeros((H, W), dtype=int)

for i in range(H):
    up[i] = (up[i-1] + 1)*maze[i]
    down[-i] = (down[-(i-1)] + 1)*maze[-i] 
    
#print(up)
#print(down)

for i in range(W):
    right[:, i] = (right[:, i-1] + 1)*maze[:, i]
    left[:, -i] = (left[:, -(i-1)] + 1)*maze[:, -i]

print(np.max(up+down+right+left)-4)
Problem p03087 (python)

Fixed submission:
N, Q = map(int,input().split())
S = input()+"d"
#'AC'が見つかったらCのほうに+1
count = [0]*(N+1)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "C":
            count[i+1] += count[i] + 1
        else:
            count[i+1] = count[i]
    else:
        count[i+1] = count[i]
    
#print(count)

for _ in range(Q):
    l, r = map(int,input().split())
    print(count[r-1]-count[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int,input().split())
S = input()
#'AC'が見つかったらCのほうに+1
count = [0]*(N+1)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "C":
            count[i+1] += count[i] + 1
        else:
            count[i+1] = count[i]
    else:
        count[i+1] = count[i]
    
#print(count)

for _ in range(Q):
    l, r = map(int,input().split())
    print(count[r-1]-count[l-1])
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
last = "1"
ind = 100
for i,s in enumerate(S):
    if s != "1":
        last = s
        ind = i
        break
if K-1 < ind:
    print("1")
else:
    print(last)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
last = "1"
for i,s in enumerate(S):
    if s != "1":
        last = s
        ind = i
        break
if K-1 < ind:
    print("1")
else:
    print(last)
Problem p02584 (python)

Fixed submission:
a,b,c=map(int,input().split())
a=abs(a)
temp=a//c
if(temp>b):
    temp=temp-b
    if(a%c==0):
        if(temp>b):
            print(a-(b*c))
        else:
            print(temp*c)
    else:
        print(a-(b*c))
else:
    if(temp==b):
        if(a%c==0):
            print(0)
        else:
            print(a%c)
    else:
        if(a%c==0):
            b=b-temp;
            if(b%2==0):
                print(0)
            else:
                print(c)
        else:
            b=b-temp;
            if(b%2==0):
                print(a%c)
            else:
                t1=(a%c)-c
                t2=(a%c)+c
                if(abs(t1)>abs(t2)):
                    print(abs(t2))
                else:
                    print(abs(t1))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
temp=a//c
if(temp>b):
    print(a-(b*c))
else:
    if(temp==b):
        if(a%c==0):
            print(0)
        else:
            print(a%c)
    else:
        if(a%c==0):
            b=b-temp;
            if(b%2==0):
                print(0)
            else:
                print(c)
        else:
            b=b-temp;
            if(b%2==0):
                print(a%c)
            else:
                t1=(a%c)-c
                t2=(a%c)+c
                if(abs(t1)>abs(t2)):
                    print(abs(t2))
                else:
                    print(abs(t1))
Problem p02660 (python)

Fixed submission:
import math
from collections import Counter
A= int(input())
if A == 1:
    print(0)
    exit()
resArray = []
tmpA = A
i = 1
while i <= math.sqrt(A):
    #print (i)
    i += 1
    if tmpA == 1:
        break

    if i >2 and i %2 == 0:
        continue


    while tmpA % i == 0:
        tmpA = tmpA / i
        resArray.append(i)

res = 0
if tmpA == A:
    print(1)
    exit()
elif tmpA > 1:
    res += 1


cArray = Counter(resArray)

for i in cArray.values():
    if i > 0:
        
        tmp = 1
        while tmp*(tmp+1)//2 <= i:
            tmp += 1
        res += tmp -1
print(res)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter
A= int(input())
resArray = []
tmpA = A
i = 1
while i <= math.sqrt(A):
    #print (i)
    i += 1
    if tmpA == 1:
        break

    if i >2 and i %2 == 0:
        continue


    while tmpA % i == 0:
        tmpA = tmpA / i
        resArray.append(i)

res = 0
if tmpA == A:
    print(1)
    exit()
else tmpA > 1:
    res += 1


cArray = Counter(resArray)

for i in cArray.values():
    if i > 0:
        
        tmp = 1
        while tmp*(tmp+1)//2 <= i:
            tmp += 1
        res += tmp -1
print(res)
Problem p02667 (python)

Fixed submission:
import math
import re
T=input()
x=0
Td=T
d = len(re.sub(r'0', '', Td))
x += math.ceil((d/2+1)*d/2)
spT = T.split('0')
lenT = list(map(len, spT))

tmpX = math.ceil(d/2)
bT = 0
aT = d
tmp = ''
for i in range(len(spT) - 1):
    tmp += spT[i]
    bT += lenT[i]
    aT -= lenT[i]
    if bT % 2==1:
        bT += 1
        if aT % 2 ==1:
            tmpX += 1
        x += tmpX
        tmp += '0'
    else:
        tmp +='+'
tmp += spT[-1]

spT = tmp.split('+')
vT =[]
aT = bT
bT = 0

odT = 0
tmpOd = True

for i in range(len(spT)):
    
    od = len(re.sub(r'0', '', spT[i][0 if tmpOd else 1::2]))
    ev = len(re.sub(r'0', '', spT[i][1 if tmpOd else 0::2]))
    odT += od
    vT.append(od - ev)
    if len(spT[i]) %2 == 1:
        tmpOd = not tmpOd

for i in reversed(range(1, len(spT))):
    odT = odT - vT[i]
    x += odT
    vT[i-1] -= vT[i]


print(x)

Buggy submission (verdict: Runtime Error):
import math
import re
T=input()
x=0
Td=T
d = len(re.sub(r'0', '', Td))
x += math.ceil((d/2+1)*d/2)
spT = T.split('0')
lenT = list(map(len, spT))

tmpX = math.ceil(d/2)
bT = 0
aT = d
tmp = ''
for i in range(len(spT) - 1):
    tmp += spT[i]
    bT += lenT[i]
    aT -= lenT[i]
    if bT % 2==1:
        bT += 1
        if aT % 2 ==1:
            tmpX += 1
        x += tmpX
        tmp += '0'
    else:
        tmp +='+'
tmp += spT[-1]

spT = tmp.split('+')
vT =[]
aT = bT
bT = 0
odT = 0
for i in range(len(spT)):
    od = len(re.sub(r'0', '', spT[i][::2]))
    ev = len(re.sub(r'0', '', spT[i][::2]))
    odT += od
    vt.append(od - ev)

while len(vT) >1:
    tmpIdx = len(vT)-1
    tmpL = -sum(vT[i:])
    tmpMax = -1
    for i in range(1, len(vT)):
        if odT + tmpL > tmpMax:
            tmpIdx = i
            tmpMax = odT + tmpL
        tmpL += vt[i]
    odT = tmpMax
    x += odT
    vT[tmpIdx-1] += vT[tmpIdx]

    del vT[tmpIdx]

print(x)

Buggy submission (verdict: Runtime Error):
import math
import re
T=input()
x=0
Td=T
d = len(re.sub(r'0', '', Td))
x += math.ceil((d/2+1)*d/2)
spT = T.split('0')
lenT = list(map(len, spT))

#tmpT = '1'*d
tmpX = math.ceil(d/2)
bT = 0
aT = d
tmp = ''
for i in range(len(spT) - 1):
    tmp += spT[i]
    bT += lenT[i]
    aT -= lenT[i]
    if bT % 2==1:
        bT += 1
        if aT % 2 ==1:
            tmpX += 1
        x += tmpX
        tmp += '0'
    else:
        tmp +='+'
tmp += spT[-1]

spT = tmp.split('+')
vT =[]
aT = bT
bT = 0
odT = 0
ccT = 0
for i in range(len(spT)):
    vT.append([len(re.sub(r'0', '', spT[i][::2])), len(re.sub(r'0', '', spT[i][1::2]))])
    odT += vT[-1][0]
    ccT += vT[-1][1]


while len(vT) >1:
    tmpIdx = len(vT)
    tmpL = 0
    tmpMax = 0
    for i in reversed(range(1, len(vT))):
        tmpL += vT[i][1] - vT[i][0]
        if tmpMax  < odT + tmpL:
            tmpIdx = i
            tmpMax = odT + tmpL

    for i in (range(tmpIdx, len(vT))):
        tmpVT = vT[i][1]
        vT[i][1] = vT[i][0]
        vT[i][0] = tmpVT
    odT = tmpMax
    x +=odT
    vT[tmpIdx-1][0] += vT[tmpIdx][0]
    vT[tmpIdx-1][1] += vT[tmpIdx][1]
    del vT[tmpIdx]

print(x)
Problem p02743 (python)

Fixed submission:
from decimal import *
import math
a, b, c = list(map(int, input().split()))
print('Yes' if c - a - b> 0 and 4*a*b < (c - a - b)**2 else 'No')

Buggy submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split()))
print('Yes' if 2 * Decimal(math.sqrt(a*b)) < c - a - b else 'No')
Problem p02982 (python)

Fixed submission:
import math

n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        if math.sqrt(dis)%1==0:
            cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math

n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        if sqrt(dis)%1==0:
            cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math

n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        if is_integer(sqrt(dis)):
            cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math


#vector的なやつ
#a=[input() for in range(n)]

n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        if is_integer(sqrt(dis)):
            cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math


#vector的なやつ
#a=[input() for in range(n)]

n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        if(sqrt(dis)%1==0):
            cnt+=1
print(cnt)
Problem p03503 (python)

Fixed submission:
import math

n=int(input())
f=list()
p=list()
ans=-10**10
for i in range(n):
    f.append(list(map(int,input().split())))
for i in range(n):
    p.append(list(map(int,input().split())))
for i in range(1,1<<10):
    shop=list()
    cnt=[0]*n
    tmp=0
    for j in range(10):
        if i>>j&1:
            shop.append(j)
    for s in range(n):
        for k in shop:
            if(f[s][k]==1):
                cnt[s]+=1
        tmp+=p[s][cnt[s]]
    ans=max(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n=int(input())
f=list()
p=list()
ans=-10**10
for i in range(n):
    f.append(list(map(int,input().split())))
for i in range(n):
    p.append(list(map(int,input().split())))
for i in range(1,1<<10):
    shop=list()
    cnt=[0]*n
    tmp=0
    for j in range(10):
        if i&(1<<j):
            shop.append(j)
    for s in range(n):
        for p in shop:
            if(f[s][p]==1):
                cnt+=1
        tmp+=p[s][cnt[s]]
    ans=max(ans,tmp)
print(ans)
Problem p02556 (python)

Fixed submission:
import sys
input = sys.stdin.readline
 
t = int(input())
po = []
 
for _ in range(t):
  x,y = list(map(int,input().split()))
  po.append((x,y))
  
po.sort()
 
dp1 = [+(10**99) for _ in range(t)]
 
for i in range(t):
  x,y = po[i][0], po[i][1]
  value = x+y
  dp1[i] = min(dp1[i-1], value)
  
dp2 = [+(10**99) for _ in range(t)]
 
for i in range(t):
  x,y = po[i][0], po[i][1]
  value = x-y
  dp2[i] = min(dp2[i-1], value)
  
best = -9999999999999999999999999999
#print(dp)
 
for i in range(1,t):
  dist = po[i][0] + po[i][1] - dp1[i-1]
  best = max(best, dist)
  
  dist = po[i][0] - po[i][1] - dp2[i-1]
  best = max(best, dist)
  
print(best)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stding.readline

t = int(input())
po = []

for _ in range(t):
  x,y = list(map(int,input().split()))
  po.append((x,y))
  
po.sort()

dp = [-(10**99) for _ in range(t)]

for i in range(t):
  value = min(x+y, x-y)
  dp[i] = min(dp[i-1], value)
  
best = -9999999999999999999999999999

for i in range(1,t):
  dist = po[i][0] + po[i][1] - dp[i-1]
  best = max(best, dist)
  
print(best)
Problem p02576 (python)

Fixed submission:
import sys
input = sys.stdin.readline
 
a,b,c = list(map(int,input().split()))
 
if a%b==0:
  print((a//b) * c)
else:
  print(((a//b)+1) * c)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

a,b,c = map(list(int,input().split()))

if a%b==0:
  print((a//b) * c)
else:
  print((a//b) * (c+1))