Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
n = [0] * N
for i in range(N):
    n[A[i]-1] += 1

for j in range(N):
    print(n[j])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
n = [0] * N
#A_2 A_3 ... A_N とA_1をのぞいて続くのでN-1となる
for i in range(N-1):
    n[A[i]-1] += 1

for j in range(N):
    print(n[j])

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
n = [0] * N
for i in range( N):
    n[A[i]-1] += 1

for j in range(N):
    print(n[j])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
n = [0] * N
#A_2 A_3 ... A_N とA_1をのぞいて続くのでN-1となる
for i in range(N-1):
    n[A[i]-1] += 1

for j in range(N):
    print(n[j])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
n = [0] * N
for i in range(1, N+1):
    c = A.count(i)
    n[i-1] = c
for j in range(N):
    print(n[j])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
n = [0] * N
#A_2 A_3 ... A_N とA_1をのぞいて続くのでN-1となる
for i in range(N-1):
    n[A[i]-1] += 1

for j in range(N):
    print(n[j])
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
           ans += math.gcd(math.gcd(i, j), k)
print(ans)

Fixed submission:
import math
K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        a = math.gcd(i,j)
        for k in range(1, K+1):
           ans += math.gcd(a, k)
print(ans)
Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
p = list(map(int, input().split()))

for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break

Fixed submission:
N, K = list(map(int, input().split()))
a = N // K
b = N % K
print(min(abs(N - K * a), abs(b - K)))
Buggy python submission (verdict: Time Limit Exceeded):
L = int(input())
ans = [0]
for i in range(1, 350):
    for j in range(1, 350):
        for k in range(1, 350):
            if i + j + k == L:
                ans.append(i*j*k)
print(max(ans))

Fixed submission:
L = int(input())

a=b=c=L/3
print(a*b*c)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

for X in range(10**N):
  X = str(X)
  
  #all　すべてがtrueならという意味
  if len(X) == N and all(X[s-1] == str(c) for s, c in SC):
    print(X[s-1])
    break
else:
  print(-1)

Fixed submission:
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]
 
for X in range(10**N):
  X = str(X)
  
  #all　すべてがtrueならという意味
  if len(X) == N and all(X[s-1] == str(c) for s, c in SC):
    print(X)
    break
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = {input() for _ in range(n)}
dic={}

#各単語の出現回数を数える
for i in range(n):
    if arr[i] not in dic:
        dic[arr[i]] = 1
    else:
        dic[arr[i]] += 1
#最大の出現回数を求める
largest = max(dic.values())
ans = []

for keys in dic.keys():
    if dic[keys] == largest:
        ans.append(keys)
#単語を辞書順に並べ替えて出力する
ans = sorted(ans)

for words in ans:
    print(words)

Fixed submission:
n=int(input())
arr=[input() for _ in range(n)]
dic={}
for i in range(n): #各単語の出現回数を数える
 if arr[i] not in dic:
   dic[arr[i]]=1
 else:
   dic[arr[i]]+=1
largest=max(dic.values()) #最大の出現回数を求める
ans=[]
for keys in dic.keys():
 if dic[keys]==largest: #出現回数が最も多い単語を集計する
   ans.append(keys)
ans=sorted(ans) #単語を辞書順に並べ替えて出力する
for words in ans:
 print(words)

Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = {input() for _ in range(n)}
dic={}

#各単語の出現回数を数える
for i in range(n):
    if arr[i] not in dic:
        dic[arr[i]] = 1
    else:
        dic[arr[i]] += 1
#最大の出現回数を求める
largest = max(dic.values())
ans = []

for keys in dic.keys():
    if dic[keys] == largest:
        ans.append(keys)
#単語を辞書順に並べ替えて出力する
ans = sorted(ans)

for words in ans:
    print(words)

Fixed submission:
n=int(input())
arr=[input() for _ in range(n)]
dic={}
for i in range(n): #各単語の出現回数を数える
 if arr[i] not in dic:
   dic[arr[i]]=1
 else:
   dic[arr[i]]+=1
