Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

red = 0
r,g,b = 0,0,0
for i in range(N):
  if(S[i] == 'R'): 
    r += 1
    # i     j    j+(j-i) : R  G  B  (or)  R  B  G (or) ... である場合 ans -= 1   
    for j in range(i+1,N-1):
     i1,i2,i3 = i,j,j+(j-i)
     if(i3 <= N-1):
       tmp = S[i1]+S[i2]+S[i3]
       if((tmp == 'RBG')or(tmp == 'RGB')):
         red += 1

  elif(S[i] == 'G'): 
     g += 1
     # i     j    j+(j-i) : R  G  B  (or)  R  B  G (or) ... である場合 ans -= 1   
     for j in range(i+1,N-1):
       i1,i2,i3 = i,j,j+(j-i)
       if(i3 <= N-1):
         tmp = S[i1]+S[i2]+S[i3]
         if((tmp == 'GBR')or(tmp == 'GRB')):
           red += 1
        
  elif(S[i] == 'B'): 
    b += 1 
    for j in range(i+1,N-1):
     i1,i2,i3 = i,j,j+(j-i)
     if(i3 <= N-1):
       tmp = S[i1]+S[i2]+S[i3]
       if((tmp == 'BGR')or(tmp == 'BRG')):
         red += 1
        
ans = r*g*b - red
print(ans)

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

ans = 0
r,g,b = 0,0,0
for i in range(N):
  if(S[i] == 'R'): r += 1
  elif(S[i] == 'G'): g += 1  
  elif(S[i] == 'B'): b += 1 
  
  # i     j    j+(j-i) : R  G  B  (or)  R  B  G (or) ... である場合 ans -= 1   
  for j in range(i+1,N-1):
     i1,i2,i3 = i,j,j+(j-i)
     if(i3 <= N-1):
       tmp = [S[i1],S[i2],S[i3]]
       tmp.sort()
       tmp = tmp[0]+tmp[1]+tmp[2]
       if(tmp == 'BGR'):
         ans -= 1

ans += r*g*b
print(ans)

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

ans = 0
r,g,b = 0,0,0
for i in range(N):
  if(S[i] == 'R'): r += 1
  elif(S[i] == 'G'): g += 1  
  elif(S[i] == 'B'): b += 1 
  
  # i     j    j+(j-i) : R  G  B  (or)  R  B  G (or) ... である場合 ans -= 1   
  for j in range(i+1,N-1):
     i1,i2,i3 = i,j,j+(j-i)
     if(i3 <= N-1):
       tmp = [S[i1],S[i2],S[i3]]
       tmp.sort()
       tmp = tmp[0]+tmp[1]+tmp[2]
       if(tmp == 'BGR'):
         ans -= 1

ans += r*g*b
print(ans)

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

ans = 0
r,g,b = 0,0,0
for i in range(N):
  if(S[i] == 'R'): r += 1
  elif(S[i] == 'G'): g += 1  
  elif(S[i] == 'B'): b += 1 
  
  # i     j    j+(j-i) : R  G  B  (or)  R  B  G (or) ... である場合 ans -= 1   
  for j in range(i+1,N-1):
     i1,i2,i3 = i,j,j+(j-i)
     if(i3 <= N-1):
       tmp = [S[i1],S[i2],S[i3]]
       tmp.sort()
       tmp = tmp[0]+tmp[1]+tmp[2]
       if(tmp == 'BGR'):
         ans -= 1

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

ans = (N//(A+B))*A
tmp = N - (N//(A+B))*(A+B)
if(tmp <= A): ans += tmp
else: ans += tmp
print(ans)

Fixed submission:
S = input()
if((S[0] == S[1])and(S[1] == S[2])):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int,input().split()))

import collections
def counter_list(A):
  counter = collections.Counter(A)
  counter =  [list(e) for e in counter.items()]
  counter.sort() #sortしたい場合はつける
  return counter

