Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
X, Y, Z, K = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

ab_items = []
for a in a_list:
    for b in b_list:
        ab_items.append(a + b)

ab_items.sort(reverse=True)
ab_items = ab_items[:K + 1]

ans = []
for c in c_list:
    for ab in ab_items:
        ans.append(c + ab)

ans.sort(reverse=True)

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


Fixed submission:
X, Y, Z, K = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

ab_items = []
for a in a_list:
    for b in b_list:
        ab_items.append(a + b)

ab_items.sort(reverse=True)
ab_items = ab_items[:K + 1]

ans = []
for c in c_list:
    for ab in ab_items:
        ans.append(c + ab)

ans.sort(reverse=True)

for i in range(K):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
s_list = list(map(int, input().split()))

s_list.sort(reverse=True)

mod = 10 ** 9 + 7

dp = [[0] * (X + 1) for _ in range(N + 1)]
dp[0][X] = 1

for i in range(N):
    for x in range(X + 1):
        if dp[i][x] == 0:
            continue
        s = s_list[i]
        dp[i + 1][x % s] += dp[i][x]
        dp[i + 1][x % s] %= mod
        dp[i + 1][x] += dp[i][x] * (N - i - 1)
        dp[i + 1][x] %= mod

ans = 0
for x in range(1, X + 1):
    ans += dp[N][x] * x
    ans %= mod
print(ans)


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

s_list.sort(reverse=True)

mod = 10 ** 9 + 7

dp = [[0] * (X + 1) for _ in range(N + 1)]
dp[0][X] = 1

for i in range(N):
    for x in range(X + 1):
        if dp[i][x] == 0:
            continue
        s = s_list[i]
        dp[i + 1][x % s] += dp[i][x]
        dp[i + 1][x % s] %= mod
        dp[i + 1][x] += dp[i][x] * (N - i - 1)
        dp[i + 1][x] %= mod

ans = 0
for x in range(1, X + 1):
    ans += dp[N][x] * x
    ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

mod = 10 ** 9 + 7

dp = [[[[0] * 4 for _ in range(4)] for _ in range(4)] for _ in range(N + 1)]

dp[0][3][3][3] = 1

print(dp)
for i in range(N):
    for j in range(4):
        for k in range(4):
            for m in range(4):
                if dp[i][j][k][m] == 0:
                    continue
                for l in range(4):
                    if l == 2 and j == 1 and k == 0:
                        continue
                    if l == 2 and j == 0 and k == 1:
                        continue
                    if l == 1 and j == 2 and k == 0:
                        continue
                    if l == 2 and j == 1 and m == 0:
                        continue
                    if l == 2 and k == 1 and m == 0:
                        continue
                    dp[i + 1][l][j][k] += dp[i][j][k][m]
                    dp[i + 1][l][j][k] %= mod

ans = 0
print(dp)
for i in range(4):
    for j in range(4):
        for k in range(4):
            ans += dp[N][i][j][k]
            ans %= mod
print(ans)


Fixed submission:
b = input()

if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "G":
    print("C")
else:
    print("G")
Buggy python submission (verdict: Runtime Error):
A, B, Q = map(int, input().split())
s_list = [int(input()) for i in range(A)]
t_list = [int(input()) for i in range(B)]
x_list = [int(input()) for _ in range(Q)]

s_list.sort()
t_list.sort()
import bisect

ans = []
for x in x_list:
    tmp = float("inf")
    s_i = bisect.bisect_left(s_list, x)
    t_i = bisect.bisect_left(t_list, x)

    if s_i == A and t_i == B:
        tmp = abs(x - min(s_list[-1], t_list[-1]))
        ans.append(tmp)
        continue
    if s_i == A:
        if t_i != 0:
            tmp = abs(s_list[-1] - x)
            if s_list[-1] <= t_list[t_i] <= x:
                ans.append(tmp)
                continue
            else:
                tmp += min(abs(t_list[t_i] - x) * 2, abs(t_list[t_i - 1] - s_list[-1]))
        else:
            tmp = abs(min(abs(s_list[s_i - 1] - x), abs(t_list[0] - x)) * 2 + max(abs(s_list[s_i - 1] - x), abs(t_list[0] - x)))
        ans.append(tmp)
        continue
    if t_i == B:
        if s_i != 0:
            tmp = abs(t_list[-1] - x)
            if t_list[-1] <= s_list[t_i] <= x:
                ans.append(tmp)
                continue
            else:
                tmp += min(abs(s_list[s_i] - x) * 2, abs(s_list[s_i - 1] - t_list[-1]))
        else:
            tmp = abs(min(abs(t_list[t_i - 1] - x), abs(s_list[0] - x)) * 2 + max(abs(t_list[t_i - 1] - x), abs(s_list[0] - x)))
        ans.append(tmp)
        continue
    tmp = min(tmp, max(s_list[s_i], t_list[t_i]) - x)
    if s_i != 0:
        tmp = min(tmp, s_list[s_i - 1] + t_list[t_i] - x)
    if t_i != 0:
        tmp = min(tmp, s_list[s_i] + t_list[t_i - 1] - x)
    ans.append(tmp)

