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

Fixed submission:
import fractions
from functools import reduce
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

n, x = map(int,input().split())
li = list(map(int,input().split()))
d = [abs(x-li[0])]
 
for i in range(n-1):
    d.append(abs(li[i]-li[i+1]))

print(gcd(*d))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

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

n, x = map(int,input().split())
li = list(map(int,input().split()))
d = [abs(x-li[0])]

for i in range(n-1):
    d.append(abs(li[i]-li[i+1]))

print(gcd(*d))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

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

n, x = map(int,input().split())
li = list(map(int,input().split()))
d = [abs(x-li[0])]

for i in range(n-1):
    d.append(abs(li[i]-li[i+1]))

print(gcd(*d))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

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

n, x = map(int,input().split())
li = list(map(int,input().split()))
d = [abs(x-li[0])]

for i in range(n-1):
    d.append(abs(li[i]-li[i+1]))

print(gcd_list(d))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

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

n, x = map(int,input().split())
li = list(map(int,input().split()))
d = [abs(x-li[0])]

for i in range(n-1):
    d.append(abs(li[i]-li[i+1]))

print(gcd_list(d))
Problem p03361 (python)

Fixed submission:
h, w = map(int,input().split())
li = [list(input()) for i in range(h)]

if h == 1 or w == 1:
    print("No")
    exit()

for i in range(h):
    for j in range(w):
        x = 0 #縦OK
        y = 0 #横OK
        if li[i][j] == "#":
            if i == 0:
                if li[i+1][j] == "#":
                    x = 1
            elif i == h-1:
                if li[i-1][j] == "#":
                    x = 1
            else:
                if li[i+1][j] == "#" or li[i-1][j] == "#":
                    x = 1
            if j == 0:
                if li[i][j+1] == "#":
                    y = 1
            elif j == w-1:
                if li[i][j-1] == "#":
                    y = 1
            else:
                if li[i][j+1] == "#" or li[i][j-1] == "#":
                    y = 1 

            if x == 0 and y == 0:
                print("No")
                exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split())
li = [list(input()) for i in range(h)]

if h == 1 or w == 1:
    print("No")
    exit()

for i in range(h):
    for j in range(w):
        x = 0 #縦OK
        y = 0 #横OK
        if li[i][j] == "#":
            if i == 0:
                if li[i+1][j] == "#":
                    x = 1
            elif i == w-1:
                if li[i-1][j] == "#":
                    x = 1
            else:
                if li[i+1][j] == "#" or li[i-1][j] == "#":
                    x = 1
            if j == 0:
                if li[i][j+1] == "#":
                    y = 1
            elif j == h-1:
                if li[i][j-1] == "#":
                    y = 1
            else:
                if li[i][j+1] == "#" or li[i][j-1] == "#":
                    y = 1 

            if x == 0 and y == 0:
                print("No")
                exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
h, w = map(int,input().split())
li = [list(input()) for i in range(h)]

for i in range(h):
    for j in range(w):
        x = 0 #縦OK
        y = 0 #横OK
        if li[i][j] == "#":
            if i == 0:
                if li[i+1][j] == "#":
                    x = 1
            elif i == w-1:
                if li[i-1][j] == "#":
                    x = 1
            else:
                if li[i+1][j] == "#" or li[i-1][j] == "#":
                    x = 1
            if j == 0:
                if li[i][j+1] == "#":
                    y = 1
            elif j == h-1:
                if li[i][j-1] == "#":
                    y = 1
            else:
                if li[i][j+1] == "#" or li[i][j-1] == "#":
                    y = 1 

            if x == 0 and y == 0:
                print("No")
                exit()

print("Yes")
Problem p03379 (python)

Fixed submission:
import statistics

n = int(input())
li = list(map(int,input().split()))
median_low = statistics.median_low(li)
median_high = statistics.median_high(li)

for i in li:
    if i <= median_low:
        print(median_high)
    else:
        print(median_low)

Buggy submission (verdict: Runtime Error):
import statistics

n = int(input())
li = list(map(int,input().split()))
median_low = statistics.median_low(li)
median_high = statistics.median_high(li)

for i in li:
    if i <= median_low:
        print(median_high)
    else:
        print(median_low)
Problem p03469 (python)

Fixed submission:
print(input().replace('2017', '2018'))

Buggy submission (verdict: Runtime Error):
s = input()
s[3] = "8"
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
s[3] = 8
print(s)
Problem p03502 (python)