largest=max(dic.values()) #最大の出現回数を求める
ans=[]
for keys in dic.keys():
 if dic[keys]==largest: #出現回数が最も多い単語を集計する
   ans.append(keys)
ans=sorted(ans) #単語を辞書順に並べ替えて出力する
for words in ans:
 print(words)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    s = input()
    S.append(s)

ret = [letter for letter,count in S.most_common() if count == S.most_common()[0][1]]
print(ret)

Fixed submission:
n=int(input())
arr=[input() for _ in range(n)]
dic={}
for i in range(n): #各単語の出現回数を数える
 if arr[i] not in dic:
   dic[arr[i]]=1
 else:
   dic[arr[i]]+=1
largest=max(dic.values()) #最大の出現回数を求める
ans=[]
for keys in dic.keys():
 if dic[keys]==largest: #出現回数が最も多い単語を集計する
   ans.append(keys)
ans=sorted(ans) #単語を辞書順に並べ替えて出力する
for words in ans:
 print(words)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
Nl = list(range(1, N+1))
p = list(itertools.permutations(Nl,N))
c1 = 1
c2 = 1
for v in range(math.factorial(N)):
    if list(p[v]) == P:
        break
    else:
        c1 += 1
for v in range(math.factorial(N)):
    if list(p[v]) == Q:
        break
    else:
        c2 += 1
print(abs(c1-c2))

Fixed submission:
import itertools
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
Nl = list(range(1, N+1))
p = list(itertools.permutations(Nl,N))
NN = math.factorial(N)
c1 = 1
c2 = 1
for v in range(NN):
    if list(p[v]) == P:
        break
    else:
        c1 += 1
for v in range(NN):
    if list(p[v]) == Q:
        break
    else:
        c2 += 1
print(abs(c1-c2))
Buggy python submission (verdict: Runtime Error):
A, B ,K = list(map(int, input(),split()))
for k in range(K):
  if A>0:
    A -= 1
  elif A=0 and B>0:
    B -= 1
  else:
    break
else:
  print(A B)

Fixed submission:
A, B ,K = list(map(int, input().split()))
if A > K:
  print(A-K, B)
else:
  b = B-(K-A) if B>(K-A) else "0"
  print(0, b)
Buggy python submission (verdict: Runtime Error):
n1 = int(input())
n2 = int(input())
 
print(n1)
print(n2)
 
if n1 == 1:
  if n2 == 2:
    print("3")
  else:
    print("2")
else n1 == 2:
  if n2 == 1:
    print("3")
  else:
    print("1")
else n1 ==3:
  if n2 == 1:
    print("2"):
  else:
    print("1"):

Fixed submission:
n1 = int(input())
n2 = int(input())
 
#print(n1)
#print(n2)
 
if n1 == 1:
  if n2 == 2:
    print("3")
  else:
    print("2")
elif n1 == 2:
  if n2 == 1:
    print("3")
  else:
    print("1")
elif n1 ==3:
  if n2 == 1:
    print("2")
  else:
    print("1")

Buggy python submission (verdict: Runtime Error):
n1 = int(input())
n2 = int(input())
 
#print(n1)
#print(n2)
 
if n1 == 1:
  if n2 == 2:
    print("3")
  else:
    print("2")
else n1 == 2:
  if n2 == 1:
    print("3")
  else:
    print("1")
else n1 ==3:
  if n2 == 1:
    print("2")
  else:
    print("1")

Fixed submission:
n1 = int(input())
n2 = int(input())
 
#print(n1)
#print(n2)
 
if n1 == 1:
  if n2 == 2:
    print("3")
  else:
    print("2")
elif n1 == 2:
  if n2 == 1:
    print("3")
  else:
    print("1")
elif n1 ==3:
  if n2 == 1:
    print("2")
  else:
    print("1")

Buggy python submission (verdict: Runtime Error):
n1 = int(input())
n2 = int(input())

#print(n1)
#print(n2)