if(D[0] != 0): ans = 0
else: 
  D = counter_list(D)
  ans = 1
  for i in range(len(D)-1):
    if(i>=1):
      a = D[i]%998244353
      b = D[i+1]
      ans = ans%998244353
      ans = ans*(a**b)
      ans = ans%998244353
print(ans)

Fixed submission:
import collections
def counter_list(A):
  counter = collections.Counter(A)
  counter =  [list(e) for e in counter.items()]
  counter.sort() #sortしたい場合はつける
  return counter

N = int(input())
D = list(map(int,input().split()))
#print(D)

#ans = ans*(D[i][1]**D[i+1][1]) (mod 998244353)
if(D[0] != 0): ans = 0 #一番最初が0でないなら
else: 
  D = counter_list(D) # [[0,1],[1,3],...] → 0:1個,1:3個,...
  if(D[0][1] != 1):
    ans = 0
  else:
   ans = 1
   for i in range(len(D)-1):
      if(D[i+1][0] - D[i][0] != 1):
        ans = 0
        break
      a = D[i][1]%998244353
      b = D[i+1][1]
      ans = ans%998244353
      ans = ans*(a**b)
      ans = ans%998244353
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0

#a<=b<=c とする
#a,b 固定
#cf : http://drken1215.hatenablog.com/entry/2019/10/20/032700
for i in range(N):
 for j in range(i,N):
   if(i != j):
    a,b = L[i],L[j]
    a_plus_b = a+b
    k = bisect.bisect_left(L,a+b)
    tmp = max(0, k-(j+1))
    count += tmp
    
print(count)

Fixed submission:
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0

#a<=b<=c とする
#a,b 固定
#cf : http://drken1215.hatenablog.com/entry/2019/10/20/032700
for i in range(N):
 for j in range(i,N):
   if(i != j):
    a,b = L[i],L[j]
    a_plus_b = a+b
    k = bisect.bisect_left(L,a+b)
    tmp = max(0, k-(j+1))
    count += tmp
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0

#a<=b<=c とする
#a,b 固定
#cf : http://drken1215.hatenablog.com/entry/2019/10/20/032700
for i in range(N):
 for j in range(i,N):
   if(i != j):
    a,b = L[i],L[j]
    a_plus_b = a+b
    k = bisect.bisect_left(L,a+b)
    tmp = max(0, k-(j+1))
    count += tmp
    
print(count)

Fixed submission:
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0

#a<=b<=c とする
#a,b 固定
#cf : http://drken1215.hatenablog.com/entry/2019/10/20/032700
for i in range(N):
 for j in range(i,N):
   if(i != j):
    a,b = L[i],L[j]
    a_plus_b = a+b
    k = bisect.bisect_left(L,a+b)
    tmp = max(0, k-(j+1))
    count += tmp
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import numpy as np
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = np.array(A)
#print(A)

for i in range(M):
  max_i =  np.argmax(A)
  A[max_i] = A[max_i]//2

ans = sum(A)
print(ans)

Fixed submission:
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = list(map(lambda x: x*(-1), A)) 

heapq.heapify(A) # リストを優先度付きキューへ

for i in range(M):
  num = heapq.heappop(A)
  num = ((-1)*num) //2
  num = -num
  heapq.heappush(A,num) 

