Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
k=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))

cnt=0
for i in range(2**n):
  l=[0 for j in range(n)]
  for j in range(n):
    if (i>>j)&1:
      l[j]=1

  t_cnt0
  for j in range(m):
    on_l=0
    for x in k[j][1:]:
      x-=1
      if l[x]==1:
        on_l+=1
    if on_l%2==p[j]:
      t_cnt+=1

  if t_cnt==m:
    cnt+=1

print(cnt)

Fixed submission:
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))

ans=0
for i in range(2**n):
#  bit=format(i,'011b')
#  bit=list(reversed(format(i,'b')))
#  bit=bin(i)
#  print(bit)
  #ある電球
  num=0
  for j in range(m):
    #ある電球に接続されている各スイッチ
    cnt=0
    for k in range(1,l[j][0]+1):
#      print(l[j][k])
#      if bit[l[j][k]]==1:
#      if (i>>k)&1:
#      print(i,l[j][k])
      if (i>>l[j][k]-1)&1:
        cnt+=1
#    print(i,j,cnt)
    if cnt%2==p[j]:
      num+=1
  if num==m:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(m)]

b_sum=0
for b,c in l:
  a+=[c]*b
  b_sum+=b

a=sorted(a)[b_sum:]

print(sum(a))

Fixed submission:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())

n,m=map(int,input().split())
a=sorted(list(nii()))
l=[list(nii()) for i in range(m)]
l=sorted(l,key=lambda x:x[1],reverse=True)

man=[]
num=0
for b,c in l:
  man+=[c]*b
  num+=b
  if num>n:
    break

ans=0
for i in range(n):
  if i<num:
    ans+=max(a[i],man[i])
  else:
    ans+=a[i]
print(ans)

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

for b,c in l:
  a+=[c]*b
  a=sorted(a)[b:]

print(sum(a))

Fixed submission:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())

n,m=map(int,input().split())
a=sorted(list(nii()))
l=[list(nii()) for i in range(m)]
l=sorted(l,key=lambda x:x[1],reverse=True)

man=[]
num=0
for b,c in l:
  man+=[c]*b
  num+=b
  if num>n:
    break

ans=0
for i in range(n):
  if i<num:
    ans+=max(a[i],man[i])
  else:
    ans+=a[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())

n,m=map(int,input().split())
a=sorted(list(nii()))

l=[]
for i in range(m):
  b,c=nii()
  l+=[c]*b
l=sorted(l,reverse=True)
l_len=len(l)
if l_len<n:
 l+=[0]*(n-l_len)

ans=0
for i in range(n):
  ans+=max(a[i],l[i])
print(ans)

Fixed submission:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())

n,m=map(int,input().split())
a=sorted(list(nii()))
l=[list(nii()) for i in range(m)]
l=sorted(l,key=lambda x:x[1],reverse=True)

man=[]
num=0
for b,c in l:
  man+=[c]*b
  num+=b
  if num>n:
    break

