Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
h = [list(map(int, input().split()))for i in range(M)]
for i in range(M):
    h[i].append(i)
h = sorted(h,key=lambda h:(h[0],h[1]))
k = 0
p = h[0][0]
for i in range(M):
    if h[i][0] == p:
        h[i].append(str(p).zfill(6)+str(k+1).zfill(6))
        k+=1
    else:
        p = h[i][0]
        k = 0
        h[i].append(str(p).zfill(6) + str(k + 1).zfill(6))
        break
h = sorted(h,key=lambda h:h[2])
# print(h)
for i in range(M):
    print(h[i][3])

Fixed submission:
N,M = map(int,input().split())
h = [list(map(int, input().split()))for i in range(M)]
for i in range(M):
    h[i].append(i)
h = sorted(h,key=lambda h:(h[0],h[1]))
k = 0
p = h[0][0]
for i in range(M):
    if h[i][0] == p:
        h[i].append(str(p).zfill(6)+str(k+1).zfill(6))
        k+=1
    else:
        p = h[i][0]
        k = 0
        h[i].append(str(p).zfill(6) + str(k + 1).zfill(6))
        k += 1
# print(h)
h = sorted(h,key=lambda h:h[2])
# print(h)
for i in range(M):
    print(h[i][3])

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
h = [list(map(int, input().split()))for i in range(M)]
for i in range(M):
    h[i].append(i)
h = sorted(h,key=lambda h:(h[0],h[1]))
k = 0
p = h[0][0]
for i in range(M):
    if h[i][0] == p:
        h[i].append(str(p).zfill(6)+str(k+1).zfill(6))
        k+=1
    else:
        p += 1
        k = 0
        h[i].append(str(p).zfill(6) + str(k + 1).zfill(6))
        break
h = sorted(h,key=lambda h:h[2])
# print(h)
for i in range(M):
    print(h[i][3])

Fixed submission:
N,M = map(int,input().split())
h = [list(map(int, input().split()))for i in range(M)]
for i in range(M):
    h[i].append(i)
h = sorted(h,key=lambda h:(h[0],h[1]))
k = 0
p = h[0][0]
for i in range(M):
    if h[i][0] == p:
        h[i].append(str(p).zfill(6)+str(k+1).zfill(6))
        k+=1
    else:
        p = h[i][0]
        k = 0
        h[i].append(str(p).zfill(6) + str(k + 1).zfill(6))
        k += 1
# print(h)
h = sorted(h,key=lambda h:h[2])
# print(h)
for i in range(M):
    print(h[i][3])
Buggy python submission (verdict: Runtime Error):
def solve(V):
    n = len(V)
    ac = Counter(V[::2]).most_common(2)
    bc = Counter(V[1::2]).most_common(2)
    print(ac,bc)
    if ac[0][0] != bc[0][0]:
        return n - ac[0][1] - bc[0][1]
    else:
        if len(bc) == 1 or len(ac) == 1:
            return n // 2
        else:
            return n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1])


if __name__ == "__main__":
    n = int(input())
    l = input()
    print(l)
    print(solve(l.split(" ")))

Fixed submission:
from collections import Counter


def solve(V):
    n = len(V)
    ac = Counter(V[::2]).most_common(2)
    bc = Counter(V[1::2]).most_common(2)
   
    if ac[0][0] != bc[0][0]:
        return n - ac[0][1] - bc[0][1]
    else:
        if len(bc) == 1 or len(ac) == 1:
            return n // 2
        else:
            return n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1])


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

    print(solve(l.split(" ")))
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(pow(n / 3, 3))

Fixed submission:
n, m = input().split()
n = int(n)
m = int(m)
ans = (n * (n - 1) / 2) + (m * (m - 1) / 2)
print(round(ans))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations_with_replacement

n, m, q = map(int,input().split())
l = []
s = []
for _ in range(q):
    a, b, c, d = map(int,input().split())
    l.append([a, b, c, d])

ps = list(combinations_with_replacement(range(2, m+1), n-1))
n_p = len(ps)

