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

Fixed submission:
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()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
ans = []

for i in range(min(X, K)):
  for j in range(min(Y, K)):
    if (i + 1) * (j + 1) > K:
      break
    for k in range(min(Z, K)):
      if (i + 1) * (j + 1) * (k + 1) > K:
        break
      ans.append(A[i] + B[j] + C[k])

ans.sort(reverse = True)

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

Buggy 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()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
ans = []

ApB = []

for i in range(min(X, K)):
  for j in range(min(Y, K)):
      ApB.append(A[i] + B[j])

ApB.sort(reverse = True)

for i in range(min(Z, K)):
  for j in range(int(min(len(ApB), K) / (i + 1)):
    ans.append(C[i] + ApB[j])

ans.sort(reverse = True)

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

Buggy 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()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
ans = []

ApB = []

for i in range(min(X, K)):
  for j in range(min(Y, K)):
      ApB.append(A[i] + B[j])

ApB.sort(reverse = True)

for i in range(min(Z, K)):
  for j in range(min(ApB.count() + 1, K)):
    ans.append(C[i] + ApB[j])

ans.sort(reverse = True)
    
for i in range(K):
  print(ans[i])

Buggy 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()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
ans = []

for i in range(min(X, int(K / 2))):
  for j in range(min(Y, int(K / 2))):
    for k in range(min(Z, int(K / 2))):
      ans.append(A[i] + B[j] + C[k])

ans.sort(reverse = True)

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

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
N = int(input())
memo = [{} for _ in range(N + 1)]

def ok(last4):
  for i in range(4):
    s = list(last4)
    if i >= 1:
      s[i - 1]. s[i] = s[i], s[i - 1]
    if "".join(s).count("AGC") >= 1:
      return False
    return True

def dfs(last3, n):
  if last3 in memo[n]:
    return memo[n][last3]
  if n == N:
    return 1
  ret = 0
  for c in "AGCT":
    if ok(last3 + c):
      ret += dfs(last3[1:] + c, n + 1) % (10 ** 9 + 7)
  memo[n][last3] = ret
  return ret

print(dfs("TTT", 0))

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

AC_list = []
cnt = 0
for i in range(N):
  if i != 0 and S[i - 1] == "A" and S[i] == "C":
    cnt += 1
  AC_list.append(cnt)

for _ in range(Q):
  l, r = map(int, input().split())
  print(AC_list[r - 1] - AC_list[l - 1])
Problem p03109 (python)

Fixed submission:
S = list(map(int, input().split("/")))
if S[1] > 4:
  print("TBD")
else:
  print("Heisei")

Buggy submission (verdict: Runtime Error):
S = map(int, input().split("/"))
if S[1] > 4:
  print("TBD")
else:
  print("Heisei")
Problem p03138 (python)

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

X = 0
k = 1 << 41
for _ in range(41):
  k = k >> 1
  if X + k > K:
    continue
  
  count = 0
  for i in range(N):
    if A[i] & k:
      count += 1
  
  if count < N / 2:
    X += k
    
ans = 0
for i in range(N):
  ans += A[i] ^ X
  
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
a_copy = [] + a
a_digit = [0 for i in range(n)]
digit = []
k_bin = list(map(int, str(bin(k)).replace("0b", "")))

same = True
for _ in range(len(k_bin)):
  for i in range(n):
    a_digit[i] = a[i] % 2
    a[i] = int(a[i] / 2)
  if a_digit.count(0) >= n / 2:
    if same:
      if k_bin[i] == 0:
        digit.append(0)
      else:
        digit.append(1)
    else:
      digit.append(1)
  else:
    digit.append(0)
    if k_bin[i] == 1:
      same = False

x = 0
for i in range(len(digit)):
  x += 2 ** i * digit[i]
ans = 0
for ai in a_copy:
  ans += ai ^ x
print(ans)
Problem p03264 (python)

Fixed submission:
K = int(input())
print((K - int(K / 2)) * int(K / 2))

Buggy submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())