for a in ans:
    print(a)



Fixed submission:
A, B, Q = map(int, input().split())
s_list = [int(input()) for i in range(A)]
t_list = [int(input()) for i in range(B)]
x_list = [int(input()) for _ in range(Q)]

s_list.sort()
t_list.sort()
s_list = [-float("inf")] + s_list + [float("inf")]
t_list = [-float("inf")] + t_list + [float("inf")]
import bisect

ans = []
for x in x_list:
    tmp = float("inf")
    s_i = bisect.bisect_left(s_list, x)
    t_i = bisect.bisect_left(t_list, x)

    for s in (s_list[s_i - 1], s_list[s_i]):
        for t in (t_list[t_i - 1], t_list[t_i]):
            d1 = abs(s - x) + abs(t - s)
            d2 = abs(t - x) + abs(s - t)
            tmp = min(tmp, d1, d2)
    ans.append(tmp)
for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_list = list(map(int, input().split()))

items = {
    1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6
}
dp = [0] * (N + 1)

b_list = []
for a in a_list:
    need = items[a]
    if need <= N:
        dp[need] = a
        b_list.append(a)

M = len(b_list)
b_list.sort()
for i in range(N + 1):
    for b in b_list:
        if i - items[b] >= 0:
            if dp[i - items[b]] != 0:
                cnt = 0
                num = dp[i - items[b]]
                while num >= 1:
                    cnt += 1
                    num //= 10
                tmp = max(b * (10 ** cnt) + dp[i - items[b]], dp[i - items[b]] * 10 + b)
                dp[i] = max(tmp, dp[i])
print(dp[N])


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())
x_list = list(map(int, input().split()))

x_list.sort()
ans = 0

margin = [0] * (M - 1)
f = x_list[0]
for i in range(1, M):
    margin[i - 1] = x_list[i] - f
    f = x_list[i]
margin = sorted(enumerate(margin), key=lambda x: (-x[1], x[0]))
cnt = [0]
for i, v in margin:
    cnt.append(i + 1)
    if len(cnt) == N:
        break

start = 0
prev = x_list[0]
for i, c in enumerate(cnt[1:]):
    for j in range(start, c):
        ans += x_list[j] - prev
        prev = x_list[j]
    start = c
    prev = x_list[c]
last = cnt[-1]
for i in range(last, M):
    if i == last:
        prev = x_list[i]
    else:
        ans += x_list[i] - prev
        prev = x_list[i]
print(ans)


Fixed submission:
T, x = map(int, input().split())
print(T/x)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
a_list = list(map(int, input().split()))
cnt = [0] * K
for a in a_list:
    bi = bin(a)[2:].zfill(K)
    if a >= K:
        continue
    for j in range(len(bi)):
        if bi[j] == "1":
            cnt[j] += 1
xor_str = ""
first = float("inf")
k_bin = bin(K)[2:]
for i, c in enumerate(cnt):
    if c % 2 == 0:
        xor_str += "0"
        if c >= 2 and i < first:
            first = i
    else:
        xor_str += "1"
if xor_str.count("0") == K:
    xor_str = xor_str[1:first] + "1" + xor_str[first:K]
xor = int(xor_str, 2)
ans = 0
for a in a_list:
    ans += xor ^ a
print(ans)


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

b = [0] * 41
for a in A:
    for k in range(41):
        if a & (1 << k):
            b[k] += 1

x = 0
for k in range(40, -1, -1):
    if x + (1 << k) > K:
        continue
    if b[k] < (N + 1) // 2:
        x += (1 << k)

ans = 0
for a in A:
    ans += x ^ a
print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s_list = []
for i in range(H):
    s = list(input())
    s_list.append(s)