for i in range(n_p):
    ns = [1] + list(ps[i])
    ss = 0
    for j in range(q):
        k = l[j]
        if ns[k[1]-1] - ns[k[0]-1] == k[2]:
            ss += k[3]
    s.append(ss)

print(max(s))


Fixed submission:
from itertools import combinations_with_replacement

n, m, q = map(int,input().split())
l = []
s = []
for _ in range(q):
    a, b, c, d = map(int,input().split())
    l.append([a, b, c, d])

ps = list(combinations_with_replacement(range(1, m+1), n-1))
n_p = len(ps)

for i in range(n_p):
    ns = [1] + list(ps[i])
    ss = 0
    for j in range(q):
        k = l[j]
        if ns[k[1]-1] - ns[k[0]-1] == k[2]:
            ss += k[3]
    s.append(ss)

print(max(s))
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
li = list(map(int, input().split()))

res = n - li.sum()
if res >= 0:
	print(res)
else:
    print(-1)

Fixed submission:
n, m = map(int,input().split())
li = list(map(int, input().split()))
 
res = n - sum(li)
if res >= 0:
	print(res)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
ans = "APPROVED"
for i in s:
  if i%5 != 0 and i%3 != 0:
    ans = "DENIED"
    pass
print(ans)


Fixed submission:
s = [int(x) for x in list(input().split())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)

Buggy python submission (verdict: Runtime Error):
s = [x for x in list(input())]
ans = "No"
for i in range(3):
  tmp = [int(x)/int(s[i]) == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)


Fixed submission:
s = [int(x) for x in list(input().split())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)

Buggy python submission (verdict: Runtime Error):
s = [x for x in list(input())]
ans = "No"
for i in range(3):
  tmp = [int(x)/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)


Fixed submission:
s = [int(x) for x in list(input().split())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)

Buggy python submission (verdict: Runtime Error):
s = [int(x) for x in list(input())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)

Fixed submission:
s = [int(x) for x in list(input().split())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(x) for x in list(input().split()) if x%2 == 0]
ans = "APPROVED"
for i in s:
  if not i%5 != 0 && i%3 != 0:
    ans = "DENIED"
    pass
print(ans)


Fixed submission:
n = int(input())
s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
ans = "APPROVED"
for i in s:
  if i%5 != 0 and i%3 != 0:
    ans = "DENIED"
    pass
print(ans)
Buggy python submission (verdict: Runtime Error):
if {input().split()} == {"1", "9", "7", "4"}:
  print("YES")
else:
  print("NO")

Fixed submission:
if set(input().split()) == {"1", "9", "7", "4"}:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import math
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
n = ii()
a = li()
b = [0]*n
for i in range(n):
    b[i] = a.count(i+1)
for i in range(n):
    print(b[i])

Fixed submission:
import math
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
n = ii()
a = li()
b = [0]*(n+10)
for i in range(n-1):
    b[a[i]-1]+=1
