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

Fixed submission:
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    d = [0] * N
    multi = [0] * N

    edges = defaultdict(list)
    edges_l = []
    for _ in range(N-1):
        a, b = map(int, input().split())
        d[a-1] += 1
        d[b-1] += 1
        multi[a-1] += 1
        multi[b-1] += 1

        edges_l.append((a-1, b-1))
        edges[a-1].append(b-1)
        edges[b-1].append(a-1)

    for i in range(len(d)):
        d[i] = (d[i], i)
    d.sort(key=lambda v: v[0], reverse=True)

    C = list(map(int, input().split()))
    C.sort(reverse=True)
    # print(d)
    # print(C)
    used = [False] * N
    ans = [0] * N
    count = 0
    que = []
    que.append(d[0][1])
    while que:
        index = que.pop()
        if not used[index]:
            # print('i = {}, Ci = {}'.format(i, C[i]))
            ans[index] = C[count]
            used[index] = True
            count += 1

        # print(edges[i])
        for nei in edges[index]:
            if not used[nei]:
                que.append(nei)

    val = 0
    for a, b in edges_l:
        node_val = min(ans[a], ans[b])
        val += node_val

    print(val)
    print(' '.join(map(str, ans)))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    d = [0] * N
    multi = [0] * N

    edges = defaultdict(list)
    edges_l = []
    for _ in range(N-1):
        a, b = map(int, input().split())
        d[a-1] += 1
        d[b-1] += 1
        multi[a-1] += 1
        multi[b-1] += 1

        edges_l.append((a-1, b-1))
        edges[a-1].append(b-1)
        edges[b-1].append(a-1)

    for i in range(len(d)):
        d[i] = (d[i], i)
    d.sort(key=lambda v: v[0], reverse=True)

    C = list(map(int, input().split()))
    C.sort(reverse=True)
    # print(d)
    # print(C)
    used = [False] * N
    ans = [0] * N
    count = 0
    que = d[i]
    while que:
        dub, index = que.pop()
        if not used[index]:
            # print('i = {}, Ci = {}'.format(i, C[i]))
            ans[index] = C[count]
            used[index] = True
            count += 1

        # print(edges[i])
        for nei in edges[index]:
            if not used[nei]:
                que.append(d[nei])

    val = 0
    for a, b in edges_l:
        node_val = min(ans[a], ans[b])
        val += node_val

    print(val)
    print(' '.join(map(str, ans)))


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

Fixed submission:
# https://atcoder.jp/contests/abc118/tasks/abc118_d


def main():
    N, M = map(int, input().split())

    A = list(map(int, input().split()))  # 使っていい数字

    costs = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]  # 各数字のマッチの数

    dp = [-1 for _ in range(N + 1)]
    dp[0] = 0
    for i in range(1, N + 1):
        for a in A:
            if i < costs[a]:
                continue
            dp[i] = max(dp[i], dp[i - costs[a]] * 10 + a)
    print(dp[N])


main()

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

    A = list(map(int, input().split()))  # 使っていい数字

    match_dic = {9: 6, 8: 7, 7: 3, 6: 6, 5: 5, 4: 4, 3: 5, 2: 5, 1: 2}
    available_dic = {k: v for k, v in match_dic.items() if k in A }
    availables = sorted(available_dic.items(), key=lambda x: x[1])

    def dfs(cost, nums):
        if cost == 0:
            nums.sort(key=lambda x: -x)
            return int(''.join(map(str, nums)))

        candidates = [dfs(cost - avs[1], nums + [avs[0]]) for avs in availables if cost >= avs[1]]
        if len(candidates) == 0:
            return 0
        else:
            return max(candidates)

    print(dfs(N, []))


main()

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

    A = list(map(int, input().split()))  # 使っていい数字

    match_dic = {9: 6, 8: 7, 7: 3, 6: 6, 5: 5, 4: 4, 3: 5, 2: 5, 1: 2}
    available_dic = {k: v for k, v in match_dic.items() if k in A }
    availables = sorted(available_dic.items(), key=lambda x: x[1])

    def dfs(cost, nums):
        if cost == 0:
            nums.sort(key=lambda x: -x)
            return int(''.join(map(str, nums)))

        cand = [dfs(cost - avs[1], nums + [avs[0]]) for avs in availables if cost >= avs[1]]
        if len(cand) == 0:
            return 0
        else:
            return max(dfs(cost - avs[1], nums + [avs[0]]) for avs in availables if cost >= avs[1])

    print(dfs(N, []))


main()
Problem p03129 (python)

