Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = []
Y = []
hh = []
for _ in range(N):
    x, y, h = map(int, input().split())
    X.append(x)
    Y.append(y)
    hh.append(h)

Hmax = float("inf")
allZero = True
for i in range(0,101):
    for j in range(0,101):
        s = set()
        for k in range(N):
            key = abs(X[k] - i) + abs(Y[k] - j) + hh[k]
            if h == 0:
                # H <= abs(X[k]-i) + abs(Y[k]-j)であることがわかる
                Hmax = min(abs(X[k]-i) + abs(Y[k]-j), Hmax)
            else:
                allZero = False
                s.add(key)
        if len(s) == 1:
            H = key
            Cx = i
            Cy = j

if allZero:
    print(Hmax)
else:
    print(Cx, Cy, H)

Fixed submission:
N = int(input())
X = []
Y = []
hh = []
vec = list()
G = (-1,-1,-1)

for _ in range(N):
    x, y, h = map(int, input().split())
    X.append(x)
    Y.append(y)
    hh.append(h)
    # 高さが1以上の三組を一つ取る(この場合, hi = H - |Xi - Cx| - |Yi - Cy|が成立する)
    if h >= 1:
        G = (x, y, h)

for i in range(0,101):
    for j in range(0,101):
        # 最初にHを固定する
        H = G[2] + abs(G[0] - i) + abs(G[1] - j)
        H = max(H, 0)
        flag = True
        for k in range(N):
            key = H - abs(X[k] - i) - abs(Y[k] - j)
            key = max(key, 0)
            if key != hh[k]:
                flag = False
        # 全てのkについてHが成立するとき, append
        if flag:
            vec.append((i,j,H))

if len(vec) == 1:
    print(vec[0][0], vec[0][1], vec[0][2])
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = list(map(int,input().split()))
a = [int(input()) for i in range(q)]
t = ["No"]*(n-max(a))
if k - q > 0:
        print(*["Yes"]*n,sep="\n")
        exit()
for i in range(1,max(a)+1):
    if k + a.count(i) - q > 0 :
        print("Yes")
    else:
        print("No")
print(*t,sep="\n")

Fixed submission:
n,k,q = list(map(int,input().split()))
t = [0]*n
for i in range(q):
    t[int(input())-1] += 1