a = x2 - x1
b = y2 - y1

x3 = x2 - b
y3 = y2 + a
x4 = x1 - b
y4 = y1 + a

print("{} {} {} {}".format(x3, y3, x4, y4))
Problem p02995 (python)

Fixed submission:
from fractions import gcd
A,B,C,D=map(int, input().split())
A -= 1

cc = B//C - A//C
dd = B//D - A//D

E = C*D//gcd(C, D)
ee = B//E - A//E

print(B - A - cc - dd + ee)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
A,B,C,D=map(int, input().split())
A -= 1

cc = B//C - A//C
dd = B//D - A//D

E = C*D//fractions.gcd(C, D)
ee = B//E - A//E

print(B - A - cc - dd + ee)
Problem p02997 (python)

Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
if N > 2:
    x = combinations_count(N-1, 2)
else:
    x = 0
if x < K:
    print('-1')
    quit()

h = []
for i in range(2,N+1):
    h.append(('1', str(i)))

hen = x-K
x = 2
y = 3
while hen > 0:
    h.append((x,y))
    y += 1
    if y > N:
        x += 1
        y = x+1
    hen -= 1

print(len(h))
for x,y in h:
    print(x,y)

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
x = combinations_count(N-1, 2)
if x < K:
    print('-1')
    quit()

h = []
for i in range(2,N+1):
    h.append(('1', str(i)))

hen = x-K
x = 2
y = 3
while hen > 0:
    h.append((x,y))
    y += 1
    if y > N:
        x += 1
        y = x+1
    hen -= 1

print(len(h))
for x,y in h:
    print(x,y)

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
x = combinations_count(N-1, 2)
if x < K:
    print('-1')
    quit()

for i in range(2,N+1):
    print('1', str(i))

hen = x-K
x = 2
y = 3
while hen > 0:
    print(x,y)
    y += 1
    if y > N:
        x += 1
        y = x+1
    hen -= 1

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
x = combinations_count(N-1, 2)
if K < N-1 and x < K:
    print('-1')
    quit()

for i in range(2,N+1):
    print('1', str(i))

hen = x-K
x = 2
y = 3
while hen > 0:
    print(x,y)
    y += 1
    if y > N:
        x += 1
        y = x+1
    hen -= 1

Buggy submission (verdict: Runtime Error):
import itertools
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N, K = map(int, input().split())
x = combinations_count(N-1, 2)
if N-1 < K or K < x:
    print('-1')
    quit()

for i in range(2,N+1):
    print('1', str(i))

hen = x-K
x = 2
y = 3
while hen > 0:
    print(x,y)
    y += 1
    if y > N:
        x += 1
        y = x+1
    hen -= 1

Buggy submission (verdict: Runtime Error):
import itertools
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, K = map(int, input().split())
x = combinations_count(N-1, 2)
if N-1 < K < combinations_count(N-1, 2):
    print('-1')
    quit()

for i in range(2,N+1):
    print('1', str(i))

for i in range(2,x-K,2):
    print(str(i), str(i+1))

Buggy submission (verdict: Runtime Error):
import itertools
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, K = map(int, input())
x = combinations_count(N-1, 2)
if N-1 < K < combinations_count(N-1, 2):
    print('-1')
    quit()

for i in range(2,N+1):
    print('1', str(i))

for i in range(2,x-K,2):
    print(str(i), str(i+1))
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())

if x == W/2 and y == H/2:
    print((W*H)/2, 1)
else:
    print((W*H)/2, 0)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if (x == 0 and y == 0) or (x == W and y == H) or (x == 0 and y == H) or (x == W and y == 0):
    print((W*H)/2, 0)
elif x = W/2 and y = H/2:
    print((W*H)/2, 1)
else:
    A = W*y
    B = W*(H-y)
    C = H*x
    D = H*(W-x)
    dup = 0
    if min(A,B) == min(C,D):
        dup = 1
    print(max(min(A,B), min(C,D)), dup)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if (x == 0 and y == 0) or (x == W and y == H) or (x == 0 and y == H) or (x == W and y == 0):
    print((W*H)/2, 0)