Fixed submission:
s = int(input())
x = 0
 
for i in str(s):
  x += int(i)
 
if s%x == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = int(input())
x = 0

for i in s:
  x += int(i)

if s%x == 0:
  print("Yes")
else:
  print("No")
Problem p03544 (python)

Fixed submission:
n = int(input())
x = 2
y = 1

if n == 1:
    ans = 1

for i in range(n-1):
    ans = x + y
    x = y
    y = ans

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = 2
y = 1

for i in range(n-1):
    ans = x + y
    x = y
    y = ans

print(ans)
Problem p03545 (python)

Fixed submission:
import copy
import numpy as np

s = input()
n = 3
ans = 0

for i in range(1,3 ** n):
    x = copy.deepcopy(s)
    y = str(np.base_repr(i,3)).rjust(3,'0') #3進数に変換
    if (y[0] == "0" and s[0] == "0") or (y[1] == "0" and s[1] == "0") or (y[2] == "0" and s[2] == "0"):
        continue
    z = 1
    for j in range(3):
        if y[j] == "1": #フラグが立っていたら
            x = x[:j+z] + "+" + x[j+z:]
            z += 1
        if y[j] == "2": #フラグが立っていたら
            x = x[:j+z] + "-" + x[j+z:]
            z += 1
    if eval(x) == 7:
        print(x +"=7")
        exit()

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

s = input()
n = 3
ans = 0

for i in range(1,3 ** n):
    x = copy.deepcopy(s)
    y = str(np.base_repr(i,3)).rjust(3,'0') #3進数に変換
    if y[0] == "0" and s[0] == "0":
        continue
    z = 1
    for j in range(3):
        if y[j] == "1": #フラグが立っていたら
            x = x[:j+z] + "+" + x[j+z:]
            z += 1
        if y[j] == "2": #フラグが立っていたら
            x = x[:j+z] + "-" + x[j+z:]
            z += 1
    if eval(x) == 7:
        print(x +"=7")
        exit()

Buggy submission (verdict: Runtime Error):
s = list(input())
ans = 0

for c in s:
    ans += int(c)

if ans == 7:
    print(s[0]+"+"+s[1]+"+"+s[2]+"+"+s[3]+"=7")

else:
    x = str((ans-7)//2)
    a = s.index(x)
    
    for i in range(4):
        print(s[i], end="")
        if i == 3:
            print("=7")
            exit()
        if i == a-1:
            print("-", end="")
            a = 100
        else:
            print("+", end="")

Buggy submission (verdict: Runtime Error):
s = list(input())
ans = 0

for c in s:
    ans += int(c)

if ans == 7:
    print(s[0]+"+"+s[1]+"+"+s[2]+"+"+s[3]+"=7")

else:
    x = str((ans-7)//2)
    a = s.index(x)
    
    for i in range(4):
        print(s[i], end="")
        if i == 3:
            print("=7")
        if i == a-1:
            print("-", end="")
            a = 100
        else:
            print("+", end="")

Buggy submission (verdict: Runtime Error):
s = list(input())
ans = 0

for c in s:
    ans += int(c)
print(ans)

if ans == 7:
    print(s[0]+"+"+s[1]+"+"+s[2]+"+"+s[3]+"=7")

else:
    x = str((ans-7)//2)
    a = s.index(x)
    
    for i in range(4):
        print(s[i], end="")
        if i == 3:
            print("=7")
        if i == a-1:
            print("-", end="")
            a = 100
        else:
            print("+", end="")
Problem p03607 (python)

Fixed submission:
import collections

n = int(input())
li = [int(input()) for i in range(n)]
c = collections.Counter(li)
ans = 0

for item in c.items():
    if item[1]%2 == 1:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [0]*1000000000

for i in range(n):
  x = int(input())
  if l[x-1] == 0:
    l[x-1] = 1
  else:
    l[x-1] = 0

print(l.count(1))
Problem p03624 (python)

Fixed submission:
s = list(input())
set(s)
s.sort()
t = list("abcdefghijklmnopqrstuvwxyz")

for c in t:
  if c in s:
    continue
  else:
    print(c)
    exit()

print("None")

Buggy submission (verdict: Runtime Error):
s = list(input())
s = set(s).sort()
t = "abcdefghijklmnopqrstuvwxyz"

for c in t:
  if t in s:
    cotinue
  else:
    print(c)
    exit()
Problem p03633 (python)

Fixed submission:
import fractions
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
 
n = int(input())
t = [int(input()) for i in range(n)]
 
print(lcm(*t))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]

print(lcm(*t))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]

print(lcm_list(t))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]