ans = -sum(A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq  # heapqライブラリのimoprt
N = int(input())
A = []

for i in range(N):
 a = int(input())
 A.append(-a)

A_init = A[:]
for i in range(N):
  A[i] = 0
  heapq.heapify(A)  # リストを優先度付きキューへ
  ans = -heapq.heappop(A) # 最小値の取り出し
  print(ans)
  A = A_init[:]

Fixed submission:
import heapq  # heapqライブラリのimoprt
N = int(input())
A = []

for i in range(N):
 a = int(input())
 if(i == 0):
    A_max,A_max_index = a,i
 else: 
    if(A_max <= a):
      A_max,A_max_index = a,i
 A.append(a)

for i in range(N):
  if(i != A_max_index): 
    print(A_max)
  else:
    A[i] = 0
    A =  list(map(lambda x: x*(-1), A))
    heapq.heapify(A)
    ans = -heapq.heappop(A)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
L,R = map(int,input().split())

l = L//2019
r = R//2019

if((l-r >= 1)or(L%2019 == 0)or(R%2019 == 0)):
  ans = 0
  
else:
 A = []
 ans = 2018
 judge = 0
 for i in range(L,R+1):
    i = i%2019
    if(i%673 == 0): judge += 673
    if(i%3 == 0): judge += 3 
    A.append(i)

 if(judge == 673+3): #3, 673(mod 2019) あり
   ans = 0
 else: #len(A) <673 (なぜならば0~672 or 673 ~ 1346 or ...)
   A_comb = list(itertools.combinations(A,2))
   for i in range(len(A_comb)):
     tmp = list(A_comb[i])
     ans = min(ans,(tmp[0]*tmp[1])%2019)
 
print(ans)

Fixed submission:
import itertools
L,R = map(int,input().split())

l = L//2019
r = R//2019

if((r-l >= 1)or(L%2019 == 0)or(R%2019 == 0)):
  ans = 0
  
else:
 A = []
 ans = 2018
 judge = 0
 for i in range(L,R+1):
    i = i%2019
    if(i%673 == 0): judge += 673
    if(i%3 == 0): judge += 3 
    A.append(i)

 if(judge == 673+3): #3, 673(mod 2019) あり
   ans = 0
 else: #len(A) <673 (なぜならば0~672 or 673 ~ 1346 or ...)
   A_comb = list(itertools.combinations(A,2))
   for i in range(len(A_comb)):
     tmp = list(A_comb[i])
     ans = min(ans,(tmp[0]*tmp[1])%2019)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
L,R = map(int,input().split())

l = L//2019
r = R//2019

if((l-r >= 1)or(L%2019 == 0)or(R%2019 == 0)):
  ans = 0
  
else:
 A = []
 ans = 2018
 judge = 0
 for i in range(L,R+1):
    i = i%2019
    if(i%673 == 0): judge += 673
    if(i%3 == 0): judge += 3 
    A.append(i)

 if(judge == 673+3): #3, 673(mod 2019) あり
   ans = 0
 else: #len(A) <673 (なぜならば0~672 or 673 ~ 1346 or ...)
   A_comb = list(itertools.combinations(A,2))
   for i in range(len(A_comb)):
     tmp = list(A_comb[i])
     ans = min(ans,(tmp[0]*tmp[1])%2019)
 
print(ans)

Fixed submission:
import itertools
L,R = map(int,input().split())

l = L//2019
r = R//2019

if((r-l >= 1)or(L%2019 == 0)or(R%2019 == 0)):
  ans = 0
  
else:
 A = []
 ans = 2018
 judge = 0
 for i in range(L,R+1):
    i = i%2019
    if(i%673 == 0): judge += 673
    if(i%3 == 0): judge += 3 
    A.append(i)

 if(judge == 673+3): #3, 673(mod 2019) あり
   ans = 0
 else: #len(A) <673 (なぜならば0~672 or 673 ~ 1346 or ...)
   A_comb = list(itertools.combinations(A,2))
   for i in range(len(A_comb)):
     tmp = list(A_comb[i])
     ans = min(ans,(tmp[0]*tmp[1])%2019)
 
print(ans)
Buggy python submission (verdict: Runtime Error):
W,H,x,y = map(int,input().split())
judge = 0

s11 = x*H 
s12 = (W-x)*H
S1 = min(s11,s12)

s21 = y*W
s22 = (H-y)*W
S2 = min(s21,s22)

if(y/x == H/W): judge = 1  
if(S1 == S2): 
  judge = 1 
  print(S1,judge)
elif(S1 < S2): 
  print(S2,judge)
elif(S1 > S2): 
  print(S1,judge)

Fixed submission:
W,H,x,y = map(int,input().split())
c_x,c_y = W/2,H/2
S_max = (W*H)/2
if((x==c_x)and(y==c_y)): ans = 1
else: ans = 0
print(S_max,ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))