print(*["Yes" if k + i - q > 0 else "No" for i in t],sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
n,k,q = list(map(int,input().split()))
a = [int(input()) for i in range(q)]
t = ["No"]*n
for i in range(1,max(a)+1):
    if k - q > 0:
        print(*["Yes"]*n,sep="\n")
        exit()
    elif k + a.count(i) - q > 0 :
        t[i-1] = "Yes"
print(*t,sep="\n")

Fixed submission:
n,k,q = list(map(int,input().split()))
t = [0]*n
for i in range(q):
    t[int(input())-1] += 1

print(*["Yes" if k + i - q > 0 else "No" for i in t],sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
for i in range(q):
    x,y = map(int,input().split())
    print(s[x-1:y].count("AC"))
    

Fixed submission:
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
b = []
for i in range(q):
    a = list(map(int,input().split()))
    b.append(str(s[a[0]-1:a[1]].count("AC")))
    b.append("\n")
print("".join(b))

Fixed submission:
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
b = []
for i in range(q):
    a = list(map(int,input().split()))
    b.append(str(s[a[0]-1:a[1]].count("AC")))
    b.append("\n")
print("".join(b))

Fixed submission:
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
a = [list(map(int,input().split())) for i in range(q)]

for i in range(q):
    print(s[a[i][0]-1:a[i][1]].count("AC"))

Fixed submission:
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = list(map(int,list(input())))
c = 0
while s :
    t = len(s)
    for i in range(t-1):
        if (s[i] == 0 and s[i+1] == 1) or (s[i] == 1 and s[i+1] == 0):
            s.remove(s[i])
            s.remove(s[i])
            c += 2
            break
    else:
        print(c)
        exit()

print(c)
    

Fixed submission:
s = input()
print(min(s.count("1"),s.count("0"))*2)
Buggy python submission (verdict: Runtime Error):
X = int(input())
a = 1
for i in range(1,X):
    for j in range(2,X):
        if i**j <= X:
            a = max(a,i**j)
        else:
            break

print(a)


Fixed submission:
a,b,c,d = map(int,input().split())
print('Yes' if abs(b-a) <= d and abs(c-b) <= d or abs(c-a) <= d else 'No')
Buggy python submission (verdict: Runtime Error):
X = int(input())
List =[]
for i in range(33):
    if i >= X:
        break
    for j in range(2,11):
        if i**j < X :
            pass
        elif i**j == X:
            List.append(i**j)
            break
        else:
            List.append(i**(j-1))
            break
print(max(List))

Fixed submission:
X = int(input())
a = 1
for i in range(1,X):
    for j in range(2,X):
        if i**j <= X:
            a = max(a,i**j)
        else:
            break

print(a)
Buggy python submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
s=sum(int(i)<x for i in input().split())
print(min(s,m-s))

Fixed submission:
a,b,x = map(int,input().split())
print('YES' if a <= x <= (a+b) else 'NO')
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
a = input().split()
a += str(x) 
b = sorted(a).index(str(x))
if b <= (len(a)-1-b):
    print(b)
else:
    print(len(a)-1-b)


Fixed submission:
n,m,x=map(int,input().split())
s=sum(int(i)<x for i in input().split())
print(min(s,m-s))

Buggy python submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
a = input().split()
a += str(X) 
b = sorted(a).index(str(X))
if b <= (len(a)-1-b):
    print(b)
else:
    print(len(a)-1-b)

Fixed submission:
n,m,x=map(int,input().split())
s=sum(int(i)<x for i in input().split())
print(min(s,m-s))

Buggy python submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
a = input().split()
a += str(X) 
b = sorted(a).index(str(X))
if b <= (len(a)-1-b):
    print(b)
else:
    print(len(a)-1-b)


Fixed submission:
n,m,x=map(int,input().split())
s=sum(int(i)<x for i in input().split())
print(min(s,m-s))
Buggy python submission (verdict: Runtime Error):
31415 92653

Fixed submission:
a,b = map(int,input().split())
c = 0
for i in range(a,b+1):
    if str(i) == str(i)[::-1]:
        c +=1   
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = [set(map(int,input().split())) for i in range(m)]

for i in range(m-1):
    for j in range(i+1,m):
        if ((a[i]|a[j])-(a[i]&a[j])) == {1,n}:
            print("POSSIBLE")
            exit()
else:
    print("IMPOSSIBLE")

Fixed submission:
n,m = map(int,input().split())
X = set()
Y = set()
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        X.add(b)
    if b == n:
        Y.add(a) 
print("IMPOSSIBLE" if not X&Y else "POSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
print(sum([1 for a in range(k+1) for b in range(k+1) for c in range(k+1) if a+b+c == s]))

Fixed submission:
k,s = map(int,input().split())
print(sum([1 for a in range(k+1) for b in range(k+1) if 0 <= s-a-b <= k]))
Buggy python submission (verdict: Runtime Error):
R=input(int())
R=R*2*(22/7)
print(R,end="")

Fixed submission:
R=input()
R=int(R)
c=R*(44/7)
print(c)
Buggy python submission (verdict: Runtime Error):
item = input().split()
fumidai_sum = 0

for i in range(int(item[0])):
  b = int(item[i])
  t = int(item[i + 1])
  
  if b > t:
    fumidai_sum += (b - t)
      
print(fumidai_sum)

Fixed submission:
num = int(input())
item = input().split()
res = 0

for i in range(num):
  if i == 0:
    continue
  b = int(item[i - 1])
  t = int(item[i])
  
  if b > t:
    res += (b - t)
    item[i] = b
    
      
print(res)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
s = input()
counter = 0

for i in range(len(s) - 4):
  for j in range(4, len(s) + 1):
      if int(float(s[i:j])) % 2019 == 0:
        counter += 1
        
print(counter)


Fixed submission:
# -*- coding: utf-8 -*-
s, w = map(int,input().split())
if s-w > 0:
  print('safe')
else:
  print('unsafe')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a, b, c, d = map(int, input().slice())

while True:
  c -= b
  if c <=0:
    print('Yes')
    break
  a -= d
  if a <= 0:
    print('No')
    break

Fixed submission:
# -*- coding: utf-8 -*-

a, b, c, d = map(int, input().split())

while True:
  c -= b
  if c <= 0:
    print('Yes')
    break
  
  a -= d
  if a <= 0:
    print('No')
    break
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())

s_list = []
for i in range(n):
  s_tmp = input()
  if s_tmp not in s_list:
    s_list.append(s_tmp)
    
print(len(s_list))


Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
s_set = {input() for i in range(n) }
print(len(s_set))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())

s_list = []
for i in range(n):
  s_tmp = input()
  if not s_tmp in s_list:
    s_list.append(s_tmp)

print(len(s_list))

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
s_set = {input() for i in range(n) }
print(len(s_set))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import math

K = int(input())
ans_list = []
ans = 0
for a in range(1, K+1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans_list = [a, b, c]
            gcd_ans = ans_list[0]
            for item in ans_list:
                gcd_ans = math.gcd(gcd_ans, item)
            ans += gcd_ans
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
import math
 
K = int(input())
ans_list = []
ans = 0
for a in range(1, K+1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans_list = [a, b, c]
            gcd_ans = ans_list[0]
            for item in ans_list:
                gcd_ans = math.gcd(gcd_ans, item)
            ans += gcd_ans
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n,k=input().split()
n=int(n)
k=int(k)
for i in range(1,k+1):
    x=math.factorial(n-k+1)/(math.factorial(n-k+1-i)*math.factorial(i))
    y=math.factorial(k-1)/(math.factorial(k-i)*math.factorial(i-1))
    ans=x*y%(10**9+7)
    print(int(ans))

Fixed submission:
S = sorted(input())
if len(set(S)) == 2 and S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
	print("Yes")
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[int(i) for i in input().split()]
ans=0
for x in range(1,n-1):
    a=p[x-1]
    b=p[x]
    c=p[x+1]
    if a<b<c or c<b<a:
        ans+=1
print(ans)

Fixed submission:
S = sorted(input())
if len(set(S)) == 2 and S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[int(i) for i in input().split()]
ans=0
for x in range(2,n):
    a=p[x-1]
    b=p[x]
    c=p[x+1]
    if a<b<c or c<b<a:
        ans+=1
print(ans)

Fixed submission:
n=int(input())
p=[int(i) for i in input().split()]
ans=0
for x in range(1,n-1):
    a=p[x-1]
    b=p[x]
    c=p[x+1]
    if a<b<c or c<b<a:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
s=[int(i) for i in input().split()]
if s[1]==s[2] or s[2]==s[3] or s[3]==s[4]:
    print("Bad")
else:
    print("Good")

Fixed submission:
s=input()
if int(s[0])==int(s[1]) or int(s[1])==int(s[2]) or int(s[2])==int(s[3]):
    print("Bad")
else:
    print("Good")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[map(int,input().split())]
A_sort=sorted(A)
Alice=[]
Bob=[]
if N%2==0:
    for i in range(int(N/2)):
        Alice.append(A_sort(2*i+1))
        Bob.append(A_sort(2*i))
else:
    for i in range(int(N/2+1)):
        Alice.append(A_sort(2*i))
    for i in range(int(N/2)):
        Bob.append(A_sort(2*i+1))
Alice_sum=sum(Alice)
Bob_sum=sum(Bob)
ans=Alice_sum-Bob_sum
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A_sort=sorted(A)
Alice=[]
Bob=[]
if N%2==0:
    for i in range(int(N/2)):
        Alice.append(A_sort[2*i+1])
        Bob.append(A_sort[2*i])
else:
    for i in range(int(N/2+1)):
        Alice.append(A_sort[2*i])
    for i in range(int(N/2)):
        Bob.append(A_sort[2*i+1])
Alice_sum=sum(Alice)
Bob_sum=sum(Bob)
ans=Alice_sum-Bob_sum
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def FindSumOfDigits(n):
    Sum=0
    while(n>0):
        Sum+=(int(n%10))
        n=n/10
    return Sum

N,A,B=map(int,input().split())
ans=0
ans_list=[]
sumlist=[]
for i in range(1,N+1):
    sumlist.append(FindSumOfDigits(i))
    if A<=FindSumOfDigits(i)<=B:
        ans+=i
        ans_list.append(i)
print(ans)
#print(ans_list)
#print(sum_list)

Fixed submission:
N,A,B=map(int,input().split())
Z=[]
for n in range(1,N+1):
    ns=str(n)
    len_ns=len(ns)
    total=0
    for x in range(len_ns):
        total=total+int(ns[x])
    if A<=total<=B:
        Z.append(n)
print(sum(Z))
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
count=0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k==S:
                count+=1
print(count)

Fixed submission:
K,S=map(int,input().split())
count=0
for i in range(K+1):
    for j in range(K+1):
        if 0<=S-i-j<=K:
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
def main():
    N = input()
    if int(N) < 1 or int(N) >= 2*10**5:
        raise ValueError
    A = []
    for i in input().split():
        if int(i) < 1 or int(i) >= 10**9:
            raise ValueError
        A.append(int(i))
    temp = A[0]
    su = 0
    for i in A:
        if i >= temp:
            height = 0
        else:
            height = temp-i
        temp = i + height
        su += height
    print(su)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    temp = A[0]
    su = 0
    for i in range(1, N):
        if A[i - 1] > A[i]:
            su += A[i - 1] - A[i]
            A[i] = A[i - 1]
    print(su)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
x, k, d = input().split()
x = int(x)
k = int(k)
d = int(d)
x = abs(x)
if x > d:
  if  x // d > k:
    x = x - k*d
    print(x)
    exit()
  else:
  	k -= x // d
    x = x % d
    
    
if k % 2 == 1:
  x = abs(x-d)

print(x)
    

Fixed submission:
x, k, d = input().split()
x = int(x)
k = int(k)
d = int(d)
x = abs(x)
if x > d:
  if  x // d > k:
    x = x - k*d
    print(x)
    exit()
  else:
  	k -= x // d
  	x = x % d
    
    
if k % 2 == 1:
  x = abs(x-d)

print(x)
Buggy python submission (verdict: Runtime Error):
n, d = input().split()
n = int(n)
d = int(d)
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
c = 0

for i in range(n):
  if x[i]*x[i]+y[i]*y[i] <= d*d:
    c +=1

print(c)

Fixed submission:
a = int(input())

if a < 30:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
n, d = input().split()
n = int(n)
d = int(d)
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
c = 0

for i in range(n):
  if x[i]*x[i]+y[i]*y[i] <= d*d:
    c +=1

print(c)

Fixed submission:
n, d = input().split()
n = int(n)
d = int(d)
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
c = 0

for i in range(n):
  if x[i]*x[i]+y[i]*y[i] <= d*d:
    c +=1

print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
a = [str(c) for c in s]

def sea(a, z, n):
  while z[0] < n-1:
    if a[z[0]] == 'W':
      break
    z[0] += 1
    
  while z[1] > 0:
    if a[z[1]] == 'R':
      break
    z[1] += 1
  
  return(z)

z = [0, n-1]

z = a(a, z, n)
c = 0
while z[0] < z[1]:
  a[z[0]], a[z[1]] = a[z[1]], a[z[0]]
  c += 1
  z = a(a,z,n)
  
print(c)

Fixed submission:
n = int(input())
s = input()
a = [str(c) for c in s]

def sea(a, x, y, n):
  while x < n-1:
    if a[x] == 'W':
      break
    x += 1
    
  while y > 0:
    if a[y] == 'R':
      break
    y -= 1
  
  return[x, y]

z = [0, n-1]

z = sea(a, z[0] ,z[1], n)
c = 0
while z[0] < z[1]:
  a[z[0]], a[z[1]] = a[z[1]], a[z[0]]
  c += 1
  z = sea(a,z[0], z[1],n)
  
print(c)

Buggy python submission (verdict: Runtime Error):
n= int(input())
s = input()
a = [str(c) for c in s]

z = [0, n-1]


def search(a,n,x,y):
  x1 = x
  y1 = y

  for i in range(n):
    x = x1 + i
    if a[x1 +i] == 'W':
      break
  for i in range(n):
    y = y1 -i
    if a[y1-i] == 'R':
      break
  return[x, y]

c = 0

while True:
  z = search(a, n, z[0],z[1])
  if z[0] > z[1]:
    break
  else:
    c +=1
    a[z[0]], a[z[1]] = a[z[1]], a[z[0]]
  
  
    
print(c)

Fixed submission:
n = int(input())
s = input()
a = [str(c) for c in s]

def sea(a, x, y, n):
  while x < n-1:
    if a[x] == 'W':
      break
    x += 1
    
  while y > 0:
    if a[y] == 'R':
      break
    y -= 1
  
  return[x, y]

z = [0, n-1]

z = sea(a, z[0] ,z[1], n)
c = 0
while z[0] < z[1]:
  a[z[0]], a[z[1]] = a[z[1]], a[z[0]]
  c += 1
  z = sea(a,z[0], z[1],n)
  
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
s = input()
a = [str(c) for c in s]




def search(a,n):
  x = 0
  y = n-1
  for i in range(n):
    x = i
    if a[i] == 'W':
      break
  for i in range(n):
    y = n-i-1
    if a[n-i-1] == 'R':
      break
  return[x, y]

c = 0

for i in range(n):
  z = search(a, n)
  if z[0] < z[1]:
    a[z[0]], a[z[1]] =a[z[1]], a[z[0]]
    c += 1
  else:
    break
    
print(c)

Fixed submission:
n = int(input())
s = input()
a = [str(c) for c in s]

def sea(a, x, y, n):
  while x < n-1:
    if a[x] == 'W':
      break
    x += 1
    
  while y > 0:
    if a[y] == 'R':
      break
    y -= 1
  
  return[x, y]

z = [0, n-1]

z = sea(a, z[0] ,z[1], n)
c = 0
while z[0] < z[1]:
  a[z[0]], a[z[1]] = a[z[1]], a[z[0]]
  c += 1
  z = sea(a,z[0], z[1],n)
  
print(c)
Buggy python submission (verdict: Runtime Error):
s = input()
a = [str(c) for c in s]
t = input()
b = [str(c) for c in s]

c = 0

for i in range(n):
  if a[i] == b[i]:
    c +=1

print(n-c)

Fixed submission:
s = input()
a = [str(c) for c in s]
t = input()
b = [str(c) for c in t]

c = 0
n = len(a)
for i in range(n):
  if a[i] == b[i]:
    c +=1

print(n-c)
Buggy python submission (verdict: Runtime Error):
s = inpu()
if s == 'ARC':
  print('ABC')
else:
  print('ARC')

Fixed submission:
s = input()
if s == 'ARC':
  print('ABC')
else:
  print('ARC')
Buggy python submission (verdict: Runtime Error):
a, n = input().split()
a = int(a)
n = int(n)
p = list(map(int, input().split()))

c = 0
for i in range n:
  c += p[i]
  
if c > a:
  print(-1)
else:
  print(a-c)


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

c = 0
for i in range(n):
  c += p[i]
  
if c > a:
  print(-1)
else:
  print(a-c)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n+1):
  print(a.count(i))



Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)

for i in range(n-1):
  b[a[i]] += 1

for i in range(1,n+1):
  print(b[i])

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

for i in range(1, n+1):
  print(a.count[i])
	

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)

