Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = input().split()
man = int(N[0])
border = int(N[1])
hight = input().split()
enable = 0
for i in range(man):
  if hight[i] >= border:
    enable +=1

print(enable)
    

Fixed submission:
N = input().split()
man = int(N[0])
border = int(N[1])
hight = input().split()
enable = 0
for i in range(man):
  if int(hight[i]) >= border:
    enable +=1
print(enable)
Buggy python submission (verdict: Runtime Error):
s = input()
if s == "Sunny":
  print("Cloudy")
elseif 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):
S = list(map(str, input()))
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "L":
      unreadble += 1
  else:
    if S[i] == "R":
  	  unreadble += 1
if unreadble >= 1:
  print("No")
else:
  print("Yes")

Fixed submission:
S = list(map(str, input()))
unreadble = 0
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "L":
      unreadble += 1
  else:
    if S[i] == "R":
  	  unreadble += 1
if unreadble >= 1:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
S = list(map(str, input()))
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "L":
      print("No")
  else:
    if S[i] == "R":
      print("No")
print("Yes)


Fixed submission:
S = list(map(str, input()))
unreadble = 0
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "L":
      unreadble += 1
  else:
    if S[i] == "R":
  	  unreadble += 1
if unreadble >= 1:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
s = int(input())
s[0] = A
s[1] = B
result = A - B * 2
if result < 0:
    result = 0
print(result)

Fixed submission:
s = list(map(int, input().split()))
A = s[0] 
B = s[1]
result = A - B * 2
if result < 0:
    result = 0
print(result)
Buggy python submission (verdict: Runtime Error):
str = input()
week_whether = {'Sunny':0, 'Cloudy':1, 'Rainy':2}
weel_labels = {0:'Sunny',1:'Cloudy', 2: 'Rainy'}
print(weel_labels[week_whether[str] + 1])

Fixed submission:
str = input()
week_whether = {'Sunny':0, 'Cloudy':1, 'Rainy':2}
weel_labels = {0:'Sunny',1:'Cloudy', 2: 'Rainy'}
print(weel_labels[(week_whether[str] + 1)%3])
Buggy python submission (verdict: Runtime Error):
s = list(map(int, input.split()))
A = s[0]
B = s[1]
result = (A + B)
if result % 2 ==0:
    print(result/2)
else:
    print('IMPOSSIBLE')
    

Fixed submission:
s = list(map(int, input().split()))
A = s[0]
B = s[1]
result = abs(A - B)
if result % 2 ==0:
    print(int(min(A,B) + result/2))
else:
    print('IMPOSSIBLE')

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

Fixed submission:
s = list(map(int, input().split()))
A = s[0]
B = s[1]
result = abs(A - B)
if result % 2 ==0:
    print(int(min(A,B) + result/2))
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n=int(input())
d = list(map(int,input().split()))
li=[]
for i in n:
  for j in n:
    a=d[i]*d[j]
    li.append(a)
b=sum(li)
print(b/2)

Fixed submission:
import math
n = int(input())
d = list(map(int,input().split()))
li=[]
li2=[]
for i in range(n):
  for j in range(n):
    a = d[i]*d[j]
    li.append(a)
b = sum(li)
for k in range(n):
  c=d[k]**2
  li2.append(c)
d=sum(li2)
b -= d
print(math.floor(b/2))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
a=[]
a.append(s[0])
for i in range(n):
  if s[i] != s[i+1]:
    a.append(s[l+1])
  else:
    continue
print(len(a))

Fixed submission:
n=int(input())
s=list(input())
a=[]
a.append(s[0])
for i in range(n-1):
  if s[i] != s[i+1]:
    a.append(s[i+1])
  else:
    continue
print(len(a))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
a=[]
a.append(s[0])
for i in range(n-1):
  if s[i] != s[i+1]:
    a.append(s[l+1])
  else:
    continue
print(len(a))

Fixed submission:
n=int(input())
s=list(input())
a=[]
a.append(s[0])
for i in range(n-1):
  if s[i] != s[i+1]:
    a.append(s[i+1])
  else:
    continue
print(len(a))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
for i in range(n-1):
  if s[i] == s[i+1]:
    del s[i+1]
  else:
    continue
print(len(s))

Fixed submission:
n=int(input())
s=list(input())
a=[]
a.append(s[0])
for i in range(n-1):
  if s[i] != s[i+1]:
    a.append(s[i+1])
  else:
    continue
print(len(a))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
now=1
ans=0
while now < b:
  for i in range(21):
    now = naw - 1 + a
    ans += 1
print(ans)

Fixed submission:
a,b = map(int,input().split())
now=1
ans=0
while now < b:
  now = now - 1 + a
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
now=1
ans=0
while now < b:
  for i in range(21):
    now - 1 + a
    ans+=1
print(ans)

Fixed submission:
a,b = map(int,input().split())
now=1
ans=0
while now < b:
  now = now - 1 + a
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

Fixed submission:
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[0]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

Buggy python submission (verdict: Runtime Error):
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[]
for i in range(n):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

Fixed submission:
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[0]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

Buggy python submission (verdict: Runtime Error):
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[]
for i in range(n):
  if h[i] >= h[h+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

Fixed submission:
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[0]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
h = list(map(int,input().split()))
li=[]
ans=0
for i in range(n):
  for j in range(n):   
    while h[i] > h[i+1]:
      ans+=1
    li.append(ans)
    ans=0
print(max(li))

Fixed submission:
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[0]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
V = list(map(int,input().split()))
ans=0
V.sort()
S=V[0]
for i in N-1:
  ans += (S + V[i])/2
  S=V[i]
print(ans)  


Fixed submission:
N = int(input())
V = list(map(int,input().split()))
V.sort()
S = V[0]
for i in range(N):
  S = (S + V[i])/2
print(S)
Buggy python submission (verdict: Runtime Error):
K = int(input())
X = int(input())
A=X-K+1
B=X+K-1
L=[]
for i in range(A,B):
  if i > 1000000 or i < -1000000:
    continue
  L.attend(str(i))
print(*L)

Fixed submission:
K,X = map(int,input().split())
A=X-K+1
B=X+K-1
L=[]
for i in range(A,B+1):
  if i > 1000000 or i < -1000000:
    continue
  L.append(str(i))
print(*L)

Buggy python submission (verdict: Runtime Error):
K = int(input())
X = int(input())
A=X-K+1
B=X+K-1
L=[]
for i in range(A,B):
  if i > 1000000 or i < -1000000:
    continue
  L.attend(i)
print(*L[0])

Fixed submission:
K,X = map(int,input().split())
A=X-K+1
B=X+K-1
L=[]
for i in range(A,B+1):
  if i > 1000000 or i < -1000000:
    continue
  L.append(str(i))
print(*L)

Buggy python submission (verdict: Runtime Error):
K = int(input())
X = int(input())
A=X-K+1
B=X+K-1
L=[]
for i in range(A,B):
  if i > 1000000 or i < -1000000:
    continue
  L.attend(i)
print(*L)

Fixed submission:
K,X = map(int,input().split())
A=X-K+1
B=X+K-1
L=[]
for i in range(A,B+1):
  if i > 1000000 or i < -1000000:
    continue
  L.append(str(i))
print(*L)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
ans=c-(a-b)
if ans => 0:
  print(ans)
else:
  print(0)

Fixed submission:
a,b,c = map(int,input().split())
ans=c-(a-b)
if ans >= 0:
  print(ans)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n=int(input())
l1=[int(input()) for i in range(n)]

for i in range(n):
  l2 = copy.copy(l1)
  del l2[i]
  print(max(l2))

Fixed submission:
n=int(input())
l1=[int(input()) for i in range(n)]
l2=sorted(l1)
max1=l2[-1]
max2=l2[-2]
for i in l1:
  if i == max1:
    print(max2)
  else:
    print(max1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n=int(input())
l1=[int(input()) for i in range(n)]

for i in range(n):
  l2 = copy.copy(l1)
  del l2[i]
  print(max(l2))

Fixed submission:
n=int(input())
l1=[int(input()) for i in range(n)]
l2=sorted(l1)
max1=l2[-1]
max2=l2[-2]
for i in l1:
  if i == max1:
    print(max2)
  else:
    print(max1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
list=[int(input()) for i in range(n)]

for i in range(n):
  listA=list.remove[i]
  print(max(listA))

Fixed submission:
n=int(input())
l1=[int(input()) for i in range(n)]
l2=sorted(l1)
max1=l2[-1]
max2=l2[-2]
for i in l1:
  if i == max1:
    print(max2)
  else:
    print(max1)
Buggy python submission (verdict: Runtime Error):
li = input().split()
s=(int(li[2])*int(li[1])/int(li[0])
print(str(s))

Fixed submission:
li = input().split()
A=int(li[0])
B=int(li[1])
T=int(li[2])
s=T//A*B
print(s)
Buggy python submission (verdict: Runtime Error):
n = input()
vli = list(map(int,input().split()))
cli = list(map(int,input().split()))
for i in n:
  sli = []
  sli.append(vli[i] - cli[i])
for j in n:
  ans = []
  if sli[j] > 0:
    ans.append(sli[j])
answer = sum(ans)    
print(answer)

Fixed submission:
n = int(input())
vli = list(map(int,input().split()))
cli = list(map(int,input().split()))
ans = 0
for i in range(n):
  s=vli[i] - cli[i]
  if s>0:
    ans+=s
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
vli = list(map(int,input().split()))
cli = list(map(int,input().split()))
for i in n:
  sli=[]
  sli.append(vli[i]-cli[i])
for j in n:
  ans=[]
  if sli[j]>0:
    ans.append(sli[j])
print(sum(ans))

Fixed submission:
n = int(input())
vli = list(map(int,input().split()))
cli = list(map(int,input().split()))
ans = 0
for i in range(n):
  s=vli[i] - cli[i]
  if s>0:
    ans+=s
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
N = int(input())
A = list(map(int,input().split()))
S = []
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
for i in range(N):
  B = A.copy()
  del B[i]
  m = gcd(*B)
  S.append(m)
print(max(S))

Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
 
 
N = int(input())
A = list(map(int, input().split()))
L = [0 for i in range(N)]
R = [0 for i in range(N)]
T = [0 for i in range(N)]
 
for i in range(N):
    if i == 0:
        L[i] = 0
    else:
        L[i] = gcd(L[i-1], A[i-1])
for i in range(N-1, -1, -1):
    if i == N-1:
        R[i] = 0
    else:
        R[i] = gcd(R[i+1], A[i+1])
for i in range(N):
    T[i] = gcd(L[i], R[i])
 
print(max(T))
Buggy python submission (verdict: Runtime Error):
x,y = map(int(input()))
if x % y == 0:
  print(str(x + y))
else:
  print(str(x - y))

Fixed submission:
x,y = map(int,input().split())
if y % x == 0:
  print(str(x + y))
else:
  print(str(y - x))
Buggy python submission (verdict: Runtime Error):
num = list(map(int,input().split()))
if num[1] > num[2]:
  a = num[2]
else:
  a = num[1]
b = num[1] + num[2] - num[0]
print(a + " " + b)

Fixed submission:
num = list(map(int,input().split()))
if num[1] > num[2]:
  a = num[2]
else:
  a = num[1]
b = num[1] + num[2] - num[0]
if b < 0:
  b = 0
print(str(a) + " " + str(b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = list(map(int,input().split()))
ans = 0
for i in range(n):
  if li[i - 1] == 0:
    del li[i - 1]
    n = len(li)
  else:
    ans += li[i - 1]
    for j in range(n):
      li[j - 1] -= 1
print(str(ans))

Fixed submission:
N=int(input())
x=[int(i) for i in input().split()]
x.append(0)
cnt=0
while x.count(0)!=N+1:
    for i in range(N):
        if x[i+1]==0 and x[i]>0:
            cnt+=1
        if x[i]>0:
            x[i]-=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
s = input()
for i in range(length(s)):
  if i%2 == 1:
    if not(s[i] == 'R' or s[i] == 'U' or s[i] == 'D'):
      print('No')
      exit()
  if i%2 == 0:
    if not(s[i] == 'L' or s[i] == 'U' or s[i] == 'D'):
      print('No')
      exit()
print('Yes')

Fixed submission:
s = input()
if 'L' in s[0::2] or 'R' in s[1::2]:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
tinpo = []
count = 0

for i in range(n-1):
  if h[i] >= h[i+1]:
    count += 1
  else:
    tinpo.append(count)
    count = 0
  if i == n-2:
    tinpo.append(count)

print(max(tinpo))

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
tinpo = [0]
count = 0

for i in range(n-1):
  if h[i] >= h[i+1]:
    count += 1
  else:
    tinpo.append(count)
    count = 0
  if i == n-2:
    tinpo.append(count)

print(max(tinpo))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
mod = 10 ** 9 + 7
#dp[k] -> 13で割ったあまりがkのパターン数
dp = [0] * 13
dp[0] = 1
mul = 1

for c in s[::-1]:
  #次の状態
  nextDP = [0] * 13
  if c == "?":
    for k in range(10):
      for j in range(13):
        nextDP[(k * mul + j)%13] += dp[j]
        nextDP[(k * mul + j)%13] %= mod
      
  else:
    k = int(c)
    for j in range(13):
        nextDP[(k * mul + j)%13] += dp[j]
        nextDP[(k * mul + j)%13] %= mod

  mul *= 10
  mul %= 13
  dp = nextDP

print(dp[5])


Fixed submission:
s = input()
mod = 10 ** 9 + 7
#dp[k] -> 13で割ったあまりがkのパターン数
dp = [0] * 13
dp[0] = 1
mul = 1

for c in s[::-1]:
  #次の状態
  nextDP = [0] * 13
  if c == "?":
    for k in range(10):
      for j in range(13):
        nextDP[(k * mul + j)%13] += dp[j]
        nextDP[(k * mul + j)%13] %= mod
      
  else:
    k = int(c)
    for j in range(13):
        nextDP[(k * mul + j)%13] += dp[j]
        nextDP[(k * mul + j)%13] %= mod

  mul *= 10
  mul %= 13
  dp = nextDP

print(dp[5])
Buggy python submission (verdict: Runtime Error):
r = int(input())
print(3 * a**2)

Fixed submission:
r = int(input())
print(3 * r**2)
Buggy python submission (verdict: Time Limit Exceeded):
L, R = (int(i) for i in input().split())  
unko = []
flag = True
if flag:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      n = (i*j) % 2019
      unko.append((i*j) % 2019)
      if n == 0:
        flag = False
print(min(unko))


Fixed submission:
l,r = (int(i) for i in input().split())
a = []
for i in range(l,min(r,l+2019)):
  for j in range(i+1,min(r,l+2019)+1):
    a.append(i*j%2019)
print(min(a))

Buggy python submission (verdict: Time Limit Exceeded):
L, R = (int(i) for i in input().split())  
unko = []
flag = True
if flag:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      n = (i*j) % 2019
      unko.append((i*j) % 2019)
      if n == 0:
        flag = False
print(min(unko))

Fixed submission:
l,r = (int(i) for i in input().split())
a = []
for i in range(l,min(r,l+2019)):
  for j in range(i+1,min(r,l+2019)+1):
    a.append(i*j%2019)
print(min(a))

Buggy python submission (verdict: Time Limit Exceeded):
L, R = (int(i) for i in input().split())  
unko = []
flag = True
if flag:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      n = (i*j) % 2019
      unko.append((i*j) % 2019)
      if n == 0:
        flag = False
print(min(unko))

Fixed submission:
l,r = (int(i) for i in input().split())
a = []
for i in range(l,min(r,l+2019)):
  for j in range(i+1,min(r,l+2019)+1):
    a.append(i*j%2019)
print(min(a))
Buggy python submission (verdict: Runtime Error):
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print(Bad)
else:
  print(Good)
  
  

Fixed submission:
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print("Bad")
else:
  print("Good")

Buggy python submission (verdict: Runtime Error):
s = input()
bad = False
for i in range(len(s))[1:]:
  if s[i] == s[i-1]:
    bad = True
    break:

if bad:
  print(Bad)
else:
  print(Good)
  
  

Fixed submission:
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print("Bad")
else:
  print("Good")

Buggy python submission (verdict: Runtime Error):
s = input()
for i in range(len(s))[1:]:
  if s[i] == s[i-1]:
    print(Bad)
    break:
print(Good)
  

Fixed submission:
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print("Bad")
else:
  print("Good")
Buggy python submission (verdict: Runtime Error):
x, a = (int(i) for i in input().split())  
if x < a:
  print(0)
else:
  pritn(10)

Fixed submission:
x, a = (int(i) for i in input().split())  
if x < a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = (int(i) for i in input().split())
S = w * h / 2
a = 0
if w//2 == x and h//2 == y:
  a = 1
print(S+" "+a)


Fixed submission:
w, h, x, y = (int(i) for i in input().split())
S = w * h / 2
a = 0
if x*2 == w and y*2 == h:
  a = 1
print(S, a)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
bc = []

for i in range(m):
  tmp = [int(i) for i in input().split()]
  bc.append(tmp)

for i in range(m):
  tmp = [bc[i][1]] * bc[i][0]
  a += tmp

a.sort()
print(sum(a[::-1][:n]))


Fixed submission:
n, m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
bc = []
for i in range(m):
  tmp = [int(i) for i in input().split()]
  bc.append(tmp[::-1])

for i in range(n):
  tmp = [a[i]]
  tmp.append(1)
  bc.append(tmp)
  
bc.sort()
bc = bc[::-1]
#print(bc)

ans = 0
i = 0
count = 0
while count < n:
  if bc[i][1] == 0:
    i += 1
  ans += bc[i][0]
  bc[i][1] -= 1
  count += 1
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = (int(i) for i in input().split())  
s = input()
s_ = s[:k-1] + s[k].lower() + s[k:]
print(s_)

Fixed submission:
n, k = (int(i) for i in input().split())  
s = input()
s_ = s[:k-1] + s[k-1].lower() + s[k:]
print(s_)

Buggy python submission (verdict: Runtime Error):
n, k = (int(i) for i in input().split())  
s = input()
s_ = s[:k-1] + s[k].lower() + s[k:]
print(s_)

Fixed submission:
n, k = (int(i) for i in input().split())  
s = input()
s_ = s[:k-1] + s[k-1].lower() + s[k:]
print(s_)
Buggy python submission (verdict: Runtime Error):
a,b = (int(i) for i in input().split()) 
if a == b:
  print(a + b):
else:
  s = max(a, b)
  print(s + s -1)

Fixed submission:
a,b = (int(i) for i in input().split()) 
if a == b:
  print(a + b)
else:
  s = max(a, b)
  print(s + s -1)
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
ab = []
for i in range(x):
  for j in range(y):
    tmp = a[i] + b[j]
    ab += [tmp]
ab.sort()
ab = ab[::-1][:k]
#print(ab)

ans = []
for i in range(len(ab)):
  for j in range(z):
    tmp = ab[i] + c[j]
    ans += [tmp]
ans.sort()
ans = ans[::-1][:k]
for i in ans:
  print(i)


Fixed submission:
x,y,z,k = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
ab = []
for i in range(x):
  for j in range(y):
    tmp = a[i] + b[j]
    ab += [tmp]
ab.sort()
ab = ab[::-1][:k]
#print(ab)

ans = []
for i in range(len(ab)):
  for j in range(z):
    tmp = ab[i] + c[j]
    ans += [tmp]
ans.sort()
ans = ans[::-1][:k]
for i in ans:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = (int(i) for i in input().split())  
s = input()
l = []
r = []

for i in range(q):
  tmp = [int(j) for j in input().split()]
  l.append(tmp[0])
  r.append(tmp[1])
  
search = [0]
for i in range(1,n):
  if s[i-1:i+1] == "AC":
    search.append(1)
  else:
    search.append(0)

for i in range(q):
  ans = sum(search[l[i]-1:r[i]])
  if search[l[i]-1] == 1:
    ans -= 1
  print(ans)



Fixed submission:
n, q = (int(i) for i in input().split())  
s = input()
t = [0] * (n+1)

for i in range(n):
  if s[i:i+2] == "AC":
    t[i+1] = t[i] + 1
  else:
    t[i+1] = t[i]
    
for i in range(q):
  l, r = (int(i) for i in input().split())
  print(t[r-1] - t[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(i) for i in input().split()) 
p, y = [], []
yd = [[] for i in range(n+1)]
for i in range(m):
  tmp = [int(i) for i in input().split()]
  p.append(tmp[0])
  y.append(tmp[1])
  yd[p[i]].append(y[i])
for i in range(n):
  yd[i+1].sort()
for i in range(m):
  l = str(p[i])
  r = str(yd[p[i]].index(y[i])+1)
  lzero = l.zfill(6)
  rzero = r.zfill(6)
  print(lzero + rzero)


Fixed submission:
n, m = (int(i) for i in input().split()) 
py = [[int(i) for i in input().split()] for i in range(m)]
cnt = [0]*(n+1)
ids = {}
for p,y in sorted(py, key=lambda x: x[1]):
  cnt[p] += 1
  ids[y] = '%06d%06d' % (p, cnt[p])
for _, y in py:
  print(ids[y])

Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(i) for i in input().split()) 
p, y = [], []
yd = [[] for i in range(n+1)]
for i in range(m):
  tmp = [int(i) for i in input().split()]
  p.append(tmp[0])
  y.append(tmp[1])
  yd[p[i]].append(y[i])
for i in range(n):
  yd[i+1].sort()
for i in range(m):
  l = str(p[i])
  r = str(yd[p[i]].index(y[i])+1)
  lzero = l.zfill(6)
  rzero = r.zfill(6)
  print(lzero + rzero)

Fixed submission:
n, m = (int(i) for i in input().split()) 
py = [[int(i) for i in input().split()] for i in range(m)]
cnt = [0]*(n+1)
ids = {}
for p,y in sorted(py, key=lambda x: x[1]):
  cnt[p] += 1
  ids[y] = '%06d%06d' % (p, cnt[p])
for _, y in py:
  print(ids[y])
Buggy python submission (verdict: Runtime Error):
a,b = (int(i) for i in input().split())
def ssum(n):
  if n == 1:
    return 1
  else:
    return n + ssum(n-1)
print(ssum(b-a)-b)

Fixed submission:
a,b = (int(i) for i in input().split())
tower = [sum(range(1, i+1)) for i in range(1,1000)]
print(tower[b-a-1]-b)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x = [int(i) for i in input().split()]
x = sorted([[x[i], i] for i in range(n)])
#print(x)
ans = [0]*n
#print(ans)
for i in range(n):
  x_ = x[:i]+x[i+1:]
#  print(x_)
  ans[x[i][1]] = x_[n//2-1][0]
for i in range(n):
  print(ans[i])

Fixed submission:
n=int(input())
x = [int(i) for i in input().split()]
x = sorted([[x[i], i] for i in range(n)])
#print(x)
ans = [0]*n
for i in range(n):
  if i < n//2:
    ans[x[i][1]] = x[n//2][0]
  else:
    ans[x[i][1]] = x[n//2-1][0]
for i in range(n):
  print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,h = (int(i) for i in input().split())
a = []
b = []
cnt = 0
for i in range(n):
  x,y = (int(i) for i in input().split())
  a.append(x)
  b.append(-y)
import heapq
max = max(a)
b.append(-max)
heapq.heapify(b)
while(h>0):
  pop = heapq.heapreplace(b, -max)
  h -= -pop
  cnt += 1
print(cnt)

Fixed submission:
n,h = (int(i) for i in input().split())
a = []
b = []
cnt = 0
for i in range(n):
  x,y = (int(i) for i in input().split())
  a.append(x)
  b.append(y)
max = max(a)
b.sort()
for i in b[::-1]:
  if i >= max:
    h -= i
    cnt += 1
 #   print(i,h,cnt)
  if h <= 0:
    print(cnt)
    exit()
import math
cnt += int(math.ceil(h / max))
print(cnt)