Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

M = 1000

P = [True for i in range(M+1)]
p_set = set()
for i in range(2,M+1):
  if P[i]:
    p_set.add(i)
    for j in range(2*i, M+1, i):
      P[j] = False
#print( len(p_set) )
#N = 10 ** 6
#A = [1001 for i in range(N)]

c = 0
for p in p_set:
  c_tmp = 0
  for i in range(N):
    if A[i] % p == 0:
      c_tmp += 1
      while A[i] % p == 0:
        A[i] //= p
  c = max(c, c_tmp)

dic = {}
for a in A:
  if a > M:
    if a in dic:
      dic[a] += 1
    else:
      dic[a] = 1
for v in dic.values():
  c = max(c, v)

if c == N:
  print("not coprime")
elif c < 2:
  print("pairwise coprime")
else:
  print("setwise coprime")

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
#A = [888881 for i in range(10**6)]
M = max(A)


#高速素因数分解
#前処理：その数にある最小の素因数→エラトステネスの篩で最初におとすもの
P = [1 for i in range(M+1)]
for i in range(2, M+1):
    if P[i] == 1:
        for j in range(i, M+1, i):
            if P[j] == 1:
                P[j] = i
dic = {}
for a in A:
  t_dic = {}
  x = a
  while x > 1:
    if P[x] in t_dic:
      t_dic[ P[x] ] += 1
    else:
      t_dic[ P[x] ] = 1    
    x //= P[x]
  for k in t_dic.keys():
    if k in dic:
      dic[k] += 1
    else:
      dic[k] = 1
#print(dic)
c = 0
for v in dic.values():
  c = max(c, v)

if c == len(A):
  print("not coprime")
elif c < 2:
  print("pairwise coprime")
else:
  print("setwise coprime")
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

S = [0 for i in range(H+4)]
S[0] = "#"*(W+4)
S[1] = "#"*(W+4)
S[H+2] = "#"*(W+4)
S[H+3] = "#"*(W+4)
for i in range(2, H+2):
  S[i] = "##" + input() + "##"
  
B = [ [-1 for i in range(W+4)] for i in range(H+4)]

def search(i,j,c):
  global B
  B[i][j] = c
  L = [(-1,0), (1, 0), (0, -1), (0, 1)]
  for X in L:
    if S[i+X[0]][j+X[1]] == '.' and B[i+X[0]][j+X[1]] < 0:
        search(i+X[0],j+X[1],c)
        
#<01>[2--H+1]<H+2,3>#
c = 0
for i in range(2,H+2):
  for j in range(2,W+2):
    if S[i][j] == '.' and B[i][j] < 0:
      search(i, j, c)
      c += 1

Cc = B[Ch+1][Cw+1]
Dc = B[Dh+1][Dw+1]
dic = {i:set() for i in range(c)}

for i in range(2, H+2):
  for j in range(2, W+2):
    if B[i][j] >= 0:
      for x in range(-2, 3):
        for y in range(-2, 3):
          if S[i+x][j+y] == '.' and B[i][j] != B[i+x][j+y]:
            dic[B[i][j]].add(B[i+x][j+y])

ans = [-1 for i in range(c)]
ans[Cc] = 0
not_check = [1 for i in range(c)]
not_check[Cc] = 0
next_check = {Cc}
#
t = 0
while len( next_check ):
  t += 1
  tmp = set()
  for i in next_check:
    for j in dic[i]:
      if not_check[j]:
        not_check[j] = 0
        ans[j] = t
        tmp.add( j )
  next_check = {i for i in tmp}
#
print(ans[Dc])

Fixed submission:
H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())

S = [0 for i in range(H+4)]
S[0] = "#"*(W+4)
S[1] = "#"*(W+4)
S[H+2] = "#"*(W+4)
S[H+3] = "#"*(W+4)
for i in range(2, H+2):
  S[i] = "##" + input() + "##"
  
B = [ [-1 for i in range(W+4)] for i in range(H+4)]

def search(i,j,c):
  global B
  B[i][j] = c
  L = [(-1,0), (1, 0), (0, -1), (0, 1)]
  for X in L:
    if S[i+X[0]][j+X[1]] == '.' and B[i+X[0]][j+X[1]] < 0:
        search(i+X[0],j+X[1],c)
        
#<01>[2--H+1]<H+2,3>#
c = 0
for i in range(2,H+2):
  for j in range(2,W+2):
    if S[i][j] == '.' and B[i][j] < 0:
      search(i, j, c)
      c += 1

