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

Fixed submission:
A = input()
B = input()
C = input()
D = input()
E = input()


l = [A, B, C, D, E]
l2 = list()

# check min 1 keta

m = -1

for x in l:
    t = int(x) % 10
    if t == 0:
        l2.append(int(x))
    else:
        l2.append((int(x) + 10) // 10 * 10)

l3 = [int(x) % 10 for x in l]
l3 = [x for x in l3 if x != 0]

if len(l3) == 0:
    print(sum(l2))
else:
    print(sum(l2) - 10 + min(l3))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

l = [a, b, c, d, e]
d = list()

for i, x in enumerate(l[:-1]):
    l2 = l[i+1:]
    for y in l2:
        d.append(y-x)

if max(d) <= k:
    print('Yay!')
else:
    print(':(')
Problem p03086 (python)

Fixed submission:
S = input()

ans = 0
ans_tmp = 0

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
      ans_tmp += 1
  else:
    ans = max(ans_tmp, ans)
    ans_tmp = 0
ans = max(ans_tmp, ans)

print(ans)

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

ans = list()
ans_tmp = list()

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
    ans_tmp.append(s)
  else:
    if len(ans_tmp) > len(ans):
      ans = ans_tmp.copy()
      ans_tmp = list()

print(len(ans))

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

ans = list()
ans_tmp = list()

x = {'A', 'G', 'C', 'T'}

for s in S:
  if s in x:
    ans_tmp.append(s)
  else:
    if len(ane_tmp) > len(ans):
      ans = ans_tmp
      ans_tmp = list()

print(len(ans))
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
L, R = [None] * Q, [None] * Q

S = input()

for i in range(Q):
    L[i], R[i] = map(int, input().split())

counts = [0] * N
count_tmp = 0

for i in range(1, N):
    if S[i-1] == 'A' and S[i] == 'C':
        count_tmp += 1
    counts[i] = count_tmp

# print(counts)

for i in range(Q):
    print(counts[R[i] - 1] - counts[L[i] - 1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
L, R = [None] * N, [None] * N

S = input()

for i in range(Q):
    L[i], R[i] = map(int, input().split())


counts = [0] * N
count_tmp = 0

for i in range(1, N):
    if S[i-1] == 'A' and S[i] == 'C':
        count_tmp += 1
    counts[i] = count_tmp

# print(counts)

for i in range(Q):
    print(counts[R[i] - 1] - counts[L[i] - 1])
Problem p03239 (python)

Fixed submission:
N, T = map(int, input().split())
c = [None] * N
t = [None] * N

for i in range(N):
  c[i], t[i] = map(int, input().split())

a = [x for x, y in zip(c, t) if y <= T]
if len(a) > 0:
  print(min(a))
else:
  print('TLE')

Buggy submission (verdict: Runtime Error):
N, T = map(int, input.split())
c = [None] * N
t = [None] * N

for i in range(N):
  c[i], t[i] = map(int, input.split())

a = [x for x, y in zip(c, t) if y <= T]
if len(a) > 0:
  print(min(a))
else:
  print('TLE')
Problem p03251 (python)

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

xs = list(map(int, input().split()))
xs.append(X)
ys = list(map(int, input().split()))
ys.append(Y)

if max(xs) < min(ys):
    print("No War")
else:
    print("War")

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

xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

if (max(xs) < min(ys)) ans (X < Y):
    print("No War")
else:
    print("War")
Problem p03292 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(A: "List[int]"):
    print(max(A) - min(A))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [ int(next(tokens)) for _ in range(3) ]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(A: "List[int]"):
    print(abs(A[0] - A[1] + abs(A[1] - A[2]))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [ int(next(tokens)) for _ in range(3) ]  # type: "List[int]"
    solve(A)

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

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

A = [A[i] - i - 1 for i in range(N)]
A = sorted(A)
indx = int(len(A) / 2)

b = sum([abs(a - A[indx]) for a in A])

ans = [b]

if N > 1:
    b1 = sum([abs(a - A[indx-1]) for a in A])
    ans.append(b1)

if N > 2:
    b2 = sum([abs(a - A[indx+1]) for a in A])
    ans.append(b2)

print(min(ans))

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

A = [A[i] - i - 1 for i in range(N)]
A = sorted(A)
indx = int(len(A) / 2)

b = sum([abs(a - A[indx]) for a in A])
b1 = sum([abs(a - A[indx-1]) for a in A])
b2 = sum([abs(a - A[indx+1]) for a in A])

print(min([b, b1, b2]))
Problem p03469 (python)

Fixed submission:
S = input()

print('2018' + S[4:])

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

S[0:4] = '2018'
print(S)

Buggy submission (verdict: Runtime Error):
from numba import jit
N, Y = map(int, input().split())

count_max = Y / 1000  # all 1000

@jit
def sample(n, y):
    ans = '-1 -1 -1'
    for i in reversed(range(y // 10000 + 1)):
        count_tmp1 = count_max - 9 * i
        price_tmp1 = y - 10000 * i
        if count_tmp1 < n or price_tmp1 < 0:
            continue

        if count_tmp1 == n:
            ans = '{} {} {}'.format(i, 0, N - i)
            return ans

        if price_tmp1 > 5000 * count_tmp1:
            return ans

        for j in reversed(range(price_tmp1 // 5000 + 1)):
            count_tmp2 = count_tmp1 - 4 * j
            price_tmp2 = price_tmp1 - 5000 * j
            if count_tmp2 < n or price_tmp2 < 0:
                continue
            if count_tmp2 == n:
                ans = '{} {} {}'.format(i, j, N - i -j)
                return ans
            if price_tmp2 > 5000 * count_tmp2:
                return ans
    return ans
a = sample(N, Y)
print(a)

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

ans = '-1 -1 -1'
count_max = Y / 1000  # all 1000

if (Y % 10000 == 0) and (Y // 10000 == N):
    print('{} 0 0'.format(Y//10000))
    exit()


for i in reversed(range(Y // 10000)):
    count_tmp1 = count_max - 9 * i
    price_tmp1 = Y - 10000 * i
    if count_tmp1 < N or price_tmp1 < 0:
        continue

    if count_tmp1 == N:
        ans = '{} {} {}'.format(i, 0, N - i)
        #ans_list.append(ans)
        break

    if (price_tmp1 % 5000 == 0) and ((price_tmp1 // 5000 + count_tmp1) == N):
        ans = '{} {} {}'.format(i, price_tmp1 // 5000, 0)
        break

    is_continue = True
    for j in reversed(range(price_tmp1 // 5000)):
        count_tmp2 = count_tmp1 - 4 * j
        price_tmp2 = price_tmp1 - 5000 * j
        if count_tmp2 < N or price_tmp2 < 0:
            continue
        if count_tmp2 == N:
            ans = '{} {} {}'.format(i, j, N - i -j)
            is_continue = False
            break
    if not is_continue:
        break
print(ans)

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

ans = '-1 -1 -1'
count_max = Y / 1000  # all 1000

if Y % 10000 == 0:
    print('{} 0 0'.format(Y//10000))
    exit()


for i in reversed(range(Y // 10000)):
    count_tmp1 = count_max - 9 * i
    price_tmp1 = Y - 10000 * i
    if count_tmp1 < N or price_tmp1 < 0:
        continue

    if count_tmp1 == N:
        ans = '{} {} {}'.format(i, 0, N - i)
        #ans_list.append(ans)
        break

    if price_tmp1 % 5000 == 0:
        ans = '{} {} {}'.format(i, price_tmp1 // 5000, 0)
        break

    is_continue = True
    for j in reversed(range(price_tmp1 // 5000)):
        count_tmp2 = count_tmp1 - 4 * j
        price_tmp2 = price_tmp1 - 5000 * j
        if count_tmp2 < N or price_tmp2 < 0:
            continue
        if count_tmp2 == N:
            ans = '{} {} {}'.format(i, j, N - i -j)
            is_continue = False
            break
    if not is_continue:
        break
print(ans)
Problem p03471 (python)

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

count_max = Y / 1000  # all 1000

ans = '-1 -1 -1'
for i in range(N+1):  # 10000
    for j in range(N+1 - i):  # 5000
        k = N - i - j
        if k < 0:
            continue
        total = 10000 * i + 5000 * j + 1000 * k
        if total == Y:
            ans = '{} {} {}'.format(i, j, k)
            break
print(ans)

Buggy submission (verdict: Runtime Error):
from numba import jit
N, Y = map(int, input().split())

count_max = Y / 1000  # all 1000

@jit
def sample(n, y):
    ans = '-1 -1 -1'
    for i in reversed(range(y // 10000 + 1)):
        count_tmp1 = count_max - 9 * i
        price_tmp1 = y - 10000 * i
        if count_tmp1 < n or price_tmp1 < 0:
            continue

        if count_tmp1 == n:
            ans = '{} {} {}'.format(i, 0, N - i)
            return ans

        if price_tmp1 > 5000 * count_tmp1:
            return ans

        for j in reversed(range(price_tmp1 // 5000 + 1)):
            count_tmp2 = count_tmp1 - 4 * j
            price_tmp2 = price_tmp1 - 5000 * j
            if count_tmp2 < n or price_tmp2 < 0:
                continue
            if count_tmp2 == n:
                ans = '{} {} {}'.format(i, j, N - i -j)
                return ans
            if price_tmp2 > 5000 * count_tmp2:
                return ans
    return ans
a = sample(N, Y)
print(a)
Problem p03493 (python)

Fixed submission:
num_str = input()

print(sum([1 for a in num_str if a == '1']))

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))
ans_count = 0

while(1):
  count = len(np.where(a % 2 == 1)[0])
  if count > 0:
    break
  a = a / 2
  ans_count += 1
print(ans_count)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))
ans_count = 0

while:
  count = len(np.where(a % 2 == 1)[0])
  if count > 0:
    break
  a = a / 2
  ans_count += 1
print(ans_count)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = np.array(map(int, input().split()))
ans_count = 0
print(ans_count)
Problem p03494 (python)

Fixed submission:
import numpy as np
 
n = int(input())
a = np.array(list(map(int, input().split())))
ans_count = 0
 
while(1):
  count = len(np.where(a % 2 == 1)[0])
  if count > 0:
    break
  a = a / 2
  ans_count += 1
print(ans_count)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = np.array(map(int, input().split()))
ans_count = 0

while:
  count = len(np.where(a % 2 == 1)[0])
  if count > 0:
    break
  a = a / 2
  ans_count += 1
print(ans_count)
Problem p03673 (python)

Fixed submission:
from collections import deque

N = int(input())

A = list(map(int, input().split()))
B = deque()

for i, a in enumerate(A):
    if i % 2 == 0:
        B.appendleft(a)
    else:
        B.append(a)

if N % 2 == 0:
    B.reverse()

B = list(map(str, list(B)))

print(" ".join(B))

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

B = list()
for a in A:
  B.append(a)
  B = B[::-1]
print(" ".join(B))
Problem p02732 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k=np.array(list(Counter(a).keys()))
t=np.array(list(Counter(a).values()))
l=np.ones(len(t))
for i in range(n):
  s=np.copy(t)
  s[int(np.where(k==a[i])[0])]-=1
  print(int(sum(s*(s-l)//2)))

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k=np.array(list(Counter(a).keys()))
t=np.array(list(Counter(a).values()))
l=np.ones(len(t))
for i in range(n):
  s=np.copy(t)
  s[int(np.where(k==a[i])[0])]-=1
  print(int(sum(s*(s-l)//2)))

Buggy submission (verdict: Runtime Error):
import copy
import numpy as np
import collections

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  ans = 0
  b = copy.copy(a)
  b.pop(i)
  c = np.array(list(collections.Counter(b).values()))
  d = int(sum(c*(c-np.ones(len(c)))//2))
  print(d)
Problem p02741 (python)

Fixed submission:
a = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
k = int(input())
b = a.split(", ")
print(b[k-1])

Buggy submission (verdict: Runtime Error):
a = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
k = int(input())
b = a.split(", ")
print(b[k])
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
a, b, num = [0]*m, [0]*m, [0]*n
if n!=1:
  num[0]=1
for i in range(m):
  a[i], b[i] = map(int, input().split())
  num[a[i]-1]=b[i]
for i in range(m):
  if num[a[i]-1]!=b[i]:
    print(-1)
    exit()

ans=''
for i in num:
  ans+=str(i)
ans = int(ans)
ans = str(ans)
if len(ans)==n:
  print(ans)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a, b, num = [0]*n, [0]*n, [0]*n
num[0]=1
for i in range(m):
  a[i], b[i] = map(int, input().split())
  num[a[i]-1]=b[i]
for i in range(m):
  if num[a[i]-1]!=b[i]:
    print(-1)
    exit()

ans=''
for i in num:
  ans+=str(i)
ans = int(ans)
ans = str(ans)
if len(ans)==n:
  print(ans)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a, b ,cnt, num= [0]*n, [0]*n, [0]*n, [0]*n
for i in range(m):
  a[i], b[i] = map(int, input().split())
  cnt[a[i]-1]+=1
  if cnt[a[i]-1]==2:
    if num[a[i]-1]!=b[i]:
      print(-1)
      exit()
  num[a[i]-1]=b[i]

ans=''
for i in num:
  ans+=str(i)
  ANS=int(ans)
if ans==str(ANS):
  print(int(ans))
else:
  print(-1)
Problem p02772 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 'APPROVED'
for i in range(n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      ans = 'APPROVED'
    else:
      print('DENIED')
      exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      ans = 'APPROVED'
    else:
      print('DENIED')
      exit()
print(ans)
Problem p02823 (python)

Fixed submission:
n, a, b = map(int, input().split())
if abs(a-b)%2==0:
       print(abs(a-b)//2)
else:
  x = min(n-a, n-b, a-1, b-1)
  print(x+(abs(a-b)+1)//2)

Buggy submission (verdict: Runtime Error):
n, a_, b_ = map(int, input().split())
a = a_-1
b = b_-1
A = [0]*n
B = [0]*n
for i in range(n):
  A[i] = abs(i-a)
  B[i] = abs(i-b)
for i in range(n):
  if A[i]==B[i]:
    print(A[i])
    exit()
m = [A[0], B[0], A[n-1], B[n-1]]
M = m.index(min(m))
if M == 0:
  print(m[1])
elif M == 1:
  print(m[0])
elif M == 2:
  print(m[3])
elif M == 3:
  print(m[2])
Problem p02841 (python)

Fixed submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
if m1==m2:
  print("0")
else:
  print("1")

Buggy submission (verdict: Runtime Error):
m1, d1 = int(input())
m2, d2 = int(input())
if m1==m2:
  print("0")
else:
  print("1")
Problem p02848 (python)

Fixed submission:
n = int(input())
s = list(input())
k = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(len(s)):
  s[i] = k[(k.index(s[i])+n)%len(k)]
s_change = "".join(s)
print(s_change)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
k = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(n):
  s.replace(s[i], k[k.index(s[i])+2])
print(s)
Problem p02917 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(n-2):
  s+=min(a[n-2-i],a[n-i-3])
print(s+a[n-2]+a[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
s = 0
for i in range(n-2):
  s+=min(a[n-2-i],a[n-i-3])
print(s+a[n-2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
s = 0
for i in range(n-2):
  s+=min(a[n-i],a[n-i-1])
print(s+a[n-2])
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
cnt = 0
ans = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt += 1
        ans = max(ans,cnt)
    else:
        cnt = 0
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(x) for x in input().split()]
cnt = []
cur_cnt = 0
for x in range(n-1):
    if h[x] >= h[x + 1]:
        cur_cnt += 1
    else:
        cnt.append(cur_cnt)
        cur_cnt = 0
cnt.append(cur_cnt)

print(max(count))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
cnt = []
cur_cnt = 0
for x in range(n-1):
    if h[x] >= h[x + 1]:
        cur_cnt += 1
    else:
        cnt.append(cur_cnt)
        cur_cnt = 0
cnt.append(cur_cnt)

print(max(count))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = map(int, input().split())
cnt = []
cur_cnt = 0
for x in range(n-1):
    if h[x] >= h[x + 1]:
        cur_cnt += 1
    else:
        cnt.append(cur_cnt)
        cur_cnt = 0
cnt.append(cur_cnt)

print(max(count))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = map(int, input().split())
judge = 0
for i in range(n):
  flag=0
  count=0
  I=i
  while flag==0 and (I+count+1)<n:
    if h[I+count]>=h[I+count+1]:
      count+=1
    else:
      flag=1
    judge = max(judge, count)
print(judge)
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
print(sum(list(range(n))))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(range(n))
ans = sum(a)+1
print(ans)
Problem p03435 (python)

Fixed submission:
c = [] 
for i in range(3):
  box = list(map(int, input().split()))
  c.append(box)

  
for i in range(101):
  a1 = i
  b1 = c[0][0]-a1
  b2 = c[0][1]-a1
  b3 = c[0][2]-a1
  if c[1][0]-b1 == c[1][1]-b2 == c[1][2]-b3:
    if c[2][0]-b1 == c[2][1]-b2 == c[2][2]-b3:
      print('Yes')
      exit()
print('No')

Buggy submission (verdict: Runtime Error):
c_box = [] 
for i in range(3):
  c = list(map(int, input().split()))
  c_box.append(c)
  
for i in range(101):
  a1 = i
  b1 = c[0][0]-a1
  b2 = c[0][1]-a1
  b3 = c[0][2]-a1
  if c[1][0]-b1 == c[1][1]-b2 == c[1][2]-b3:
    if c[2][0]-b1 == c[2][1]-b2 == c[2][2]-b3:
      print('Yes')
      exit()
print('No')
Problem p03610 (python)

Fixed submission:
n = input()
ans = ""
for i in range(len(n)):
  if i%2 == 0:
    ans += n[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
ans = ""
for i in range(n):
  if i%2==0:
    ans += n[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
ans = ""
for i in range(n):
  if i%2==0:
    ans += n[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
ans = ""
for i in range(n):
  if i%2==1:
    ans += n[i]
print(ans)
Problem p03644 (python)

Fixed submission:
n = int(input())
a = 1
while(1):
  if a<=n:
    a*=2
  else:
    print(a//2)
    exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
a = 1
wihle(1):
  if a<=n:
    a*=2
  else:
    print(a//2)
    exit()
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.sort()
q.sort()
r.sort()
r = sorted(r,reverse = True)
p = p[A-X:]
q = q[B-Y:]
if X+Y<C:
    r = r[:X+Y]
px = 0
qx = 0
for i in range(C):
    if px == len(p) and qx == len(q):
        break
    elif px == len(p):
        if min(q[qx],r[i])==q[qx]:
            q[qx] =r[i]
            qx += 1
        else:
            break
    elif qx == len(q):
        if min(p[px],r[i])==p[px]:
            p[px] =r[i]
            px += 1
        else:
            break
    else:
        if min(p[px],q[qx],r[i]) ==p[px]:
            p[px] = r[i]
            px +=1
        elif min(p[px],q[qx],r[i]) ==q[qx]:
            q[qx] = r[i]
            qx += 1
        else:
            break
print(sum(p)+sum(q))

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.sort()
q.sort()
r.sort()
r = sorted(r,reverse = True)
p = p[A-X:]
q = q[B-Y:]
if X+Y<C:
    r = r[:X+Y]
px = 0
qx = 0
for i in range(C):
    if px == len(p) and qx == len(q):
        break
    if px == len(p):
        if min(q[qx],r[i])==q[qx]:
            q[qx] =r[i]
            qx += 1
        else:
            break
    if qx == len(q):
        if min(p[px],r[i])==p[px]:
            p[px] =r[i]
            px += 1
        else:
            break
    else:
        if min(p[px],q[qx],r[i]) ==p[px]:
            p[px] = r[i]
            px +=1
        elif min(p[px],q[qx],r[i]) ==q[qx]:
            q[qx] = r[i]
            qx += 1
        else:
            break
print(sum(p)+sum(q))

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.sort()
q.sort()
r.sort()
r = sorted(r,reverse = True)
p = p[A-X:]
q = q[B-Y:]
if X+Y<C:
    r = r[:X+Y+1]
px = 0
qx = 0
for i in range(X+Y):
    if px == len(p) or qx ==len(q):
        break
    if min(p[px],q[qx],r[i]) ==p[px]:
        p[px] = r[i]
        px +=1
    elif min(p[px],q[qx],r[i]) ==q[qx]:
        q[qx] = r[i]
        qx += 1
    else:
        px += 1
        qx += 1
print(sum(p)+sum(q))
Problem p03076 (python)

Fixed submission:

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


ten = a//10 + b//10 + c//10 + d//10 + e//10

aa = [a%10,b%10,c%10,d%10,e%10]
zero = aa.count(0)

if zero == 5:
	print(ten*10)
else:
	for i in range(1,10):
		if  i in aa:
			one = i
			break
	print(ten*10 + (4-zero)*10 +one)

Buggy submission (verdict: Runtime Error):
ten = a//10 + b//10 + c//10 + d//10 + e//10

aa = [a%10,b%10,c%10,d%10,e%10]
zero = aa.count(0)

if zero == 5:
	print(ten)
else:
	for i in range(1,10):
		if  i in aa:
			one = i
			break
	print(ten*10 + (4-zero)*10 +one)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


ten = a//10 + b//10 + c//10 + d//10 + e//10

aa = [a%10,b%10,c%10,d%10,e%10]
zero = aa.count(0)

if zero == 5:
	print(ten)
else:
	for i in range(1,9):
		if  i in aa:
			one = i
			break
	print(ten*10 + (4-zero)*10 +one)
Problem p03087 (python)

Fixed submission:
#累積和　なるほど！

n,q = map(int, input().split())
s = input()
lr = list(map(str, [input() for i in range(q)]))

ac = [0]*n
#012345678
# ACACTACG
# 01122233

for i in range(1,n):
	if s[i-1:i+1] =='AC':
		ac[i] = ac[i-1] + 1
	else:
		ac[i] = ac[i-1]

for i in range(q):
	l,r = map(int, lr[i].split())
	answer = ac[r-1]-ac[l-1] 

	print(answer)

Buggy submission (verdict: Runtime Error):
n,q = map(int, input().split())
s = input()
lr = list(map(str, [input() for i in range(q)]))

ac = [0]*n


for i in range(1,n):
	if s[i] =='C':
		if s[i-1] == 'A':
			ac[i-1] = 1

for i in range(q):
	answer = sum(ac[int(lr[i][0])-1:int(lr[i][2])])
	if answer >= 1:
		if ac[int(lr[i][2])-1] == 1:
			answer -= 1
	print(answer)

Buggy submission (verdict: Runtime Error):
n,q = map(int, input().split())
s = input()
lr = list(map(str, [input() for i in range(q)]))

ac = [0]*n


for i in range(1,n):
	if s[i] =='C':
		if s[i-1] == 'A':
			ac[i-1] = 1

for i in range(q):
	answer = sum(ac[int(lr[i][0])-1:int(lr[i][2])])
	if ac[int(lr[i][2])-1] == 1:
		answer -= 1
	print(answer)
Problem p03280 (python)

Fixed submission:
a,b = map(int,input().split())
print((a-1)*(b-1))

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