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

#for i in range(N):
#	x[i] = abs(x[i] - X)

x.sort()
#x.reverse()

xmin = x[0]
#xmin = x[N-1]
'''
div = []
for i in range(int(xmin/2)+1, 0, -1):
	if xmin % i == 0:
		div.append(i)

for d in div:
	for xi in x:
		if xi % d != 0:
			break
	else:
		D = d
		break

print(D)
'''
for d in range(xmin,0,-1):
	for xi in x:
		if xi % d != 0:
			break
	else:
		D = d
		break

print(D)

Fixed submission:
N, X = map(int, input().split())
x = list(map(lambda x:abs(int(x)-X), input().split()))

#for i in range(N):
#	x[i] = abs(x[i] - X)

x.sort()
#x.reverse()

xmin = x[0]
#xmin = x[N-1]
'''
div = []
for i in range(int(xmin/2)+1, 0, -1):
	if xmin % i == 0:
		div.append(i)

for d in div:
	for xi in x:
		if xi % d != 0:
			break
	else:
		D = d
		break

print(D)
'''
for d in range(xmin,0,-1):
	for xi in x:
		if xi % d != 0:
			break
	else:
		D = d
		break

print(D)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()], 
             dtype = 'int64')
A = A - np.arange(N) - 1
B = np.abs(A - np.reshape(A, (-1, 1)))
print(np.sum(B, axis=1).min())