elif (x/y == W/H) or (y/x == H/W):
    print((W*H)/2, 0)
elif abs(W/2-x) > abs(H/2-y):
    A = W*y
    B = W*(H-y)
    print(min(A,B), 0)
elif abs(H/2-y) > abs(W/2-x):
    A = H*x
    B = H*(W-x)
    print(min(A,B), 0)
else:
    print((W*H)/2, 1)
Problem p03006 (python)

Fixed submission:
N = int(input())
xy = [0] * N
for i in range(N):
    xy[i] = tuple(map(int, input().split()))

case = [N]
for x,y in xy:
    for xx, yy in xy:
        if x == xx and y == yy:
            continue
        score = N
        xs = xx - x
        ys = yy - y
        for xxx,yyy in xy:
            if x == xxx and y == yyy:
                continue
            if (xxx - xs,yyy - ys) in xy:
                score -= 1
        case.append(score)
print(min(case))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [0] * N
for i in range(N):
    xy[i] = tuple(map(int, input().split()))

case = []
for x,y in xy:
    for xx, yy in xy:
        if x == xx and y == yy:
            continue
        score = N
        xs = xx - x
        ys = yy - y
        for xxx,yyy in xy:
            if x == xxx and y == yyy:
                continue
            if (xxx - xs,yyy - ys) in xy:
                score -= 1
        case.append(score)
print(min(case))
Problem p03007 (python)

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
p = []
m = []
for a in A:
    if a < 0:
        m.append(a)
    else:
        p.append(a)
was = []
if N == 2:
    print(max(A)-min(A))
    print(max(A), min(A))
    quit()
if len(m) == 0:
    p.sort()
    m.append(p[0] - p[-1])
    was.append((p[0], p[-1]))
    p = p[1:-1]
elif len(p) == 0:
    m.sort()
    p.append(m[-1] - m[0])
    was.append((m[-1], m[0]))
    m = m[1:-1]

mm = m[0]
m = m[1:]
pp = p[0]
p = p[1:]
for x in p:
    was.append((mm,x))
    mm -= x
for x in m:
    was.append((pp,x))
    pp -= x
was.append((pp, mm))
print(pp-mm)
for p,m in was:
    print(p,m)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
p = []
m = []
for a in A:
    if a < 0:
        m.append(a)
    else:
        p.append(a)
was = []
if N == 2:
    print(max(A)-min(A))
    print(max(A), min(A))
    quit()
p.sort()
if len(m) == 0:
    m.append(p[-1] - p[0])
    was.append((p[-1], p[0]))
    p = p[1:-1]

mm = m[0]
m = m[1:]
pp = p[0]
p = p[1:]
for x in p:
    was.append((mm,x))
    mm -= x
for x in m:
    was.append((pp,x))
    pp -= x
was.append((pp, mm))
print(pp-mm)
for p,m in was:
    print(p,m)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