Cc = B[Ch+1][Cw+1]
Dc = B[Dh+1][Dw+1]
dic = {i:set() for i in range(c)}

for i in range(2, H+2):
  for j in range(2, W+2):
    if B[i][j] >= 0:
      for x in range(-2, 3):
        for y in range(-2, 3):
          if S[i+x][j+y] == '.' and B[i][j] != B[i+x][j+y]:
            dic[B[i][j]].add(B[i+x][j+y])

ans = [-1 for i in range(c)]
ans[Cc] = 0
not_check = [1 for i in range(c)]
not_check[Cc] = 0
next_check = {Cc}
#
t = 0
while len( next_check ):
  t += 1
  tmp = set()
  for i in next_check:
    for j in dic[i]:
      if not_check[j]:
        not_check[j] = 0
        ans[j] = t
        tmp.add( j )
  next_check = {i for i in tmp}
#
print(ans[Dc])
Buggy python submission (verdict: Time Limit Exceeded):
H, W, M = map(int, input().split())

L = [ 0 for i in range(M)]
for i in range(M):
  L[i] = tuple( map(int, input().split()) )

H_val = [ 0 for i in range(H+1)]
W_val = [ 0 for i in range(W+1)]
for i in L:
  H_val[ i[0] ] += 1
  W_val[ i[1] ] += 1
  
Hm = 0
Hs = set()
Wm = 0
Ws = set()
for i in range(1, H+1):
  if H_val[i] == Hm:
    Hs.add(i)
  elif H_val[i] > Hm:
    Hs = {i}
    Hm = H_val[i]
for i in range(1, W+1):
  if W_val[i] == Wm:
    Ws.add(i)
  elif W_val[i] > Wm:
    Ws = {i}
    Wm = W_val[i]
  
flg = False
for i in Hs:
  for j in Ws:
    if (i,j) not in L:
      flg = True
      break
  if flg:
    break
if flg:
  print( Hm + Wm )
else:
  print( Hm + Wm - 1)

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

L = [ 0 for i in range(M)]
for i in range(M):
  L[i] = tuple( map(int, input().split()) )

H_val = [ 0 for i in range(H+1)]
W_val = [ 0 for i in range(W+1)]

H_key = {}
for i in L:
  if i[0] in H_key:
    H_key[ i[0] ].add( i[1] )
  else:
    H_key[ i[0] ] = {i[1]}

for i in L:
  H_val[ i[0] ] += 1
  W_val[ i[1] ] += 1
  
Hm = 0
Hs = set()
Wm = 0
Ws = set()
for i in range(1, H+1):
  if H_val[i] == Hm:
    Hs.add(i)
  elif H_val[i] > Hm:
    Hs = {i}
    Hm = H_val[i]
for i in range(1, W+1):
  if W_val[i] == Wm:
    Ws.add(i)
  elif W_val[i] > Wm:
    Ws = {i}
    Wm = W_val[i]
  
flg = False
for i in Hs:
  for j in Ws:
    if j not in H_key[i]:
      flg = True
      break
  if flg:
    break
if flg:
  print( Hm + Wm )
else:
  print( Hm + Wm - 1)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

t = 1
for i in range(K):# A[0] ~ A[K-1]
  t *= A[i]
  
for i in range(K, N):
  temp = t // A[i-K] * A[i]
  if t < temp:
    print('Yes')
  else:
    print('No')
  t = temp


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

for i in range(K, N):
  if A[i-K] < A[i]:
    print('Yes')
  else:
    print('No')

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

t = 1
for i in range(K):# A[0] ~ A[K-1]
  t *= A[i]
  
for i in range(K, N):
  temp = t // A[i-K] * A[i]
  if t < temp:
    print('Yes')
  else:
    print('No')
  t = temp

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

for i in range(K, N):
  if A[i-K] < A[i]:
    print('Yes')
  else:
    print('No')

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

t = 1
for i in range(K):# A[0] ~ A[K-1]
  t *= A[i]
  
L = [ 0 for i in range(N)]

L[K-1] = t

for i in range(K, N):
  t = t // A[i-K] * A[i]
  L[i] = t
  
for i in range(K, N):
  if L[i-1] < L[i]:
    print('Yes')
  else:
    print('No')

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

for i in range(K, N):
  if A[i-K] < A[i]:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
mod_ = 10 ** 9 + 7

nA = 1

for i in range(N):
  nA *= M - i
  nA %= mod_