print(lcm_list(t))
Problem p03699 (python)

Fixed submission:
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
x = 0
y = 0

if sum(s)%10 != 0:
    print(sum(s))

else:
    while y == 0:
        if s[x]%10 != 0:
            s.pop(x)
            y = 1
            break
        else:
            x += 1
        
        if x >= len(s)-1:
            print(0)
            exit()

    print(sum(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for i in range(n)]
s.sort()
x = 0
y = 0

if sum(s)%10 != 0:
    print(sum(s))

else:
    while y == 0:
        if s[x]%10 != 0:
            s.pop(x)
            y = 1
            break
        else:
            x += 1
        if x == len(s)-1:
            print(0)
            exit()

    print(sum(s))
Problem p03773 (python)

Fixed submission:
x, y = map(int,input().split())
z = x+y
print(z) if z < 24 else print(z-24)

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())
z = z+y
print(z) if z < 25 else print(z-24)
Problem p03827 (python)

Fixed submission:
n = int(input())
s = input()
x = 0
ans = 0

for c in s:
  if c == "I":
    x += 1
  else:
    x -= 1
  if x > ans:
    ans = x

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
x = 0
ans = 0

for c in x:
  if c == "I":
    x += 1
  else:
    x -= 1
  if x > ans:
    ans = x

print(ans)
Problem p03844 (python)

Fixed submission:
li = input().split()
x = int(li[0])
y = int(li[2])
print(x+y) if li[1]=="+" else print(x-y)

Buggy submission (verdict: Runtime Error):
li = list(map(int,input().split()))
x = int(li[0])
y = int(li[2])

if li[1] = "+" print(x+y) else print(x-y)
Problem p03852 (python)

Fixed submission:
s = input()

print("vowel") if s == "a" or s == "i" or s == "u" or s == "e" or s == "o" else print("consonant")

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

print("vowel") if s == a or s == i or s == u or s == e or s == o else print("consonant")
Problem p02899 (python)

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

B = [0 for _ in range(N)]
for i, a in enumerate(A):
    B[a - 1] = str(i + 1)

print(' '.join(B))

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

B = [0 for _ in range(N)]
for i, a in enumerate(A):
    B[a - 1] = str(i + 1)

print(' '.join(B))
Problem p03001 (python)

Fixed submission:
w, h, x, y = map(int, input().split())

area = w * h / 2

flag = 0

if x == w/2 and y == h/2:
    flag = 1

print(area, flag)

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())

cnt = 0

s1 = float((abs(w - x) * abs(h)) / x)
s2 = float((abs(w - 0) * abs(h - y)) / y)

cnt = [s1,s2]
ans = cnt.count(max(cnt))
if ans > 1:
    print(max(cnt), '1')
else:
    print(max(cnt), '0')

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())

cnt = 0

s1 = float((abs(w - x) * abs(h)) / x)
s2 = float((abs(w - 0) * abs(h - y)) / y)

cnt = [s1,s2]
ans = cnt.count(max(cnt))
if ans > 1:
    print(max(cnt), '1')
else:
    print(max(cnt), '0')
Problem p02657 (python)

Fixed submission:
A, B = [int(i) for i in input().split()]
print(A*B)

Buggy submission (verdict: Runtime Error):
A, B = [int(i) for i in input()]
print(A*B)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
count = 0

for i in range(3):
  if S[i] == T[i]:
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
 S = input()
 T = input()
count = 0

for i in range(3):
  if S[i] == T[i]:
    count += 1
    
 print(count)
Problem p03000 (python)

Fixed submission:
# W, H, x, y = [int(i) for i in input().split()]
N, X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
D = 0
count = 0
answer = 1

while D <= X:
  if count + 1 > len(L):
    print(N+1)
    exit()
  D += L[count]
  count += 1
  answer += 1

print(answer - 1)

Buggy submission (verdict: Runtime Error):
N, X = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]
D = 0
count = 0
answer = 1

while D <= X:
  D += L[count]
  count += 1
  answer += 1

print(answer - 1)
Problem p03262 (python)

Fixed submission:
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

N, X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
numbers = [abs(i - X) for i in x]

answer = numbers[0]
for i in numbers:
  answer = gcd(answer, i)
print(answer)

Buggy submission (verdict: Runtime Error):
import math