Fixed submission:
# https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_a

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

if K <= (N + 1) / 2:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
K, A, B = map(int, input().split())

need_turns = A + 1 + 1  # 交換に必要なターン
first_need_turns = need_turns - 1

if A + 2 > B or K < first_need_turns:  # 交換せずにビスケットを叩き続ける方が得
    print(1 + K)
    exit()

ans = B  # 一度交換した
K -= (need_turns - 1)

# print("{}, {}".format(K, ans))

while K >= 0:
    if ans >= A and K >= 2:
        ans += (B - A) * K / 2
        K = 0
    else:
        ans += 1
        K -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
K, A, B = map(int, input().split())
 
need_turns = A + 1 + 1  # 交換に必要なターン
first_need_turns = need_turns - 1
 
if A + 2 > B or K < first_need_turns:  # 交換せずにビスケットを叩き続ける方が得
    print(1 + K)
    exit()
 
ans = B  # 一度交換した
K -= (need_turns - 1)
 
# print("{}, {}".format(K, ans))
 
while K > 0:
    if ans >= A and K >= 2:
        ans += (B - A) * K / 2
        K = K % 2
    else:
        ans += 1
        K -= 1
 
print(ans)

Buggy submission (verdict: Runtime Error):
K, A, B = map(int, input().split())

need_turns = A + 1 + 1  # 交換に必要なターン
first_need_turns = need_turns - 1

if A + 2 > B or K < first_need_turns:  # 交換せずにビスケットを叩き続ける方が得
    print(1 + K)
    exit()

ans = B  # 一度交換した
K -= (need_turns - 1)

# print("{}, {}".format(K, ans))

while K > 0:
    if ans >= A and K >= 2:
        ans += (B - A) * K / 2
        K = K % 2
    else:
        ans += 1
        K -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
# https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_c


K, A, B = map(int, input().split())

need_turns = A + 1 + 1  # 交換に必要なターン
first_need_turns = need_turns - 1

if A + 2 > B or K < first_need_turns:  # 交換せずにビスケットを叩き続ける方が得
    print(1 + K)
    exit()

ans = B  # 一度交換した
K -= (need_turns - 1)

# print("{}, {}".format(K, ans))

while K > 0:
    if ans >= A and K >= 2:
        ans += (B - A) * K / 2
        K = 0
    else:
        ans += 1
        K -= 1

print(ans)
Problem p03132 (python)

Fixed submission:
# https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_d

L = int(input())

A = [int(input()) for _ in range(L)]

INF = int(1e15)
dp = [[INF] * (L + 1) for _ in range(5)]

for i in range(4):
    dp[i][0] = 0

for i in range(L):
    dp[0][i + 1] = dp[0][i] + A[i]  # 全部取り除く
    dp[1][i + 1] = min(dp[j][i] for j in range(2)) + (A[i] % 2 if A[i] != 0 else 2)
    dp[2][i + 1] = min(dp[j][i] for j in range(3)) + (1 if A[i] % 2 == 0 else 0)
    dp[3][i + 1] = min(dp[j][i] for j in range(4)) + (A[i] % 2 if A[i] != 0 else 2)
    dp[4][i + 1] = min(dp[j][i] for j in range(5)) + A[i]  # 全部取り除く


print(min(dp[i][L] for i in range(1, 5)))

Buggy submission (verdict: Runtime Error):
# https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_d

L = int(input())

A = [int(input()) for _ in range(L)]

INF = int(1e15)
dp = [[INF] * (L + 1) for _ in range(5)]

for i in range(4):
    dp[i][0] = 0

for i in range(n):
    dp[0][i + 1] = dp[0][i] + A[i]  # 全部取り除く
    dp[1][i + 1] = min(dp[j][i] for j in range(2)) + (A[i] % 2 if A[i] != 0 else 2)
    dp[2][i + 1] = min(dp[j][i] for j in range(3)) + (1 if A[i] % 2 == 0 else 0)
    dp[3][i + 1] = min(dp[j][i] for j in range(4)) + (A[i] % 2 if A[i] != 0 else 2)
    dp[4][i + 1] = min(dp[j][i] for j in range(5)) + A[i]  # 全部取り除く


print(min(dp[i][L] for i in range(1, 5)))

Buggy submission (verdict: Runtime Error):
# https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_d

L = int(input())

A = [int(input()) for _ in range(L)]

INF = int(1e15)
dp = [[INF] * (L + 1)] for _ in range(5)]

for i in range(4):
    dp[i][0] = 0

