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

Fixed submission:
A,B = map(int,input().split())
if A == B:
    print(0)
else:
    if (A+B) % 2 == 0:
        print((A+B)//2)
    else:
        print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
S = input()
dp = [[0]*13 for _ in range(len(S))]
mod = 10**9+7
for i in range(13):
    if S[0] == "?":
        dp[0][i] = 1 if i <= 9 else 0
    else:
        dp[0][i] = 1 if int(S[0]) == i else 0
for i in range(1,len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(k*10+j) % 13] = (dp[i][(k*10+j) % 13]+dp[i-1][k])%mod
    else:
        j = int(S[i])
        for k in range(13):
            dp[i][(k*10+j)%13] = (dp[i][(k*10+j)%13]+dp[i-1][k])%mod
print(dp[len(S)-1][5])
Problem p02960 (python)

Fixed submission:
S = input()
dp = [[0]*13 for _ in range(len(S))]
mod = 10**9+7
for i in range(13):
    if S[0] == "?":
        dp[0][i] = 1 if i <= 9 else 0
    else:
        dp[0][i] = 1 if int(S[0]) == i else 0
for i in range(1,len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(k*10+j) % 13] = (dp[i][(k*10+j) % 13]+dp[i-1][k])%mod
    else:
        j = int(S[i])
        for k in range(13):
            dp[i][(k*10+j)%13] = (dp[i][(k*10+j)%13]+dp[i-1][k])%mod
print(dp[len(S)-1][5])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

ls = [0,4,8,12,3,7,11,2,6,10,1,5,9]
S = input()
dp = [[None]*13 for _ in range(len(S))]
mod = 10**9+7
def f(i, r):
    if dp[i][r] != None:
        return dp[i][r]
    if i == 0:
        if S[0] == "?":
            dp[i][r] = 1 if r <= 9 else 0
            return dp[i][r]
        else:
            dp[i][r] = 1 if int(S[0]) == r else 0
            return dp[i][r]
    if S[i] != "?":
        c = int(S[i])
        tmp = (r-c) % 13
        dp[i][r] = f(i-1, ls[tmp]) % mod 
        return dp[i][r]
    else:
        ans = 0
        for j in range(10):
            tmp = (r-j) % 13
            ans = (ans +f(i-1, ls[tmp])) % mod
        dp[i][r] = ans % mod
        return dp[i][r]

print(f(len(S)-1, 5))
Problem p02972 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
b = [None for _ in range(N)]
for i in range(N):
    j = N-i
    if j > N//2:
        b[j-1] = a[j-1]
    else:
        s = 0
        for k in range(2*j-1, N, j):
            s = (s+b[k])%2
        b[j-1] = (a[j-1]-s) % 2
ans = []
for i in range(N):
    if b[i] == 1:
        ans.append(i+1)
if ans == []:
    print(0)
else:
    print(len(ans))
    print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
import bisect as bs
N = int(input())
A = [int(input()) for _ in range(N)]
def LDS(a):
    N = len(a)
    INF = float("inf")
    dp = [-INF]*N
    dp[N-1] = a[0]
    for i in range(1, N):
        j = bs.bisect_left(dp, a[i])-1
        dp[j] = a[i]
    for i in range(N-1, -1, -1):
        if dp[i] == -INF:
            return N-i-1
    return N
print(LDS(A))

Buggy submission (verdict: Runtime Error):
import bisect as bs
N = int(input())
A = [int(input()) for _ in range(N)]
def LDS(a):
    N = len(a)
    INF = float("inf")
    dp = [-INF]*N
    dp[N-1] = a[0]
    for i in range(1, N):
        j = bs.bisect_left(dp, a[i])-1
        print(j)
        dp[j] = a[i]
    for i in range(N-1, -1, -1):
        if dp[i] == -INF:
            return N-i-1
    return N
print(LDS(A))
Problem p02997 (python)

Fixed submission:
N, K = map(int,input().split())
edges = []

if K > (N-1)*(N-2)//2:
    print(-1)
else:
    edges.append((1,2))
    for i in range(3, N+1):
        edges.append((2, i))
    sa = (N-1)*(N-2)//2 - K
    for i in range(min(sa, N-2)):
        sa -= 1
        edges.append((1, i+3))
    if sa != 0:
        i = 3
        j = 4
        while sa > 0:
            while j <= N and sa > 0:
                edges.append((i, j))
                j += 1
                sa -= 1
            i += 1
            j = i + 1
        print(len(edges))
        for i in range(len(edges)):
            print(edges[i][0], edges[i][1])
    else:
        print(len(edges))
        for i in range(len(edges)):
            print(edges[i][0], edges[i][1])

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
edges = []

if K > (N-1)*(N-2)//2:
    print(-1)
else:
    edges.append((1,2))
    for i in range(3, N+1):
        edges.append((2, i))
    sa = (N-1)*(N-2)//2 - K
    for i in range(min(sa, N-2)):
        sa -= 1
        edges.append((1, i+3))
    if sa != 0:
        i = 3
        j = 4
        while sa > 0:
            while j < N and sa > 0:
                edges.append((i, j))
                j += 1
                sa -= 1
            i += 1
            j = i + 1
        print(len(M))
        for i in range(len(edges)):
            print(edges[i][0], edges[i][1])
    else:
        print(len(M))
        for i in range(len(edges)):
            print(edges[i][0], edges[i][1])
Problem p03032 (python)

Fixed submission:
N,K= map(int,input().split())
D = list(map(int,input().split()))
from itertools import accumulate
acc = [0]+list(accumulate(D, lambda x,y:x+y))
mx = 0
for k in range(min(K+1, N+1)): # k 回とる
    rest = K-k # rest回まで捨てることができる
    for l in range(min(k+1, N+1)): # 左から何個とるか
        r = k-l
        left = acc[l]
        right = acc[N]-acc[N-r]
        tmp = left+right
        tmpl = D[:l]
        tmpr = D[N-r:N]
        minus = sorted([i for i in tmpl+tmpr if i < 0])
        tmp -= sum(minus[:rest])
        mx = max(mx, tmp)
if K > N:
    tmp = acc[-1]
    rest = K - N
    minus = sorted([i for i in D if i < 0])
    tmp -= sum(minus[:rest])
    mx = max(mx, tmp)
print(mx)

Buggy submission (verdict: Runtime Error):
N,K= map(int,input().split())
D = list(map(int,input().split()))
from itertools import accumulate
acc = [0]+list(accumulate(D, lambda x,y:x+y))
mx = 0
for k in range(K+1): # k 回とる
    rest = K-k # rest回まで捨てることができる
    for l in range(1, min(k+1, N)): # 左から何個とるか
        r = k-l
        left = acc[l]
        right = acc[N]-acc[N-r]
        tmp = left+right
        tmpl = D[:l]
        tmpr = D[N-r:N]
        minus = sorted([i for i in tmpl+tmpr if i < 0])
        tmp -= sum(minus[:rest])
        mx = max(mx, tmp)
print(mx)

Buggy submission (verdict: Runtime Error):
N,K= map(int,input().split())
D = list(map(int,input().split()))
from itertools import accumulate
acc = [0]+list(accumulate(D, lambda x,y:x+y))
mx = 0
for k in range(K+1): # k 回とる
    rest = K-k # rest回まで捨てることができる
    for l in range(1, k+1): # 左から何個とるか
        r = k-l
        left = acc[l]
        right = acc[N]-acc[N-r]
        tmp = left+right
        tmpl = D[:l]
        tmpr = D[N-r:N]
        minus = sorted([i for i in tmpl+tmpr if i < 0])
        tmp -= sum(minus[:rest])
        mx = max(mx, tmp)
print(mx)
Problem p03047 (python)

Fixed submission:
print((lambda x,y:x-y+1)(*map(int,input().split())))

Buggy submission (verdict: Runtime Error):
N = int(input())
headB=0
tailA=0 
both = 0
ans = 0
for j in range(N):
    t = input()
    if t[0] == "B":
        if t[-1] == "A":
            both += 1
        else:
            headB += 1
    elif t[-1] == "A":
        tailA += 1
    ans += t.count("AB")
if tailA > 0 or headB > 0:
    while both > 0:
        tmp = min(tailA+headB,both)
        ans += tmp
        both -= tmp
else:
    ans += both-1
ans += min(headB,tailA)
print(ans)
Problem p03101 (python)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
print(H*W-h*W-w*H+h*w)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
h,w = map(int,input().split())
print(H*W-h*W-wH+h*w)
Problem p03219 (python)

Fixed submission:
x,y = map(int,input().split())
print(x+y//2)

Buggy submission (verdict: Runtime Error):
print(int(input()) + int(input())//2)

Buggy submission (verdict: Runtime Error):
print(int(input())+int(input())//2)
Problem p03220 (python)

Fixed submission:
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))
sa = [abs(T-0.006*H[i] - A) for i in range(N)]
print(sa.index(min(sa))+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))
sa = [abs(T-0.006*H[i] - A) for i in range(N)]
print(sa.index(min(sa))+1)N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))
sa = [abs(T-0.006*H[i] - A) for i in range(N)]
print(sa.index(min(sa))+1)
Problem p03231 (python)

