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

Fixed submission:
A, B, C, x = [int(input()) for i in range(4)]
print(sum(500 * a + 100 * b + 50 * c == x for a in range(A+1) for b in range(B+1) for c in range(C+1)))

Buggy submission (verdict: Runtime Error):
x500 = int(input())
x100 = int(input())
x50 = int(input())
xxx = int(input())

i = 0
j = 0
k = 0


def judge(sum, xxx):
    sum = 500 * i + 100 * j + 50 * k
    return sum == xxx and sum <= 2000


count = 0
for i in range(x500):
    if judge(i, j, k):
        count += 1
    for j in range(x100):
        if judge(i, j, k):
            count += 1
        for k in range(x50):
            if judge(i, j, k):
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
x500 = int(input())
x100 = int(input())
x50 = int(input())
xxx = int(input())

i = 0
j = 0
k = 0

count = 0
for i in range(x500):
    if total(i, j, k) == xxx:
        count += 1
    for j in range(x100):
        if total(i, j, k) == xxx:
            count += 1
        for k in range(x50):
            if total(i, j, k) == xxx:
                count += 1
print(count)


def total(i, j, k):
    return 500 * i + 100 * j + 50 * k

Buggy submission (verdict: Runtime Error):
x500 = int(input())
x100 = int(input())
x50 = int(input())
xxx = int(input())

i = 0
j = 0
k = 0

count = 0
for i in range(x500):
    if total(i, j, k) == xxx:
        count += 1
    for j in range(x100):
        if total(i, j, k) == xxx:
            count += 1
        for k in range(x50):
            if total(i, j, k) == xxx:
                count += 1
print(count)


def total(i, j, k):
    return 500 * i + 100 * j + 50 * k

Buggy submission (verdict: Runtime Error):
x500 = int(input())
x100 = int(input())
x50 = int(input())
xxx = int(input())

i = 0
j = 0
k = 0

count = 0
for i in x500:
    if total(i, j, k) == xxx:
        count += 1
    for j in x100:
        if total(i, j, k) == xxx:
            count += 1
        for k in x50:
            if total(i, j, k) == xxx:
                count += 1
print(count)


def total(i, j, k):
    return 500 * i + 100 * j + 50 * k

Buggy submission (verdict: Runtime Error):
x500 = int(input())
x100 = int(input())
x50 = int(input())
xxx = int(input())

n500 = 0
n100 = 0
n50 = 0

count = 0
for i in x500:
    if total(i, j, k) == xxx:
        count += 1
    for j in x100:
        if total(i, j, k) == xxx:
            count += 1
        for k in x50:
            if total(i, j, k) == xxx:
                count += 1
print(count)


def total(i, j, k):
    return 500 * i + 100 * j + 50 * k
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
print("Even") if (a * b) % 2 == 0 else print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input.split())
print("Even" if a*b %2 == 0 else "Odd")
Problem p02812 (python)

Fixed submission:
#--Count ABC

N = int(input())
S = list(input())

A_list = [i for i, x in enumerate(S) if x == 'A']
A_num = len(A_list)

k = 0
for j in range(A_num):
  if(A_list[j] < N-2):
    pp = A_list[j]
    if(S[pp+1]=="B" and S[pp+2]=="C"):
      k = k + 1
    else:
      pass
  else:
    pass

print(k)

Buggy submission (verdict: Runtime Error):
#--Count ABC

N = int(input())
S = list(input())

A_list = [i for i, x in enumerate(S) if x == 'A']
A_num = len(A_list)

k = 0
for j in range(A_num):
  if(A_list[j] < N-1):
    pp = A_list[j]
    if(S[pp+1]=="B" and S[pp+2]=="C"):
      k = k + 1
    else:
      pass
  else:
    pass

print(k)
Problem p02713 (python)

Fixed submission:
import math
n = int(input())

a = 0
 
for i in range(n):
  for j in range(n):
    for k in range(n):
      t = math.gcd(i+1, j+1)
      a = a + math.gcd(t, k+1)
      
print(a)

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

def gcd(nums):
    return functools.reduce(euclid, nums)

a = 0

for i in range(n):
  for j in range(n):
    for k in range(n):
      num = [i+1, j+1, k+1]
      a = a + gcd(num)
      
print(a)
Problem p02714 (python)

Fixed submission:
n = int(input())
s = input()
 
count = {"R":0,"G":0,"B":0}
for c in s:
    count[c] += 1
 
