Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02675 (python)

Fixed submission:
a = input()
n = len(a)
if (int(a[n-1])==3):
  print("bon")
elif(int(a[n-1]) in [0,1,6,8]):
  print("pon")
elif(int(a[n-1]) in [2,4,5,7,9]):
  print("hon")

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int, input().split())

total_min = 60 * H + M
ch = (360/(12*60)) * total_min
cm = 360/60 * M

print(math.sqrt(A*A + B*B - 2*A*B*math.cos(ch-cm)) )

Buggy submission (verdict: Runtime Error):
a = input()
n = len(a)
if (int(a[n-1])==3):
  print(bon)
if (int(a[n-1]) in [0,1,6,8] ):
  print(pon)
if (int(a[n-1]) in [2,4,5,7,9] ):
  print(hon)

Buggy submission (verdict: Runtime Error):
a = input()
n = len(a)
if (a[n-1]==3):
  print(bon)
elif(a[n-1] in [0,1,6,8]):
  print(hon)
else:
  print(pon)

Buggy submission (verdict: Runtime Error):
a = input()
n = len(a)
if (a[n]==3):
  print(bon)
elif(a[n] in [0,1,6,8]):
  print(hon)
else:
  print(pon)
Problem p02607 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0, n, 2):
    if a[i] % 2 == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n+2, 2):
    if a[i-1] % 2 == 1:
        ans += 1
print(ans)
Problem p03598 (python)

Fixed submission:
n=int(input())
k=int(input())
xs=list(map(int,input().split(' ')))
#A (0,i)
#B (K,i)
sum=0
for i in range(n):
  deltak=abs(xs[i]-k)
  if xs[i]<deltak:
    sum+=2*xs[i]
  else:
    sum+=deltak*2
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
xs=map(int,input().split(' '))
#A (0,i)
#B (K,i)
sum=0
for i in range(n):
  deltak=abs(xs[i]-k)
  if xs[i]<deltak:
    sum+=2*xs[i]
  else:
    sum+=deltak*2
print(sum)
Problem p02621 (python)

Fixed submission:
n=int(input())
p = n +n*n+n*n*n
print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
print(a*(1+a+a*a))
Problem p02618 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def solve(D, C, S):
    return [1] * D


def main():
    D = int(input())
    C = inpl()
    S = [inpl() for _ in range(D)]
    ans = solve(D, C, S)

    print(*ans, sep='\n')
    return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from random import randint
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def count_v(last_d, C, S, t, d):
    ret = S[t - 1]
    last_d[t - 1] = d
    for i in range(len(last_d)):
        ret -= C[i] * (d - last_d[i])
    return ret


def count_v_virtual(last_d, C, S, t, d):
    ret = S[t]
    tmp = last_d[t]
    last_d[t] = d
    for i in range(len(last_d)):
        ret -= C[i] * (d - last_d[i])
    last_d[t] = tmp
    return ret


def get_diff_score(T, d, q, C, D, Ss):
    diff = 0
    original_t = T[d - 1]
    last_d_q = 0
    last_d_ori = 0
    for i in range(d):
        if T[i] == q:
            last_d_q = i + 1
        if T[i] == original_t and i < d - 1:
            last_d_ori = i + 1
    # print(d, q, original_t, last_d_q, last_d_ori)
    for i in range(d - 1, D):
        if T[i] == q:
            break
        diff += C[q - 1] * (d - last_d_q)
    # print(diff, C[q - 1])
    T[d - 1] = q
    for i in range(d - 1, D):
        if T[i] == original_t:
            break
        diff -= C[original_t - 1] * (d - last_d_ori)
    # print(C[original_t - 1], diff)
    diff += Ss[d - 1][q - 1] - Ss[d - 1][original_t - 1]
    return diff


def main():
    D = int(input())
    C = inpl()
    Ss = [inpl() for _ in range(D)]
    T = []
    last_d = [-1] * len(C)
    Contest = 26

    for d in range(D):
        tmp_t, tmp_v = -1, -float('inf')
        for i in range(Contest):
            tmp_score = count_v_virtual(last_d, C, Ss[d], i + 1, d)
            if tmp_score > tmp_v:
                tmp_v = tmp_score
                tmp_t = i
        last_d[tmp_t] = d
        T.append(tmp_t + 1)

    Cs = [i + 1 for i, c in enumerate(C)]
    Cs.sort(key=lambda x: C[x - 1])

    for _ in range(100):
        d, q = randint(1, D), randint(1, Contest)
        ori_q = T[d - 1]
        diff = get_diff_score(T, d, q, C, D, Ss)
        if diff < 0:
            T[d - 1] = ori_q

    for t in T:
        print(t)

    return