for i in range(n):
    print(b[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    print(A.count(i+1))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
for i in range(N):
    print(counter[i+1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort()
for i in range(N):
    print(A.count(i+1))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
for i in range(N):
    print(counter[i+1])
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

def lcm(a, b):
  return a*b/gcd(a, b)

N = int(input())
T = list(int(input()) for i in range(N))
T = list(set(T))
T.sort()
a = lcm(T[0], T[1])
for i in T[2:]:
    a = lcm(a, i)
print(int(a))

Fixed submission:
N = list(map(int, (input())))
if N == N[::-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
diff = []
for i in range(N-1):
    diff.append(abs(sum(a[:i+1]) - sum(a[i+1:])))
print(min(diff))


Fixed submission:
A, B = map(int, input().split())
if(A%3==0):
    print("Possible")
elif(B%3==0):
    print("Possible")
elif((A+B)%3==0):
    print("Possible")
else:
    print("Impossible")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
diff = []
total = sum(a)
for i in range(N-1):
    diff.append(abs((sum(a[:i+1]) * 2) - total))
print(min(diff))


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
sunuke = []
diff = []
total = sum(a)
for i, x in enumerate(a[0:-1]):
    if(i==0):
        sunuke.append(x)
    else:
        sunuke.append(x + sunuke[i-1])
for i in sunuke:
    diff.append(abs((i * 2) - total))
print(min(diff))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
diff = []
for i in range(N-1):
    diff.append(abs(sum(a[:i+1]) - sum(a[i+1:])))
print(min(diff))


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
sunuke = []
diff = []
total = sum(a)
for i, x in enumerate(a[0:-1]):
    if(i==0):
        sunuke.append(x)
    else:
        sunuke.append(x + sunuke[i-1])
for i in sunuke:
    diff.append(abs((i * 2) - total))
print(min(diff))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
diff = []
for i in range(N-1):
    diff.append(abs(sum(a[:i+1]) - sum(a[i+1:])))
print(min(diff))


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
sunuke = []
diff = []
total = sum(a)
for i, x in enumerate(a[0:-1]):
    if(i==0):
        sunuke.append(x)
    else:
        sunuke.append(x + sunuke[i-1])
for i in sunuke:
    diff.append(abs((i * 2) - total))
print(min(diff))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list()
for i in range(n):
    if(i==0):
        b.append(a[i])
    elif(i%2==1):
        b.append(a[i])
    else:
        b.insert(0,a[i])
if(i%2==1):
    b.reverse()
for i in b:
    print(i,end=' ')


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list()
c = list()
for i in range(n):
    if(i==0):
        b.append(a[i])
    elif(i%2==1):
        b.append(a[i])
    else:
        c.append(a[i])
c.reverse()
c = c + b
if(i%2==1):
    c.reverse()
for i in c:
    print(i,end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list()
for i in range(n):
    if(i==0):
        b.append(a[i])
    elif(i%2==1):
        b.append(a[i])
    else:
        b.insert(0,a[i])
if(i%2==1):
    b.reverse()
for i in b:
    print(i,end=' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list()
c = list()
for i in range(n):
    if(i==0):
        b.append(a[i])
    elif(i%2==1):
        b.append(a[i])
    else:
        c.append(a[i])
c.reverse()
c = c + b
if(i%2==1):
    c.reverse()
for i in c:
    print(i,end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
b=list()
for i in range(n):
    b.append(a[i])
    b.reverse()
for i in b:
    print(i,end=' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list()
c = list()
for i in range(n):
    if(i==0):
        b.append(a[i])
    elif(i%2==1):
        b.append(a[i])
    else:
        c.append(a[i])
c.reverse()
c = c + b
if(i%2==1):
    c.reverse()
for i in c:
    print(i,end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(2 ** 30)

def fact(n):
    if n == 0: return 1
    return n * fact(n-1)


N, M=map(int,input().split())
if(abs(N%1000000007-M%1000000007)>1):
    i=0
else:
    i=fact(M%1000000007)*fact(N%1000000007)
if(N==M):
    i=i*2
ans=i%1000000007
print(ans)

Fixed submission:
import sys
import math

N, M=map(int,input().split())
if(abs(N%1000000007-M%1000000007)>1):
    i=0
else:
    i=math.factorial(M%1000000007)*math.factorial(N%1000000007)
if(N==M):
    i=i*2
ans=i%1000000007
print(ans)

Buggy python submission (verdict: Runtime Error):
def fact(n):
    if n == 0: return 1
    return n * fact(n-1)

import sys
sys.setrecursionlimit(1000)
N, M=map(int,input().split())
if(abs(N%1000000007-M%1000000007)>1):
    i=0
else:
    i=fact(M%1000000007)*fact(N%1000000007)
if(N==M):
    i=i*2
ans=i%1000000007
print(ans)

Fixed submission:
import sys
import math

N, M=map(int,input().split())
if(abs(N%1000000007-M%1000000007)>1):
    i=0
else:
    i=math.factorial(M%1000000007)*math.factorial(N%1000000007)
if(N==M):
    i=i*2
ans=i%1000000007
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
god = 0
for i in range(N-1):
    if a[i] < 400:
        gray = True
    elif a[i] < 800:
        brown = True
    elif a[i] < 1200:
        green = True
    elif a[i] < 1600:
        sky = True
    elif a[i] < 2000:
        blue = True
    elif a[i] < 2400:
        yellow = True
    elif a[i] < 2800:
        orange = True
    elif a[i] < 3200:
        red = True
    else:
        god+=1
if god > 0:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + god + 1
    color_min = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + 1
else:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red)
    color_min = color_max
if color_max>8:
    print(color_min, "8")
else:
    print(color_min, color_max)

Fixed submission:
r, g, b = map(str, input().split())
if int(r+g+b, 10)%4==0:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
god = int(0)
for i in range(N-1):
    if a[i] < 400:
        gray = True
    elif a[i] < 800:
        brown = True
    elif a[i] < 1200:
        green = True
    elif a[i] < 1600:
        sky = True
    elif a[i] < 2000:
        blue = True
    elif a[i] < 2400:
        yellow = True
    elif a[i] < 2800:
        orange = True
    elif a[i] < 3200:
        red = True
    else:
        god+=1
if god > 0:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + god
    color_min = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + 1
else:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red)
    color_min = color_max
print(color_max, color_min)

Fixed submission:
r, g, b = map(str, input().split())
if int(r+g+b, 10)%4==0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int,input().split())
tmp = A % k
if(tmp == 0): 
	print('OK')
else:
	if(A + (K-tmp) <= B):
		print('OK')
	else:
		print('NG')

Fixed submission:
K = int(input())
A, B = map(int,input().split())

tmp = A % K
if(tmp == 0): 
	print('OK')
else:
	if(A + (K-tmp) <= B):
		print('OK')
	else:
		print('NG')

Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int,input().split())
tmp = a % k
if(tmp == 0): 
	print('OK')
else:
	if(A + (K-tmp) <= B):
		print('OK')
	else:
		print('NG')

Fixed submission:
K = int(input())
A, B = map(int,input().split())

tmp = A % K
if(tmp == 0): 
	print('OK')
else:
	if(A + (K-tmp) <= B):
		print('OK')
	else:
		print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int,input().split())
bst = -10000000000

for i in range(N+1):
    if((A*i)//B - A*(i//B) > bst):
        bst = (A*i)//B - A*(i//B)

print(bst)

Fixed submission:
A,B,N = map(int, input().split())
p = min(N,B)

if p%B == 0:
    print(int(A*(p-1)//B))
else :
    print(int(A*(p)//B))

Buggy python submission (verdict: Runtime Error):
import math

A, B, N = map(int,input().split())
bst = -pow(10, 10)

for i in range(N+1):
    if((floor((A*i)/B) - A*floor(i/B)) > bst):
        bst = floor((A*i)/B) - A*floor(i/B)

print(bst)

Fixed submission:
A,B,N = map(int, input().split())
p = min(N,B)

if p%B == 0:
    print(int(A*(p-1)//B))
else :
    print(int(A*(p)//B))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int,input().split())
bst = -100000000

for i in range(N+1):
  ans = (A*i)//B - A*(i//B)
  if (ans > bst):
    bst = ans

print(bst)

Fixed submission:
A,B,N = map(int, input().split())
p = min(N,B)

if p%B == 0:
    print(int(A*(p-1)//B))
else :
    print(int(A*(p)//B))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int,input().split())
bst = -100000000

for i in range(N):
  ans = (A*(i+1))//B - A*((i+1)//B)
  if (ans > bst):
    bst = ans
print(bst)

Fixed submission:
A,B,N = map(int, input().split())
p = min(N,B)

if p%B == 0:
    print(int(A*(p-1)//B))
else :
    print(int(A*(p)//B))
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += gcd(i+1, j+1, k+1)
print(ans)

Fixed submission:
import math
from functools import reduce
import itertools


def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
l = list(range(1, K + 1))
ans = K * (K + 1) // 2
for i in itertools.combinations(l, 2):
    ans += 3*(gcd(i[0], i[0], i[1])+gcd(i[0], i[1], i[1]))
for i in itertools.combinations(l, 3):
    ans += 6*gcd(i[0], i[1], i[2])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for _ in range(N):
    S.append(input())

S_set = list(set(S))
S_dic = {}
M = 0
for s in S_set:
    S_dic[s] = S.count(s)
    M = max(M, S.count(s))

S_dic_sorted = sorted(S_dic.items(), key=lambda x: x[0])
for l in S_dic_sorted:
    if l[1] == M:
        print(l[0])

Fixed submission:
import collections

N = int(input())
S = []
for _ in range(N):
    S.append(input())

C = collections.Counter(S).most_common()
M = C[0][1]

ans = []
for c in C:
    if c[1] == M:
        ans.append(c[0])
    else:
        break

ans.sort()
for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
s=input()
if s=="Sunny":
  print("Cloudy")
elif s=="Cloudy":
  print("Rainy")
else:
  print(Sunny)

Fixed submission:
s=input()
if s=="Sunny":
  print("Cloudy")
elif s=="Cloudy":
  print("Rainy")
else:
  print("Sunny")
Buggy python submission (verdict: Runtime Error):
def dist(X1,X2):
  d=X1-X2
  d=[x**2 for x in d]
  d=sum(d)
  return d
 
count=int(0)
N,D=map(int,input().split())
X=list(range(N))
for i in range(N):
  X[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(i+1,N):
    d=dist(X[i],X[j])
    if isinstance(d,int):
      count=count+1
print(count)

Fixed submission:
import math

def dist(X1,X2):
  d=[abs(X1[i]-X2[i]) for i in range(len(X1))]
  d=[x**2 for x in d]
  d=sum(d)
  d=math.sqrt(d)
  return d
 
count=int(0)
N,D=map(int,input().split())
X=list(range(N))
for i in range(N):
  X[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(i+1,N):
    d=dist(X[i],X[j])
    if d.is_integer():
      count=count+1
print(count)

Buggy python submission (verdict: Runtime Error):
def dist(X1,X2):
  d=X1-X2
  d=[x**2 for x in d]
  d=sum(d)
  return d
 
count=int(0)
N,D=map(int,input().split())
X=list(range(N))
for i in range(N):
  X[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(i+1:N):
    d=dist(X[i],X[j])
    if isinstance(d,int):
      count=count+1
print(count)

Fixed submission:
import math

def dist(X1,X2):
  d=[abs(X1[i]-X2[i]) for i in range(len(X1))]
  d=[x**2 for x in d]
  d=sum(d)
  d=math.sqrt(d)
  return d
 
count=int(0)
N,D=map(int,input().split())
X=list(range(N))
for i in range(N):
  X[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(i+1,N):
    d=dist(X[i],X[j])
    if d.is_integer():
      count=count+1
print(count)

Buggy python submission (verdict: Runtime Error):
def dist(X1,X2):
  d=X1-X2
  d=[x**2 for x in d]
  return d=sum(d)

count=int(0)
N,D=map(int,input().split())
X=list(range(N))
for i in range(N):
  X[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(i+1:N):
    d=dist(X[i],X[j])
    if isinstance(d,int):
      count=count+1
print(count)

Fixed submission:
import math

def dist(X1,X2):
  d=[abs(X1[i]-X2[i]) for i in range(len(X1))]
  d=[x**2 for x in d]
  d=sum(d)
  d=math.sqrt(d)
  return d
 
count=int(0)
N,D=map(int,input().split())
X=list(range(N))
for i in range(N):
  X[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(i+1,N):
    d=dist(X[i],X[j])
    if d.is_integer():
      count=count+1
print(count)
Buggy python submission (verdict: Runtime Error):
S=list(input())
S=[if s=="1" s="9" else s="1" for s in S]
print(S)

Fixed submission:
S=input()
ans=""
for s in S:
  if s=="1":ans+="9"
  else:ans+="1"
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
print("Yay!" if A<=8 and B<=8 ":(")

Fixed submission:
A,B=map(int,input().split())
print("Yay!" if A<=8 and B<=8 else ":(")
Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l))))

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l))))

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))

Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=list(set(N))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range len(l))))

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))