N, X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
numbers = [abs(i - X) for i in x]

gcd = numbers[0]
for i in numbers:
  gcd = math.gcd(gcd, i)
print(gcd)

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

N, X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
numbers = [abs(i - X) for i in x]

gcd = functools.reduce(math.gcd, numbers)
print(gcd)
Problem p03633 (python)

Fixed submission:
import fractions

N = int(input())
T = [int(input()) for _ in range(N)]

ans = T[0]
for i in range(1, N):
    ans = ans * T[i] // fractions.gcd(ans, T[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
T = [int(input()) for _ in range(N)]

print(lcm_list(T))
Problem p02687 (python)

Fixed submission:
import sys
import math
import numpy as np
import copy

def main():
    s = input()
    print("ARC" if s == "ABC" else "ABC")
    return 0

if __name__ == '__main__':
    sys.exit(main())

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

def main():
    s = input()
    print "ARC" if s == "ABC" else "ABC"
    return 0

if __name__ == '__main__':
    sys.exit(main())
Problem p02926 (python)

Fixed submission:
import sys

import math
import numpy as np

def main():
    n = int(input())
    vec = [tuple(map(int, input().split())) for i in range(n)]
    vec.sort(key=lambda x: math.atan2(x[1], x[0]))

    maxx = 0
    for i in range(n):
        for j in range(1, n+1):
            now = [0, 0]
            for k in range(j):
                idx = (i + k) % n
                now[0] += vec[idx][0]
                now[1] += vec[idx][1]
            maxx = max(maxx, now[0]*now[0] + now[1]*now[1])

    print(math.sqrt(maxx))
    return 0

if __name__ == '__main__':
    sys.exit(main())

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

n = int(input())
x, y = np.array([list(map(int, input().split())) for _ in range(n)]).T

def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0:
        return 1
    else:
        return 0

ans = []

for i in range(n):
    v1 = np.array([y[i], -x[i]])
    if i < n-1:
        v2 = np.array([(y[i]+y[i+1])/2, (x[i]+x[i+1])/2])
    else:
        v2 = v1

    total1, total2 = np.array([0, 0]), np.array([0, 0])
    tmp1, tmp2, v3 = [], [], []
    for j in range(n):
        v3.append(np.array([x[j], y[j]]))
        if isin90deg(v1, v3[j]):
            total1 += v3[j]
            tmp1.append(j)
        if isin90deg(v2, v3[j]):
            total2 += v3[j]
            tmp2.append(j)

    start1, end1 = min(tmp1), max(tmp1)
    start2, end2 = min(tmp2), max(tmp2)
    ans.append(np.linalg.norm(total1, ord=2))
    ans.append(np.linalg.norm(total1 - v3[start1], ord=2))
    ans.append(np.linalg.norm(total1 - v3[end1], ord=2))
    ans.append(np.linalg.norm(total2, ord=2))
    ans.append(np.linalg.norm(total2 - v3[start2], ord=2))
    ans.append(np.linalg.norm(total2 - v3[end2], ord=2))

print(max(ans))
Problem p02972 (python)

Fixed submission:
import sys

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    ans = [False for i in range(n)]

    for i in range(n-1, -1, -1):
        num = i + 1
        j = 2
        accum = 0
        while num * j <= n:
            accum = (accum + ans[num * j - 1]) % 2
            j += 1
        ans[i] = (not accum == a[i])

    out = list()
    for i in range(n):
        if ans[i]:
            out.append(i + 1)
    print(len(out))
    print(*out)

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

if __name__ == '__main__':
    n, q = map(int, input().split())

    board = np.zeros(n+1, dtype=np.int64)

    for i in range(q):
        l, r = map(int, input().split())
        l -= 1
        r -= 1
        board[l] += 1
        board[r+1] -= 1

    cumsum = np.cumsum(board)

    for i in range(n):
        print(int(cumsum[i])%2, end="")
    print()
Problem p03386 (python)

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

if b - a <= 2*k - 1:
  print(*range(a, b+1), sep="\n")
else:
  print(*range(a, a+k), sep="\n")
  print(*range(b-k+1, b+1), sep="\n")

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

if b - a <= 2*k - 1:
  print(*range(a, b+1))