A.sort()
was = []
def x(A,N):
    newA = []
    sw = True
    for i in range(N//2):
        if sw:
            was.append((A[i], A[-(i+1)]))
            newA.append(A[i] - A[-(i+1)])
        else:
            was.append((A[-(i+1)], A[i]))
            newA.append(A[-(i+1)] - A[i])
        sw = not sw
    if N%2 != 0:
        newA.append(A[N//2])
    if len(newA) == 2:
        was.append((max(newA), min(newA)))
        return max(newA) - min(newA)
    else:
        newA.sort()
        return x(newA, len(newA))

print(x(A,N))
for x,y in was:
    print(x, y)
Problem p03069 (python)

Fixed submission:
import bisect
N = int(input())
S = input()
# 右全部#
b = []
w = []
for i in range(N):
    if S[i] == '#':
        b.append(i)
    if S[i] == '.':
        w.append(i)

kouho = []
for i in range(0,N+1):
    cost = 0
    #iより右にある白の数
    cost += len(w) - bisect.bisect_left(w,i)
    #iより左にある黒の数
    cost += bisect.bisect_left(b,i)
    
    if cost >= 0:
        kouho.append(cost)

print(min(kouho))

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

# 右全部#にする

b = S.count('W')

ans = 10**9
cost = 0
for c in S:
    if c == '.':
        # 今見てる所以降全部白にする事を考える
        w -= 1
        # まだ見てない白の数 + 今まで白にした黒のコストが答え候補
        if w + cost < ans:
            ans = w + cost
    else:
        # 今見てる所が黒の場合、白の個数は減らない
        if w + cost< ans:
            ans = w + cost
        # 以降の計算に向けてコストを1増やす
        cost += 1

print(ans)
Problem p03086 (python)

Fixed submission:
S = input()

result = [0]
count = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        result.append(count)
        count = 0
result.append(count)
print(max(result))

Buggy submission (verdict: Runtime Error):
S = input()

result = []
count = 0
for i in range(len(S)):
    if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
        count += 1
    else:
        result.append(count)
        count = 0

print(max(result))
Problem p03160 (python)

Fixed submission:
N = int(input())
hList = [int(x) for x in input().split()]

#i番目まで飛んだ時点で一番小さい値、を計算していく
dp = [0, abs(hList[0] - hList[1])]
for i in range(2,N):
    dp.append(min(dp[i-2] + abs(hList[i-2] - hList[i]), dp[i-1] + abs(hList[i-1] - hList[i])))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
hList = [int(x) for x in input().split()]

def dfs(idx):
    if idx < N-2:
        return min(abs(hList[idx] - hList[idx+1]) + dfs(idx+1), abs(hList[idx] - hList[idx+2]) + dfs(idx+2))
    elif idx < N-1:
        return abs(hList[idx] - hList[idx+1]) + dfs(idx+1)
    else:
        return 0

print(dfs(0))

Buggy submission (verdict: Runtime Error):
N = int(input())
hList = [int(x) for x in input().split()]


def dfs(idx):
    if idx == N-1:
        return 0
    if idx < N-2:
        return min(abs(hList[idx] - hList[idx+1]) + dfs(idx+1), abs(hList[idx] - hList[idx+2]) + dfs(idx+2))
    elif idx < N-1:
        return abs(hList[idx] - hList[idx+1]) + dfs(idx+1)

print(dfs(0))
Problem p03200 (python)

Fixed submission:
S = input()

count = 0
for i in range(len(S)):
    if S[i] == 'W':
        continue
    else:
        break
S = S[i:]

count = 0
score = 0
for i in range(len(S)):
    if S[i] == 'W':
        score += (i - count)
        count += 1
print(score)

Buggy submission (verdict: Runtime Error):
S = input()

count = 0
for i in range(len(S)):
    if S[i] == 'W':
        continue
    else:
        break
S = S[i:]

count = 0
score = 0
for i in range(len(S))
    if S[i] == 'W':
        score += (i - count)
        count += 1
print(score)
Problem p03210 (python)

Fixed submission:
x = input()

if x == '7' or x == '5' or x == '3':
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
x = input()

if x == '7' or x == '5' or x == '3':
  print('YES'
else:
  print('NO')
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
N, X = input().split()
xList = [int(x) for x in input().split()]
N = int(N)
X = int(X)
xList.append(X)
xList.sort()
diffList = []
for x, xx in zip(xList, xList[1:]):
    diffList.append(xx - x)
if len(diffList) > 1:
    diffList.sort()
    gcdList = []
    for x in diffList[1:]:
        gcdList.append(gcd(diffList[0], x))
    gcdList.sort()
    print(gcdList[0])
else:
    print(diffList[0])

Buggy submission (verdict: Runtime Error):
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
     
    N, X = input().split()
    xList = [int(x) for x in input().split()]
    N = int(N)
    X = int(X)
    xList.append(X)
    xList.sort()
    diffList = []
    for x, xx in zip(xList, xList[1:]):
        diffList.append(xx - x)
    if len(diffList) > 1:
        diffList.sort()
        gcdList = []
        for x in diffList[1:]:
            gcdList.append(gcd(diffList[0], x))
        gcdList.sort()
        print(gcdList[0])
    else:
        print(diffList[0])

Buggy submission (verdict: Runtime Error):
import fraction

N, X = input().split()
xList = [int(x) for x in input().split()]
N = int(N)
X = int(X)
xList.append(X)
xList.sort()
diffList = []
for x, xx in zip(xList, xList[1:]):
    diffList.append(xx - x)

diffList.sort()

print(fraction.gcd(diffList[0], diffList[-1]))
Problem p03308 (python)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]

print(max(a) - min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))

print(max(a) - min(a))
Problem p03361 (python)

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

hw = []
hw.append('.'*(W+2))
for _ in range(H):
    edited = input()
    edited = '.' + edited + '.'
    hw.append(edited)
hw.append('.'*(W+2))
#四方を白に囲まれた黒がある場合に達成不可能
for i in range(1,H+1):
    for j in range(1,W+1):
        if hw[i][j] == '#':
            #探索
            if hw[i+1][j] == '.' and hw[i-1][j] == '.' and hw[i][j+1] == '.' and hw[i][j-1] == '.':
                print('No')
                quit()

print('Yes')

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

hw = []
hw.append('.'*W)
for _ in range(H):
    edited = input()
    edited = '.' + edited + '.'
    hw.append(edited)
hw.append('.'*W)
#四方を白に囲まれた黒がある場合に達成不可能

for i in range(1,H+1):
    for j in range(1,W+1):
        if hw[i][j] == '#':
            #探索
            if hw[i+1][j] == '.' and hw[i-1][j] == '.' and hw[i][j+1] == '.' and hw[i][j-1] == '.':
                print('No')
                quit()

print('Yes')
Problem p04048 (python)

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

if N/2 == X:
    l = X*3
elif N/2 > X:
    l = N
    x = X
    n = N - X
    while x > 0:
        l += (n//x)*2*x
        c = x
        x = n%x
        n = c
    l -= n
else:
    l = N
    x = X
    n = N - X
    while x > 0:
        l += (n//x)*2*x
        c = x
        x = n%x
        n = c
    l -= n
print(l)

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

if N/2 == X:
    print(X*3)
elif N/2 > X:
    # 上側
    l = X + N - X
    l += ((N-X)//X)*2
    n = (N-X)%X
    l += (X//n)*2*n
    l += n
else:
    l = X
    n = X-N
    l += (N//n)*2*n
print(l)

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

if N/2 == X:
    print(X*3)
else:
    # 上側
    l = X + N - X
    while X > 0:
        l += X*2
        X -= 1
    l += 1
print(l)
Problem p02612 (python)

Fixed submission:
print((100000-int(input()))%1000)

Buggy submission (verdict: Runtime Error):
print(100000-int(input().split())%1000)
Problem p02702 (python)

Fixed submission:
n = input()
l = len(n)
s = [0] * 2020
m = [0] * (l+1)
m[0] = 1
s[0] = 1
for i in range(1, l+1):
    m[i] = (m[i-1]*10) % 2019
tmp = 0
n = list(n)[::-1]
for i in range(len(n)):
    #print(i, n[-1-i], m[i])
    tmp = (tmp + int(n[i])*m[i]) % 2019
    # print(tmp)
    s[tmp] += 1
su = 0
for i in s:
    if i > 1:
        # print("#", i)
        su += i * (i - 1)//2
print(su)

Buggy submission (verdict: Runtime Error):
n = input()
s = [0] * 2020
m = [0] * 2020
m[0] = 1
s[0] = 1
for i in range(1, 2020):
    m[i] = (m[i-1]*10) % 2019
tmp = 0
for i in range(len(n)):
    #print(i, n[-1-i], m[i])
    tmp = (tmp + int(n[-1-i])*m[i]) % 2019
    # print(tmp)
    s[tmp] += 1
su = 0
for i in s:
    if i > 1:
        # print("#", i)
        su += i * (i - 1)//2
print(su)
Problem p02727 (python)

Fixed submission:
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p)
q=sorted(q)
r=sorted(r)
p=p[(a-x):]
q=q[(b-y):]
res=sum(p)+sum(q)
tp=0
tq=0
tr=c-1
while 1:
  if(tr<0 ):
    break
  if(tp>=x):
    pp=100000000000
  else:
    pp=p[tp]
  if(tq>=y):
    qq=100000000000
  else:
    qq=q[tq]

  if(pp>r[tr] and qq>r[tr]):
    break
  if(pp<qq ):
    res+=r[tr]-pp
    tp+=1
  else:
    res+=r[tr]-qq
    tq+=1
  tr-=1
print(res)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p)
q=sorted(q)
r=sorted(r)
p=p[(a-x):]
q=q[(b-y):]
res=sum(p)+sum(q)
tp=0
tq=0
tr=c-1
while(p[tp]<r[tr] or q[tq]<r[tr]):
  if(p[tp]<q[tq]):
    res+=r[tr]-p[tp]
    tp+=1
  else:
    res+=r[tr]-q[tq]
    tq+=1
  tr-=1
print(res)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p)
q=sorted(q)
r=sorted(r)
p=p[(a-x):]
q=q[(b-y):]
res=sum(p)+sum(q)
tp=0
tq=0
tr=c-1
while(p[tp]<r[tr] or q[tq]<r[tr]):
  if(p[tp]<q[tq]):
    res+=r[tr]-p[tp]
    tp-=1
  else:
    res+=r[tr]-q[tq]
    tq-=1
  tr-=1
print(res)
Problem p02760 (python)

Fixed submission:
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[0]*N
for i in range(N):
  b[i]=int(input())
C1=any([i == A1[0] for i in b])
C2=any([i == A1[1] for i in b])
C3=any([i == A1[2] for i in b])
C4=any([i == A2[0] for i in b])
C5=any([i == A2[1] for i in b])
C6=any([i == A2[2] for i in b])
C7=any([i == A3[0] for i in b])
C8=any([i == A3[1] for i in b])
C9=any([i == A3[2] for i in b])

if(any([all([C1,C2,C3]),all([C4,C5,C6]),all([C7,C8,C9]),all([C1,C4,C7]),all([C2,C5,C8]),all([C3,C6,C9]),all([C1,C5,C9]),all([C3,C5,C7])])):
   print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):

A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[0]*N
for i in range(N):
  print(i)
  b[i]=int(input())
C1=any([i == A1[0] for i in b])
C2=any([i == A1[1] for i in b])
C3=any([i == A1[2] for i in b])
C4=any([i == A2[0] for i in b])
C5=any([i == A2[1] for i in b])
C6=any([i == A2[2] for i in b])
C7=any([i == A3[0] for i in b])
C8=any([i == A3[1] for i in b])
C9=any([i == A3[2] for i in b])

if(any(all(C1,C2,C3),all(C4,C5,C6),all(C7,C8,C9),all(C1,C4,C7),all(C2,C5,C8),all(C3,C6,C9),all(C1,C5,C9),all(C3,C5,C7)):
   print("Yes")
else:
   print("No")
Problem p02780 (python)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
for i in range(N-1):
    p[i+1]=p[i+1]+p[i]
max=p[K-1]
if N>K:
    for i in range(1,N-K+1):
        tmp=p[i+K-1]-p[i-1]
        if max < tmp:
            max=tmp
print((max+K)/2.)

Buggy submission (verdict: Runtime Error):
N=input().split()
p=map(int, input().split())
NN=int(N[0])
MM=int(N[1])
p2=[0.]*(NN-MM+1)
for i in range(NN-MM+1):
    a=0.
    for j in range(MM):
        a=a+(p[i+j]+1)/2
    p2[i]=a
print(max(p2))