if n1 == 1:
  if n2 == 2:
    print("3")
  else:
    print("2")
else n1 == 2:
  if n2 == 1:
    print("3")
  else:
    print("1")
else n1 ==3:
  if n2 == 1:
    print("2"):
  else:
    print("1"):


Fixed submission:
n1 = int(input())
n2 = int(input())
 
#print(n1)
#print(n2)
 
if n1 == 1:
  if n2 == 2:
    print("3")
  else:
    print("2")
elif n1 == 2:
  if n2 == 1:
    print("3")
  else:
    print("1")
elif n1 ==3:
  if n2 == 1:
    print("2")
  else:
    print("1")
Buggy python submission (verdict: Runtime Error):
N = int(input())

S = input()
T = input()

#print(S)
#print(len(S))
#print(len(T))

moji = ""

if(len(S) == len(T) == N):
  for i in range(0, N):
    str = (S + T)[i::N]
    moji += str
print(moji)

Fixed submission:
N = int(input())

S, T = map(str, input().split())

#print(S)
#print(len(S))
#print(len(T))

moji = ""

if(len(S) == len(T) == N):
  for i in range(0, N):
    str = (S + T)[i::N]
    moji += str
print(moji)

Buggy python submission (verdict: Runtime Error):
N = int(input())

S = input()
T = input()

if(len(S) == len(T) == N):
  print("OK")

Fixed submission:
N = int(input())

S, T = map(str, input().split())

#print(S)
#print(len(S))
#print(len(T))

moji = ""

if(len(S) == len(T) == N):
  for i in range(0, N):
    str = (S + T)[i::N]
    moji += str
print(moji)
Buggy python submission (verdict: Runtime Error):
import fractions

A, B = map(int, input.split())

print(A * B // fractions.gcd(a, b))



Fixed submission:
import fractions
a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = []
xy = []
for i in range(N):
    a =  int(input())
    A.append(a)
    for j in range(a):
        x, y = map(int, input().split())
        #２次元配列
        xy.append([x, y])
print(xy)

honest = 0

for i in range(1, 2**N):
    flag = 0
    for j in range(N):
        # j番目が正直と仮定する
        if (i>>j)&1 == 1:
            for x,y in xy[j]:
                # j番目は正直だが矛盾を発見
                if (i>>x)&1 != y:
                    flag = 1
                    break
    # 矛盾がある場合はflag == 1になる
    if flag == 0:
        honest = max(honest, bin(i)[2:].count('1'))
print(honest)

Fixed submission:
N = int(input())
 
testimony = [[] for _ in range(N)]
 
for i in range(N):
    num = int(input())
    for j in range(num):
        person, state = map(int, input().split())
        testimony[i].append([person-1, state])
        
honest = 0
for i in range(1, 2**N):
    flag = 0
    for j in range(N):
        if (i>>j)&1 == 1: # j番目は正直と仮定
            for x,y in testimony[j]:
                if (i>>x)&1 != y: # j番目は正直だが矛盾を発見
                    flag = 1
                    break
    if flag == 0:  # 矛盾がある場合はflag == 1になる
        honest = max(honest, bin(i)[2:].count('1'))  # 1の数をカウントし最大となるものを選択
print(honest)
Buggy python submission (verdict: Runtime Error):
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S = input()
N = int(input())

for i in S:
  b = a.index(i) + N
  if b<=25:
    print(a[b], end="")
  else:
    print(a[b-26], end="")


Fixed submission:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
 
for i in S:
    b = a.index(i) + N
    if b <= 25:
        print(a[b], end="")
    else:
        print(a[b-26], end="")

Buggy python submission (verdict: Runtime Error):
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S = input()
N = int(input())

for i in S:
  b = a.index(i) + N
  if b<=25:
    print(a[b], end="")
  else:
    print(a[b-25], end="")


Fixed submission:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
 
for i in S:
    b = a.index(i) + N
    if b <= 25:
        print(a[b], end="")
    else:
        print(a[b-26], end="")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

if(N%2 == 0):
  n = N/2
  if(S[0:(n/2-1)] == S[n/2:N]):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed submission:
N = int(input())
S = input()

if(N%2 == 0):
  #Pythonでは、//で整数の商、%で余り（剰余、mod）が算出
  n = N//2
  #[:n] 0~n-1 [n:] n~最後まで
  if(S[:n] == S[n:]):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

if(S.len()%2 == 0):
  n = (S.len())/2
  if(S[0:(n/2-1)] == S[n/2:n]):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed submission:
N = int(input())
S = input()

if(N%2 == 0):
  #Pythonでは、//で整数の商、%で余り（剰余、mod）が算出
  n = N//2
  #[:n] 0~n-1 [n:] n~最後まで
  if(S[:n] == S[n:]):
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())