for i in range(n-1):
  b[a[i]] += 1

for i in range(1,n+1):
  print(b[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)

for i in range(1, n+1):
  b[i] = a.count(i)
  
for i in range(1, n+1):
  print(b[i])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)

for i in range(n-1):
  b[a[i]] += 1

for i in range(1,n+1):
  print(b[i])
Buggy python submission (verdict: Runtime Error):
s = input()
a = [int(c) for c in s]

if bool(a[0]!=7 and a[1]!=7 and a[2]!=7):
        print("No")
else
        print("Yes")


Fixed submission:
s = input()
a = [int(c) for c in s]

if bool(a[0]!=7 and a[1]!=7 and a[2]!=7):
        print("No")
else:
        print("Yes")

Buggy python submission (verdict: Runtime Error):
s = input()
a = [int(c) for c in s]

if bool(a[0]!=7 and a[1]!=7 and a[2]!=7:
        print("No")
else
        print("Yes")

Fixed submission:
s = input()
a = [int(c) for c in s]

if bool(a[0]!=7 and a[1]!=7 and a[2]!=7):
        print("No")
else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
n, m = input().split()
n = int(n)
m = int(m)
c=0
for i in range(n):
  c += a[i]
v = c/(4*m)
a = list(map(int, input().split()))
a.sort(reverse = True)
if a[m-1] < v:
  print('No')
else:
  print('Yes')


Fixed submission:
n, m = input().split()
n = int(n)
m = int(m)
c=0

a = list(map(int, input().split()))
for i in range(n):
  c += a[i]
v = c/(4*m)
a.sort(reverse = True)
if a[m-1] < v:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
import math
n, m = input().split()
n = int(n)
m = int(m)

print(int(math.factorial(n)/(2 * math.factorial(n-2)) + math.factorial(m)/(2 * math.factorial(m-2))))



Fixed submission:
import math
n, m = input().split()
n = int(n)
m = int(m)
x = 0
y = 0
if n > 1:
  x = int(math.factorial(n)/(2 * math.factorial(n-2)))
if m > 1:
  y = int(math.factorial(m)/(2 * math.factorial(m-2)))

print(x+y)

Buggy python submission (verdict: Runtime Error):
import math
n, m = input().split()
n = int(n)
m = int(m)

print(int(math.factorial(n)/(2 * math.factorial(n-2)) + math.factorial(m)/(2 * math.factorial(m-2))))



Fixed submission:
import math
n, m = input().split()
n = int(n)
m = int(m)
x = 0
y = 0
if n > 1:
  x = int(math.factorial(n)/(2 * math.factorial(n-2)))
if m > 1:
  y = int(math.factorial(m)/(2 * math.factorial(m-2)))

print(x+y)

Buggy python submission (verdict: Runtime Error):
n, m = input().split()
n = int(n)
m = int(m)

print(n!/(2 * (n-2)!) + m!/(2 * (n-2)!))

Fixed submission:
import math
n, m = input().split()
n = int(n)
m = int(m)
x = 0
y = 0
if n > 1:
  x = int(math.factorial(n)/(2 * math.factorial(n-2)))
if m > 1:
  y = int(math.factorial(m)/(2 * math.factorial(m-2)))

print(x+y)
Buggy python submission (verdict: Runtime Error):
n = int(input())

s = input()
a = [str(c) for c in s]

c = 0

for i in range(n):
  if a[i] == 'A' and a[i+1] == 'B' and a[i+2] == 'C':
    c +=1
  else:
    continue
    
print(c)

Fixed submission:
n = int(input())

s = input()
a = [str(c) for c in s]

c = 0

for i in range(n-2):
  if a[i] == 'A' and a[i+1] == 'B' and a[i+2] == 'C':
    c +=1
  else:
    continue
    
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())

b = list(map(int, input().split()))

a[0]=b[0]
a[n-1]=b[n-2]

for i in range(1, n-1):
  if b[i] >= b[i-1]:
    a[i] = b[i-1]
  else:
    a[i] = b[i]

c = 0

for i in range(n):
  c += a[i]
print(c)
  
    
  
  

Fixed submission:
n = int(input())

b = list(map(int, input().split()))
a=[0]*n
a[0]=b[0]
a[n-1]=b[n-2]

for i in range(1, n-1):
	if b[i]>=b[i-1]:
		a[i]=b[i-1]
	else:
		a[i]=b[i]
s = 0
for i in range(n):
	s += a[i]
	
print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n):
  if a[i] != i + 1:
    c+=1
    
if c == 0 or c == 2:
  print('YES')
  
else:
  print('NO')


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

if (a + b) % 2 ==0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')