Fixed submission:
def gcd(x,y):
    a = max(x,y)
    b = min(x,y)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b
N,M=map(int,input().split())
S = input()
T = input()
g = gcd(M,N)
n = N//g
m = M//g
l = N*M // g
f = True
for i in range(g):
    a = n*i
    b = m*i
    if S[a] != T[b]:
        f = False
print(l if f else -1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
S = input()
T = input()
g = np.gcd(M,N)
n = N//g
m = M//g
l = N*M // g
f = True
for i in range(g):
    a = n*i
    b = m*i
    if S[a] != T[b]:
        f = False
print(l if f else -1)

Buggy submission (verdict: Runtime Error):
import math
N,M=map(int,input().split())
S = input()
T = input()
g = math.gcd(N,M)
n = N//g
m = M//g
l = N*M // g
f = True
for i in range(g):
    a = n*i
    b = m*i
    if S[a] != T[b]:
        f = False
print(l if f else -1)
Problem p03244 (python)

Fixed submission:
import collections as c
N = int(input())
a = list(map(int,input().split()))
ue = a[0::2]
sita = a[1::2]
dictue = c.defaultdict(int)
dictsita = c.defaultdict(int)
for i in ue:
    dictue[i] += 1
for i in sita:
    dictsita[i] += 1
ue = list(dictue.items())
ue.sort(key=lambda x:x[1])
sita = list(dictsita.items())
sita.sort(key=lambda x:x[1])
m = ue[len(ue)-1]
n = sita[len(sita)-1]
if m[0] == n[0]:
    if len(ue) == 1:
        if len(sita) == 1:
            print(N//2)
        else:
            print(N-m[1]-sita[len(sita)-2][1])
    else:
        if len(sita) == 1:
            print(N-n[1]-ue[len(ue)-2][1])
        else:
            print(min(N-n[1]-ue[len(ue)-2][1],N-m[1]-sita[len(sita)-2][1]))
else:
    print(N-m[1]-n[1])

Buggy submission (verdict: Runtime Error):
import collections as c
N = int(input())
a = list(map(int,input().split()))
ue = a[0::2]
sita = a[1::2]
dictue = c.defaultdict(int)
dictsita = c.defaultdict(int)
for i in ue:
    dictue[i] += 1
for i in sita:
    dictsita[i] += 1
ue = list(dictue.items())
ue.sort(key=lambda x:x[1])
sita = list(dictsita.items())
sita.sort(key=lambda x:x[1])
m = ue[len(ue)-1]
n = sita[len(sita)-1]
if m[0] == n[0]:
    if len(ue) == 1:
        if len(sita) == 1:
            print(N//2)
        else:
            print(N-sita[len(sita)-2][1])
    else:
        if len(sita) == 1:
            print(N-ue[len(ue)-2])
        else:
            print(min(N-ue[len(ue)-2],N-sita[len(sita)-2]))
else:
    print(N-m[1]-n[1])
Problem p03287 (python)

Fixed submission:
import itertools
import collections
N,M = map(int,input().split())
A = list(map(int,input().split()))
B = [0] + list(itertools.accumulate(A))
d = collections.defaultdict(int)
for i in range(N+1):
    d[B[i]%M] += 1
d = list(d.items())
ans = 0
for i in d:
    ans += i[1]*(i[1]-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
class Node:
    def __init__(self,mod):
        self.mod = mod
        self.samemod = 1
        self.right = None
        self.left = None
def sumx(node,s):
    if node.left != None:
        s = sumx(node.left,s)
    s += node.samemod*(node.samemod-1)//2
    if node.right != None:
        s = sumx(node.right,s)
    return s
def add(node,x):
    if node == None:
        return Node(x)
    elif node.mod == x:
        node.samemod += 1
    elif node.mod > x:
        node.left = add(node.left,x)
    else:
        node.right = add(node.right,x)
    return node

n,m = map(int,input().split())
A = list(map(int,input().split()))
B = [0]
tmp = 0
root = None
root = add(root,0)
for i in range(n):
    tmp = B[i]+A[i]
    B.append(tmp)
    root = add(root,tmp%m)
ans = sumx(root,0)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = [0]
x = [0]*m
tmp = 0
for i in range(n):
    tmp = B[i]+A[i]
    B.append(tmp)
    x[tmp%m] += 1
print(sum(x))
Problem p03294 (python)

Fixed submission:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def lcm(x, y):
    return (x * y) // gcd(x, y)
n = int(input())
a = list(map(int,input().split()))
x = 1
for i in range(n-1):
    x *= lcm(a[i],a[i+1])
Sum = 0
for i in range(n):
    Sum += (x-1)%a[i]
print(Sum)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
n = int(input())
a = list(map(int,input().split()))
x = 1
for i in range(n-1):
    x *= lcm(a[i],a[i+1])
Sum = 0
for i in range(n):
    Sum += (x-1)%a[i]
print(Sum)
Problem p03297 (python)

Fixed submission:
def gcd(x,y):
    if x < y:
        tmp = y
        y = x
        x = tmp

    while x % y != 0:
        r = x % y
        x = y
        y = r
    return y

n = int(input())
x = []
for i in range(n):
    a,b,c,d = map(int,input().split())
    x.append((a,b,c,d))

def f(a,b,c,d):
    if a < b:
        print("No")
    elif b > d:
        print("No")
    elif c >= b:
        print("Yes")
    else:
        g = gcd(b,d)
        if b-g+(a%g) > c:
            print("No")
        else:
            print("Yes")

for i in range(n):
    a,b,c,d = x[i][0],x[i][1],x[i][2],x[i][3]
    f(a,b,c,d)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
x = []
for i in range(n):
    a,b,c,d = map(int,input().split())
    x.append((a,b,c,d))

def f(a,b,c,d):
    if a < b:
        print("No")
    elif b > d:
        print("No")
    elif c >= b:
        print("Yes")
    else:
        g = math.gcd(b,d)
        if b-g+(a%g) > c:
            print("No")
        else:
            print("Yes")

for i in range(n):
    a,b,c,d = x[i][0],x[i][1],x[i][2],x[i][3]
    f(a,b,c,d)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
for i in range(n):
    a,b,c,d = map(int,input().split())
    if a < b:
        print("No")
    elif b > d:
        print("No")
    elif c >= b:
        print("Yes")
    else:
        g = math.gcd(b,d)
        if b-g+(a%g) > c:
            print("No")
        else:
            print("Yes")
Problem p03337 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max(a+b.a-b,a*b))
Problem p03361 (python)

Fixed submission:
l = input().split()
h,w = int(l[0]),int(l[1])
mapxy = []
for i in range(h):
    mapxy.append(list(input()))
dx = [1,0,-1,0]
dy = [0,1,0,-1]
flag1 = 0
flag2 = 0
for i in range(h):
    for j in range(w):
        if mapxy[i][j] == "#":
            for k in range(4):
                if 0<=i+dy[k]<h and 0<=j+dx[k]<w:
                    if mapxy[i+dy[k]][j+dx[k]] == "#":
                        flag1 = 1
            if flag1 == 0:
                flag2 = 1
                break
            flag1 = 0
    if flag2 == 1:
        print("No")
        break
if flag2 != 1:
    print("Yes")

Buggy submission (verdict: Runtime Error):
l = input().split()
h,w = int(l[0]),int(l[1])
mapxy = []
for i in range(h):
    mapxy.append(list(input()))
dx = [1,0,-1,0]
dy = [0,1,0,-1]
flag1 = 0
flag2 = 0
for i in range(h):
    for j in range(w):
        if mapxy[i][j] == "#":
            for k in range(4):
                if 0<=i+dx[k]<w and 0<=j+dy[k]<h:
                    if mapxy[i+dx[k]][j+dy[k]] == "#":
                        flag1 = 1
            if flag1 == 0:
                flag2 = 1
                break
            flag1 = 0
    if flag2 == 1:
        print("No")
        break
if flag2 != 1:
    print("Yes")

Buggy submission (verdict: Runtime Error):
l = input().split()
h,w = int(l[0]),int(l[1])
maze = []
for i in range(h):
    maze.append(list(input()))
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(h):
    for j in range(w):
        if maze[i][j] == "#" or maze[i][j] == 1:
            for k in range(4):
                if 0<=i+dx[k]<w and 0<=j+dy[k]<h:
                    if maze[i+dx[k]][j+dy[k]]=="#" or maze[i+dx[k]][j+dy[k]]==1:
                        maze[i+dx[k]][j+dy[k]]=1
flag = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == "#":
            print("No")
            flag = 1
            break
if flag != 1:
    print("Yes")
Problem p03645 (python)

Fixed submission:
n,m = map(int,input().split())
ahoge = []
hanege = []
for i in range(m):
    ai,bi = map(int,input().split())
    if ai == 1:
        ahoge.append(bi)
    if bi == n:
        hanege.append(ai)
ahoge.sort()
hanege.sort()
def bis(i):
    under = 0
    upper = len(hanege)-1
    while under <= upper:
        l = (under+upper)//2
        if i == hanege[l]:
            return 1
        elif i < hanege[l]:
            upper = l-1
        elif i > hanege[l]:
            under = l+1
    return 0
flag = 0
for i in ahoge:
    if bis(i) == 1:
        print("POSSIBLE")
        flag = 1
        break
if flag == 0:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ahoge = []
hanege = []
for i in range(m):
    ai,bi = map(int,input().split())
    if ai == 1:
        ahoge.append(bi)
    if bi == n:
        hanege.append(ai)
ahoge.sort()
hanege.sort()
def bis(i):
    under = 0
    upper = len(hanege)
    l = (under+upper)//2
    while under <= upper:
        if i == hanege[l]:
            return 1
        elif i < hanege[l]:
            upper = l-1
        elif i > hanege[l]:
            under = l+1
    return 0
flag = 0
for i in ahoge:
    if bis(i) == 1:
        print("POSSIBLE")
        flag = 1
        break
if flag == 0:
    print("IMPOSSIBLE")
Problem p03814 (python)

Fixed submission:
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
        break
for i in range(len(s)-1,0,-1):
    if s[i]=="Z":
        z=i
        break
print(z-a+1)

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
for i in range(a+1,len(s)):
    if s[i]=="Z":
        z=i
print(z-a+1)
Problem p03854 (python)

Fixed submission:
s = input()[::-1]
flag = 1
i = 0
while i < len(s):
    if s[i:i+5] == "maerd" or s[i:i+5] == "esare":
        i += 5
    elif s[i:i+6] == "resare":
        i += 6
    elif s[i:i+7] == "remaerd":
        i += 7
    else:
        flag = 0
        break

print("YES" if flag else "NO")

Buggy submission (verdict: Runtime Error):
s = input()[::-1]

def solve(s):
    if s in ["maerd","remaerd","esare","resare"]:
        return True
    elif len(s) <= 7:
        return False
    if s[0:5] in ["maerd","esare"]:
        return solve(s[5:])
    if s[0:6] == "resare":
        return solve(s[6:])
    if s[0:7] == "remaerd":
        return solve(s[7:])
    return False
print("YES" if solve(s) else "NO")

Buggy submission (verdict: Runtime Error):
def solve(S):
    if S in ["dream","dreamer","erase","eraser"]:
        return True
    elif len(S) <= 7:
        return False

    if S[0:7] == "dreamer":
        return solve(S[7:]) or solve(S[5:])
    elif S[0:5] == "dream":
        return solve(S[5:])
    if S[0:6] == "eraser":
        return solve(S[6:])
    elif S[0:5] == "erase":
        return solve(S[5:])

    return False

print("YES" if solve(input()) else "NO")

Buggy submission (verdict: Runtime Error):
def solve(S):
    if S in ["dream","dreamer","erase","eraser"]:
        return True
    elif len(S) <= 7:
        return False

    if S[0:7] == "dreamer":
        return solve(S[7:]) or solve(S[5:])
    elif S[0:5] == "dream":
        return solve(S[5:])
    if S[0:6] == "eraser":
        return solve(S[6:]) or solve(S[5:])
    elif S[0:5] == "erase":
        return solve(S[5:])

    return False

print("YES" if solve(input()) else "NO")

Buggy submission (verdict: Runtime Error):
def solve(S):
    if S == "":
        return True
    
    if S in ["dream","dreamer","erase","eraser"]:
        return True
    elif len(S) <= 6:
        return False

    if S[0:7] == "dreamer":
        return solve(S[7:]) or solve(S[5:])
    elif S[0:5] == "dream":
        return solve(S[5:])
    if S[0:6] == "eraser":
        return solve(S[6:]) or solve(S[5:])
    elif S[0:5] == "erase":
        return solve(S[5:])

    return False

print("YES" if solve(input()) else "NO")

Buggy submission (verdict: Runtime Error):
def solve(S):
    if S in ["dream","dreamer","erase","eraser"]:
        return True
    elif len(S) <= 7:
        return False
    if S[0:7] == "dreamer":
        return solve(S[7:]) or solve(S[5:])
    elif S[0:5] == "dream":
        return solve(S[5:])
    if S[0:6] == "eraser":
        return solve(S[6:]) or solve(S[5:])
    elif S[0:5] == "erase":
        return solve(S[5:])

    return False

print("YES" if solve(input()) else "NO")
Problem p03943 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if 2*max(a,b,c)==a+b+c else "No")

Buggy submission (verdict: Runtime Error):
split())
print("Yes" if 2*max(a,b,c)==a+b+c else "No")
Problem p02934 (python)

Fixed submission:
n = int(input())
y = []

a = input().split()
for i in range(n):
    x = 1/int(a[i])
    y.append(x)
#print(y)

s = sum(y)
an = 1/s

print(an)

Buggy submission (verdict: Runtime Error):
n = int(input())
y = []
for i in n:
    a = int(input())
    x = 1/a
    y.append(x)

s = sum(y)
an = 1/s

print(s)
Problem p02982 (python)

Fixed submission:
import math


    
def deffer(A,B):
    sum = 0
    for i in range(len(A)):
        sum += (A[i]-B[i])**2
    sum = math.sqrt(sum)
    return sum


N,D= map(int,input().split())
listA = [list(map(int,input().split())) for i in range(N)]
ans =0
for i in range(N):
    for j in range(i +1,N):
        D = deffer(listA[i],listA[j])
        
        if D.is_integer():
            ans +=1
            
print(ans)

    
def deffer(A,B):
    sum = 0
    for i in range(len(A)):
        sum += (A[i]-B[i])**2
    sum = math.sqrt(sum)
    print("sum is {}".format(sum))
    return sum

Buggy submission (verdict: Runtime Error):
import math
N,D= map(int,input().split())
listA = [list(map(int,input().split())) for i in range(N)]
ans =0
for i in range(N):
    for j in range(i +1,N):
        D = deffer(listA[i],listA[B])
        if isinstance(D):
            ans +=1
            
print(ans)

    
def deffer(A,B):
    sum = 0
    for i in range(len(A)):
        sum += (A[i]-B[i])**2
    sum = math.sqrt(sum)
    return sum