dp = [0 for i in range(N+1)]
dp[1] = M - N
dp[2] = M - N + 1 + (M - N)*(M - N)
dp[1] %= mod_
dp[2] %= mod_
for i in range(3, N+1):
  dp[i] = dp[i-1] * (M - N + i - 1) + dp[i-2] * (i-1)
  dp[i] %= mod_
  
print( nA * dp[N] % mod_ )

Fixed submission:
N, M = map(int, input().split())
mod_ = 10 ** 9 + 7

nA = 1

for i in range(N):
  nA *= M - i
  nA %= mod_

dp = [0 for i in range(N+1)]
dp[1] = M-N
if N == 1:
  print( nA * dp[N] % mod_ )  
else:
  dp[2] = M - N + 1 + (M - N)*(M - N)
  dp[1] %= mod_
  dp[2] %= mod_
  for i in range(3, N+1):
    dp[i] = dp[i-1] * (M - N + i - 1) + dp[i-2] * (i-1)
    dp[i] %= mod_
  print( nA * dp[N] % mod_ )
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = input()
s = len(S)
base = 10 ** 9 + 7

L26 = [ 1 for i in range(K+1)] # 26^i mod base 
for i in range(K):
  L26[i+1] = (L26[i] * 26) % base

T1 = 1
T2 = 1
ans = 0
for i in range( s, s+K+1):
  T3 = L26[K + s - i]
  #T4 = pow(26, K + s - i, base)
  #print(T3, T4)
  p = (T1 * T2) % base
  p = (p * T3) % base
  ans += p
  ans %= base
  #print(ans, T1, T2, T3)
  T1 *= 25
  T1 %= base
#  T2 = (T2 * i ) // (i+1-s) # T2 = (i, s-1) = (i-1, s-1) * i // (i+1-s)
  T2 *= i
  T2 %= base
  T2 *= pow(i+1-s, base-2, base)
  T2 %= base
  
print(ans % base)

Fixed submission:
K = int(input())
S = input()
s = len(S)
base = 10 ** 9 + 7

L26 = [ 1 for i in range(K+1)] # 26^i mod base 
for i in range(K):
  L26[i+1] = (L26[i] * 26) % base

T1 = 1
T2 = 1
ans = 0
for i in range( s, s+K+1):
  T3 = L26[K + s - i]
  #T4 = pow(26, K + s - i, base)
  #print(T3, T4)
  p = (T1 * T2) % base
  p = (p * T3) % base
  ans += p
  ans %= base
  #print(ans, T1, T2, T3)
  T1 *= 25
  T1 %= base
#  T2 = (T2 * i ) // (i+1-s) # T2 = (i, s-1) = (i-1, s-1) * i // (i+1-s)
  T2 *= i
  T2 %= base
  T2 *= pow(i+1-s, base-2, base)
  T2 %= base
  
print(ans % base)
Buggy python submission (verdict: Runtime Error):
H, M, h, m, K = map(int, input().slpit())

print( max(0, 60*(h-H) + m - M - K) )

Fixed submission:
H, M, h, m, K = map(int, input().split())

print( max(0, 60*(h-H) + m - M - K) )
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

not_in = [0 for i in range(N+1)]
not_in[0] = A[0]
for i in range(1, N+1):
  not_in[i] = not_in[i-1] * 2 + A[i]

if not_in[N] > 2 ** N:
  print(-1)
else:
  in_num = 0
  up = A[N]
  for i in range(N-1,-1,-1):
    in_temp = min(2 ** i - not_in[i], up)
    in_num += in_temp
    up = in_temp + A[i]
  print( in_num + sum(A) )

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

not_in = [0 for i in range(N+1)]
not_in[0] = A[0]
for i in range(1, N+1):
  not_in[i] = not_in[i-1] * 2 + A[i]

if not_in[N] > 2 ** N:
  print(-1)
else:
  in_num = 0
  up = A[N]
  for i in range(N-1,-1,-1):
    in_temp = min(2 ** i - not_in[i], up)
    in_num += in_temp
    up = in_temp + A[i]
  print( in_num + sum(A) )
Buggy python submission (verdict: Runtime Error):
big_int = 10 ** 9

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

L = []
for i in range(N):
  L.insert( tuple(map(int, input().split())) )

def foo(i):
  T = [0 for j in range(M+1)]
  for j in range(N):
    for k in range(M+1):
      T[k] += L[j][k] * (i%2)
      i //= 2
  for k in range(1,M+1):
    if T[k] < X:
      return big_int
  return T[0]
  