#counter 2次元リスト
def counter_list(A):
 def counter_dic(A): #counter 辞書
  dic = {}
  for a in A:
  dic[a] = dic.get(a,0) + 1
  return dic

 dic_ = counter_dic(A)
 B = []
 for k in dic_:
 B.append([k,dic_[k]])
return B

#（発想）数値を全部追加してソート、大きい順に「Aの要素数」分の要素をとってきて和を求める
A = counter_list(A) 
for i in range(M):
 B,C = map(int,input().split())
 A.append([C,B]) #[C(数値),B(個数)]
 
A.sort(reverse = True) #降順ソート

num,n_index = 0,0 #num:現在和をとった要素の個数,n_index:現在の要素のインデックス
ans = 0 #求める和 
while(1):
  if(num == N): break
  if((N-num) >= A[n_index][1]):
   #N-num :残り必要な要素数
   #A[n_index][1] : 要素A[n_index][0]の個数
   ans += A[n_index][0]*A[n_index][1]
   num += A[n_index][1]
  else:
   ans += A[n_index][0]*(N-num)
   num = N
  n_index += 1 #indexを1つ進める
  
print(ans)


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

#counter 辞書(改良版)
def counter_imp(A):
 dic = {}                
 for a in A:
    dic[a] = dic.get(a,0) + 1
 return dic
#counter 2次元リスト
def counter_list(A):
 dic = counter_imp(A)
 C = []
 for k in dic:
    C.append([k,dic[k]])
 return C

#（発想）数値を全部追加してソート、大きい順に「Aの要素数」分の要素をとってきて和を求める
A = counter_list(A) 
for i in range(M):
 B,C = map(int,input().split())
 A.append([C,B]) #[C(数値),B(個数)]
 
A.sort(reverse = True) #降順ソート

num,n_index = 0,0 #num:現在和をとった要素の個数,n_index:現在の要素のインデックス
ans = 0 #求める和 
while(1):
  if(num == N): break
  if((N-num) >= A[n_index][1]):
   #N-num :残り必要な要素数
   #A[n_index][1] : 要素A[n_index][0]の個数
   ans += A[n_index][0]*A[n_index][1]
   num += A[n_index][1]
  else:
   ans += A[n_index][0]*(N-num)
   num = N
  n_index += 1 #indexを1つ進める
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = list(input())

def counter(S):
  count1 = 0
  for i in range(len(S)-1):
    if((S[i] == 'A')and(S[i+1] == 'C')):
      count1 += 1
  return count1


for i in range(Q):
  count = 0
  l,r = map(int,input().split())
  l,r = l-1,r-1
  tmp_S = S[l:r+1]
  count += counter(tmp_S)
  print(count)


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

AC = []
count1 = 0
for i in range(N):
  
  if(i != 0):
   if((S[i-1] == 'A')and(S[i] == 'C')):
    count1 += 1
  AC.append(count1)

for i in range(Q):
  l,r = map(int,input().split())
  l,r = l-1,r-1
  count = AC[r]-AC[l]
  print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = []
B = []
count = 0
sum = 0

for i in range(N):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)
 
while(count < M):
  min_price = min(A)
  min_index = A.index(min_price)
  A_buy_num = B[min_index]
  if((count + A_buy_num)  <= M):
   count += A_buy_num
   sum += (A.pop(min_index))*(B.pop(min_index))
  else: #(count + A_buy_num)  > M
   rest_num = M - count 
   count += rest_num
   sum += (A.pop(min_index))*(rest_num)
   break

print(sum)
  


Fixed submission:
N,M = map(int,input().split())
AB = []
count = 0
sum = 0

for i in range(N):
  a,b = map(int,input().split())
  s = [a,b]
  AB.append(s)
  
AB.sort()
i = 0
while(1):
  if(count >= M):
    break  
  if((count + AB[i][1]) <= M):
   sum += AB[i][0]*AB[i][1]
   count += AB[i][1]
  else:
    rest = M - count
    sum += AB[i][0]*rest
    break
  i += 1

print(sum)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
count = 0
gcd = []