if __name__ == '__main__':
    main()
Problem p02721 (python)

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


def inpl():
    return list(map(int, input().split()))


def GetBase(t=0):
    ret = []
    last = -C * 2 - 1
    for i, s in enumerate(S[t:]):
        if s == 'x':
            continue
        elif last + C >= i + t:
            continue

        ret.append(i + t)
        last = i + t
    return ret


def GetReverse():
    ret = []
    last = -C * 2 - 1
    for i, s in enumerate(S[::-1]):
        if s == 'x':
            continue
        elif last + C >= i:
            continue

        ret.append(len(S) - 1 - i)
        last = i
    return reversed(ret)


def GetDepend(base_ans):
    ruiseki = []
    a = 0
    for s in S:
        if s == 'o':
            a += 1
            ruiseki.append(a)
        else:
            ruiseki.append(a)

    ret = {a: False for a in base_ans}
    for a in ret:
        if ruiseki[a] == ruiseki[min(N - 1, a + C)]:
            ret[a] = True
    return ret


def solve():
    base_ans = GetBase()
    if len(base_ans) > K:
        return []

    reverse_ans = GetReverse()

    return sorted(list(set(base_ans) & set(reverse_ans)))


N, K, C = inpl()
S = list(input().strip())

ans = solve()

for a in ans:
    print(a + 1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def inpl():
    return list(map(int, input().split()))


def GetBase(s=0):
    ret = []
    last = -C * 2 - 1
    for i, s in enumerate(S[s:]):
        if s == 'x':
            continue
        elif last + C >= i + s:
            continue

        ret.append(i + s)
        last = i + s
    return ret


def GetDepend(base_ans):
    ruiseki = []
    a = 0
    for s in S:
        if s == 'o':
            a += 1
            ruiseki.append(a)
        else:
            ruiseki.append(a)

    ret = {a: False for a in base_ans}
    for a in ret:
        if ruiseki[a] == ruiseki[min(N - 1, a + C)]:
            ret[a] = True
    return ret


def solve():
    base_ans = GetBase()
    if len(base_ans) > K:
        return []

    depend_dict = GetDepend(base_ans)
    for i, b in enumerate(base_ans):
        if depend_dict[b] is True:
            continue
        S[b] = 'x'
        tmp = GetBase(s=i)
        if len(tmp) + i < K:
            depend_dict[b] = True
        else:
            for s in set(base_ans) & set(tmp):
                depend_dict[s] = True

        S[b] = 'o'

    return [a + 1 for a in base_ans if depend_dict[a] is True]


N, K, C = inpl()
S = list(input().strip())

ans = solve()

for a in ans:
    print(a)
Problem p02742 (python)

Fixed submission:
def inpl():
    return list(map(int, input().split()))


HW = inpl()
HW.sort()
if HW[0] == 1:
    print(1)
    exit()
print(HW[0] * HW[1] // 2 + int(HW[0] % 2 == 1 and HW[1] % 2 == 1))

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


HW = inpl()
HW.sort()
if HW[0] == 1:
    print(1)
    exit()
print(HW[0] * HW[1] // 2 + int(H[0] % 2 == 1 and H[1] % 2 == 1))
Problem p02749 (python)

Fixed submission:
import sys

sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def dfs(n, d):
    if depth[n] != -1:
        return
    depth[n] = d
    for nn in eAB[n]:
        dfs(nn, d + 1)
    return


N = int(input())
AB = [inpl() for i in range(N - 1)]

eAB = [[] for i in range(N)]
for a, b in AB:
    eAB[a - 1].append(b - 1)
    eAB[b - 1].append(a - 1)

depth = [-1 for i in range(N)]

dfs(0, 0)

eo = [[], []]
for i in range(N):
    eo[depth[i] % 2].append(i)

# print(eo)
ans = [-1 for i in range(N)]
if len(eo[0]) > N // 3 and len(eo[1]) > N // 3:
    for i in range(N // 3):
        ans[eo[0][i]] = 3 * i + 1
        ans[eo[1][i]] = 3 * i + 2
    t_0 = N // 3
    t_1 = N // 3
    if N % 3 > 0:
        ans[eo[0][N // 3]] = 3 * (N // 3) + 1
        t_0 += 1
    if N % 3 > 1:
        ans[eo[1][N // 3]] = 3 * (N // 3) + 2
        t_1 += 1
    # print(ans)
    for i, v in enumerate(eo[0][t_0:] + eo[1][t_1:]):
        ans[v] = 3 * (i + 1)
else:
    if len(eo[0]) <= N // 3:
        ni = 0
    else:
        ni = 1
    tmp = [True for i in range(N + 1)]
    for i in range(len(eo[ni])):
        ans[eo[ni][i]] = 3 * (i + 1)
        tmp[3 * (i + 1)] = False
    tmp = [i for i, t in enumerate(tmp) if t is True]
    j = 1
    for i in range(N):
        if ans[i] != -1:
            continue
        ans[i] = tmp[j]
        j += 1

print(" ".join(list(map(str, ans))))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def dfs(n, d):
    if depth[n] != -1:
        return
    depth[n] = d
    for nn in eAB[n]:
        dfs(nn, d + 1)
    return


N = int(input())
AB = [inpl() for i in range(N - 1)]

eAB = [[] for i in range(N)]
for a, b in AB:
    eAB[a - 1].append(b - 1)
    eAB[b - 1].append(a - 1)

depth = [-1 for i in range(N)]

dfs(0, 0)

eo = [[], []]
for i in range(N):
    eo[depth[i] % 2].append(i)

ans = [-1 for i in range(N)]
if len(eo[0]) > N // 3 and len(eo[1]) > N // 3:
    for i in range(N // 3):
        ans[3 * i] = eo[0][i]
        ans[3 * i + 1] = eo[1][i]
    t_0 = i + 1
    t_1 = i + 1
elif len(eo[0]) <= N // 3:
    for i in range(len(eo[0])):
        ans[3 * i + 2] = eo[0][i]
    t_0 = len(eo[0])
    t_1 = 0
elif len(eo[1]) <= N // 3:
    for i in range(len(eo[1])):
        ans[3 * i + 2] = eo[1][i]
    t_0 = 0
    t_1 = len(eo[1])

for i in range(N):
    if ans[i] != -1:
        continue
    if t_0 < len(eo[0]):
        ans[i] = eo[0][t_0]
        t_0 += 1
    else:
        ans[i] = eo[1][t_1]
        t_1 += 1

print(" ".join(list(map(str, [a + 1 for a in ans]))))
Problem p02789 (python)

Fixed submission:
print("Yes" if len(set(input().split()))==1 else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" if len(set(input.split()))==1 else "No")
Problem p02910 (python)

Fixed submission:
def inpl():
    return list(map(int, input().split()))


S = input()

flag = True
for i in range(len(S)):
    if i % 2 == 0 and S[i] in 'RUD':
        continue
    elif i % 2 == 1 and S[i] in 'LUD':
        continue
    flag = False

print('Yes' if flag is True else 'No')

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


S = input()

p = re.compile(r'([^L][^R])*[^L]?$')

if p.match(S):
    print('Yes')
else:
    print('No')
Problem p02936 (python)

Fixed submission:
import sys
from collections import deque
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def bfs():
    visited[0] = True
    ans[0] = counter[0]
    deq = deque()
    deq.append(0)
    while deq:
        v = deq.popleft()
        for nv in edge[v]:
            if visited[nv] is True:
                continue
            visited[nv] = True
            ans[nv] = ans[v] + counter[nv]
            deq.append(nv)


N, Q = inpl()

edge = [[] for i in range(N)]
for i in range(N - 1):
    a, b = inpl()
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)

counter = {k: 0 for k in range(N)}
for i in range(Q):
    p, q = inpl()
    counter[p - 1] = counter.get(p - 1, 0) + q

ans = [0 for i in range(N)]
visited = [False for i in range(N)]

bfs()

print(" ".join(list(map(str, ans))))

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


def dfs(v=0, c=0):
    if visited[v] is True:
        return
    visited[v] = True
    c += counter[v]
    ans[v] = c
    for nv in edge[v]:
        dfs(nv, c)
    return


N, Q = inpl()
AB = [inpl() for i in range(N - 1)]
PQ = [inpl() for i in range(Q)]

edge = [[] for i in range(N)]
for a, b in AB:
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)
counter = {k: 0 for k in range(N)}
for p, q in PQ:
    counter[p - 1] += q

ans = [0 for i in range(N)]
visited = [False for i in range(N)]

dfs()

print(" ".join(list(map(str, ans))))
Problem p03048 (python)

Fixed submission:
def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    # greatest common divisor
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


def lcm(a, b):
    # least common multiple
    return a * b // gcd(a, b)

import sys

sys.setrecursionlimit(5000)


R, G, B, N = inpl()
ans = 0
for r in range(N // R + 1):
    rest = N - r * R
    for i in range(B):
        if (G * i) % B == rest % B:
            x = i
            break
    else:
        # print(r)
        continue
    if rest - G * x < 0:
        continue
    ans += (rest - G * x) // lcm(B, G) + 1
    # print(r, rest, x, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    # greatest common divisor
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


def lcm(a, b):
    # least common multiple
    return a * b // gcd(a, b)


R, G, B, N = inpl()
ans = 0
for r in range(N // R + 1):
    rest = N - r * R
    for i in range(B):
        if (G * i) % B == rest % B:
            x = i
            break
    else:
        # print(r)
        continue
    if rest - G * x < 0:
        continue
    ans += (rest - G * x) // lcm(B, G) + 1
    # print(r, rest, x, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


def gcd(a, b):
    # greatest common divisor
    la = max(a, b)
    sm = min(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la - sm)


def lcm(a, b):
    # least common multiple
    return a * b // gcd(a, b)


R, G, B, N = inpl()
ans = 0
for r in range(N // R + 1):
    rest = N - r * R
    x = 0
    while (G * x) % B != rest % B:
        x += 1
    if rest - G * x < 0:
        continue
    ans += (rest - G * x) // lcm(B, G) + 1
    # print(r, rest, x, ans)

print(ans)
Problem p03241 (python)

Fixed submission:
from itertools import product

N, M = map(int, input().split())

max_ans = M // N

ans = 1
tmp = 2
tmpM = M
max_prime = int(M ** 0.5)
all_list = []
i = -1
k = 0
div = 2
while tmpM != 1:
    if tmpM % div == 0:
        tmpM = tmpM // div
        if k == 0:
            i += 1
            all_list.append(set())
            all_list[i].add(div ** k)
            k += 1
        all_list[i].add(div ** k)
        k += 1

    else:
        k = 0
        if div == 2:
            div = 3
        elif div > max_prime:
            div = tmpM
        else:
            div += 2

if all_list == []:
    print(1)
    exit()

# print(all_list)
ans = 1

for div_tuple in product(*all_list):
    tmp = 1
    for k in div_tuple:
        tmp *= k
        if tmp > max_ans:
            break
    else:
        ans = max(ans, tmp)

print(ans)

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

max_ans = M // N

tmpM = M
insu = {}
tmp = 2
while tmpM != 1:
    if tmpM % tmp == 0:
        insu[tmp] = insu.get(tmp, 0) + 1
        tmpM = tmpM // tmp
        continue
    else:
        if tmp == 2:
            tmp = 3
        elif tmpM // tmp == 1:
            tmp = tmpM
        else:
            tmp += 2

ins = set()
for k, v in insu.items():
    # print(ins, k, v)
    ins.add(1)
    for s in list(ins):
        t = 1
        for _ in range(v):
            t *= k
            ans = t * s
            if ans > max_ans:
                break
            ins.add(ans)
# print(ins)
print(max(ins))
Problem p03245 (python)

Fixed submission:
import sys

N = int(input())

co = []
x, y = map(int, input().split())
co.append((x, y))
Amod = (x + y) % 2
flag = True
max_co = abs(x) + abs(y)
for i in range(N - 1):
    x, y = map(int, input().split())
    co.append((x, y))

    if(Amod != (x + y) % 2):
        flag = False

    tmp = abs(x) + abs(y)
    max_co = max(max_co, tmp)

if(flag is False):
    print(-1)
    sys.exit()

ex2 = [1, 2, 4, 8, 16, 32]
expo = 32
# print(maxxy)
while(expo < max_co):
    expo *= 2
    ex2.append(expo)


ans_list = []
for x, y in co:
    if Amod == 0:
        x -= 1
        ans = "R"
    else:
        ans = ""

    for arm in reversed(ex2):
        # print("present", x, y)
        if abs(x) > abs(y):
            if x > 0:
                x -= arm
                ans = "R" + ans
            else:
                x += arm
                ans = "L" + ans
        else:
            if y > 0:
                y -= arm
                ans = "U" + ans
            else:
                y += arm
                ans = "D" + ans
    # print(x, y)

    ans_list.append(ans)

if Amod == 0:
    ex2.append(1)

print(len(ex2))
arm = ""
for a in ex2:
    arm += " " + str(a)
print(arm[1:])
for a in ans_list:
    print(a)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())

co = []
x, y = map(int, input().split())
co.append((x, y))
Amod = (x + y) % 2
flag = True
max_co = 0
for i in range(N - 1):
    x, y = map(int, input().split())
    co.append((x, y))

    if(Amod != (x + y) % 2):
        flag = False

    tmp = abs(x) + abs(y)
    if(tmp > max_co):
        max_co = tmp

if(flag is False):
    print(-1)
    sys.exit()

m = max_co
arm = "1" + " 1" * (m - 1)

ans_list = []
for x, y in co:
    ans = ""
    absxy = abs(x) + abs(y)
    ans += "UD" * ((max_co - absxy) // 2)

    if(x < 0):
        ans += "L" * abs(x)
    else:
        ans += "R" * x
    if(y < 0):
        ans += "D" * abs(y)
    else:
        ans += "U" * y
    ans_list.append(ans)

# print(co, ans_list)
print(m)
print(arm)
for a in ans_list:
    print(a)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())

co = []
x, y = map(int, input().split())
Amod = (x + y) % 2
flag = True
max_co = 0
for i in range(N - 1):
    x, y = map(int, input().split())
    co.append((x, y))

    if(Amod != (x + y) % 2):
        flag = False

    tmp = abs(x) + abs(y)
    if(tmp > max_co):
        max_co = tmp

if(flag is False):
    print(-1)
    sys.exit()

m = max_co
arm = "1" + " 1" * (m - 1)

ans_list = []
for x, y in co:
    ans = ""
    absxy = abs(x) + abs(y)
    ans += "UD" * ((max_co - absxy) // 2)

    if(x < 0):
        ans += "L" * abs(x)
    else:
        ans += "R" * x
    if(y < 0):
        ans += "D" * abs(y)
    else:
        ans += "U" * y
    ans_list.append(ans)

for a in ans_list:
    print(a)
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    while(b != 0):
        amari = a % b

        a = b
        b = amari
    return(a)


N, K = map(int, input().split())

X = list(map(int, input().split()))

tmp = abs(X[0] - K)
for i in range(1, N):
    tmp = gcd(tmp, abs(X[i] - K))

print(tmp)

Buggy submission (verdict: Runtime Error):
from math import gcd

N, K = map(int, input().split())

X = list(map(int, input().split()))

tmp = abs(X[0] - K)
for i in range(1, N):
    tmp = gcd(tmp, abs(X[i] - K))

print(tmp)
Problem p03316 (python)

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

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

Buggy submission (verdict: Runtime Error):
)
S = 0
for lit in str(N):
    S += int(lit)

if(N % S == 0):
    print("Yes")
else:
    print("No")
Problem p03338 (python)

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

for i in range(1, N):
    tmp_ans = len(set(S[0:i]) & set(S[i:]))
    if(tmp_ans > ans):
        ans = tmp_ans

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = 0

for i in range(1,N):
    tmp_ans = len(set(N[0:i]) and set(N[i:]))
    if(tmp_ans>ans):
      ans=tmp_ans

print(ans)
Problem p03352 (python)

Fixed submission:
X = int(input())
 
ans = 1
p = 2
A = set()
for i in range(2,X):
  if(i in A):
    continue
  p = 1
  while(True):
    p += 1
    power = i ** p
    if(power <= X):
      A.add(power)
      tmp = power
      pass
    else:
      break
  if(ans<tmp):
    ans = tmp
  if(p == 2):
    break
  
print(ans)

Buggy submission (verdict: Runtime Error):
X = int(input())
 
ans = 1
p = 2
A = set()
for i in range(2,X):
  if(i in A):
    continue
  p = 1
  while(True):
    p += 1
    power = i ** p
    if(power <= X):
      A.add(power)
      tmp = power
      pass
    else:
      break
  if(ans<tmp):
    ans = tmp
  if(p == 2):
    break
  
print(ans)
X = int(input())
 
ans = 0
p = 2
A = set()
for i in range(X):
  if(i in A):
    continue
  p = 1
  while(True):
    p += 1
    power = i ** p
    if(power <= X):
      A.add(power)
      tmp = power
      pass
    else:
      break
  if(ans<tmp):
    ans = tmp
  if(p == 2):
    break
  
print(ans)
Problem p03360 (python)

Fixed submission:
a = list(map(int, input().split()))
a.sort()
K = int(input())
 
print(a[2]*(2**K) + a[1] + a[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
a.sort()
K = int(input())
 
print(a[2]*(2**k) + a[1] + a[0])
a = list(map(int, input().split()))
a.sort()
K = int(input())

print(a[2]*(2**K) + a[1] + a[0])

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
a.sort()
K = int(input())

print(a[2]*(2**k) + a[1] + a[0])
Problem p03362 (python)

Fixed submission:
N = int(input())

Prime = [2, ]
ans = []
i = 3

while(len(ans) < N):
    Pflag = True
    for p in Prime:
        if(i % p == 0):
            Pflag = False
            break

    if(Pflag is True):
        Prime.append(i)
        if(i % 5 == 1):
            ans.append(i)

    i += 2

S = ""
for p in ans:
    S += " " + str(p)

print(S[1:])

Buggy submission (verdict: Runtime Error):
A = [257, 2, 3, 131, 5, 7, 137, 11, 139, 13, 17, 19, 149, 23, 151, 29, 157, 31, 163, 37, 167, 41, 43, 173, 47, 179, 53, 181, 59, 61, 191, 193, 67, 197, 71, 199, 73, 79, 83, 211, 89, 223, 97, 227, 101, 229, 103, 233, 107, 109, 239, 113, 241, 251, 127]

N = int(input())

ans = ""
for i in range(N):
  ans += " " + A[i]
  
print(ans[1:])
Problem p03379 (python)

Fixed submission:
# import copy

N = int(input())
X = list(map(int, input().split()))
# S_X = copy.copy(X)
S_X = sorted(X)
miX = S_X[N // 2 - 1]
mi1X = S_X[N // 2]
# print(S_X, X)
# print(miX, mi1X)

# print(miX, mi1X)
# print(X)
for a in X:
    if(a <= miX):
        print(mi1X)
    else:
        print(miX)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
 
s_X = sorted(X)
miX = s_X[N//2]
mi1X = s_X[N//2 + 1]
 
for a in X:
  if(s_X.index(a)<=N//2):
    print(mi1X)
  else:
    print(miX)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
 
s_X = sorted(X)
miX = s_X[N//2]
mi1X = s_X[N//2 + 1]
 
for a in X:
  if(a.find(s_X)<=N//2):
    print(mi1X)
  else:
    print(miX)

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

s_X = soreted(X)
miX = s_X[N//2]
mi1X = s_X[N//2 + 1]

for a in X:
  if(a.find(s_X)<=N//2):
    print(mi1X)
  else:
    print(miX)
Problem p03399 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
 
print(min(A,B)+min(C,D))

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())

print(min(A+B)+min(C+D))
Problem p03408 (python)

Fixed submission:
N = int(input())
card = {}
for i in range(N):
  S = input()
  card[S] = card.get(S, 0) + 1
 
M = int(input())
for i in range(M):
  S = input()
  card[S] = card.get(S, 0) - 1

tmp = list(card.values())
tmp.append(0)
print(max(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
card = {}
for i in range(N):
  S = input()
  card[S] = card.get(S, 0) + 1

M = int(input())
for i in range(M):
  S = input()
  card[S] = card.get(S, 0) - 1
  
print(max(max(list(card.values()),0))