ans = big_int

for i in range(2**N):
  ans = min(ans, foo(i))
  
if ans == big_int:
  print(-1)
else:
  print(ans)

Fixed submission:
big_int = 10 ** 9

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

L = [0 for i in range(N)]
for i in range(N):
  L[i] = tuple(map(int, input().split()))

def foo(i):
  t = i
  T = [0 for j in range(M+1)]
  for j in range(N):
    for k in range(M+1):
      T[k] += L[j][k] * (t%2)
    t //= 2
  for k in range(1,M+1):
    if T[k] < X:
      return big_int
  return T[0]
  
ans = big_int

for i in range(2**N):
  ans = min(ans, foo(i))
  
if ans == big_int:
  print(-1)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = tuple( map(int, input().split()) )

L = [0 for i in range(N+1)]
L[1] = 1
x = 1
t = 1
while K>0:
  t += 1
  K -= 1
  x = A[x]
  if L[x] != 0:
    p = t - L[x]
    K %= p
    break
  else:
    L[x] = t
    
while K>0:
  x = A[x]
  K -= 1
print(x)

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

L = [0 for i in range(N+1)]
L[1] = 1
x = 1
t = 1
while K>0:
  t += 1
  K -= 1
  x = A[x-1]
  if L[x] != 0:
    p = t - L[x]
    K %= p
    break
  else:
    L[x] = t
    
while K>0:
  x = A[x-1]
  K -= 1
print(x)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

L = [0 for i in range(N+1)]

for i in range(K):
  d = int(input())
  for j in range(d):
    s = int(input())
    L[s] += 1

ans = 0
for i in range(1,N+1):
  if L[i] == 0:
    ans += 1
print(ans)

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

L = [0 for i in range(N+1)]

for i in range(K):
  d = int(input())
  LL = list(map(int, input().split()))
  for j in range( len(LL) ):
    L[ LL[j] ] += 1

ans = 0
for i in range(1,N+1):
  if L[i] == 0:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))

L = [0 for in range(N+1)]

for q in range(M):
  A, B = map(int, input().split())
  if H[A] < H[B]:
    L[A] += 1
  elif H[A] > H[B]:
    L[B] += 1
  else:
    L[A] += 1
    L[B] += 1
    
ans = 0
for i in range(1,N+1):
  if L[i] == 0:
    ans += 1
print(ans)


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

L = [0 for i in range(N+1)]

for q in range(M):
  A, B = map(int, input().split())
  if H[A-1] < H[B-1]:
    L[A] += 1
  elif H[A-1] > H[B-1]:
    L[B] += 1
  else:
    L[A] += 1
    L[B] += 1
    
ans = 0
for i in range(1,N+1):
  if L[i] == 0:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

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

dict_ = {}

ans = 0
for i in range(N):
  k = (i+1) - A[i]
  if k in dict_:
    ans += dict[k]
  ad = (i+1) + A[i]
  if ad in dict_:
    dict_[ad] = dict_[ad] + 1
  dict_[ad] = 1

print(ans)

Fixed submission:
N = int(input())

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

dict_ = {}

ans = 0
for i in range(N):
  k = (i+1) - A[i]
  if k in dict_:
    ans += dict_[k]
  ad = (i+1) + A[i]
  if ad in dict_:
    dict_[ad] = dict_[ad] + 1
  else:
    dict_[ad] = 1

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

# floor( Ar / B ) : r = 0..min(B-1,N%B)

r = N if N < B else r = B-1

print( A*r // B )

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

# floor( Ar / B ) : r = 0..min(B-1,N%B)

if N < B:
  r = N
else:
  r = B-1

print( A*r // B )
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

t = 0

while True:
  if t = 0:
    C = C - B
    t = 1
    if C <= 0:
      print('Yes')
      break
  else:
    A = A - D
    t = 0
    if A <= 0:
      print('No')
      break

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

t = 0

while True:
  if t == 0:
    C = C - B
    t = 1
    if C <= 0:
      print('Yes')
      break
  else:
    A = A - D
    t = 0
    if A <= 0:
      print('No')
      break
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
s = sum(A)
 
print( max(N - A, -1) )

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
s = sum(A)
 
print( max(N - s, -1) )

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

s = sum(A)

print( max(N - A, -1) )

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
s = sum(A)
 
print( max(N - s, -1) )
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() ) )
 
ans = [ 0 for i in range(N) ]

for i in A:
  ans[i-1] += 1

for i in ans:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

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