r,g,b = count.values()
ans = r*g*b
for i in range(1,(n-1)//2+1): #1から
    for rgb in zip(s,s[i:],s[i*2:]):  #rgbに連続した三つのリストの要素を入れ込む
        if len(set(rgb)) == 3:  #リストrgbをセットにまとめ、長さが
            ans -=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
 
a = 0
 
for i in range(n):
  if s[i]=='R':
    for j in range(n):
      if s[j]=='G':
        for k in range(n):
          if s[k]=='B':
            if i<j<k:
              if (j-i)!=(k-j):
                a = a + 1
            elif j<k<i:
              if (k-j)!=(i-k):
                a = a + 1
            elif k<i<j:
              if abs(j-i)!=abs(k-i):
                a = a + 1
            elif j<i<k:
              if abs(j-i)!=abs(k-i):
                a = a + 1
            elif i<k<j:
              if abs(k-i)!=abs(k-j):
                a = a + 1
            elif k<j<i:
              if abs(j-i)!=abs(k-j):
                a = a + 1
          
print(a)
n = int(input())
s = list(input())

a = 0

for i in range(n):
  if s[i]=='R':
    for j in range(n):
      if s[j]=='G':
        for k in range(n):
          if s[k]=='B':
            if i<j<k:
              if (j-i)!=(k-j):
                a = a + 1
            elif i<k<j:
              if (k-i)!=(j-k):
                a = a + 1
            elif j<i<k:
              if (i-j)!=(k-i):
                a = a + 1
            elif j<k<i:
              if (k-j)!=(i-k):
                a = a + 1
            elif k<i<j:
              if (i-k)!=(j-i):
                a = a + 1
            elif k<j<i:
              if (j-k)!=(i-j):
                a = a + 1
          
print(a)
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
if N>=K:
  N = N%K

while N!=0:
  if N>=abs(N-K):
    N = abs(N-K)
  elif N==0:
    break  
  else:
    break
print(N)

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

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

while N>=K:
  N = N - K

while N!=0:
  if N>=np.abs(N-K):
    N = N-K
    if N<0:
      N = N * -1
  elif N==0:
    break
  else:
    break            
print(N)
Problem p02760 (python)

Fixed submission:
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
flag = False
for i in range(3):
    if all(a[i][j] in b for j in range(3)): #bの中にa[i][j]があるかどうか
        flag = True
    if all(a[j][i] in b for j in range(3)):
        flag = True
if all(a[i][i] in b for i in range(3)) or all(a[i][2-i] in b for i in range(3)):
    flag = True
 
if flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
flag = False
for i in range(3):
    if all(a[i][j] in b for j in range(3)): #bの中にa[i][j]があるかどうか
        flag = True
    if all(a[j][i] in b for j in range(3)):
        flag = True
if all(a[i][i] in b for i in range(3)) or all(a[i][2-i] in b for i in range(3)):
    flag = True
 
if flag:
    print("Yes")
else:
Problem p03000 (python)

Fixed submission:
n,x= list(map(int, input().split()))

L=list(map(int, input().split()))
D=[0]
for i in range(0,n):
    D.append(D[i]+L[i])
ans=0
for i in range(n+1):
    if D[i]<=x:
        ans+=1
    else:
        break

print(ans)

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

L=list(map(int, input().split()))
d=0

for i in range(1,n):
    d+=L[i-1]
    if d>x:
        ans=i
        break
print(ans)

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

L=list(map(int, input().split()))
d=0

for i in range(1,n+2):
    d+=L[i-1]
    if d>x:
        ans=i
        break
print(ans)
Problem p03085 (python)

Fixed submission:
b=input()

if b=="A":
    print("T")
elif b=="T":
    print("A")
elif b=="C":
    print("G")
else:
    print("C")

Buggy submission (verdict: Runtime Error):
n, q = list(map(int, input().split()))
s = input()
for i in range(q):
    l, r = list(map(int, input().split()))
    print(len(s[l - 1:r].split("AC")) - 1)
Problem p03086 (python)

Fixed submission:
s = input()+"E"
ans = []
c=0
for st in s:
    if st in ["A","T","C","G"]:
        c+=1
    else:
        ans.append(c)
        c=0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
c=0
for st in s:
    if st in ["A","T","C","G"]:
        c+=1
    else:
        ans.append(c)
        c=0
print(max(ans))

Buggy submission (verdict: Runtime Error):
import re

s = input()
ans = []
while len(s) > 0:
    ans.append(len(re.match("[ATCG]*", s)[0]))
    s = s[1:-1]
print(max(ans))
Problem p03105 (python)

Fixed submission:
a,b,c=list(map(int,input().split()))
if b>a*c:
    print(c)
else:
    print(int(b/a))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

ans = n * (n - 1) // 2
result = [ans]
leader = [-1] * n
size = [1] * n


def leader_check(i):
    if leader[i] == -1:
        return i
    ln = leader_check(leader[i])
    leader[i] = ln
    return ln


for a, b in ab[:0:-1]:
    a, b = a - 1, b - 1
    la = leader_check(a)
    lb = leader_check(b)
    if la != lb:
        leader[la] = lb
        ans -= size[la] * size[lb]
        size[lb] += size[la]
    result.append(ans)

for i in result[::-1]:
    print(i)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
l = len(t)-1
if s == t[:l]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s, t = map(str, input().split())
l = len(t)-1
print('Yes') if s == t[:l] else print('No')
Problem p02713 (python)

Fixed submission:
import math
import fractions

k = input()

sum = 0
for a in range(int(k)):
    for b in range(int(k)):
        x = math.gcd(a+1, b+1)
        for c in range(int(k)):
            y = math.gcd(x, c+1)
            sum += y
print(sum)

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

k = input()

sum = 0
for a in range(k):
    for b in range(k):
        x = fractions.gcd(a+1, b+1)
        for c in range(k):
            y = fractions.gcd(x, c+1)
            sum += y
print(sum)
Problem p03061 (python)

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

n = int(input())
a = list(map(int, input().split()))
l = [a[0]] * n
r = [a[n-1]] * n
for i in range(1, n):
    l[i] = gcd(l[i-1], a[i-1])
for i in range(n-2, -1, -1):
    r[i] = gcd(r[i+1], a[i+1])
l[0] = r[0]
r[n-1] = l[n-1]
ans = 0
for i in range(n):
    ans = max(ans, gcd(l[i], r[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
l = [a[0]] * n
r = [a[n-1]] * n
for i in range(1, n):
    l[i] = math.gcd(l[i-1], a[i-1])
for i in range(n-2, -1, -1):
    r[i] = math.gcd(r[i+1], a[i+1])
l[0] = r[0]
r[n-1] = l[n-1]
ans = 0
for i in range(n):
    ans = max(ans, math.gcd(l[i], r[i]))
print(ans)
Problem p02641 (python)

Fixed submission:
x, n  = map(int, input().split())
if n > 0:
  p = set(map(int, input().split()))
  i = 0
  while True:
    if x - i not in p:
      print(x-i)
      break
    if x + i not in p:
      print(x+i)
      break
    i += 1
else:
  print(x)

Buggy submission (verdict: Runtime Error):
x, n  = map(int, input().split())
p = map(int, intput().split())

m = -1
for a in p:
  if m == -1 or (abs(a - x) < abs(m - x)) or (abs(a - x) == abs(m - x) and a < m):
    m = a

print(m)
Problem p02741 (python)

Fixed submission:
arr = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
k=int(input())

k -= 1
print(arr[k])

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

x = math.sqrt(a)
y = math.sqrt(b)
z = math.sqrt(c)

x += y

if x < z:
    print('Yes')
else:
    print('No')
Problem p02719 (python)

Fixed submission:
N,K=map(int,input().split())
ans=min(N,N%K,abs(N%K-K))
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
if K==0:
  ans=N
elif N%K==0 and K%N==0:
  ans=0
else:
  if N%2==0:
    ans=min(N,abs(N-K))
  else:
    ans=1
print(ans)
Problem p02885 (python)

Fixed submission:
x, y = map(int, input().split())
output =  0 if x <= 2 * y else x - 2 * y
print(output)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
    for j in range(i+1, len(d)):
        count += d[i] * d[j]
print(count)
Problem p02886 (python)

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
    for j in range(i+1, len(d)):
        count += d[i] * d[j]
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
    for j in range(i+1, len(d)):
        count += d[i] * d[j]
print(count)7
Problem p02898 (python)

Fixed submission:
num, lim = map(int, input().split())
x = map(int, input().split())
print(len([person for person in x if person >= lim]))

Buggy submission (verdict: Runtime Error):
import re

num, lim = input().split()
x = re.split(' +', input())
if len(x) > num:
    print(0)
else:
    print(len([person for person in x if person >= lim]))
Problem p02658 (python)

Fixed submission:
_=input()
A=sorted(list(map(int,input().split())))
B=1
for a in A:
    B*=a
    if B>10**18:
        B=-1
        break
print(B)

Buggy submission (verdict: Runtime Error):
a=input()
b=eval(input().replace(" ","*"))
print(-1 if b>10**18 else b)

Buggy submission (verdict: Runtime Error):
_=input()
A=eval('*'.join(input().split()))
print(-1 if A>1000000000000000000 else A)

Buggy submission (verdict: Runtime Error):
_=input()
A=eval('*'.join(input().split()))
print(-1 if A>10**18 else A)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=eval(input().replace(' ','*'))
print('-1' if a>10**18 else a)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=eval(input().replace(' ','*'))
print(-1 if a>10**18 else a)
Problem p02677 (python)

Fixed submission:
import math
A,B,H,M=map(int,input().split())
x=360*(H+M/60)/12-360*M/60
cos=math.cos(math.radians(x))
C = A**2 + B**2 - 2*A*B*(cos)
print(C**0.5)

Buggy submission (verdict: Runtime Error):
A,B,H,M=map(int,input().split())
x=360*(H+M/60)/12-360*M/60
cos=math.cos(math.radians(x))
C = A**2 + B**2 - 2*A*B*(cos)
print(C**0.5)
Problem p02713 (python)

Fixed submission:
from math import gcd
 
n = int(input())
 
ans = 0
 
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      ans += gcd(gcd(i,j),k)
      
print(ans)

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

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

k = int(input())
ans = 0

seq = [i for i in range(1, k+1)]
b = list(itertools.combinations_with_replacement(seq,3))

for a in b:
    if a[0] == a[1] == a[2]:
        ans += gcd(a[0], a[1], a[2])
    else:
        ans += gcd(a[0], a[1], a[2])*(n+1)
print(ans)
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
print(min(N*A,B)
Problem p03210 (python)

Fixed submission:
X=int(input())
print('YES' if X in [7,5,3] else 'NO')

Buggy submission (verdict: Runtime Error):
A=int(intput())
print('Yes' if A in list(range(3,8,2)) else 'No')
Problem p03502 (python)

Fixed submission:
n = list(input())
x = int(''.join(n))
y = sum(map(int, n))

print('Yes' if x%y==0 else 'No')

Buggy submission (verdict: Runtime Error):
n = int(input())
a, b = map(int, list(str(n)))

print('Yes' if n%(a+b)==0 else 'No')
Problem p03545 (python)

Fixed submission:
A = input()
n = len(A)
i = 1
ans = ''

def check(i, a, ans):
    if i == n:
        if eval(a) == 7:
            ans = a
        return ans
    
    else:
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '+' + a[p:]
        ans = check(i+1, a, ans)
        
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '-' + a[p:]
        ans = check(i+1, a, ans)
    return ans

ans = check(i, A, ans) 
print(ans+'=7')

Buggy submission (verdict: Runtime Error):
A = input()
n = len(a)
i = 1
ans = ''

def check(i, a, ans):
    if i == n:
        if eval(a) == 7:
            ans = a
        return ans
    
    else:
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '+' + a[p:]
        ans = check(i+1, a, ans)
        
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '-' + a[p:]
        ans = check(i+1, a, ans)
    return ans

ans = check(i, A, ans) 
print(ans+'=7')

Buggy submission (verdict: Runtime Error):
A = input()
n = len(a)
i = 1
ans = ''

def check(i, a, ans):
    if i == n:
#         print(i, 'bottom', a)
        if eval(a) == 7:
            ans = a
        return ans
    
    else:
        a = a[:2*i-2] + A[i-1:]
#         print(i, 'left', a)
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '+' + a[p:]
        ans = check(i+1, a, ans)
        
        a = a[:2*i-2] + A[i-1:]
#         print(i, 'right', a)
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '-' + a[p:]
        ans = check(i+1, a, ans)
    return ans

ans = check(i, A, ans) 
print(ans+'=7')

Buggy submission (verdict: Runtime Error):
A = input()
n = len(a)
i = 1
ans = ''

def check(i, a, ans):
    if i == n:
        print(i, 'bottom', a)
        if eval(a) == 7:
            ans = a
        return ans
    
    else:
        a = a[:2*i-2] + A[i-1:]
        print(i, 'left', a)
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '+' + a[p:]
        ans = check(i+1, a, ans)
        
        a = a[:2*i-2] + A[i-1:]
        print(i, 'right', a)
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '-' + a[p:]
        ans = check(i+1, a, ans)
    return ans

ans = check(i, A, ans) 
print(ans+'=7')
Problem p03555 (python)

Fixed submission:
a,b = (input() for _ in range(2))
print('YES' if list(a) == list(reversed(b)) else 'NO')

Buggy submission (verdict: Runtime Error):
a = input().split()
print('YES' if list(a[0]) == list(reversed(a[1])) else 'NO')
Problem p03844 (python)

Fixed submission:
a, op, b = map(str, input().split(' '))
if op == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy submission (verdict: Runtime Error):
a, op, b = map(str, input().split(' '))
if op == '+':
    print(int(a) + int(b))
else:
    print(ans = int(a) - int(b))
Problem p04030 (python)

Fixed submission:
ans = []
for i in input():
    if (i == '1' or i == '0'): ans.append(i) 
    if i == 'B' and len(ans) != 0: ans.pop() 
print(''.join(ans))

Buggy submission (verdict: Runtime Error):
ans = []
for i in input():
    if (i == '1' or i == '0'): ans.append(i) 
    if i == 'B': ans.pop() 
print(''.join(ans))
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split(' '))
a = list(input() for _ in range(n))
print(''.join(sorted(a)))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split(' '))
hoges = []
for _ in range(n):
    hoges.append(input())
a = hoges.sort()
print(''.join(a))
Problem p02731 (python)

Fixed submission:
L = int(input())

print((L/3)**3)

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

print((L/3)**3
Problem p02921 (python)

Fixed submission:
s = input()
t = input()

cnt = 0
for i in range(3):
    if s[i] == t[i]:
        cnt += 1

print(cnt)

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

n = 1
while True:
    if b == 1:
        print(0)
        break
    elif (a-1) * (n-1) + a >= b:
        print(n)
        break
    else:
        n+=1
Problem p02952 (python)

Fixed submission:
n = int(input())

cnt = 0
for i in range(1,n+1):
    if len(str(i)) % 2 == 1:
        cnt += 1

print(cnt)

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

cnt = 0
for i in range(1,n+1):
    if len(str(i)) % 2 == 1:
        cnt += 1

print(cnt
Problem p02945 (python)

Fixed submission:
a, b = input().split(" ")

a = int(a)
b = int(b)

mul = a*b
sub = a-b
add = a+b

print(max(mul,sub,add))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

mul = a*b
sub = a-b
add = a+b

print(max(mul,sub,add))
Problem p02658 (python)

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

ans = 1
for a in A:
    ans *= a

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

Buggy submission (verdict: Runtime Error):
_ = input()
A = list(map(int, input().split()))
b = np.prod(A)
b = b if b < 10 ** 18 else -1
print(b)
Problem p02732 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

ad = {}
for i in range(n) :
    if a[i] in ad :
        ad[a[i]] += 1
    else :
        ad[a[i]] = 1

ans = 0
for v in ad.values():
    ans += v*(v-1)//2

for i in range(n):
    v = ad[a[i]]
    print(ans-v*(v-1)//2+(v-1)*(v-2)//2)

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

ad = dict((i, a.count(i)) for i in set(a))

for i in range(n):
  ans = 0
  for v in list(ad):
    ans += ad[v]*(ad[v]-1)//2 if a[v] != v else (ad[v]-1)*(ad[v]-2)//2
   
  print(ans)

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

for e in A:
    d = dict((i, A.count(i)) for i in set(A))
    d[e]-=1
    
    ans = 0
    for i in list(d):
        if d[i] < 2:
            continue
        ans += d[i]*(d[i]-1)/2
    print(int(ans))

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

for e in A:
    d = dict((i, A.count(i)) for i in set(A))
    d[e]-=1
    
    ans = 0
    for i in list(d):
        if d[i] < 2:
            continue
        ans += d[i]*(d[i]-1)/2
    print(int(ans))

Buggy submission (verdict: Runtime Error):
import math
N, *A = map(int,inp.split())

for e in A:
    d = dict((i, A.count(i)) for i in set(A))
    d[e]-=1
    
    ans = 0
    for i in list(d):
        if d[i] < 2:
            continue
        ans += d[i]*(d[i]-1)/2
    print(int(ans))
Problem p03106 (python)

Fixed submission:
a,b,c = map(int, input().split())
def m(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list


list = m(a)+ m(b)
res = [e for e in set(list) if list.count(e) > 1]
res.sort(reverse=True)
print(res[c-1])

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
def m(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list

print(m(a), m(b))
list = m(a)+ m(b)
res = [e for e in set(list) if list.count(e) > 1]
print(res[c])
Problem p03125 (python)

Fixed submission:
a, b = map(int, input().split())
if b % a == 0:
  print(a+b)
else:print(b-a)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
if b % a == 0:
  print(a+b)
else:print(b-a)
Problem p03238 (python)

Fixed submission:
N=int(input())
sum_a=0
if N==1:
    print("Hello World")
else:
    for _ in range(2):
        a=int(input())
        sum_a+=a
    print(sum_a)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1:
     print("Hello World")
else:
     A =  int(input())
     B =  int(input())
     print(A+B