for i in range(n):
    dp[0][i + 1] = dp[0][i] + A[i]  # 全部取り除く
    dp[1][i + 1] = min(dp[j][i] for j in range(2)) + (A[i] % 2 if A[i] != 0 else 2)
    dp[2][i + 1] = min(dp[j][i] for j in range(3)) + (1 if A[i] % 2 == 0 else 0)
    dp[3][i + 1] = min(dp[j][i] for j in range(4)) + (A[i] % 2 if A[i] != 0 else 2)
    dp[4][i + 1] = min(dp[j][i] for j in range(5)) + A[i]  # 全部取り除く


print(min(dp[i][L] for i in range(1, 5)))
Problem p03150 (python)

Fixed submission:
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b

import re

S = input()

if "keyence" == S:
    print("YES")
else:
    patterns = ["^keyence(.*)", "^k(.*)eyence$", "^ke(.*)yence$", "^key(.*)ence$", "^keye(.*)nce$", "^keyen(.*)ce$", "^keyenc(.*)e$", "keyence$"]

    matched = False
    for pattern in patterns:
        matchOB = re.search(pattern, S)
        if matchOB:
            matched = True
            break
    if matched:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b

import re

S = input()

if "keyence" == S:
    print("YES")
else:
    patterns = ["^keyence*", "^k*eyence$", "^ke*yence$", "^key*ence$", "^keye*nce$", "^keyen*ce$", "^keyenc*e$", "*keyence$"]

    matched = False
    for pattern in patterns:
        matchOB = re.search(pattern, S)
        if matchOB:
            matched = True
            break
    if matched:
        print("YES")
    else:
        print("NO")
Problem p03262 (python)

Fixed submission:
# https://atcoder.jp/contests/abc109/tasks/abc109_c

def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)


def main():
    N, X = map(int, input().split())

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

    ans = abs(X - xl[0])
    for i in range(1, len(xl)):
        ans = gcd(max(ans, abs(X - xl[i])), min(ans, abs(X - xl[i])))

    print(ans)


main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc109/tasks/abc109_c

def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)


def main():
    N, X = map(int, input().split())

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

    ans = abs(X - xl[0])
    for i in range(1, len(xl)):
        ans = gcd(max(ans, abs(X - xl[i])), min(ans, abs(X - xl[i])))

    print(ans)


main()
# https://atcoder.jp/contests/abc109/tasks/abc109_c

def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)


def main():
    N, X = map(int, input().split())

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

    ans = abs(X - xl[0])
    for i in range(1, len(xl)):
        ans = gcd(max(ans, abs(X - xl[i])), min(ans, abs(X - xl[i])))

    print(ans)


main()
Problem p03274 (python)

Fixed submission:
# https://atcoder.jp/contests/abc107/tasks/arc101_a

import itertools
import collections
import bisect

def main():
    # big value
    INF = int(1e15)

    N, K = map(int, input().split())
    X = [-INF] + list(map(int, input().split())) + [INF]
    pos = bisect.bisect(X, 0) # 0より大きい中で最小の要素のインデックス
    # print(pos)

    right_num = N - pos + 1
    left_num = pos - 1

    ans = INF
    if right_num >= K:  # 右側からだけ取れるなら
        ans = min(ans, abs(X[pos + K - 1]))
    # print(ans)

    for i in range(1, K):  # 左側からいくつ取るか
        if i > left_num:  # 左側に取れるだけ数がないなら continue
            continue
        if K - i > right_num:  # 右側に取れるだけ数がないなら continue
            continue

        left_distance = abs(X[pos - i])
        right_distance = abs(X[pos + K - i - 1])
        # min(一番左までの距離 x 往復 + 一番右までの距離, 一番右までの距離 x 往復 + 一番左までの距離)
        ans = min(ans, left_distance * 2 + right_distance, right_distance * 2 + left_distance)

    if left_num >= K:  # 左側からだけ取れるなら
        ans = min(ans, abs(X[pos - K]))
    # print(ans)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc107/tasks/arc101_a

import itertools
import collections
import bisect