def gcd3(a,b,c):
  return gcd(a, gcd(b,c))

ans = 0

for x in range(1,K+1):
  for y in range(1,K+1):
    for z in range(1,K+1):
      ans += gcd3(x,y,z)

print(ans)

Fixed submission:
K = int(input())

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

def gcd3(a,b,c):
  return gcd(a, gcd(b,c))

ans = 0

for x in range(1,K+1):
  for y in range(1,K+1):
    for z in range(1,K+1):
      ans += gcd3(x,y,z)

print(ans)
Buggy python submission (verdict: Runtime Error):
K, N = map(int, input().split())
A = list(map(int, input().split()))

m = K - A[N-1] + A[0]

for i in range(N):
  m = min(m, A[i+1] - A[i])

print(K - m)

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

m = K - A[N-1] + A[0]

for i in range(N-1):
  m = max(m, A[i+1] - A[i])

print(K - m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(N)]

total = 0

for i in range(N):
  r = 0
  for j in range(N):
    if i != j and A[i] == A[j]:
      r += 1
  L[i] = r
  total += r

total = total // 2

for i in L:
  print(total - i)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
#L = [0 for i in range(N)]
dict = {}

for i in A:
  if i in dict:
    dict[i] = dict[i] + 1
  else:
    dict[i] = 1

#print(dict)
total = 0;
for i in dict:
#  print("i:" + str(i) + " " + str(dict[i]))
  total += dict[i]*(dict[i]-1) // 2

#print("T:" + str(total))

for i in A:
  print(total - dict[i] + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(N)]

total = 0

for i in range(N):
  r = 0
  for j in range(N):
    if i != j and A[i] == A[j]:
      r += 1
  L[i] = r
  total += r

total = total // 2

for i in L:
  print(total - i)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
#L = [0 for i in range(N)]
dict = {}

for i in A:
  if i in dict:
    dict[i] = dict[i] + 1
  else:
    dict[i] = 1

#print(dict)
total = 0;
for i in dict:
#  print("i:" + str(i) + " " + str(dict[i]))
  total += dict[i]*(dict[i]-1) // 2

#print("T:" + str(total))

for i in A:
  print(total - dict[i] + 1)

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

total = 0

for i in range(N):
  r = 0
  for j in range(N):
    if i != j and A[i] == A[j]:
      r += 1
  L[i] = r
  total += r

total = total // 2

for i in L:
  print(total - L[i])

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
#L = [0 for i in range(N)]
dict = {}

for i in A:
  if i in dict:
    dict[i] = dict[i] + 1
  else:
    dict[i] = 1

#print(dict)
total = 0;
for i in dict:
#  print("i:" + str(i) + " " + str(dict[i]))
  total += dict[i]*(dict[i]-1) // 2

#print("T:" + str(total))

for i in A:
  print(total - dict[i] + 1)
Buggy python submission (verdict: Runtime Error):
L = [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())

print(L[K])

Fixed submission:
L = [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())

print(L[K-1])
Buggy python submission (verdict: Runtime Error):
S = input()

if S == "AAA" or S = "BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()

if S == "AAA" or S == "BBB":
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
S = input()
N = int(input())

pre = ""
suf = ""
f = 1
for i in range(N):
  Q = input()
  if Q[0] == "1":
    f *= -1
  elif Q[2] == "1":
    if f > 0:
      pre = Q[4] + pre
    else:
      suf = sef + Q[4]
  else:
    if f < 0:
      pre = Q[4] + pre
    else:
      suf = sef + Q[4]

ans = pre + S + suf
if f > 0:
  print(ans)
else:
  print(ans[::-1])

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

pre = ""
suf = ""
f = 1
for i in range(N):
  Q = input()
  if Q[0] == "1":
    f *= -1
  elif Q[2] == "1":
    if f > 0:
      pre = Q[4] + pre
    else:
      suf = suf + Q[4]
  else:
    if f < 0:
      pre = Q[4] + pre
    else:
      suf = suf + Q[4]

ans = pre + S + suf
if f > 0:
  print(ans)