ans=0
for i in range(n):
  if i<num:
    ans+=max(a[i],man[i])
  else:
    ans+=a[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
print(s[:k]+s[k].lower()+s[k+1:])

Fixed submission:
n, k = map(int, input().split())
s = list(input())
ans = ''
for i in range(len(s)):
    if i == k-1:
        ans += s[i].lower()
    else:
        ans += s[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n=map(int,input().split())

cnt=0
for R in range(n//r+1):
 for G in range(n//g+1):
  num=n-R*r-G*g
  if num>=0 and num%b==0:
   cnt+=1
print(cnt)

Fixed submission:
r,g,b,n=map(int,input().split())

cnt=0
for R in range(n//r+1):
 for G in range((n-r*R)//g+1):
  num=n-R*r-G*g
  if num>=0 and num%b==0:
   cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
a_s=sorted(a)
for i in range(0,n,2):
    if a_s[i]<0 and a_s[i+1]<0:
        a_s[i]=-a_s[i]
        a_s[i+1]=-a_s[i+1]
    elif a_s[i]<0 and -a_s[i]>a_s[i+1]:
        a_s[i]=-a_s[i]
        a_s[i+1]=-a_s[i+1]
    else:
        break
print(sum(a_s))

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
a_s=sorted(a)
for i in range(0,n-1,2):
    if a_s[i]<0 and a_s[i+1]<0:
        a_s[i]=-a_s[i]
        a_s[i+1]=-a_s[i+1]
    elif a_s[i]<0 and -a_s[i]>a_s[i+1]:
        a_s[i]=-a_s[i]
        a_s[i+1]=-a_s[i+1]
    else:
        break
print(sum(a_s))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print('Yes' if min(a,b)<c<max(a,b) else 'No')

Fixed submission:
n=int(input())
s=input()
k=int(input())
ans=''
for i in range(n):
    if s[i] != s[k-1]:
        ans+='*'
    else:
        ans+=s[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
cnt_b,cnt_w=0,0
switch=0
for i in range(n):
    if s[i]=='#':
        switch=1
        if s[i:] in '.'
            cnt_b+=1
    if switch==1 and s[i]=='.':
        cnt_w+=1
if s[n-1]=='#':
    cnt_b-=1
print(min(cnt_b,cnt_w))

Fixed submission:
n=int(input())
s=input()

w_num=0
b_num=0
w_l=[0]
b_l=[0]

for i in s:
 if i=='.':
  w_num+=1
 else:
  b_num+=1
 w_l.append(w_num)
 b_l.append(b_num)

ans=10**5
for i in range(n+1):
 ans=min(ans,b_l[i]+(w_num-w_l[i]))
print(ans)
Buggy python submission (verdict: Runtime Error):
list = [int(input()) for i in range(5)]
t = 0
cnt_l = []
for i in range(5):
    cnt = 0
    while list[i] % 10 != 0:
        list[i] += 1
        cnt += 1
    t += list[i]
    if cnt != 0:
        cnt_l.append(cnt)
if not cnt:
    cnt.append(0)
print(t - max(cnt_l))

Fixed submission:
list = [int(input()) for i in range(5)]
t = 0
cnt_l = []
for i in range(5):
    cnt = 0
    while list[i] % 10 != 0:
        list[i] += 1
        cnt += 1
    t += list[i]
    if cnt != 0:
        cnt_l.append(cnt)
if not cnt_l:
    cnt_l.append(0)
print(t - max(cnt_l))

Buggy python submission (verdict: Runtime Error):
list = [int(input()) for i in range(5)]
t = 0
cnt_l = []
for i in range(5):
    cnt = 0
    while list[i] % 10 != 0:
        list[i] += 1
        cnt += 1
    t += list[i]
    if cnt != 0:
        cnt_l.append(cnt)
print(t - max(cnt_l))

Fixed submission:
list = [int(input()) for i in range(5)]
t = 0
cnt_l = []
for i in range(5):
    cnt = 0
    while list[i] % 10 != 0:
        list[i] += 1
        cnt += 1
    t += list[i]
    if cnt != 0:
        cnt_l.append(cnt)
if not cnt_l:
    cnt_l.append(0)
print(t - max(cnt_l))
Buggy python submission (verdict: Runtime Error):
s=input()
print('T' if s=='A' else 'G' of s=='C' else 'A' if s=='T' else 'C')

Fixed submission:
b=input()
print('A' if b=='T' else 'T' if b=='A' else 'C' if b=='G' else 'G')
Buggy python submission (verdict: Runtime Error):
n, q = map(int ,input().split())
s = list(input())
for i in range(q):
    l, r = map(int, input().split())
    ss = ''.join(s[l-1:r])
    ans = ss.count('AC')
    print(ans)

Fixed submission:
s=list(input())
ans=0
for i in range(len(s)):
    for j in range(len(s)):
        ss=s[i:j+1]
        if len(ss)==ss.count('A')+ss.count('T')+ss.count('G')+ss.count('C'):
            cnt=len(ss)
            ans=max(ans,cnt)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int ,input().split())
s = list(input())
l, r = [], []
for i in range(q):
    ll, rr = map(int, input().split())
    l.append(ll)
    r.append(rr)

for i in range(q):
    ss = ''.join(s[l[i]-1:r[i]])
    ans = ss.count('AC')
    print(ans)

Fixed submission:
n,q=map(int,input().split())
s=input()

b=[0]*n
for i in range(1,n):
 if s[i-1]+s[i]=='AC':
  b[i]=b[i-1]+1
 else:
  b[i]=b[i-1]

for i in range(q):
 l,r=map(int,input().split())
 print(b[r-1]-b[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A_list = []
for i in range(N):
    A, B = map(int, input().split())
    A_list += [A for i in range(B)]
A_list.sort()
value = sum(A_list[0:M])
print(value)

Fixed submission:
N, M = map(int, input().split())
AB_list = [list(map(int, input().split())) for i in range(N)]
AB_list.sort()
ans, cnt = 0, 0
for a, b in AB_list:
    ans += a*b
    cnt += b
    if cnt > M:
        ans = ans-(a*(cnt-M))
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
value = 0
A_list = []
for i in range(N):
    A, B = map(int, input().split())
    A_list += [A for i in range(B)]
A_list.sort()
for i in range(M):
    value += A_list[i]
print(value)

Fixed submission:
N, M = map(int, input().split())
AB_list = [list(map(int, input().split())) for i in range(N)]
AB_list.sort()
ans, cnt = 0, 0
for a, b in AB_list:
    ans += a*b
    cnt += b
    if cnt > M:
        ans = ans-(a*(cnt-M))
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
number, value = 0, 0
A_list, B_list = [], []
for i in range(N):
    A, B = map(int, input().split())
    A_list.append(A)
    B_list.append(B)
for i in range(N):
    A_value = min(A_list)
    A_index = A_list.index(min(A_list))
    value += A_value * B_list[A_index]
    number += B_list[A_index]
    del A_list[A_index]
    del B_list[A_index]
    if number > M:
        sabun = number - M
        value -= sabun * A_value
        break
print(value)

Fixed submission:
N, M = map(int, input().split())
AB_list = [list(map(int, input().split())) for i in range(N)]
AB_list.sort()
ans, cnt = 0, 0
for a, b in AB_list:
    ans += a*b
    cnt += b
    if cnt > M:
        ans = ans-(a*(cnt-M))
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
ii=lambda:int(input())
miis=lambda:map(int,input().split())
lmiis=lambda:list(:map(int,input().split()))

a,b=miis()
print(a+b if b%a==0 else b-a)

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

if B % A ==0:
    print(A + B)
else:
    print(B - A)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
all_dish = []

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
#    all_dish = [K_n_list_num for K_n_list_num in K_n_list]

   for K_n_list_num in K_n_list:
       all_dish.append(K_n_list_num)

prefer_dish = []
dish_kind = list(set(all_dish))
prefer_dish = [dish_kind_num for dish_kind_num in dish_kind if all_dish.count(dish_kind_num) == N]
#for dish_kind_num in dish_kind:
#    if all_dish.count(dish_kind_num) == N:
#        prefer_dish.append(dish_kind_num)

print(len(prefer_dish))

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

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
    for K_n_list_num in K_n_list:
        all_dish.append(K_n_list_num)

prefer_dish = []
dish_kind = list(set(all_dish))
for dish_kind_num in dish_kind:
    if all_dish.count(dish_kind_num) == N:
        prefer_dish.append(dish_kind_num)

print(len(prefer_dish))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=[0]+list(map(int,input().split()))+[0]

cnt=0
while any([i!=0 for i in h]):
    start,end=100,100
    for i in range(n+2):
        if h[i]!=0:
            start=min(start,i)
        elif h[i]==0 and start<i:
            end=min(end,i)
    l=[i-1 for i in h[start:end]]
    h=h[:start]+l+h[end:]
    cnt+=1
print(cnt)

Fixed submission:
n=int(input())
h=[0]+list(map(int,input().split()))+[0]

cnt=0
while any([i!=0 for i in h]):
    start,end=100,100
    for i in range(n+2):
        if h[i]!=0:
            start=min(start,i)
        elif h[i]==0 and start<i:
#            end=min(end,i)
            end=i
            break
    l=[i-1 for i in h[start:end]]
    h=h[:start]+l+h[end:]
    cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[float('inf') for i in range(n)]
dp[0]=0

for i in range(1,n):
 for j in range(1,k+1):
  if i-j>=0:
   dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
  else:
   break

print(dp[-1])

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

dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(max(i-k,0),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(max(i-k,0),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])

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

dp=[float('inf')]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    for j in range(max(i-k,0),i):
        dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]))
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

dp=[0]*(w+1)

for i in range(n):
 for j in range(w,-1,-1):
  if j+l[i][0]<=w:
   dp[j+l[i][0]]=max(dp[j+l[i][0]],dp[j]+l[i][1])

print(max(dp))

Fixed submission:
n,w=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

dp=[0]*(w+1)

for i in range(n):
 for j in range(w,-1,-1):
  if j+l[i][0]<=w:
   dp[j+l[i][0]] =max(dp[j+l[i][0]],dp[j]+l[i][1])

print(max(dp))

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

dp=[0]*(w+1)

for i in range(n):
 for j in range(w,-1,-1):
  if j+l[i][0]<=w:
   dp[j+l[i][0]] =max(dp[j+l[i][0]],dp[j]+l[i][1])

print(max(dp))

Fixed submission:
n,w=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

dp=[0]*(w+1)

for i in range(n):
 for j in range(w,-1,-1):
  if j+l[i][0]<=w:
   dp[j+l[i][0]] =max(dp[j+l[i][0]],dp[j]+l[i][1])

print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

lim=n*10**3+1
dp=[[float('inf') for i in range(lim)] for i in range(n+1)]

for i in range(n+1):
 dp[i][0]=0

for i in range(n):
 for sum_v in range(lim):

  if sum_v-l[i][1]>=0:
   dp[i+1][sum_v] = min(dp[i+1][sum_v],dp[i][sum_v-l[i][1]]+l[i][0])

  dp[i+1][sum_v]=min(dp[i+1][sum_v],dp[i][sum_v])

ans=0
for i in range(lim):
 if dp[-1][i]<=w:
  ans=max(ans,i)
print(ans)

Fixed submission:
n,w=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

lim=n*10**3+1
#dp=[[float('inf') for i in range(lim)] for i in range(n+1)]
dp=[[10**15 for i in range(lim)] for i in range(n+1)]

'''
for i in range(n+1):
 dp[i][0]=0
'''
dp[0][0]=0

for i in range(n):
 for sum_v in range(lim):

  if sum_v-l[i][1]>=0:
   dp[i+1][sum_v] = min(dp[i+1][sum_v],dp[i][sum_v-l[i][1]]+l[i][0])

  dp[i+1][sum_v]=min(dp[i+1][sum_v],dp[i][sum_v])

ans=0
for i in range(lim):
 if dp[-1][i]<=w:
  ans=max(ans,i)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

g=[[] for i in range(n)]
memo=[-1 for i in range(n)]

for i in range(m):
 x,y=map(int,input().split())
 x-=1
 y-=1
 g[x].append(y)

def rec(x):
 if memo[x]!=-1:
  return memo[x]

 res=0
 for i in g[x]:
  res=max(res,rec(i)+1)

 memo[x]=res
 return res

ans=0
for v in range(n):
 ans=max(ans,rec(v))
print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)

n,m=map(int,input().split())

g=[[] for i in range(n)]
memo=[-1 for i in range(n)]

for i in range(m):
 x,y=map(int,input().split())
 x-=1
 y-=1
 g[x].append(y)

def rec(x):
 if memo[x]!=-1:
  return memo[x]

 res=0
 for i in g[x]:
  res=max(res,rec(i)+1)

 memo[x]=res
 return res

ans=0
for v in range(n):
 ans=max(ans,rec(v))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(float,input().split()))

dp=[[0.0]*(n+1) for i in range(n+1)]
dp[0][0]=1.0

for i in range(n):
 for j in range(n):
  dp[i+1][j+1]+=dp[i][j]*p[i]
  dp[i+1][j]+=dp[i][j]*(1-p[i])

print(sum(dp[-1][(n+1)//2:]))

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

dp=[[0.0]*(n+1) for i in range(n+1)]
dp[0][0]=1.0

for i in range(n):
 for j in range(n):
  dp[i+1][j+1]+=dp[i][j]*p[i]
  dp[i+1][j]+=dp[i][j]*(1-p[i])

print(sum(dp[-1][(n+1)//2:]))
Buggy python submission (verdict: Runtime Error):
from itertools import permutations

n=int(input())
np=factorial(n)
p_list=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

ans=[]
for s,t,u in permutations(p_list,3):
  num1=(s**4)*(t**4)*(u**2)
  num2=(s**14)*(t**4)
  num3=(s**24)*(t**2)
  num4=s**74
  for z in [num1,num2,num3,num4]:
    if np%z==0:
      ans.append(z)

print(len(set(ans)))

Fixed submission:
from math import factorial
from itertools import permutations

n=int(input())

np=factorial(n)

def eratosthenes(n):
 is_p=[1]*n
 p_list=[]

 is_p[0]=0
 is_p[1]=0

 for i in range(2,n):
  if is_p[i]:
   p_list.append(i)
   for j in range(i*i,n,i):
    is_p[j] = 0

 return is_p, p_list

lim=10**2+1
is_p, p_list=eratosthenes(lim)

cnt=0
ans=[]
l=len(p_list)
for i in range(l):
  for j in range(i+1,l):
    for k in range(j+1,l):
      for s,t,u in permutations([p_list[i],p_list[j],p_list[k]],3):
        num1=(s**4)*(t**4)*(u**2)
        num2=(s**14)*(t**4)
        num3=(s**24)*(t**2)
        num4=s**74
        for z in [num1,num2,num3,num4]:
          if np%z==0:
            ans.append(z)

print(len(set(ans)))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

ans=[[] for i in range(m)]
p_list=[[] for i in range(n)]

for i in range(m):
 p,y=map(int,input().split())

 ans[i]=str(p).zfill(6)
 p_list[p].append([i,y])

for pp in p_list:
 pp=sorted(pp,key=lambda x:x[1])
 num=0
 for ppp in pp:
  num+=1
  ans[ppp[0]]+=str(num).zfill(6)
 num=0

for i in ans:
 print(i)

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

ans=[[] for i in range(m)]
p_list=[[] for i in range(n+1)]

for i in range(m):
 p,y=map(int,input().split())

 ans[i]=str(p).zfill(6)

 p_list[p].append([i,y])

for pp in p_list:
 pp=sorted(pp,key=lambda x:x[1])
 num=0
 for ppp in pp:
  num+=1
  ans[ppp[0]]+=str(num).zfill(6)
 num=0

for i in ans:
 print(i)

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

ans=[[] for i in range(m)]
p_list=[[] for i in range(m)]

for i in range(m):
 p,y=map(int,input().split())

 ans[i]=str(p).zfill(6)
 p_list[p].append([i,y])

for pp in p_list:
 pp=sorted(pp,key=lambda x:x[1])
 num=0
 for ppp in pp:
  num+=1
  ans[ppp[0]]+=str(num).zfill(6)
 num=0

for i in ans:
 print(i)

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

ans=[[] for i in range(m)]
p_list=[[] for i in range(n+1)]

for i in range(m):
 p,y=map(int,input().split())

 ans[i]=str(p).zfill(6)

 p_list[p].append([i,y])

for pp in p_list:
 pp=sorted(pp,key=lambda x:x[1])
 num=0
 for ppp in pp:
  num+=1
  ans[ppp[0]]+=str(num).zfill(6)
 num=0

for i in ans:
 print(i)
Buggy python submission (verdict: Runtime Error):
Old = int(input())
if Old == 1:
    print('Hello World')
else:
    A, B = map(int, input().split())
    print(A + B)

Fixed submission:
Old = int(input())
if Old == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)

Buggy python submission (verdict: Runtime Error):
Old = int(input())
if Old == 1:
    print('Hello world')
else:
    A, B = map(int, input().split())
    print(A + B)

Fixed submission:
Old = int(input())
if Old == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)

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

if N == 1:
    print('Hello World')
elif N == 2:
    print(A+B)

Fixed submission:
Old = int(input())
if Old == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
min_c = 10**5
for n in range(N):
    c, t = map(int, input().split())
    if t <= T:
        min_c = min(min_c, c)

if count == 1001:
    print(min_c)
else:
    print('TLE')

Fixed submission:
N, T = map(int, input().split())
min_c, count = 1000, 0
for n in range(N):
    c, t = map(int, input().split())
    if t <= T:
        count += 1
        min_c = min(min_c, c)

if count != 0:
    print(min_c)
else:
    print('TLE')
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())

for i in range(m//n,0,-1):
 chk=m-(i*n)
 if chk>=0 and chk%i==0:
  print(i)
  exit()
print(1)

Fixed submission:
def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

n,m=map(int,input().split())
l=divisore(m)
for i in l:
 if m/n>=i:
  print(i)
  exit()
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
candidate = [int(i*111) for i in range(1,10)]
print(candidate[bisect.bisect_right(candidate, N)])

Fixed submission:
import bisect
N = int(input())
candidate = [int(i*111) for i in range(1,10)]
print(candidate[bisect.bisect_left(candidate, N)])
Buggy python submission (verdict: Runtime Error):
chokudai
redcoder

Fixed submission:
from collections import Counter
s=input()
t=input()
c1=Counter(s)
c2=Counter(t)
if sorted(c1.values())==sorted(c2.values()):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s=input()
t=input()

d={}
for i in range(len(s)):
  if s[i]!=t[i]:
    if s[i] in d:
      if d[s[i]]!=t[i]
        print('No')
        exit()
      else:
       pass
    else:
      d[s[i]]=t[i]
  else:
    if s[i] in d and d[s[i]]!=t[i]:
      print('No')
      exit()
print('Yes')

Fixed submission:
from collections import Counter
s=input()
t=input()
c1=Counter(s)
c2=Counter(t)
if sorted(c1.values())==sorted(c2.values()):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
l=[i for i in range(1,n+1) if (2*i)%k==0]
cnt=0
for x in range(len(l)):
    for y in range(len(l)):
        for z in range(len(l)):
            if (l[x]+l[y])%k==0 and (l[y]+l[z])%k==0 and (l[z]+l[x])%k==0:
                cnt+=1
print(cnt)

Fixed submission:
n,k=map(int,input().split())
if k%2==1:
    print((n//k)**3)
else:
    kk=k//2
    print((n//k)**3+((n+kk)//k)**3)
Buggy python submission (verdict: Runtime Error):
,w=input().split()
a=[list(input()) for i in range(int(h))]

l1=[i for i in a if '#' in i]
l2=[i for i in zip(*l1) if '#' in i]
for i in zip(*l2):
    print(''.join(i))

Fixed submission:
h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
for i in range(h):
    if '#' not in a[i]:
        a[i]=['n']*w
for i in range(w):
    l=[a[j][i] for j in range(len(a))]
    if '#' not in l:
        for k in range(len(a)):
           a[k][i]='n'
for i in a:
    l=[x for x in i if x!='n']
    if l:
        print(''.join(l))

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1,N+1,2):
    cnt = 0
    for n in range(1,N+1,2):
        if n%i == 0:
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)

Fixed submission:
h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
for i in range(h):
    if '#' not in a[i]:
        a[i]=['n']*w
for i in range(w):
    l=[a[j][i] for j in range(len(a))]
    if '#' not in l:
        for k in range(len(a)):
           a[k][i]='n'
for i in a:
    l=[x for x in i if x!='n']
    if l:
        print(''.join(l))
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
ans = 0
for b in range(1, x//2):
    for p in range(2, x):
        if b**p <= x:
            ans = max(ans, b**p)
        else:
            continue
if x == 1:
    ans = 1
print(ans)

Fixed submission:
x = int(input())
ans = 1
for b in range(1, x):
    for p in range(2, x):
        if b**p <= x:
            ans = max(ans, b**p)
        else:
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
k=int(input())

abc='abcdefghijklmnopqrstuvwxyz'

def dfs(keta,ns):
  global cnt
  if ns in s:
    cnt+=1
  if cnt==k:
    print(ns)
    exit()
  if keta==k:
    return

  for i in abc:
    dfs(keta+1,ns+i)

cnt=0
for i in abc:
  dfs(1,i)

Fixed submission:
s=input()
k=int(input())

st=set()
s_len=len(s)

length=1
while length<=min(s_len,k):
  for i in range(s_len-length+1):
    sub_s=s[i:i+length]
    st.add(sub_s)
  length+=1

list=sorted(st)
print(list[k-1])