dp = [[0 for _ in range(W)] for _ in range(H)]
dp[0][0] = 1
mod = 10 ** 9 + 7
for i in range(H):
    for j in range(W):
        if s_list[i][j] == "#":
            continue
        if i + 1 < H and s_list[i + 1][j] == ".":
            dp[i + 1][j] += dp[i][j] % mod
        if j + 1 < W and s_list[i][j + 1] == ".":
            dp[i][j + 1] += dp[i][j] % mod
print(dp[H - 1][W - 1] % mod)


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

dp = [float("inf") for _ in range(N + 1)]
dp[1] = 0
for i in range(2, N + 1):
    if i == 2:
        dp[2] = abs(h_list[1] - h_list[0])
    else:
        dp[i] = min(dp[i - 1] + abs(h_list[i-1] - h_list[i - 2]), dp[i - 2] + abs(h_list[i-1] - h_list[i - 3]))
print(dp[N])
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())

items = [list(map(int, input().split())) for _ in range(N)]
v_sum = sum([item[1] for item in items])

inf = float("inf")
dp = [inf for _ in range(v_sum + 1)]

dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        if dp[j] >= dp[j - items[i][1] + items[i][0]]:
            dp[j] = dp[j - items[i][1]] + items[i][0]

for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        exit()


Fixed submission:
N, W = map(int, input().split())
goods = [list(map(int, input().split())) for i in range(N)]
v_sum = sum([i[1] for i in goods])
dp = [float("inf") for i in range(v_sum + 1)]
dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        dp[j] = min(dp[j - goods[i][1]] + goods[i][0], dp[j])

for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        break

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

items = [list(map(int, input().split())) for i in range(N)]
v_sum = sum([i[1] for i in items])

inf = float("inf")
dp = [inf for i in range(v_sum + 1)]

dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        if dp[j] > dp[j - items[i][1] + items[i][0]]:
            dp[j] = dp[j - items[i][1]] + items[i][0]

for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        exit()


Fixed submission:
N, W = map(int, input().split())
goods = [list(map(int, input().split())) for i in range(N)]
v_sum = sum([i[1] for i in goods])
dp = [float("inf") for i in range(v_sum + 1)]
dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        dp[j] = min(dp[j - goods[i][1]] + goods[i][0], dp[j])

for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
goods = [list(map(int, input().split())) for i in range(N)]
v_sum = sum([i[1] for i in goods])
dp = [float("inf") for i in range(v_sum + 1)]
dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        dp[j] = min(dp[j - goods[i][1]] + goods[i][0], dp[j])

for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        break


Fixed submission:
N, W = map(int, input().split())
goods = [list(map(int, input().split())) for i in range(N)]
v_sum = sum([i[1] for i in goods])
dp = [float("inf") for i in range(v_sum + 1)]
dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        dp[j] = min(dp[j - goods[i][1]] + goods[i][0], dp[j])

for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p_list = list(map(float, input().split()))