else:
  print(ans[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = int(input())

for i in range(N):
  Q = input()
  if Q[0] == "1":
    S = S[::-1]
  elif Q[2] == "1":
    S = Q[4] + S
  else:
    S = S + Q[4]

print(S)

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

pre = ""
suf = ""
f = 1
for i in range(N):
  Q = input()
  if Q[0] == "1":
    f *= -1
  elif Q[2] == "1":
    if f > 0:
      pre = Q[4] + pre
    else:
      suf = suf + Q[4]
  else:
    if f < 0:
      pre = Q[4] + pre
    else:
      suf = suf + Q[4]

ans = pre + S + suf
if f > 0:
  print(ans)
else:
  print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
N = int(input().split())

print(N//2) if N%2==0 else print(N//2 +1)

Fixed submission:
N = int(input())

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

if N == 1:
  ans = "*"
elif N == 2:
  ans = "**"
else: #N==3
  ans = "***"

  
ng = False
for i in range(M):
  s, c = input().split()
  s = int(s)
  if ans[s] != '*' or ans[s] != c:
    ng = True
    break
  else:
    ans[s] = c

if N == 1 and ans == "*":
  ans = "0"
if N == 2:
  if ans[0] == "*":
    ans[0] = "1"
  if ans[1] == "*":
    ans[1] = "0"
if N == 3:
  if ans[0] == "*":
    ans[0] = "1"
  if ans[1] == "*":
    ans[1] = "0"
  if ans[2] == "*":
    ans[2] = "0"

if ng:
  print(-1)
else:
  print(int(ans))

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

if N == 1:
  ans = ["*"]
elif N == 2:
  ans = ["*","*"]
else: #N==3
  ans = ["*","*","*"]
  
ng = False
for i in range(M):
  s, c = input().split()
  s = int(s)-1
  if ans[s] != '*' and ans[s] != c:
    ng = True
    break
  elif s==0 and c=="0" and N>1:
    ng = True
    break
  else:
    ans[s] = c

if N == 1 and ans[0] == "*":
  ans[0] = "0"
if N == 2:
  if ans[0] == "*":
    ans[0] = "1"
  if ans[1] == "*":
    ans[1] = "0"
if N == 3:
  if ans[0] == "*":
    ans[0] = "1"
  if ans[1] == "*":
    ans[1] = "0"
  if ans[2] == "*":
    ans[2] = "0"

if ng:
  print(-1)
else:
  print("".join(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
AL = list(map(int, input().split()))

s = "APPROVED"
for i in AL:
  if i%2 == 0 and i%3 != 0 and i%5 != 0:
    s = DENIED
print(s)

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

s = "APPROVED"
for i in AL:
  if i%2 == 0 and i%3 != 0 and i%5 != 0:
    s = "DENIED"
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

L = []
LL = []
S = set()
for i in range(N):
  s = input()
  L.append(s)
  if s not in S:
    S.add(s)
    LL.append(s)

L.sort()
LL.sort()

M = 0
for i in LL:
  M = max(M, L.count(i))
for i in LL:
  if L.count(i) == M:
    print(i)


Fixed submission:
N = int(input())

dict = {}
L = []

for i in range(N):
  s = input()
  if s in dict:
    dict[s] = dict[s] + 1
  else:
    dict[s]=1
    L.append(s)

L.sort()

M = 0
for i in dict:
  M = max(M, dict[i])

for i in L:
  if dict[i] == M:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

L = []
LL = []
S = set()
for i in range(N):
  s = input()
  L.append(s)
  if s not in S:
    S.add(s)
    LL.append(s)

L.sort()
LL.sort()

M = 0
for i in LL:
  M = max(M, L.count(i))
for i in LL:
  if L.count(i) == M:
    print(i)

Fixed submission:
N = int(input())

dict = {}
L = []

for i in range(N):
  s = input()
  if s in dict:
    dict[s] = dict[s] + 1
  else:
    dict[s]=1
    L.append(s)

L.sort()

M = 0
for i in dict:
  M = max(M, dict[i])

for i in L:
  if dict[i] == M:
    print(i)

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

L = []
S = set()
for i in ragne(N):
  s = input()
  L.appened(s)
  S.insert(s)
L.sorted()

for i in S:
  M = max(M, L.count(i))
  
for i in S:
  if L.count(i) == M:
    print(i)

Fixed submission:
N = int(input())

dict = {}
L = []

for i in range(N):
  s = input()
  if s in dict:
    dict[s] = dict[s] + 1
  else:
    dict[s]=1
    L.append(s)

L.sort()

M = 0
for i in dict:
  M = max(M, dict[i])

for i in L:
  if dict[i] == M:
    print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int, input().split()))

B = {}
for i in A_list:
  B.add(i)

if len(B) == N:
  print("YES")
else:
  print("NO")

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

B = set()
for i in A_list:
  B.add(i)

if len(B) == N:
  print("YES")
else:
  print("NO")