xi = []
yi = []

for i in range(N):
    x = int(input())
    y = int(input())
    xi.append(x)
    yi.append(x)
    
result = 0
for i in range(N):
    for j in range(N):
        if i != j : 
            result += math.sqrt((xi[j] - xi[i])**2 + (yi[j] - yi[i])**2)
            
print(result/N)

Fixed submission:
import math
N = int(input())
#https://qiita.com/jamjamjam888/items/e066b8c7bc85487c0785
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
l = 0

for j in range(N):
    for k in range(N):
        if j >= k:
            continue
        l += math.sqrt((x[j] - x[k])**2 + (y[j] - y[k]) ** 2)

print(l * 2/N)
Buggy python submission (verdict: Runtime Error):
A, B = int(input())
if(A>9 or B>9):
  print("-1")
elif(A>10 and B>10):
  print("-1")
else:
  ans=A*B
  print(ans)

Fixed submission:
A, B = map(int, input().split())
if(A>9 or B>9):
  print("-1")
elif(A>10 and B>10):
  print("-1")
else:
  ans=A*B
  print(ans)

Buggy python submission (verdict: Runtime Error):
A, B = int(input())
if(A>9 or B>9):
  print("-1")
else:
  print(A*B)

Fixed submission:
A, B = map(int, input().split())
if(A>9 or B>9):
  print("-1")
elif(A>10 and B>10):
  print("-1")
else:
  ans=A*B
  print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if(A>9 or B>9):
  print("-1")
elif(A>10 and B>10):
  print("-1")
else:
  ans=A*B
  print(ans)

Fixed submission:
N = int(input())
for i in range(1,10):
    for j in range(1,10):
        ij = i * j
        if(N == i*j):
            print("Yes")
            exit(0)
print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = [int(x) for x in input().split()]
t = 0
for i in itertools.permutations(d, N):
    t += i[0]*i[1]
print(total)

Fixed submission:
N = int(input())
d = [int(x) for x in input().split()]
t = 0
for i in range(N-1):
    for j in range(i+1, N):
      t += d[i]*d[j]
print(t)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = [int(x) for x in input().split()]
total = 0
for i in itertools.permutations(d, N):
    total = i[0]*i[1]
print(total)

Fixed submission:
N = int(input())
d = [int(x) for x in input().split()]
t = 0
for i in range(N-1):
    for j in range(i+1, N):
      t += d[i]*d[j]
print(t)
Buggy python submission (verdict: Runtime Error):
S = input()
if(S == "Sunny"):
  print("Cloudy")
elif(S == "Cloudy"):
  print("Rainy")
else;
  print("Sunny")

Fixed submission:
S = input()
if(S == "Sunny"):
  print("Cloudy")
elif(S == "Cloudy"):
  print("Rainy")
else:
  print("Sunny")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
c = 0

for i in range(A-2):
    c += B[i]
print(c+B[N-1]+C[N-2])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
c = 0

pre = 0
for i in range(N):
    now = A[i] - 1
    c += B[now]
    if i != 0 and pre == now - 1:
        c += C[pre]
    pre = now
print(c)
Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
result = (A+B)/2 if A%2 == B%2 else "IMPOSSIBLE"
print(int(result))


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

Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
result = (A+B)/2 if (A+B)%2 == 0 else "IMPOSSIBLE"
print(int(result))


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