def main():
    # big value
    INF = int(1e15)

    N, K = map(int, input().split())
    X = [-INF] + list(map(int, input().split())) + [INF]
    pos = bisect.bisect(X, 0) # 右にあって0に一番近い要素のインデックス
    # print(pos)

    ans = INF
    if N - pos + 1 >= K: # 右側からだけ取れるなら
        ans = min(ans, abs(X[pos + K - 1]))
    # print(ans)
    if pos - 1 >= K: # 左側からだけ取れるなら
        ans = min(ans, abs(X[pos - K]))
    # print(ans)

    for i in range(1, K):  # 左側からいくつ取るか
        if i > pos - 1:  # 左側に取れるだけ数がないなら continue
            continue
        # min(一番左までの距離 x 往復 + 一番右までの距離, 一番右までの距離 x 往復 + 一番左までの距離)
        ans = min(ans, abs(X[pos - i]) * 2 + abs(X[pos + K - i - 1]))
        ans = min(ans, abs(X[pos + K - i - 1]) * 2 + abs(X[pos - i]))

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc107/tasks/arc101_a

import itertools
import collections
import bisect

def main():
    # big value
    INF = int(1e15)

    N, K = map(int, input().split())
    X = [-INF] + list(map(int, input().split())) + [INF]
    pos = bisect.bisect(X, 0) # 右にあって0に一番近くて要素のインデックス
    # print(pos)
    ans = INF
    if N - pos + 1 >= K: # 右側からだけ取れるなら
        ans = min(ans, abs(X[pos + K - 1]))
    # print(ans)
    if pos - 1 >= K: # 左側からだけ取れるなら
        ans = min(ans, abs(X[pos - K]))
    # print(ans)

    for i in range(1, K):  # 左側からいくつ取るか
        if not i < pos - 1:  # 左側に取れるだけ数がないなら continue
            continue
        # min(一番左までの距離 x 往復 + 一番右までの距離, 一番右までの距離 x 往復 + 一番左までの距離)
        ans = min(ans, abs(X[pos - i]) * 2 + abs(X[pos + K - i - 1]))
        ans = min(ans, abs(X[pos + K - i - 1]) * 2 + abs(X[pos - i]))

    print(ans)


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

Fixed submission:
a, b = map(int, input().split())


def get_height(n):
    return n * (n + 1) // 2


h = get_height(b - a)

print(h - b)

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


def get_height(n):
    return n * (n + 1) // 2


h = get_height(b - a)

print(i - b)
Problem p03337 (python)

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

print(max(A + B, A - B, A * B))

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

match = 0
for l in range(len(A)):
    base = A[l]
    match += 1
    for r in range(l+1, len(A)):
        ando = base & A[r]
        if ando == 0:
            match += 1
        else:
            break
        base |= A[r]

print(match)
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int, input().split())

if abs(a - c) <= d:
    print('Yes')
elif abs(a - b) <= d and abs(b - c) <= d:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, d = mao(int, input().split())

if abs(a - c) <= d:
    print('Yes')
elif abs(a - b) <= d and abs(b - c) <= d:
    print('Yes')
else:
    print('No')
Problem p03359 (python)

Fixed submission:



a, b = map(int, input().split())

# print(a)
# print(b)

m = a - 1
n = 1 if b >= a else 0

print(str(m + n))

Buggy submission (verdict: Runtime Error):
# https://abc096.contest.atcoder.jp/tasks/abc096_d

import itertools


def is_prime(n):
    if n < 2: return False
    if n == 2: return True
    if n % 2 == 0: return False

    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1

    return True


N = int(input())


l = []

n = 2
while len(l) < N * 3:
    if is_prime(n):
        l.append(n)
    n += 1


for a in itertools.combinations(l, N):
    # print(a)
    is_ok = True
    for c in itertools.combinations(a, 5):
        if is_prime(sum(c)):
            # print(str(c) + ' is prime = ' + str(sum(c)))
            is_ok = False
            break
    if is_ok:
        print(' '.join(map(str, a)))
        break
Problem p03361 (python)

Fixed submission:
# https://abc096.contest.atcoder.jp/tasks/abc096_c

neighbor_i = [-1, 0, 1, 0]
neighbor_j = [0, -1, 0, 1]

H, W = map(int, input().split())


def can_draw(l, target_i, target_j):
    for i, j in zip(neighbor_i, neighbor_j):
        if target_i + i < 0 or target_j < 0:
            continue
        if target_i + i >= H or target_j + j >= W:
            continue
        if l[target_i + i][target_j + j] == '#':
            return True

    return False


data = []
for i in range(H):
    raw = list(str(input()))
    data.append(raw)


# print(data)


ok = True
for i in range(H):
    for j in range(W):
        if data[i][j] == '#':
            if not can_draw(data, i, j):
                ok = False
                break
    if not ok:
        break

if ok:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc096/tasks/abc096_c

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

# 隣に # が一つ以上あるかどうか
def has_neighbor(y, x):
    dhs = [1, -1, 0, 0]
    dws = [0, 0, 1, -1]
    for dh, dw in zip(dhs, dws):
        if S[y + dh][x + dw] == "#":
            return True
    return False


