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

Fixed submission:
from sys import stdin
input = stdin.readline

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

ls = [0] * 10 ** 6

for a in A:
    ls[a] += 1

s = sum(A)

for _ in range(Q):
    B, C = map(int, input().split())
    s += ls[B] * (C - B)
    ls[C] += ls[B]
    ls[B] = 0
    print(s)

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

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

ls = [0] * 10 ** 5

for a in A:
    ls[a] += 1

s = sum(A)

for _ in range(Q):
    B, C = map(int, input().split())
    s += ls[B] * (C - B)
    ls[B], ls[C] = 0, ls[B] + ls[C]
    print(s)
Problem p02642 (python)

Fixed submission:
from sys import stdin
input = stdin.readline

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

A.sort()

is_ok = [False] * (10 ** 6 + 1)
is_exist = [False] * (10 ** 6 + 1)

for a in A:
    if is_exist[a]:
        is_ok[a] = False
    else:
        is_exist[a] = True
        is_ok[a] = True
        for i in range(1, 10 ** 6 // a + 1):
            if a * i <= 10 ** 6:
                is_exist[a * i] = True

print(is_ok.count(True))

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

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

A.sort()

is_ok = [False] * (10 ** 5 + 1)
is_exist = [False] * (10 ** 5 + 1)

for a in A:
    if is_exist[a]:
        is_ok[a] = False
    else:
        is_exist[a] = True
        is_ok[a] = True
        for i in range(1, 10 ** 5 // a + 1):
            if a * i <= 10 ** 5:
                is_exist[a * i] = True

print(is_ok.count(True))
Problem p02660 (python)

Fixed submission:
from sys import stdin
from math import sqrt
input = stdin.readline
N = int(input())

s = [0] * (int(sqrt(N)) + 1)

ans = 0

for i in range(2, int(sqrt(N)) + 1):
    tmp = i

    while N % tmp == 0:
        N //= tmp
        s[tmp] += 1

for i in s:
    for j in range(10 ** 5):
        if (j * (j + 1)) // 2 > i:
            k = j
            break

    ans += k - 1

for i in range(2, int(sqrt(N)) + 1):
    if N % i == 0:
        print(ans)
        exit()

if N != 1:
    ans += 1


print(ans)

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

N = int(input())

ans = 0

seen = [0] * 10 ** 7

for i in range(2, int(sqrt(N)) + 1):
    tmp = i

    while N % tmp == 0:

        if seen[tmp] == 1:
            tmp *= i
            continue
        else:
            N //= tmp
            seen[tmp] = 1
            ans += 1
            tmp *= i

if N != 1 and (ans == 0 or seen[N] == 0):
    ans += 1

print(ans)

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

N = int(input())

ans = 0

seen = [0] * 10 ** 6

for i in range(2, int(sqrt(N)) + 1):
    tmp = i

    while N % tmp == 0:

        if seen[tmp] == 1:
            tmp *= i
            continue
        else:
            N //= tmp
            seen[tmp] = 1
            ans += 1
            tmp *= i

if N != 1 and (ans == 0 or seen[N] == 0):
    ans += 1

print(ans)
Problem p02936 (python)

Fixed submission:
from sys import stdin
from collections import deque
input = stdin.readline

N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]

tree = [[] for _ in range(N)]
count = [0] * N
seen = [0] * N

for a, b in ab:
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

for p, x in px:
    count[p - 1] += x

d = deque([])


def dfs(p):
    d.append(p)
    seen[p] = 1

    while d:
        p = d.pop()

        for np in tree[p]:
            if seen[np] == 0:
                seen[np] = 1
                count[np] += count[p]
                d.append(np)


dfs(0)

for c in count:
    print(c, end=" ")

print()

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

N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]

tree = [[] for _ in range(N)]
count = [0] * N

for a, b in ab:
    tree[a - 1].append(b - 1)

for p, x in px:
    count[p - 1] += x

d: deque = deque([])