dp = [[0.0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[1][1] = p_list[0]
dp[1][0] = 1 - p_list[0]

for i in range(2, N + 1):
    for j in range(i + 1):
        dp[i][j] = p_list[i - 1] * dp[i - 1][j - 1] + (1 - p_list[i - 1]) * dp[i - 1][j]

print("{:.10f}".format(sum(dp[N][N // 2 + 1:])))



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

dp = [[0.0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[1][1] = p_list[0]
dp[1][0] = 1 - p_list[0]

for i in range(2, N + 1):
    for j in range(i + 1):
        dp[i][j] = p_list[i - 1] * dp[i - 1][j - 1] + (1 - p_list[i - 1]) * dp[i - 1][j]

print("{:.10f}".format(sum(dp[N][N // 2 + 1:])))

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

dp = [[0.0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[1][1] = p_list[0]
dp[1][0] = 1 - p_list[0]

for i in range(2, N + 1):
    for j in range(i + 1):
        dp[i][j] = p_list[i - 1] * dp[i - 1][j - 1] + (1 - p_list[i - 1]) * dp[i - 1][j]

print("{:.10f}".format(sum(dp[N][N // 2 + 1:])))



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

dp = [[0.0 for _ in range(N + 1)] for _ in range(N + 1)]
dp[1][1] = p_list[0]
dp[1][0] = 1 - p_list[0]

for i in range(2, N + 1):
    for j in range(i + 1):
        dp[i][j] = p_list[i - 1] * dp[i - 1][j - 1] + (1 - p_list[i - 1]) * dp[i - 1][j]

print("{:.10f}".format(sum(dp[N][N // 2 + 1:])))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_list = list(map(int, input().split()))

one, two, three = 0, 0, 0
for a in a_list:
    if a == 1:
        one += 1
    if a == 2:
        two += 1
    if a == 3:
        three += 1

dp = [[[0.0] * 301 for _ in range(301)] for _ in range(301)]
for k in range(three+1):
    for j in range(two+three+1-k):
        for i in range(one+two+three+1-k-j):
            if i == 0 and j == 0 and k == 0:
                continue
            tmp = N * 1.0
            if i != 0:
                tmp += i * dp[i - 1][j][k]
            if j != 0:
                tmp += j * dp[i + 1][j - 1][k]
            if k != 0:
                tmp += k * dp[i][j + 1][k - 1]

            dp[i][j][k] = tmp / (i + j + k)
print(dp[one][two][three])


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

one, two, three = 0, 0, 0
for a in a_list:
    if a == 1:
        one += 1
    if a == 2:
        two += 1
    if a == 3:
        three += 1

dp = [[[0.0] * 301 for _ in range(301)] for _ in range(301)]
for k in range(three+1):
    for j in range(two+three+1-k):
        for i in range(one+two+three+1-k-j):
            if i == 0 and j == 0 and k == 0:
                continue
            tmp = N * 1.0
            if i != 0:
                tmp += i * dp[i - 1][j][k]
            if j != 0:
                tmp += j * dp[i + 1][j - 1][k]
            if k != 0:
                tmp += k * dp[i][j + 1][k - 1]

            dp[i][j][k] = tmp / (i + j + k)
print(dp[one][two][three])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = [int(input()) for _ in range(n)]

a_list.sort(reverse=True)

if n == 1:
    print("first" if a_list[0] % 2 == 1 else "second")
    exit()

elif n == 2:
    max_num = a_list[0]
    second_num = a_list[1]
    num = max_num - second_num
    print("first" if num % 2 == 1 else "second")
else:
    max_num = a_list[0] - a_list[2]
    second_num = a_list[1] - a_list[2]
    num = max_num - second_num
    if num == 0:
        print("second")
    print("first" if num % 2 == 1 else "second")


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

def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


prime_fac = prime_factorize(p)
counts = []
for k, v in prime_fac.items():
    if v >= n:
        counts.append(k**(v//n))

counts.sort(reverse=True)
#print(prime_fac)
#print(counts)
if len(counts) == 0:
    print(1)
elif n == 1:
    print(p)
else:
    r = 1
    num = 0
    for c in counts:
        if num >= n:
            break
        r *= c
        num += 1
    print(r)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int, input().split()))
two_list = [2 ** i for i in range(32)]
 
count = 0
items = {}
for a in A_list:
    if a in items:
        items[a] += 1
 
    else:
        items[a] = 1
A_list.sort(reverse=True)
 
for a in A_list:
    if items[a] >= 1:
 
        for t in two_list:
            m = t -a
            if m in items:
                if m == a and items[a] >= 2:
                    count += 1
                    items[a] -= 1
                    items[m] -= 1
                    break
 
                elif m != a and items[m] >= 1 and items[a] >=1:
                    count += 1
                    items[a] -= 1
                    items[m] -= 1
                    break
print(count)

Fixed submission:
S = input()
S_list = []
for i in S:
    S_list.append(i)

w_count = S.count("W")
b_count = S.count("B")
c = 0

for i in range(len(S)):

    if S[i] == "B":
        c += w_count
    else:
        w_count -= 1

print(c)
Buggy python submission (verdict: Runtime Error):
package main

import (
	"bufio"
	"io"
	"os"
	"strconv"
	"fmt"
)

var (
	nstr   func() string
	stdout *bufio.Writer
)

func init() {
	nstr = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func main() {
	defer stdout.Flush()
	n := nint()
	k := nint()
	aList := getIntSlice(n)

	sumList := make([]int, 0)
	for i:=0;i<n ;i++  {
		for j:=i+1;j<n+1 ;j++  {
			sum := 0
			for tmp:=i;tmp<j ;tmp++  {
				sum += aList[tmp]
			}
			sumList = append(sumList, sum)
		}
	}
	var (
		ans int
		count int
	)
	for i:=40; i>=0; i--{
		checkNum := 1 << uint(i)
		for j:=0;j<len(sumList) ;j++  {
			logical := checkNum & sumList[j]
			if logical !=0{
				count ++
			}
		}
		if count >= k{
			ans += checkNum
			tmp := make([]int, 0)
			for m:=0;m<len(sumList) ;m++  {
				if sumList[m] &( 1 << uint(i)) !=0{
					tmp = append(tmp, sumList[m])
				}

			}
			sumList =  tmp
		}
		count = 0

	}
	fmt.Println(ans)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func nint64() int64 {
	i, err := strconv.ParseInt(nstr(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func nint() int {
	return int(nint64())
}

func getIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = nint()
	}
	return b
}

func getStringSlice(n int) []string {
	b := make([]string, n)
	for i := 0; i < n; i++ {
		b[i] = nstr()
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

func contains(s []int, e int) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}

func bin(i int, prefix bool) string {
	i64 := int64(i)

	if prefix {
		return "0b" + strconv.FormatInt(i64, 2)
	} else {
		return strconv.FormatInt(i64, 2)
	}
}

func strReverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}

	return string(runes)
}



Fixed submission:
N, K = map(int, input().split())
a_list = list(map(int, input().split()))
sum_list = []

for i in range(N):
    for j in range(i, N):
        sum_list.append(sum(a_list[i:j+1]))
ans = 0
count = 0
tmp = []
for i in range(40, -1, -1):
    for s in sum_list:
        check_num = 1 << i
        logical_and = check_num & s

        if logical_and != 0:
            count += 1

    if count >= K:
        ans += 1 << i
        tmp = [x for x in sum_list if (1 << i) & x != 0]
        sum_list = tmp[:]
    count = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

p_list = []
y_list = []
shi_map = {}

for i in range(M):
    p, y = map(int, input().split())
    p_list.append(p)
    y_list.append(y)
    if p in shi_map:
        shi_map[p].append(y)
    else:
        shi_map[p] = [y]
shi_map2 = {}
for k, v in shi_map.items():
    v = sorted(v)
    shi_map2[k] = v

for i in range(M):
    p = p_list[i]
    y = y_list[i]
    j = shi_map2[p].index(y)
    p_str = str(p).zfill(6)
    j_str = str(j+1).zfill(6)
    print(p_str + j_str)



Fixed submission:
X, Y = map(int, input().split())

print(X + Y //2)
Buggy python submission (verdict: Runtime Error):
N = int(input())

in_list = []
for i in range(N):
    xyh = list(map(int, input().split()))
    in_list.append(xyh)

H = []
xy = []

for i, xyh in enumerate(in_list):
    x, y, h = xyh[0], xyh[1], xyh[2]

    if i == 0:
        for x1 in range(0, 101):
            for y1 in range(0, 101):
                H1 = h + abs(x-x1) + abs(y-y1)
                H.append(H1)
                xy.append([x1, y1])
    else:
        tmpH = []
        tmpxy = []
        for xy0, h0 in zip(xy, H):
            tm = h0-abs(x-xy0[0])-abs(y-xy0[1])
            if h == max(0, tm):
                tmpH.append(h0)
                tmpxy.append([xy0[0], xy0[1]])
        H = tmpH
        xy = tmpxy

print(xy[0][0], end=" ")
print(xy[0][1], end=" ")
print(H[0], end=" ")

Fixed submission:
N = int(input())

in_list = []
x0, y0, h0 = 0, 0, 0
for i in range(N):
    xyh = list(map(int, input().split()))
    in_list.append(xyh)

for i in range(N):
    if in_list[i][2]:
        x0, y0, h0 = in_list[i]

for Cx in range(0, 101):
    for Cy in range(0, 101):
        for xyh in in_list:
            x, y, h = xyh[0], xyh[1], xyh[2]
            H = h0 + abs(x0-Cx) + abs(y0-Cy)
            if h != max(H-abs(x-Cx)-abs(y-Cy), 0):
                break
        else:
            print(Cx, Cy, H)
Buggy python submission (verdict: Time Limit Exceeded):
def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


from math import factorial


def comb(n, r):
    return factorial(n) // (factorial(n-r) * factorial(r))


n, m = map(int, input().split())
r = 1
prime_fac = prime_factorize(m)
for v in prime_fac.values():
    r *= comb(v+n-1, v)
mod = 1000000000 + 7
print(r % mod)


Fixed submission:
def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor


from math import factorial


def comb(n, r):
    return factorial(n) // (factorial(n-r) * factorial(r))


n, m = map(int, input().split())
r = 1
prime_fac = prime_factorize(m)
for v in prime_fac.values():
    r *= comb(v+n-1, v)
mod = 1000000000 + 7
print(r % mod)