Buggy python submission (verdict: Runtime Error):
A, B = list(map(int, input().split()))
resutl = (A+B)/2 if (A+B)%2 == 0 else "IMPOSSIBLE"
print(result)

Fixed submission:
A, B = list(map(int, input().split()))
result = (A+B)//2 if (A+B)%2 == 0 else "IMPOSSIBLE"
print(result)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
c = 0
for i in range(1, N+1):
    if i == p[i]:
        c += 1
if c == 0 or c == 2:
    print("YES")
else:
    print("NO")

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
c = 0
for i in range(1, N+1):
    if i != p[i-1]:
        c += 1
if c == 0 or c == 2:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())
N = (a * b) % 2

if N == 0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a, b = map(int, input().split())
N = (a * b) % 2

if N == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if(c >= a && c <= b):
  print("Yes")
else:
  print("No")
    



Fixed submission:
a, b, c = map(int, input().split())
if(c >= a and c <= b):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())


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

s=1
for i in A:
    s=s*i

if s>10**(18):
    print(-1)
else:
    print(s)

Fixed submission:

N = int(input())


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

s=1

if 0 in A:
    print(0)
else:
    for i in range(N):
        if s > 10 ** (18):
            s=-1
            break
        s=s*A[i]

    if s > 10 ** (18):
        print(-1)
    else:
        print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

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

S = [list(map(int, input().split())) for i in range(M)]

d=set(list(range(N)))

for i in range(M):
    if H[S[i][0]-1]<H[S[i][1]-1]:
        d=d-set([S[i][0]-1])
    elif H[S[i][0]-1]>H[S[i][1]-1]:
        d=d-set([S[i][1]-1])
    elif H[S[i][0]-1]==H[S[i][1]-1]:
        d=d - set([S[i][0] - 1,S[i][1] - 1])

print(len(d))

Fixed submission:

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

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

S = [list(map(int, input().split())) for i in range(M)]

d=set(list(range(N)))

v=[]

for i in range(M):
    if H[S[i][0]-1]<H[S[i][1]-1]:
        v.append(S[i][0]-1)
    elif H[S[i][0]-1]>H[S[i][1]-1]:
        v.append(S[i][1]-1)
    elif H[S[i][0]-1]==H[S[i][1]-1]:
        v.append(S[i][0]-1)
        v.append(S[i][1] - 1)

u=set(v)

d=d-u

print(len(d))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

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

S = [list(map(int, input().split())) for i in range(M)]

d=list(range(N))

for i in range(M):
    if H[S[i][0]-1]<H[S[i][1]-1] and (S[i][0]-1) in d:
        d.remove(S[i][0]-1)
    elif H[S[i][0]-1]>H[S[i][1]-1] and (S[i][1]-1) in d:
        d.remove(S[i][1]-1)
    elif H[S[i][0]-1]==H[S[i][1]-1]:
        if (S[i][0]-1) in d:
            d.remove(S[i][0] - 1)
        if (S[i][1] - 1) in d:
            d.remove(S[i][1] - 1)

print(len(d))

Fixed submission:

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

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

S = [list(map(int, input().split())) for i in range(M)]

d=set(list(range(N)))

v=[]

for i in range(M):
    if H[S[i][0]-1]<H[S[i][1]-1]:
        v.append(S[i][0]-1)
    elif H[S[i][0]-1]>H[S[i][1]-1]:
        v.append(S[i][1]-1)
    elif H[S[i][0]-1]==H[S[i][1]-1]:
        v.append(S[i][0]-1)
        v.append(S[i][1] - 1)

u=set(v)

d=d-u

print(len(d))
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())

if N<=K:
    while K<2*N:
        N=abs(N-k)
    print(N)
else:
    R=N%K
    print(min(R,K-R))

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

if N<=K:
    while K<2*N:
        N=abs(N-K)
    print(N)