Fixed submission:
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])
A = np.sort(A - np.arange(N) - 1)
b = A[N//2]
print(np.sum(np.abs(A - b)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])
A = A - np.arange(N) - 1
B = np.abs(A - np.reshape(A, (-1, 1)))
print(np.sum(B, axis=1).min())

Fixed submission:
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])
A = np.sort(A - np.arange(N) - 1)
b = A[N//2]
print(np.sum(np.abs(A - b)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])
A = A - np.arange(N) - 1
B = A - np.reshape(A, (-1, 1))
print(np.sum(B, axis=1).max())

Fixed submission:
import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])
A = np.sort(A - np.arange(N) - 1)
b = A[N//2]
print(np.sum(np.abs(A - b)))
Buggy python submission (verdict: Runtime Error):
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub, itemgetter
import numpy as np

sys.setrecursionlimit(10000)

def read_int():
	return int(sys.stdin.readline().strip())

def read_int_n():
	return [int(x) for x in sys.stdin.readline().strip().split()]

def read_float():
	return float(sys.stdin.readline().strip())

def read_float_n():
	return [float(x) for x in sys.stdin.readline().strip().split()]

def read_str():
	return sys.stdin.readline().strip()

def read_str_n():
	return [str(x) for x in sys.stdin.readline().strip().split()]

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time
	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(S):
	c = Counter(S)
	ans = c['+'] - c['-']
	return ans

def main():
	S = read_str()
	print(slv(S))

if __name__ == '__main__':
	main()

Fixed submission:
#from sys import stdin
#input = stdin.readline

S = input()
n = 0

for i in S:
    if i == '+':
        n += 1
    else:
        n -= 1

print(n)
Buggy python submission (verdict: Runtime Error):
# AtCoder Beginner Contest 101
# B - Digit Sums

from sys import stdin
input = stdin.readline

N = input()
S = 0
for i in N:
    S += int(i)

if int(N) % S == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
N = input()
S = 0
for i in N:
    S += int(i)

if int(N) % S == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
for i in range(1,n):
  a=max(0,i-k)*(n//b)+max(0,n%i-k+1)
if k==0:
  a-=n
print(a)

Fixed submission:
n, k = map(int,input().split())
a=0
for i in range(1,n+1):
  a+=max(0,i-k)*(n//i)+max(0,n%i-k+1)
if k==0:
  a-=n
print(a)
Buggy python submission (verdict: Runtime Error):
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N = ri()
S = list(Counter(ri_()))
print('Three' if len(S) == 3 else 'Four')

Fixed submission:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N = ri()
S = list(Counter(rs_()))
print('Three' if len(S) == 3 else 'Four')
Buggy python submission (verdict: Runtime Error):
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
N, Y = ri_()
for i in range(N + 1):
    for j in range(N + 1):
        if 1000 * (N - i - j) == Y - 10000 * i - 5000 * j and N - i - j >= 0:
            print(i, j, N - i - j)
            exit()
print(-1, -1, -1)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()
def read(): return int(input())
def reads(): return [int(i) for i in input().split()]

N, Y = reads()

x_max = min(N, Y//10000)
y_max = min(N, Y//5000)

ans = (-1, -1, -1)

for x in range(x_max+1):
	for y in range(min(y_max+1, N-x+1)):
		if 10000*x + 5000*y + 1000*(N-x-y) == Y:
			ans = (x, y, N-x-y)
			break

print(str(ans[0])+' '+str(ans[1])+' '+str(ans[2]))

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()
def read(): return int(input())
def reads(): return [int(i) for i in input().split()]

N, Y = reads()

y_max = min(N, Y//10000)
i_max = min(N, Y//5000)
h_max = min(N, Y//1000)

ans = (-1, -1, -1)

for y in range(y_max+1):
	for i in range(i_max+1):
		for h in range(h_max+1):
			if 10000*y + 5000*i + 1000*h == Y:
				ans = (y, i, h)
				break

print(ans[0]+' '+ans[1]+' '+ans[2])

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()
def read(): return int(input())
def reads(): return [int(i) for i in input().split()]

N, Y = reads()

x_max = min(N, Y//10000)
y_max = min(N, Y//5000)

ans = (-1, -1, -1)

for x in range(x_max+1):
	for y in range(min(y_max+1, N-x+1)):
		if 10000*x + 5000*y + 1000*(N-x-y) == Y:
			ans = (x, y, N-x-y)
			break

print(str(ans[0])+' '+str(ans[1])+' '+str(ans[2]))
Buggy python submission (verdict: Runtime Error):
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N, A, B = ri()
print(min(A * N, B))

Fixed submission:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N, A, B = ri_()
print(min(A * N, B))
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
for op1 in ['+', '-']:
    for op2 in ['+', '-']:
        for op3 in ['+', '-']:
            ans = a
            if op1 == '+':
                ans += b
            else:
                ans -= b
            if op2 == '+':
                ans += c
            else:
                ans -= c
            if op3 == '+':
                ans += d
            else:
                ans -= d
            if ans == 7:
                print(str(a) + op1 + str(b) + op2 + str(c) + op3 + str(d) + '=7')
                exit()

Fixed submission:
a, b, c, d = [int(i) for i in input()]
for op1 in ['+', '-']:
    for op2 in ['+', '-']:
        for op3 in ['+', '-']:
            ans = a
            if op1 == '+':
                ans += b
            else:
                ans -= b
            if op2 == '+':
                ans += c
            else:
                ans -= c
            if op3 == '+':
                ans += d
            else:
                ans -= d
            if ans == 7:
                print(str(a) + op1 + str(b) + op2 + str(c) + op3 + str(d) + '=7')
                exit()

Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
for op1 in ['+', '-']:
    for op2 in ['+', '-']:
        for op3 in ['+', '-']:
            ans = a
            if op1 == '+':
                ans += b
            else:
                ans -= b
            if op2 == '+':
                ans += c
            else:
                ans -= c
            if op3 == '+':
                ans += d
            else:
                ans -= d
            if ans == 7:
                print(str(a) + op1 + str(b) + op2 + str(c) + op3 + str(d))
                exit()

Fixed submission:
a, b, c, d = [int(i) for i in input()]
for op1 in ['+', '-']:
    for op2 in ['+', '-']:
        for op3 in ['+', '-']:
            ans = a
            if op1 == '+':
                ans += b
            else:
                ans -= b
            if op2 == '+':
                ans += c
            else:
                ans -= c
            if op3 == '+':
                ans += d
            else:
                ans -= d
            if ans == 7:
                print(str(a) + op1 + str(b) + op2 + str(c) + op3 + str(d) + '=7')
                exit()
Buggy python submission (verdict: Runtime Error):
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

import numpy as np
v = np.stack([np.array(list(rs()),dtype=object), np.array(list(rs()),dtype=object)])
v = v.T.flatten()
print(''.join(v))

Fixed submission:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

o = rs()
e = rs()
ans = ''
for i in range(len(o)):
    ans += o[i]
    if i < len(e):
        ans += e[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
K, S = map(int, input().split())
ans = 0
for x in range(K+1):
  for y in range(K+1):
    z = k - x - y
    if 0 <= z <= K:
      ans += 1
print(ans)

Fixed submission:
K, S = map(int, input().split())
ans = 0
for x in range(K+1):
  for y in range(K+1):
    z = S - x - y
    if 0 <= z <= K:
      ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

K = int(input())

Sequence = 0
flag = 0
for i in range(K) : 
    Sequence += 7*(10**i)

    if Sequence % K == 0 : 
        flag = 1
        break

if flag == 1 : 
    print(i+1)
else : 
    print(-1)

Fixed submission:
# coding: utf-8
# Your code here!

K = int(input())

s = 7 % K
for i in range(1, K+1) : 
    if i != 1 : 
        s = (10*s + 7) % K

    if s == 0 : 
        print(i)
        exit()

print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

K = int(input())

Sequence = 0
flag = 0
for i in range(K) : 
    Sequence += 7*(10**i)

    if Sequence % K == 0 : 
        flag = 1
        break

if flag == 1 : 
    print(i+1)
else : 
    print(-1)

Fixed submission:
# coding: utf-8
# Your code here!

K = int(input())

s = 7 % K
for i in range(1, K+1) : 
    if i != 1 : 
        s = (10*s + 7) % K

    if s == 0 : 
        print(i)
        exit()

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

Queue = [i for i in range(1, 10, 1)]

cnt = 1

while(cnt <= k) : 
    x = Queue.pop(0)
    xx = x
    if len(str(xx)) >= 2 : 
        while(len(str(xx)) >= 2) : 
            xx = xx % 10

    ## 1つ目            
    if xx != 0 : 
        y = int("".join(map(str, [x, xx-1])))
        Queue.append(y)
        
    ## 2つ目            
    y = int("".join(map(str, [x, xx])))    
    Queue.append(y)

    ## 3つ目            
    if xx != 9 : 
        y = int("".join(map(str, [x, xx+1])))
        Queue.append(y)

    cnt += 1
            
print(x)

Fixed submission:
k = int(input())

Queue = [i for i in range(1, 10, 1)]

cnt = 0

while(cnt < k) : 
    cnt += 1
    x = Queue.pop(0)
    
    if cnt + len(Queue) >= k : 
        continue
    
    xx = x
    if len(str(xx)) >= 2 : 
        while(len(str(xx)) >= 2) : 
            xx = xx % 10

    ## 1つ目            
    if xx != 0 : 
        y = int("".join(map(str, [x, xx-1])))
        Queue.append(y)
        
    ## 2つ目            
    y = int("".join(map(str, [x, xx])))    
    Queue.append(y)

    ## 3つ目            
    if xx != 9 : 
        y = int("".join(map(str, [x, xx+1])))
        Queue.append(y)


print(x)

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

Queue = [i for i in range(1, 10, 1)]

cnt = 1

while(cnt <= k) : 
    x = Queue.pop(0)
    xx = x
    if len(str(xx)) >= 2 : 
        while(len(str(xx)) >= 2) : 
            xx = xx % 10
    for i in range(0, 10, 1) : 
        if abs(xx - i) <= 1 : 
            y = int("".join(map(str, [x, i])))
            Queue.append(y)
    cnt += 1
            
print(x)

Fixed submission:
k = int(input())

Queue = [i for i in range(1, 10, 1)]

cnt = 0

while(cnt < k) : 
    cnt += 1
    x = Queue.pop(0)
    
    if cnt + len(Queue) >= k : 
        continue
    
    xx = x
    if len(str(xx)) >= 2 : 
        while(len(str(xx)) >= 2) : 
            xx = xx % 10

    ## 1つ目            
    if xx != 0 : 
        y = int("".join(map(str, [x, xx-1])))
        Queue.append(y)
        
    ## 2つ目            
    y = int("".join(map(str, [x, xx])))    
    Queue.append(y)

    ## 3つ目            
    if xx != 9 : 
        y = int("".join(map(str, [x, xx+1])))
        Queue.append(y)


print(x)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

N = int(input())

if N%2 != 0 : 
    print(0)
    
else : 
    n = 1
    while 2*(5**n) <= N : 
        n += 1
        
    global_cnt = 0
    
    for i in range(1, n) : 
        local_cnt = N // (2*(5**i))
        global_cnt += local_cnt
        
print(global_cnt)

Fixed submission:
# coding: utf-8
# Your code here!

N = int(input())

if N%2 != 0 : 
    global_cnt = 0
else : 
    n = 1
    while 2*(5**n) <= N : 
        n += 1
        
    global_cnt = 0
    
    for i in range(1, n) : 
        local_cnt = N // (2*(5**i))
        global_cnt += local_cnt
        
print(global_cnt)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

N = int(input())

if N%2 != 0 : 
    print(0)
    
else : 
    global_cnt = 0
    
    for i in range(10, N+1, 10) : 
        mod = 0
        local_cnt = 0
        while(mod == 0) : 
            if i % 5 == 0 : 
                i = int(i/5)
                local_cnt += 1
            else : 
                mod = i % 5
        global_cnt += local_cnt
        
    print(global_cnt)

Fixed submission:
# coding: utf-8
# Your code here!

N = int(input())

if N%2 != 0 : 
    global_cnt = 0
else : 
    n = 1
    while 2*(5**n) <= N : 
        n += 1
        
    global_cnt = 0
    
    for i in range(1, n) : 
        local_cnt = N // (2*(5**i))
        global_cnt += local_cnt
        
print(global_cnt)
Buggy python submission (verdict: Runtime Error):
# input
n, q = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(n-1)]
PX = [tuple(map(int, input().split())) for _ in range(q)]

# other_setting
child = [0] * n
parent = [0] * n
value = [0] * n

for i in range(n) : 
    child[i] = []

for a, b in AB : 
    child[a-1].append(b)
    parent[b-1] = a

# op_function
def op(a) : 
    if a != 1 : 
        value[a-1] += value[parent[a-1]-1]

    if child[a-1] != [] : 
        for c in child[a-1] : 
            op(c)
            
# initial_state(value)
for p, x in PX : 
    value[p-1] += x
    
# exe
op(1)

print(*value)

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

if a < 3200 : 
    print("red")
else : 
    print(s)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
S = [input() for _ in range(n)]
cnt = 0

for i in range(n) : 
    for j in range(i) : 
        if Counter(S[i]) == Counter(S[j]) : 
            cnt += 1

print(cnt)

Fixed submission:
from collections import Counter

n = int(input())
S = [input() for _ in range(n)]
ans = 0

ctr = Counter()

for s in S : 
    a = ''.join(sorted(list(s)))
    if ctr[a] != 0 : 
        ans += ctr[a]
    ctr[a] += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# define
def isAnagram(str1, str2) : 
    true_flag = 1
    
    for i in str1 : 
        if (str1.count(i) != str2.count(i)) : 
            true_flag = 0
            
    if (true_flag == 1) : 
        return True
    else : 
        return False

# initial setting
cnt = 0
        
# number input
n = int(input())
s = [0] * n

# letter input
for i in range(n) : 
    s[i] = input()
    
# charcter count
for i in range(n) : 
    for j in range(i) : 
        if isAnagram(s[i], s[j]) == True : 
            cnt += 1

# output
print(cnt)
        
# all selection patterns(test)
# for i in range(4) : 
#     for j in range(i) : 
#         if i != j : 
#             print(i, j)

Fixed submission:
from collections import Counter

n = int(input())
S = [input() for _ in range(n)]
ans = 0

ctr = Counter()

for s in S : 
    a = ''.join(sorted(list(s)))
    if ctr[a] != 0 : 
        ans += ctr[a]
    ctr[a] += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
# input
n = int(input())
H = list(map(int, input().split()))
dec_L = []
S = []

# classify
for i in range(n-1) : 
    # increase
    if H[i] < H[i+1] : 
        inc_flag = 1
        dec_flag = 0 
    # decrease
    elif H[i] > H[i+1] : 
        dec_flag = 1
        inc_flag = 0    
    # remain
    elif H[i] == H[i+1] and inc_flag == 1 : 
        pass
    elif H[i] == H[i+1] and dec_flag == 1 : 
        pass
    
    dec_L.append(dec_flag)
    
# make new list
for i in range(len(dec_L)-1) : 
    if dec_L[i] == 0 and dec_L[i+1] == 1 : 
        p_cut = i
    elif dec_L[i] == 1 and dec_L[i+1] == 0 and p_cut >= 0 : 
        S.append(H[p_cut+1:i+2])
    elif i == len(dec_L)-2 and dec_L[len(dec_L)-2] == 1 and dec_L[len(dec_L)-1] == 1 : 
        S.append(H[p_cut+1:i+3])

# exe
NO_flag = 0
for s in S : 
    if max(s) - min(s) >= 2 : 
        NO_flag = 1
        
if NO_flag == 1 : 
    print("No")
else : 
    print("Yes")

# # confirm
# print(H)    
# print(dec_L)
# print(S)

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

No_flag = 0
for i in range(n-1, 0, -1) : 
    if H[i] >= H[i-1] : 
        pass
    elif H[i-1] - H[i] == 1 : 
        H[i-1] -= 1
    elif H[i-1] - H[i] >= 2 : 
        No_flag = 1
        break
    
if No_flag == 1 : 
    print("No")
else : 
    print("Yes")
Buggy python submission (verdict: Runtime Error):
X,Y,Z,K = map(int, input().split())


A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
D = []
E2 = []
F = []

# A + Bの全列挙 からのソート 

for i in A : 
    for j in B : 
        D.append(i+j)
        
E = sorted(D, reverse = True)

if len(E) > K : 
    for i in range(K) : 
        E2.append(E[i])
else : 
    E2 = E
        
####

for i in E2 : 
    for j in C : 
        F.append(i+j)
        
G = sorted(F, reverse = True)

for i in range(K) : 
    print(G[i])

Fixed submission:
import itertools as itr

antenna = []

s = 0

for _ in range(5) : 
    antenna.append(int(input()))
    
k = int(input())

l = list(itr.combinations(antenna, 2))

for i in l : 
    if (abs(i[0] -i[1])) > k :
        s = 1

if (s == 0) : 
    print("Yay!")
else : 
    print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
# listの各要素に人数を格納. 一番後ろに全員たどり着いたら終わり

list = [0] * 6
n_move = []

N = int(input())

for i in range(5) : 
    n_move.append(int(input()))


list[0] += N
time = 0

while list[-1] < N : 
    for i in range(4, -1, -1) : 
        if n_move[i] <= list[i] : 
            list[i+1] += n_move[i]
            list[i] -= n_move[i]
        else : 
            list[i+1] += list[i]
            list[i] = 0
    time += 1
    
print(time)

Fixed submission:
# listの各要素に人数を格納. 一番後ろに全員たどり着いたら終わり

list = [0] * 6
n_move = []
time = 4

N = int(input())

for i in range(5) : 
    n_move.append(int(input()))
    
n_min = min(n_move)

if(N % n_min == 0) : 
    time += N // n_min
else : 
    time += N // n_min + 1

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

AB = []

for i in range(N) : 
    tmp_AB = [int(i) for i in input().split()]
    AB.append(tmp_AB)
    
P_list = []

for i in range(N) : 
    for j in range(AB[i][1]) : 
        P_list.append(AB[i][0])

P_list_sorted = sorted(P_list)

sum = 0

for i in range(M) : 
    sum += P_list_sorted[i]
    
print(sum)

Fixed submission:
N,M = map(int, input().split())
 
AB = []
 
for i in range(N) : 
    tmp_AB = [int(i) for i in input().split()]
    AB.append(tmp_AB)
    
P = sorted(AB)
 
sum = 0
cnt = 0 # Mに達したら終了

for i in range(len(P)) : 
    for j in range(P[i][1]) : 
        if cnt < M: 
            sum += P[i][0]
            cnt += 1
        else :
            break
        
    if cnt >= M : 
        break
    
print(sum)