else:
  print(*range(a, a+k))
  print(*range(b-k+1, b+1)
Problem p03425 (python)

Fixed submission:
n = int(input())

s = [input() for i in range(n)]

order = "MARCH"

nums = [[name[0] for name in s].count(order[i]) for i in range(len(order))]

ans = 0
for i in range(0, 5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            ans += nums[i] * nums[j] * nums[k]
            
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

s = [input() for i in range(n)]

order = "MARCH"

initial_arary = [name[0] for name in s]
nums = [initial_array.count(order[i]) for i in range(len(order))]

ans = 0
for i in range(0, 5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            ans += nums[i] * nums[j] * nums[k]
            
print(ans)
Problem p03633 (python)

Fixed submission:
from functools import reduce

def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)

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

n = int(input())
t = [int(input()) for i in range(n)]

ans = reduce(lcm, t)
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce

def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a % b)

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

n = int(input())
t = [int(input()) for i in range(n)]

x = reduce(t, lcm)

print(x)
Problem p02756 (python)

Fixed submission:
from collections import deque

c = deque(input())
n = int(input())
head = 1

for _ in range(n):
  now = list(input().split())
  if now[0] == "1":
    head *= -1
  else:
    if now[1] == "1":
      if head == 1:
        c.appendleft(now[2])
      else:
        c.append(now[2])
    else:
      if head == 1:
        c.append(now[2])
      else:
        c.appendleft(now[2])
print("".join(c) if head == 1 else "".join([c.pop() for _ in range(len(c))]))

Buggy submission (verdict: Runtime Error):
from collections import deque

c = deque(input())
n = int(input())
head = 1

for _ in range(n):
  now = list(input().split())
  if now[0] == "1":
    head *= -1
  else:
    if now[1] == "1":
      if head == 1:
        c.appendleft(now[2])
      else:
        c.append(now[2])
    else:
      if head == 1:
        c.append(now[2])
      else:
        c.appendleft(now[2])
      
print("".join(c) if head == 1 else "".join(c[::-1]))
Problem p02780 (python)

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
 
tmp = sum(l[:k])
now = tmp
 
for i in range(n-k):
  tmp -= l[i]
  tmp += l[i+k]
  now = max(tmp, now)
  
print((now + k) / 2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
 
tmp = l[:k]
now = tmp
 
for i in range(n-k):
  tmp -= l[i]
  tmp += l[i+k]
  now = max(tmp, now)
  
print((now + k) / 2)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))
 
tmp = l[:k]
now = tmp
 
for i in range(n-k+1):
  tmp -= l[i]
  tmp += l[i+k]
  now = max(tmp, now)
  
print((now + k) / 2)
Problem p02888 (python)

Fixed submission:
from bisect import bisect_right

n = int(input())
order = sorted(list(map(int, input().split())))
ans = 0

for i in reversed(range(2, n)):
    for j in reversed(range(1, i)):
        ans += j - bisect_right(order[0:j], order[i]-order[j])

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

n = int(input())
l = deque(sorted(list(map(int, input().split()))))
ans = 0

for _ in range(len(l)-2):
    first = l.pop()
    m = l.copy()
    for _ in range(len(m)-1):
        second = m.pop()
        n = m.copy()
        fix = first - second
        if fix == 0:
            break
        else:
            for _ in range(len(n)):
                third = n.pop()
                if fix < third:
                    ans += 1
                else:
                    break

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

_ = int(input())
l = deque(sorted(list(map(int, input().split()))))
ans = 0

for _ in range(len(l)-2):
    first = l.pop()
    m = l.copy()
    for _ in range(len(m)-1):
        second = m.pop()
        n = m.copy()
        fix = first - second
        if fix == 0:
            break
        else:
            for _ in range(len(n)):
                third = n.pop()
                if fix < third:
                    ans += 1
                else:
                    break

print(ans)
Problem p02982 (python)

Fixed submission:
def solve(X:list, N:int):
    cnt = 0
    for i in range(N):
        for j in range(i):
            dist = 0
            for a, b in zip(X[i], X[j]):
                dist += (a-b)**2
            if dist**.5%1 == 0:
                cnt += 1
    print(cnt)

def main():
    N, D = map(int, input().split(" "))
    X = [list(map(int, input().split(" "))) for i in range(N)]
    solve(X, N)

if __name__ == "__main__":
    main()

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

N, D = map(int, input().split(" "))
data = pd.DataFrame()
a = 0
for i in range(N):
    data[i] = list(map(int, input().split(" ")))
for i, j in data.iteritems():
    for k, l in data.iteritems():
        if i < k:
            if np.sqrt(sum((j - l)**2))%1 == 0:
                a += 1
print(a)