def dfs(p):
    d.append(p)

    while d:
        p = d.pop()

        for np in tree[p]:
            count[np] += count[p]
            d.append(np)


dfs(0)

for c in count:
    print(c, end=" ")

print()

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]

tree = [[] for _ in range(N)]
count = [0] * N

for a, b in ab:
    tree[a - 1].append(b - 1)


def dfs(p, x):
    count[p] += x

    for np in tree[p]:
        dfs(np, x)


for p, x in px:
    dfs(p - 1, x)

for c in count:
    print(c, end=" ")

print()
Problem p02947 (python)

Fixed submission:
N = int(input())
S = [list(input()) for i in range(N)]

for s in S:
    s.sort()

S.sort()

cnt = 1
ans = 0
tmp = []

for s in S:
    if s == tmp:
        cnt += 1
    else:
        tmp = s
        ans += cnt * (cnt - 1) // 2
        cnt = 1

ans += cnt * (cnt - 1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter as ct

N = int(input())
k = []
a = 0

for i in range(N):
    s = list(input().split())

for i in range(N - 1):
    for j in range(i + 1, N):
        if ct(s[i]) == ct(s[j]):
            a += 1

print(a)
Problem p02957 (python)

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

Buggy submission (verdict: Runtime Error):
A, B = map(int,input().split())
if (A + B) % 2 == 1:
  print(IMPOSSIBLE)
else:
  print((A + B) / 2)
Problem p02958 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
q = sorted(p)
k = 0
for i in range(N):
    if p[i] - q[i] != 0:
        k += 1

if k > 2:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
q = sorted(p)
k = 0
for i in range(1, N + 1):
    if p[i] - q[i] != 0:
        k += 1

if k > 2:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
q = sorted(p)
k = 0
for i in range(1, N + 1):
    if p[i] - q[i] != 0:
        k += 1

if k > 2:
    print("NO")
else:
    print("YES")
Problem p02969 (python)

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

Buggy submission (verdict: Runtime Error):
N, D = map(int, input().split())
a = N / (2 * D + 1)
if N % (2 * D + 1) == 0:
    print(int(a))
else:
    print(int(a) + 1)
Problem p02981 (python)

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

if N * A >= B:
    print(B)
else:
    print(N * A)

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

if N * A >= B:
    print(B)
else:
    print(N * A)

Buggy submission (verdict: Runtime Error):
import math
a = 0
b = 1
N, D = map(int, input().split())
ls = [list(map(int, input().split()))for i in range(N)]
for i in range(N):
    for j in range(i, N):
        for k in range(D):
            a += (ls[i][k] - ls[j][k]) ** 2
            if math.sqrt(a).is_integer() is True:
                b += 1

print(b)
Problem p03244 (python)

Fixed submission:
from collections import Counter

n = int(input())
V = list(map(int, input().split()))

Vodd = V[: len(V):2]
Veven = V[1: len(V):2]

Voc = Counter(Vodd)
Vec = Counter(Veven)

Voc_val, Voc_cnt = zip(*Voc.most_common())
Vec_val, Vec_cnt = zip(*Vec.most_common())

Voc_val, Voc_cnt = list(Voc_val), list(Voc_cnt)
Vec_val, Vec_cnt = list(Vec_val), list(Vec_cnt)

num = Voc.most_common()[0][1] + Vec.most_common()[0][1]

if Voc_val[0] == Vec_val[0]:
    Voc_cnt.append(0)
    Vec_cnt.append(0)
    num += max(Voc_cnt[1] - Voc_cnt[0], Vec_cnt[1] - Vec_cnt[0])

print(n - num)

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

n = int(input())
V = list(map(int, input().split()))

Vodd = V[: len(V):2]
Veven = V[1: len(V):2]

if Vodd == Veven:
    print(n // 2)


Voc = Counter(Vodd)
Vec = Counter(Veven)

Voc_val, Voc_cnt = zip(*Voc.most_common())
Vec_val, Vec_cnt = zip(*Vec.most_common())

Voc_val, Voc_cnt = list(Voc_val), list(Voc_cnt)
Vec_val, Vec_cnt = list(Vec_val), list(Vec_cnt)

num = Voc.most_common()[0][1] + Vec.most_common()[0][1]

if Voc_val[0] == Vec_val[0]:
    Voc_cnt.append(0)
    Vec_cnt.append(0)
    num += max(Voc_val[1] - Voc_val[0], Vec_val[1] - Vec_val[0])

print(n - num)

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

n = int(input())
V = list(map(int, input().split()))

Vodd = V[: len(V):2]
Veven = V[1: len(V):2]

if Vodd == Veven:
    print(n // 2)


Voc = Counter(Vodd)
Vec = Counter(Veven)

Voc_val, Voc_cnt = zip(*Voc.most_common())
Vec_val, Vec_cnt = zip(*Vec.most_common())

num = Voc.most_common()[0][1] + Vec.most_common()[0][1]

if Voc_val[0] == Vec_val[0]:
    Voc_cnt += 0
    Vec_cnt += 0
    num += max(Voc_val[1] - Voc_val[0], Vec_val[1] - Vec_val[0])

print(n - num)

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

n = int(input())
V = list(map(int, input().split()))

Vodd = V[: len(V):2]
Veven = V[1: len(V):2]

for i in range(n):
    if V[0] != V[i]:
        break
    elif i == n - 1:
        print(min(len(Veven), len(Vodd)))
        exit()


Voc = Counter(Vodd)
Vec = Counter(Veven)

if Vodd == Veven:
    if Voc.most_common()[1][1] - Voc.most_common()[0][1] > Vec.most_common()[1][1] - Vec.most_common()[0][1]:
        num = Voc.most_common()[0][1] + Vec.most_common()[1][1]
else:
    num = Voc.most_common()[0][1] + Vec.most_common()[0][1]


print(n - num)
Problem p03324 (python)

Fixed submission:
from sys import stdin
input = stdin.readline

D, N = map(int, input().split())

ans = 100 ** D * N

if N == 100:
    ans += 100 ** D

print(ans)

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

D, N = map(int, input().split())

ans = 100 ** D * N

if N == 100:
    ans += 100　** D

print(ans)
Problem p02573 (python)

Fixed submission:
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)
        
    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

n,m = map(int,input().split())
par = [-1]*n
line = [0 for i in range(n)]
ans = 0
for i in range(m):
  a,b = map(int, input().split())
  unite(a-1,b-1)
for i in range(n):
  line[find(i)] += 1
  if line[find(i)] > ans:
    ans = line[find(i)]
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import connected_components

n,m = map(int, input().split())
matrix = np.zeros((n,n))
for i in range(m):
  a,b = map(int, input().split())
  matrix[a-1][b-1] += 1

x, labels = connected_components(matrix)
group_count = [0 for i in range(x)]
for i in labels:
  group_count[i] += 1
print(max(group_count))
Problem p02582 (python)

Fixed submission:
word = input()
if word == 'SSS':
  print(0)
if word == 'SSR':
  print(1)
if word == 'SRS':
  print(1)
if word == 'RSS':
  print(1)
if word == 'SRR':
  print(2)
if word == 'RRS':
  print(2)
if word == 'RSR':
  print(1)
if word == 'RRR':
  print(3)

Buggy submission (verdict: Runtime Error):
word = input():
if word == 'SSS':
  print(0)
if word == 'SSR':
  print(1)
if word == 'SRS':
  print(1)
if word == 'RSS':
  print(1)
if word == 'SRR':
  print(2)
if word == 'RRS':
  print(2)
if word == 'RSR':
  print(1)
if word == 'RRR':
  print(3)
Problem p02899 (python)

Fixed submission:
n = int(input())
line = list(map(int, input().split()))
ans = ['0' for i in range(n)]
for i in range(n):
  ans[line[i]-1] = str(i+1)
print(' '.join(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
line = list(map(int, input().split()))
ans = [0 for i in range(n)]
for i in range(n):
  ans[line[i-1]] = i+1
print(' '.join(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
line = list(map(int, input()))
ans = [0 for i in range(n)]
for i in range(n):
  ans[line[i-1]] = i+1
print(' '.join(ans))
Problem p02742 (python)

Fixed submission:
H, W = map(int, input().split())

if H == 1 or W == 1:
  print(1)
elif H % 2 == 0 or W % 2 == 0:
  print(H * W // 2)
else:
  print((H * W - 1) // 2 + 1)

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

if H % 2 == 0 or W % 2 == 0:
  print(H * W // 2)
else:
  print((H * W - 1) // 2 + 1)
  exit(1)
Problem p02772 (python)

Fixed submission:
x = int(input())

n = [int(e) for e in input().split()]

def cal(n):
    count = 0
    for i in range(len(n)):
        if n[i] % 2 == 0:
            if n[i] % 3 == 0 or n[i] % 5 == 0:
                count += 1
        else:
            count += 1
    if count == len(n):
        print("APPROVED")
    else:
        print("DENIED")
cal(n)

Buggy submission (verdict: Runtime Error):
int x=input()
n=[]
for i in range(x):
  n[i] = input()

def cal(n):
  int count=0
  for i in range(len(a)):
    if (n[i]%2==0) and ((n[i]%3==0)and(n[i]%5==0)):
      count+=1
  if count == len(n):
    print("APPROVED")
  else:
    print("DENIED")

cal(n)
Problem p02534 (python)

Fixed submission:
print(int(input())*'ACL')

Buggy submission (verdict: Runtime Error):
print(input()*'ACL')

Buggy submission (verdict: Runtime Error):
print(input()*'ACL')
Problem p02548 (python)

Fixed submission:
n = int(input())
c = 0
for i in range(1,n):
    c+=(n-1)//i
print(c)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
  for m in range(n, N+1, n):
    div[m] += 1
print(sum(div))
Problem p02608 (python)

Fixed submission:
n = 10**4
ans = [0]*10**4
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            a = (x+y+z)**2 -(x*y+y*z+z*x)
            if a <= n:
                ans[a-1] += 1
for i in range(int(input())):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = 10**4
ans = [0]*10**4
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            a = (x+y+z)**2 -(x*y+y*z+z*x)
            if a <= N:
                ans[a-1] += 1
for i in range(int(input())):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n = 10**2
k = [0]*10**2
for x in range(1,9):
    for y in range(1,9):
        for z in range(1,9):
            for i in range(n+1):
                if (x+y+z)**2 -(x*y+y*z+z*x) == i:
                    k[i-1] += 1
for i in range(int(input())):
    print(k[i])

Buggy submission (verdict: Runtime Error):
n = 10**2
k = [0]*10**2
for x in range(1,10):
    for y in range(1,10):
        for z in range(1,10):
            for i in range(n+1):
                if (x+y+z)**2 -(x*y+y*z+z*x) == i:
                    k[i-1] += 1
for i in range(int(input())):
    print(k[i])

Buggy submission (verdict: Runtime Error):
n = 10**2
k = [0]*10**2
for x in range(1,20):
    for y in range(1,20):
        for z in range(1,20):
            for i in range(n+1):
                if (x+y+z)**2 -(x*y+y*z+z*x) == i:
                    k[i-1] += 1
for i in range(int(input())):
    print(k[i])

Buggy submission (verdict: Runtime Error):
n = 10**2
k = [0]*10**2
for x in range(1,34):
    for y in range(1,34):
        for z in range(1,34):
            for i in range(n+1):
                if (x+y+z)**2 -(x*y+y*z+z*x) == i:
                    k[i-1] += 1
for i in range(int(input())):
    print(k[i])
Problem p02641 (python)

Fixed submission:
x,n = map(int, input().split())
p = set(map(int, input().split()))
for i in range(101):
    if x-i not in p:
        print(x-i)
        break
    if x+i not in p:
        print(x+i)
        break

Buggy submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = sorted(map(int, input().split()))
if p == []:
    print(x)
else:
    a = p[-1]
    d =[]
    e = 0
    E = 0
    b = 1000
    c = 0
    for i in range(a):
        d += [e]
        e += 1
    for i in range(n):
        d.remove(p[E])
        E += 1
    for i in range(n):
        b = min((abs,x-d[c]),b)
        c += 1
    if (x-b) in d:
        print(x-b)
    else:
        print(x+b)

Buggy submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = sorted(map(int, input().split()))
if p == []:
    print(x)
else:
    a = p[-1]
    d =[]
    e = 1
    E = 0
    b = 1000
    c = 0
    for i in range(a):
        d += [e]
        e += 1
    for i in range(n):
        d.remove(p[E])
        E += 1
    for i in range(n):
        b = min(abs(x-d[c]),b)
        c += 1
    if (x+b) in d:
        print(x+b)
    else:
        print(x-b)

Buggy submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = sorted(map(int, input().split()))
if p == []:
    print(x)
else:
    a = p[-1]
    d =[]
    e = 1
    E = 0
    b = 1000
    c = 0
    for i in range(a):
        d += [e]
        e += 1
    for i in range(n):
        d.remove(p[E])
        E += 1
    for i in range(n):
        b = min(abs(x-d[c]),b)
        c += 1
    if (x-b) in d:
        print(x-b)
    else:
        print(x+b)

Buggy submission (verdict: Runtime Error):
x,n = map(int, input().split())
p = sorted(map(int, input().split()))
if p == []:
    print(x)
else:
    a = p[-1]
    d =[]
    D =[]
    e = 1
    E = 0
    b = 1000
    c = 0
    for i in range(a):
        d += [e]
        e += 1
    for i in range(n):
        d.remove(p[E])
        E += 1
    for i in range(n):
        b = min(abs(x-d[c]),b)
        c += 1
    if (x-b) in d:
        print(x-b)
    else:
        print(x+b)
Problem p02658 (python)

Fixed submission:
n = int(input())
a= list(map(int,input().split()))
c = 1
if 0 in a:
    print(0)
else:
    for x in a:
        if x >10**18:
            print(-1)
            break
        else:
            z = x*c
            c = z
            if z >10**18:
                print(-1)
                break
    else:
        print(z)

Buggy submission (verdict: Runtime Error):
n = int(input())
a= list(map(int,input().split()))
c = 1
if 0 in a:
    print(0)
else:
    for x in a:
        if x >10**18:
            print(-1)
            break
        else:
            c*=x
            if c >10**18:
                print(-1)
                break
    else:
        print(z)

Buggy submission (verdict: Runtime Error):
n = int(input())
a= list(map(int,input().split()))
c = 1
if 0 in a:
    print(0)
else:
    for x in a:
        if x >10**18:
            print(-1)
            break
        else:
            z = x*c
            c = z
            if z >10**18:
                print(-1)
                break
print(z)

Buggy submission (verdict: Runtime Error):
n = int(input())
a= map(int,input().split())
c = 1
if 0 in a:
    print(0)
else:
    for x in a:
        if x >10**18:
            print(-1)
            break
        else:
            z = x*c
            c = z
            if z >10**18:
                print(-1)
                break
print(z)
Problem p02687 (python)

Fixed submission:
S = input()
if S == 'ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
S = input()
if (S == 'ABC)':
    print('ARC')
else:
    print('ABC')
Problem p02730 (python)

Fixed submission:
s = input()
if s[len(s) // 2 + 1:] == s[:len(s) // 2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
S1 = S[0:(N-1)//2]
S2 = S[(N+3)//2-1:N+1]
print("Yes"  S1 == S1[::-1] and S2 == S2[::-1] else "No")
Problem p02898 (python)

Fixed submission:
n,k = map(int,input().split())
h = list(map(int,input().split()))
print(len([i for i in h if i>=k]))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))
print(len([i for i in range(4) if h[i]>=k]))
Problem p02899 (python)

Fixed submission:
import numpy as np
n = input()
print(*np.argsort(list(map(int,input().split())))+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = input()
print(*np.argsort(list(map(int,input().split())))+1)
Problem p02909 (python)

Fixed submission:
s = input()
weather = ['Sunny','Cloudy','Rainy']
print(weather[(weather.index(s) + 1) % 3])

Buggy submission (verdict: Runtime Error):
s = input()
weather = ['Sunny','Cludy','Rainy']
print(weather[(weather.index(s) + 1) % 3])
Problem p02911 (python)

Fixed submission:
import numpy as np
n,k,q = map(int,input().split())
a =np.array([k]*n)
a-=q
for i in range(q):
    a[int(input())-1]+=1
for i in range(n):
    if a[i]>0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k,q = map(int,input().split())
a =np.array([k-q]*n)
for i in range(q):
    a[int(input())-1]+=1
for i in a:
    if a[i]>0:
        print("Yes")
    else:
        print("No")
Problem p02982 (python)

Fixed submission:
import numpy as np
from itertools import combinations
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
count=0
for x,y in combinations(X,2):
    r = np.sqrt(sum(abs(np.array(x)-np.array(y))**2))
    if r.is_integer() == True:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
from itertools import combinations
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
count=0
for x,y in combinations(X,2):
    r = np.sqrt(abs(x[0]-y[0])**2 + abs(x[1]-y[1])**2)
    if r.is_integer() == True:
        count += 1
print(count)
Problem p03001 (python)

Fixed submission:
w, h, x, y = map(int, input().split())
if w==2*x and h ==2*y:
    print(w*h/2, 1)
else:
    print(w*h/2, 0)

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
if w/x > h/y:
    print(x*h/1, '1')
elif w/x == h/y:
    print(x*h/1, '0')
else:
    print(h*y/1, '1')
Problem p03106 (python)

Fixed submission:
a,b,k = map(int,input().split())
x = []
for i in range(1,a+1):
    if a%i == 0 and b%i == 0:
        x.append(i)
print(x[-k])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
x = []
for i in range(1,a):
    if a%i == 0 and b%i == 0:
        x.append(i)
print(x[-k])
Problem p03214 (python)

Fixed submission:
import statistics
n = int(input())
a = list(map(int,input().split()))
s = statistics.mean(a)
c = float("inf")
for i in range(n):
    if c!=min(abs(s-a[i]),c):
        c = abs(s-a[i])
        d = i
print(d)

Buggy submission (verdict: Runtime Error):
import statistics
n = int(input())
a = list(map(int,input().split()))
s = statistics.mean(a)
print(s)
c = float("inf")
d = i
for i in range(n):
    if c!= min(abs(s-a[i]),c):
        c = s-a[i]
        d = i
print(d)
Problem p03227 (python)

Fixed submission:
n = input()
if len(n)==2:
    print(n)
else:
    print(n[::-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
if len(n)==2:
    print(n)
else:
    print(n[::-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
if len(n)==2:
    print(n)
else:
    print(n[::-1])
Problem p03261 (python)

Fixed submission:
n = int(input())
w = [input() for i in range(n)]
x = False
if n == len(set(w)):
    if all([w[i-1][-1] == w[i][0] for i in range(1,n)]):
        x = True
print('Yes' if x else 'No')

Buggy submission (verdict: Runtime Error):
n = int(input())
w = [input() for i in range(n)]
if n == len(set(w)) and w[i-1][-1] == w[i][0] for i in range(1,n):
    print('Yes')
else:
    print('No')
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
print((n[0]-1)*(n[1]-1))