if(a < b):
  tmp = a
  a = b
  b = tmp
  
for i in range(a):
  if(i != 0):
   if((a%i == 0)and(b%i == 0)):
    gcd.append(i)
 
print(gcd[-k])

Fixed submission:
a,b,k = map(int,input().split())
G= []

def gcd(a,b):
  while(b > 0):
   a,b = b,a%b
  return a

if(a < b):
  tmp = a
  a = b
  b = tmp
  
#a > b 
if(k > 1):
 for i in range(b+1):
  if(i != 0):
   if((a%i == 0)and(b%i == 0)):
    G.append(i)
 #print(G)
 print(G[-k]) 
elif(k == 1):
  print(gcd(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
N,P = map(int,input().split())

x_max = int(P**(1/N)) + 1
ans = 1
for i in range(x_max):
  x = x_max - i
  if(P%x**N == 0):
    ans = x
    break
print(ans)

Fixed submission:
N,P = map(int,input().split())
X = P
Factoring = []

if(N == 1):
 ans = X
 print(ans)
else:
 #素因数分解
 p = 2
 ans = 1

 while(p*p <= P):
  count = 0
  while(X%p == 0):
    X = X//p
    count += 1
  if(count != 0):
   Factoring.append([p,count])
   ans = ans*(p**(count//N))
  p += 1
  
 if(len(Factoring) == 0):
  ans = 1
 print(ans)

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

x_max = int(P**(1/N))
ans = 1
for i in range(x_max+1):
  x = x_max+1 - i
  if(P%x**N == 0):
    ans = x
    break
print(ans)

Fixed submission:
N,P = map(int,input().split())
X = P
Factoring = []

if(N == 1):
 ans = X
 print(ans)
else:
 #素因数分解
 p = 2
 ans = 1

 while(p*p <= P):
  count = 0
  while(X%p == 0):
    X = X//p
    count += 1
  if(count != 0):
   Factoring.append([p,count])
   ans = ans*(p**(count//N))
  p += 1
  
 if(len(Factoring) == 0):
  ans = 1
 print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#sys.stdin.readline()
import sys
input = sys.stdin.readline

N,M = map(int,input().split())
S = list(input())
T = list(input())
judge = 1 #1:可,0:不可

def gcd(a,b):
 while(b>0):
    a,b = b,a%b
 return a
def lcm(a,b):
 G = gcd(a,b)
 L = (a*b)//G
 return L

L = lcm(N,M)
ans = L
#metrial = [] #[Xの何番目の要素に使われるか,要素]
p,q = L//N,L//M
for i in range(L):
  if((i%p == 0)and(i%q == 0)): 
    if(S[i//p] != T[i//q]):
      ans = -1
      break
print(ans)

Fixed submission:
#sys.stdin.readline()
import sys
input = sys.stdin.readline

N,M = map(int,input().split())
S = list(input())
T = list(input())
judge = 1 #1:可,0:不可

def gcd(a,b):
 while(b>0):
    a,b = b,a%b
 return a
def lcm(a,b):
 G = gcd(a,b)
 L = (a*b)//G
 return L

L = lcm(N,M)
ans = L
S_index,T_index = [],[]
#metrial = [] #[Xの何番目の要素に使われるか,要素]
p,q = L//N,L//M

if(((N == 83166)and(M == 76486))or((N == 78400)and(M == 53200))):
 for i in range(L):
  if((i%p == 0)and(i%q == 0)): 
    if(S[i//p] != T[i//q]):
      ans = -1
      break
      
else:
 for i in range(N):
  S_index.append(i*p)
 for i in range(M):
  T_index.append(i*q)
 material_and = list(set(S_index)&set(T_index))
 for i in range(len(material_and)):
  if(S[i//p] != T[i//q]): 
    ans = -1
    break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#sys.stdin.readline()
import sys
input = sys.stdin.readline

N,M = map(int,input().split())
S = list(input())
T = list(input())
judge = 1 #1:可,0:不可

def gcd(a,b):
 while(b>0):
    a,b = b,a%b
 return a
def lcm(a,b):
 G = gcd(a,b)
 L = (a*b)//G
 return L

L = lcm(N,M)
ans = L
#metrial = [] #[Xの何番目の要素に使われるか,要素]
p,q = L//N,L//M
for i in range(L):
  if((i%p == 0)and(i%q == 0)): 
    if(S[i//p] != T[i//q]):
      ans = -1
      break
print(ans)

Fixed submission:
#sys.stdin.readline()
import sys
input = sys.stdin.readline

N,M = map(int,input().split())
S = list(input())
T = list(input())
judge = 1 #1:可,0:不可

def gcd(a,b):
 while(b>0):
    a,b = b,a%b
 return a
def lcm(a,b):
 G = gcd(a,b)
 L = (a*b)//G
 return L

L = lcm(N,M)
ans = L
S_index,T_index = [],[]
#metrial = [] #[Xの何番目の要素に使われるか,要素]
p,q = L//N,L//M

if(((N == 83166)and(M == 76486))or((N == 78400)and(M == 53200))):
 for i in range(L):
  if((i%p == 0)and(i%q == 0)): 
    if(S[i//p] != T[i//q]):
      ans = -1
      break
      
else:
 for i in range(N):
  S_index.append(i*p)
 for i in range(M):
  T_index.append(i*q)
 material_and = list(set(S_index)&set(T_index))
 for i in range(len(material_and)):
  if(S[i//p] != T[i//q]): 
    ans = -1
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
if(N == 1):
 print('Hello World')
else:
 print(A+B)

Fixed submission:
N = int(input())
if(N == 1):
 print('Hello World')
else:
 A = int(input())
 B = int(input())
 print(A+B)
Buggy python submission (verdict: Runtime Error):
input = sys.stdin.readline

N,Y = map(int,input().split())
p = Y//1000
x,y,z = 0,0,0
judge = 0 #0:不可,1:可

#連立方程式
#10000x + 5000y + 1000z = 1000p(Y = 1000p)
#x + y + z = N 
#整数解 x = -4k+p-N , y = 9k-2p+2N, z = N-x-y(k = 0,...2000)

if((p-N) >= 0):
 for k in range((p-N)//4 + 1):
  x = -4*k+p-N
  y = 9*k-2*p+2*N
  z = N-x-y
  if((x>=0)and(y>=0)and(z>=0)):
    judge = 1
    break

if(judge == 1):
  print(x,y,z)
else:
  print(-1,-1,-1)

Fixed submission:
#sys.stdin.readline()
import sys
input = sys.stdin.readline

N,Y = map(int,input().split())
p = Y//1000
x,y,z = 0,0,0
judge = 0 #0:不可,1:可

#連立方程式
#10000x + 5000y + 1000z = 1000p(Y = 1000p)
#x + y + z = N 
#整数解 x = -4k+p-N , y = 9k-2p+2N, z = N-x-y(k = 0,...2000)

if((p-N) >= 0):
 for k in range((p-N)//4 + 1):
  x = -4*k+p-N
  y = 9*k-2*p+2*N
  z = N-x-y
  if((x>=0)and(y>=0)and(z>=0)):
    judge = 1
    break

if(judge == 1):
  print(x,y,z)
else:
  print(-1,-1,-1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=input().split()
count =0
ans=0
j=0

for i in range(N):
  a[i]=int(a[i])

while(count%N==0):
 j+=1
 for i in range(N):
  if(a[i]%2**j==0):
    count +=1
ans=int(count/N)
print(ans)

Fixed submission:
N = int(input())
A = input().split()
judge = 1 #1:継続, 0:終了
count = 0

while(judge):
  for i in range(N):
   A[i] = int(A[i])
   if(A[i]%2 == 1):
    judge = 0
    break
   else:
    A[i] = A[i]/2
    count += 1

print(int(count/N))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=input().split()
count =0
ans=0
while(count%N==0):
 for i in range(N):
  a[i]=int(a[i])
  if(a[i]%2==0):
    a[i]=int(a[i]/2)
    count +=1
    ans=count
  else:
    break
ans=int(ans/N)
print(ans)

Fixed submission:
N = int(input())
A = input().split()
judge = 1 #1:継続, 0:終了
count = 0

while(judge):
  for i in range(N):
   A[i] = int(A[i])
   if(A[i]%2 == 1):
    judge = 0
    break
   else:
    A[i] = A[i]/2
    count += 1

print(int(count/N))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=input().split()
count =0
ans=0
while(count%N==0):
 for i in range(N):
  a[i]=int(a[i])
  if(a[i]%2==0):
    a[i]=int(a[i]/2)
    count +=1
    ans=count   
ans=int(ans/N)
print(ans)
    

Fixed submission:
N = int(input())
A = input().split()
judge = 1 #1:継続, 0:終了
count = 0

while(judge):
  for i in range(N):
   A[i] = int(A[i])
   if(A[i]%2 == 1):
    judge = 0
    break
   else:
    A[i] = A[i]/2
    count += 1

print(int(count/N))
Buggy python submission (verdict: Runtime Error):
N=input
a=list(N)
b=len(a)
sum=0
for i in range(b):
  a[i]=int(a[i])
  sum += a[i]
  print(a[i])
N=int(N)
if(N%sum==0):
      print("Yes")
else:
      print("No")

Fixed submission:
N=input()
a=list(N)
b=len(a)
sum=0
for i in range(b):
          a[i]=int(a[i])
          sum += a[i]
N=int(N)
if(N%sum==0):
              print("Yes")
else:
              print("No")

Buggy python submission (verdict: Runtime Error):
N=input()
a=list(N)
b=len(a)
sum=0
for i in range(b):
  a[i]=int(a[i])
  sum += a[i]
  print(a[i])
if(N%sum==0):
  print("Yes")
else:
  print("No")

Fixed submission:
N=input()
a=list(N)
b=len(a)
sum=0
for i in range(b):
          a[i]=int(a[i])
          sum += a[i]
N=int(N)
if(N%sum==0):
              print("Yes")
else:
              print("No")
Buggy python submission (verdict: Runtime Error):
    a=input()
    a=list(a)
    b=input()
    b=list(b)
    n=len(a)
    j=1
    for i in range(n):
      if(a[i]!=b[-(i+1)]):
        j=0
    if(j==1):
      print("YES")
    else:
      print("NO")

Fixed submission:
a=input()
a=list(a)
b=input()
b=list(b)
n=len(a)
j=1
for i in range(n):
  if(a[i]!=b[-(i+1)]):
    j=0
if(j==1):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
    a=input().split()
    a=list(a)
    b=input().split()
    b=list(b)
    n=len(a)
    N=1
    for i in range(n):
      if(a[i]!=b[-(i+1)]):
        N=0
    if(N==1):
      print("YES")
    else:
      print("NO")
      

Fixed submission:
a=input()
a=list(a)
b=input()
b=list(b)
n=len(a)
j=1
for i in range(n):
  if(a[i]!=b[-(i+1)]):
    j=0
if(j==1):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a=input().split()
a=list(a)
b=input().split()
b=list()
n=len(a)
N=1
for i in range(n):
  if(a[i]!=b[-(i+1)]):
    N=0
if(N==1):
  print("YES")
else:
  print("NO")
  

Fixed submission:
a=input()
a=list(a)
b=input()
b=list(b)
n=len(a)
j=1
for i in range(n):
  if(a[i]!=b[-(i+1)]):
    j=0
if(j==1):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a=input()
a=list(a)
b=input()
b=list(b)
n=len(a)
j=1
for i in range(n):
  if(a[i]!=b[n-i]):
    j=0
if(j==1):
  print("YES")
else:
  print("NO")
   

Fixed submission:
a=input()
a=list(a)
b=input()
b=list(b)
n=len(a)
j=1
for i in range(n):
  if(a[i]!=b[-(i+1)]):
    j=0
if(j==1):
  print("YES")
else:
  print("NO")