for h in range(H):
    for w in range(W):
        if S[h][w] == "#":
            if not has_neighbor(h, w):
                print("No")
                exit()

print("Yes")
Problem p03434 (python)

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

a.sort(reverse=True)

alice_score = 0
bob_score = 0

for i in range(len(a)):
    if i % 2 == 0:
        alice_score += a[i]
    else:
        bob_score += a[i]

print(alice_score - bob_score)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc088/tasks/abc088_b

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    a_sum = sum([a for a in range(A,2)])
    b_sum = sum([a for a in range(1, A,2)])
    print(a_sum - b_sum)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc088/tasks/abc088_b?lang=ja

N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

alice_score = 0
bob_score = 0

for i in range(len(a)):
    if i % 2 == 0:
        alice_score += a[i]
    else:
        bob_score += a[i]

print(alice_score - bob_score)
# https://atcoder.jp/contests/abc088/tasks/abc088_b?lang=ja

N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

alice_score = 0
bob_score = 0

for i in range(len(a)):
    if i % 2 == 0:
        alice_score += a[i]
    else:
        bob_score += a[i]

print(alice_score - bob_score)
Problem p03457 (python)

Fixed submission:
# https://atcoder.jp/contests/abc086/tasks/arc089_a

N = int(input())


def is_reachable(src, dst):
    can_go = True
    dt = dst[0] - src[0]
    dist = abs(dst[1] - src[1]) + abs(dst[2] - src[2])
    if dt < dist:
        can_go = False
    if dt % 2 != dist % 2:
        can_go = False
    return can_go


route = [list(map(int, input().split())) for _ in range(N)]
route.insert(0, [0, 0, 0])

# print(route)

reachable = True

for i in range(N):
    source = route[i]
    destination = route[i + 1]
    if not is_reachable(source, destination):
        reachable = False

if reachable:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def is_reachable(src, dst):
    can_go = True
    dt = dst[0] - src[0]
    dist = abs(dst[1] - src[1]) + abs(dst[2] - src[2])
    if dt < dist:
        can_go = False
    if dt % 2 != dist % 2:
        can_go = False
    return can_go


route = [list(map(int, input().split())) for _ in range(N)]
route.insert(0, [0, 0, 0])

# print(route)

reachable = True

for i in range(N):
    source = route[i]
    destination = route[i + 1]
    if not is_reachable(source, destination):
        reachable = False

print(reachable)
Problem p03557 (python)

Fixed submission:
# https://atcoder.jp/contests/abc077/tasks/arc084_a

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A.sort()
    B.sort()
    C.sort()

    ans = 0

    for b in B:
        i = bisect.bisect_left(A, b)
        j = bisect.bisect_right(C, b)

        ans += i * (N - j)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc077/tasks/arc084_a

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A.sort()
    B.sort()
    C.sort()

    ans = 0

    for b in B:
        i = bisect.bisect_left(A, b)
        j = bisect.bisect_right(C, b)

        ans += i * (N - j)

    print(ans)


if __name__ == '__main__':
    main()
# https://atcoder.jp/contests/abc077/tasks/arc084_a

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A.sort()
    B.sort()
    C.sort()

    ans = 0

    for b in B:
        i = bisect.bisect_left(A, b)
        j = bisect.bisect_right(C, b)

        ans += i * (N - j)

    print(ans)


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

Fixed submission:
# https://atcoder.jp/contests/abc074/tasks/abc074_a

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = int(input())
    print(N * N - A)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc074/tasks/abc074_a

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = int(input())
    print(N * N - a)

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

Fixed submission:
# https://atcoder.jp/contests/abc072/tasks/abc072_a

import itertools
import collections
import bisect

def main():
    X, t = map(int, input().split())
    print(max(0, X - t))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
print(input()[0:len(s):2])
Problem p03657 (python)

Fixed submission:
# https://atcoder.jp/contests/abc067/tasks/abc067_a

import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    A, B = map(int, input().split())
    if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
        print('Possible')
    else:
        print('Impossible')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc067/tasks/abc067_a

import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    A, B = map(int, input().split())
    if A % 3 == 0 or B % 0 == 0 or (A + B) % 3 == 0:
        print('Possible')
    else:
        print('Impossible')


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

Fixed submission:
rings = list(map(int, input().split()))
print(sum(rings) - max(rings))

Buggy submission (verdict: Runtime Error):
rings = list(map(int, input().split()))
print(sum([rings] - max([rings])))