else:
    R=N%K
    print(min(R,K-R))
Buggy python submission (verdict: Runtime Error):
S = input()

if S==hi or S==hihi or S==hihihi or S==hihihihi or S==hihihihihi:
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()

if S=='hi' or S=='hihi' or S=='hihihi' or S=='hihihihi' or S=='hihihihihi':
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B= map(int, input().split())

s=0
c=0
while c+A<N:
    c=c+A+B
    s=s+A

if c>=N:
    print(s)
else:
    print(s+N-c)

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

c=(A+B)*(N//(A+B))
s=A*(N//(A+B))

if c+A<=N:
    print(s+A)
else:
    print(s+N-c)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
s=0
 
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
 
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
 
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
 
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
 
    return result
 
s=(2**n)-cmb(n,a)-cmb(n,b)-1
 
print(s%(10**9+7))

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

if N>=10:
    print(R)

else:
    print(R+100*(10-N))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N=int(input())
S = [input() for i in range(N)]
A=[]

P=collections.Counter(S)

A = [k for k, v in P.items() if v == max(P.values())]

A0=set(A)
A1=list(A0)
A1.sort()

for List in A1:
    print(List)

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

P=collections.Counter(S)

y=max(P.values())
A = [k for k, v in P.items() if v == y]

A.sort()

for List in A:
    print(List)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S = [input() for i in range(N)]
P=[]
P0=[]
A=[]
for i in range(len(S)):
    c=S.count(S[i])
    P0.append(c)
    if i==0:
        P.append(c)
    elif P[-1] < c:
        P.append(c)

for k in range(len(P0)):
    if P0[k]==P[-1]:
        A.append(S[k])

A0=set(A)
A1=list(A0)
A1.sort()

for List in A1:
    print(List)

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

P=collections.Counter(S)

y=max(P.values())
A = [k for k, v in P.items() if v == y]

A.sort()

for List in A:
    print(List)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S = [input() for i in range(N)]
P=[]
A=[]
for i in range(len(S)):
    P.append(S.count(S[i]))

for k in range(len(P)):
    if P[k]==max(P):
        A.append(S[k])

A0=set(A)
A1=list(A0)
A1.sort()

for List in A1:
    print(List)

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

P=collections.Counter(S)

y=max(P.values())
A = [k for k, v in P.items() if v == y]

A.sort()

for List in A:
    print(List)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S = [input() for i in range(N)]
P={}
A=[]
for i in range(len(S)):
    P[S[i]] = S.count(S[i])

m=P[S[0]]
for k in range(len(S)):
    if m<P[S[k]]:
        m=P[S[k]]

for k in range(len(S)):
    if P[S[k]]==m:
        A.append(S[k])

A0=set(A)
A1=list(A0)
A1.sort()

for List in A1:
    print(List)

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

P=collections.Counter(S)

y=max(P.values())
A = [k for k, v in P.items() if v == y]

A.sort()

for List in A:
    print(List)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S = [input() for i in range(N)]
P={}
A=[]
for i in range(len(S)):
    P[S[i]] = 0
    for j in range(len(S)):
        if S[i]==S[j]:
            P[S[i]] += 1

m=P[S[0]]
for k in range(len(S)):
    if m<P[S[k]]:
        m=P[S[k]]

for k in range(len(S)):
    if P[S[k]]==m:
        A.append(S[k])

A0=set(A)
A1=list(A0)
A1.sort()

for List in A1:
    print(List)

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

P=collections.Counter(S)

y=max(P.values())
A = [k for k, v in P.items() if v == y]

A.sort()

for List in A:
    print(List)
Buggy python submission (verdict: Runtime Error):
H, N = map(int,input().split())
A = list(map(int, input().split()))
if A[0]+A[1]+A[2]<H:
    print('No')
else:
    print('Yes')

Fixed submission:
H, N = map(int,input().split())
A = list(map(int, input().split()))
s=0
for i in range(len(A)):
    s=s+A[i]
if s<H:
    print('No')
else:
    print('Yes')