Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
for i in range(N):
    l = P[:i+1]
    # print(l)
    if P[i] <= min(l):
        count += 1

print(count)


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

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
min_prev = P[0] + 1
for i in range(N):
    if P[i] < min_prev:
        min_prev = P[i]
        count += 1

print(count)

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

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
for i in range(N):
    l = P[:i+1]
    print(l)
    if P[i] <= min(l):
        count += 1

print(count)


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

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
min_prev = P[0] + 1
for i in range(N):
    if P[i] < min_prev:
        min_prev = P[i]
        count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
for i in range(N):
    flag = True
    for j in range(i):
        if flag == False:
            break
        if P[i] > P[j]:
            flag = False
    if flag:
        count += 1

print(count)


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

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
min_prev = P[0] + 1
for i in range(N):
    if P[i] < min_prev:
        min_prev = P[i]
        count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
for i in range(N):
    flag = True
    for j in range(i):
        if P[i] > P[j]:
            flag = False
    if flag:
        count += 1

print(count)


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

N = int(input())
P = list(map(int, input().split()))
# print(N, P)

count = 0
min_prev = P[0] + 1
for i in range(N):
    if P[i] < min_prev:
        min_prev = P[i]
        count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

a, b, k = map(int, input().split())
# print(a, b, k)

for i in range(k):
    if a > 0:
        a -= 1
    elif b > 0:
        b -= 1
    else:
        break

print(a, b)


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

a, b, k = map(int, input().split())
# print(a, b, k)

if k >= a + b:
    a = 0
    b = 0
else:
    if k >= a:
        b = b - (k - a)
        a = 0
        # print("k >= a")
        # print(a, b)
    else:
        # print("k < a")
        a = a - k
        b = b
        # print(a, b)

print(a, b)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

a, b, k = map(int, input().split())
# print(a, b, k)

for i in range(k):
    if a > 0:
        a -= 1
    elif b > 0:
        b -= 1

print(a, b)


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

a, b, k = map(int, input().split())
# print(a, b, k)

if k >= a + b:
    a = 0
    b = 0
else:
    if k >= a:
        b = b - (k - a)
        a = 0
        # print("k >= a")
        # print(a, b)
    else:
        # print("k < a")
        a = a - k
        b = b
        # print(a, b)

print(a, b)
Buggy python submission (verdict: Runtime Error):
if field[0][0] == '#':
    print(-1)
elif dist[(H - 1, W - 1)] == -1:
    print(-1)
else:
    steps_min = dist[(H - 1, W - 1)] + 1
    n_white = W * H - n_black
    ans = n_white - steps_min
    print(ans)


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

from collections import deque

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

field = []
for _ in range(H):
    line = list(input())
    field.append(line)
# print(H, W, field)


def is_valid(i, j):
    cond_i = 0 <= i <= H - 1
    cond_j = 0 <= j <= W - 1
    return cond_i and cond_j


def is_reachable(i, j, ):
    if is_valid(i, j):
        if field[i][j] == '.':
            return True
    return False


def adj(i, j):
    up, down = [i - 1, j], [i + 1, j]
    left, right = [i, j - 1], [i, j + 1]
    res = []
    for i_adj, j_adj in up, down, left, right:
        if is_reachable(i_adj, j_adj):
            res.append([i_adj, j_adj])
    return res


def bfs(que, dist):
    while len(que) > 0:
        i, j = que.popleft()
        # print(f"i, j: {i}, {j}")
        for i_adj, j_adj in adj(i, j):
            # print(f"i_adj, j_adj: {i_adj}, {j_adj}")
            if dist[(i_adj, j_adj)] == -1:
                que.append([i_adj, j_adj])
                dist[(i_adj, j_adj)] = dist[(i, j)] + 1


que = deque()
keys = [(i, j) for i in range(H) for j in range(W)]
values = [-1 for _ in range(H * W)]
dist = dict(zip(keys, values))
# print(dist)

n_black = 0
for i in range(H):
    for j in range(W):
        if field[i][j] == '#':
            n_black += 1

que.append([0, 0])
dist[(0, 0)] = 0
bfs(que, dist)

if dist[(H - 1, W - 1)] == -1:
    print(-1)
else:
    steps_min = dist[(H - 1, W - 1)] + 1
    n_white = W * H - n_black
    ans = n_white - steps_min
    print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n, m, k = nm()
a = nl()
b = nl()
ans = 0
sum_a = [0]*(n+1)
sum_b = [0]*(m+1)
for i in range(1, n+1):
    sum_a[i] = sum_a[i-1] + a[i-1]
for i in range(1, m+1):
    sum_b[i] = sum_b[i-1] + b[i-1]
ans = 0
bef_j = m
for i in range(n+1):
    if sum_a[i] >= k:
        break
    for j in range(m+1, -1, -1):
        if sum_a[i] + sum_b[j] <= k:
            ans = max(ans, i+j)
            bef_j = j
            break
print(ans)


Fixed submission:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n, m, k = nm()
a = nl()
b = nl()
sum_a = [0]
sum_b = [0]
for i in range(n):
    sum_a.append(sum_a[i] + a[i])
for i in range(m):
    sum_b.append(sum_b[i] + b[i])
ans = 0
j = m
for i in range(n+1):
    if sum_a[i] > k:
        break
    while sum_b[j] > k - sum_a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n, m, k = nm()
A = nl()
B = nl()
a = deque(A)
b = deque(B)
cnt = 0
time = 0
while True:
    if a[0] < b[0]:
        tmp= a.popleft()
    else:
        tmp = b.popleft()
    
    if tmp + time <= k:
        cnt += 1
        time += tmp
    else:
        break
print(cnt)

Fixed submission:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n, m, k = nm()
a = nl()
b = nl()
sum_a = [0]
sum_b = [0]
for i in range(n):
    sum_a.append(sum_a[i] + a[i])
for i in range(m):
    sum_b.append(sum_b[i] + b[i])
ans = 0
j = m
for i in range(n+1):
    if sum_a[i] > k:
        break
    while sum_b[j] > k - sum_a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = nl()
ans = 1
for ele in a:
    ans *= ele

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

Fixed submission:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
a = sorted(nl())
ans = 1
for ele in a:
    ans *= ele
    if ans > 10 ** 18:
        break

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
s = ns()

ans = s.count('R') * s.count('G') * s.count('B')

for i in range(10000):
    if 2 + 2 * i >= n: break
    for j in range(10000):
        if 2 + 2 * i + j >= n: break
        if not(s[j] == s[i+1+j] or s[i+1+j] == s[2*i+2+j] or s[2*i+2+j] == s[j]):
            ans -= 1

print(ans)

Fixed submission:
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
s = ns()

ans = s.count('R') * s.count('G') * s.count('B')

for i in range(10000):
    if 2 + 2 * i >= n: break
    for j in range(10000):
        if 2 + 2 * i + j >= n: break
        if not(s[j] == s[i+1+j] or s[i+1+j] == s[2*i+2+j] or s[2*i+2+j] == s[j]):
            ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ans = 0
for i in range(1000):
    lucky = str(i)
    if 0 <= i <= 9:
        lucky = "00" + lucky
    elif 10 <= i <= 99:
        lucky = "0" + lucky
    else:
        pass
    now = 0
    index = 0
    while index < N:
        if lucky[now] == S[index]:
            now += 1
        if now == 3:
            ans += 1
            break
        index += 1
print(ans)


Fixed submission:
N = int(input())
S = input()
ans = 0
for i in range(1000):
    lucky = str(i)
    if 0 <= i <= 9:
        lucky = "00" + lucky
    elif 10 <= i <= 99:
        lucky = "0" + lucky
    else:
        pass
    now = 0
    index = 0
    while index < N:
        if lucky[now] == S[index]:
            now += 1
        if now == 3:
            ans += 1
            break
        index += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
kuku = []
for i in range(1, 10):
  kuku += [i * e for i in range(1, 10)]
if N in kuku:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
kuku = []
for i in range(1, 10):
  kuku += [i * j for j in range(1, 10)]
if N in kuku:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import sys
import bisect

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
l = sorted(nm())

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a = l[i]
        b = l[j]
        idx = bisect.bisect_left(l, a + b)
        if idx > j: ans += idx - j - 1
print(ans)

Fixed submission:
A, B = map(int, input().split())
print(max(A - 2 * B, 0))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N, Q = map(int, input().split())
pathes = []
for _ in range(N-1):
    a, b = map(int, input().split())
    pathes.append((a, b))
childs = [[] for i in range(N+1)]
for a, b in pathes:
    childs[a].append(b)
    childs[b].append(a)
cnt = [0]*(N+1)
for _ in range(Q):
    p, x = map(int, input().split())
    cnt[p] += x
closed = []
nodes = deque()
nodes.append(1)
while len(nodes) != 0:
    node = nodes.popleft()
    closed.append(node)
    for c in childs[node]:
        if c in closed:
            continue
        nodes.append(c)
        cnt[c] += cnt[node]
for i in range(1, N+1):
    print(cnt[i])

Fixed submission:
from collections import deque
N, Q = map(int, input().split())
pathes = []
for _ in range(N-1):
    a, b = map(int, input().split())
    pathes.append((a, b))
childs = [[] for i in range(N+1)]
for a, b in pathes:
    childs[a].append(b)
    childs[b].append(a)
cnt = [0]*(N+1)
for _ in range(Q):
    p, x = map(int, input().split())
    cnt[p] += x
closed = [False]*(N+1)
nodes = deque()
nodes.append(1)
while len(nodes) != 0:
    node = nodes.popleft()
    closed[node] = True
    for c in childs[node]:
        if closed[c]:
            continue
        nodes.append(c)
        cnt[c] += cnt[node]
for i in range(1, N+1):
    print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
heapq.heapify(A)
B = []
C = []
CB = []
for _ in range(M):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)
    CB.append((c, b))
CB.sort()
for c, b in CB:
    for j in range(b):
        tmp = heapq.heappop(A)
        if tmp >= c:
            heapq.heappush(A, tmp)
            break
        else:
            heapq.heappush(A, c)
print(sum(A))


Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
heapq.heapify(A)
B = []
C = []
CB = []
for _ in range(M):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)
    CB.append((c, b))
CB.sort(reverse=True)
for c, b in CB:
    for j in range(b):
        tmp = heapq.heappop(A)
        if tmp >= c:
            heapq.heappush(A, tmp)
            break
        else:
            heapq.heappush(A, c)
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
heapq.heapify(A)
B = []
C = []
CB = []
for _ in range(M):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)
    CB.append((c, b))
CB.sort()
for c, b in CB:
    for j in range(b):
        tmp = heapq.heappop(A)
        if tmp >= c:
            heapq.heappush(A, tmp)
            break
        else:
            heapq.heappush(A, c)
print(sum(A))


Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
heapq.heapify(A)
B = []
C = []
CB = []
for _ in range(M):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)
    CB.append((c, b))
CB.sort(reverse=True)
for c, b in CB:
    for j in range(b):
        tmp = heapq.heappop(A)
        if tmp >= c:
            heapq.heappush(A, tmp)
            break
        else:
            heapq.heappush(A, c)
print(sum(A))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
for i in range(n):
  if i == k - 1:
    print(s[i].lower(), end=="")
  else:
    print(s[i], end=="")

Fixed submission:
n, k = map(int, input().split())
s = input()
for i in range(n):
  if i == k - 1:
    print(s[i].lower(), end="")
  else:
    print(s[i], end="")
print()
Buggy python submission (verdict: Runtime Error):
s = input()
a = int(s[:2])
b = int(s[2:])
f_yymm = False
f_mmyy = False

if 1 <= a <= 12:
  f_yymm = True
if 1 <= b <= 12:
  f_mmyy = True:
    
if f_yymm and f_mmyy:
  print("AMBIGUOUS")
elif f_yymm and (not f_mmyy):
  print("YYMM")
elif (not f_yymm) and f_mmyy:
  print("MMYY")
else:
  print("NA")
  

Fixed submission:
s = input()
a = int(s[:2])
b = int(s[2:])
f_yymm = False
f_mmyy = False

if 1 <= a <= 12:
  f_mmyy = True
if 1 <= b <= 12:
  f_yymm = True
    
if f_yymm and f_mmyy:
  print("AMBIGUOUS")
elif f_yymm and (not f_mmyy):
  print("YYMM")
elif (not f_yymm) and f_mmyy:
  print("MMYY")
else:
  print("NA")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list()
for benefit, cost in a, b:
  if benefit - cost > 0:
    c.append(benefit - cost)
print(sum(c))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list()
for benefit, cost in zip(a, b):
  if benefit - cost > 0:
    c.append(benefit - cost)
print(sum(c))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
abs_A =  map(lambda x: abs(x), A)

pos = []
neg = []
ans = 0

for e in A:
    if e > 0:
        pos.append(e)
    else:
        neg.append(e)
if len(neg) % 2 == 0:
    ans = sum(abs_A)
else:
    """pos.sort(reverse=True)
    neg.sort(reverse=True)
    if len(neg) == N:
        ans = -sum(neg[:-1]) + neg[-1]
    else:"""
    #ans = max(-sum(neg[:-1]) + neg[-1], -sum(neg[:-3]) + sum(neg[-3:]))
    #ans = max(sum(pos[:-1])-pos[-1]-sum(neg), sum(pos) + neg[0] -sum(neg[1:]))
    ans = sum(abs_A)
    ans -= 2 * min(abs_A)
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
abs_A = list(map(lambda x: abs(x), A))

pos = []
neg = []
ans = 0

for e in A:
    if e > 0:
        pos.append(e)
    else:
        neg.append(e)
if len(neg) % 2 == 0:
    ans = sum(abs_A)
else:
    """pos.sort(reverse=True)
    neg.sort(reverse=True)
    if len(neg) == N:
        ans = -sum(neg[:-1]) + neg[-1]
    else:"""
    #ans = max(-sum(neg[:-1]) + neg[-1], -sum(neg[:-3]) + sum(neg[-3:]))
    #ans = max(sum(pos[:-1])-pos[-1]-sum(neg), sum(pos) + neg[0] -sum(neg[1:]))
    ans = sum(abs_A)
    ans -= 2 * min(abs_A)
print(ans)

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

pos = []
neg = []
ans = 0

for e in A:
    if e > 0:
        pos.append(e)
    else:
        neg.append(e)
if len(neg) % 2 == 0:
    ans = sum(pos) - sum(neg)
else:
    """pos.sort(reverse=True)
    neg.sort(reverse=True)
    if len(neg) == N:
        ans = -sum(neg[:-1]) + neg[-1]
    else:"""
    #ans = max(-sum(neg[:-1]) + neg[-1], -sum(neg[:-3]) + sum(neg[-3:]))
    #ans = max(sum(pos[:-1])-pos[-1]-sum(neg), sum(pos) + neg[0] -sum(neg[1:]))
    ans = sum(pos) - sum(neg)
    ans -= 2 * min(min(pos), -max(neg))
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
abs_A = list(map(lambda x: abs(x), A))

pos = []
neg = []
ans = 0

for e in A:
    if e > 0:
        pos.append(e)
    else:
        neg.append(e)
if len(neg) % 2 == 0:
    ans = sum(abs_A)
else:
    """pos.sort(reverse=True)
    neg.sort(reverse=True)
    if len(neg) == N:
        ans = -sum(neg[:-1]) + neg[-1]
    else:"""
    #ans = max(-sum(neg[:-1]) + neg[-1], -sum(neg[:-3]) + sum(neg[-3:]))
    #ans = max(sum(pos[:-1])-pos[-1]-sum(neg), sum(pos) + neg[0] -sum(neg[1:]))
    ans = sum(abs_A)
    ans -= 2 * min(abs_A)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a < b:
  swap(a, b)

if a - b >= 2:
  print(2 * a - 1)
else:
  print(a + b)

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

if a - b >= 2:
  print(2 * a - 1)
else:
  print(a + b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
maxHeight = 0
cnt = 0
for _ in range(n):
  mt = list(map(int, input().split()))
for i in range(n):
  if mt[i] >= maxHeight:
    maxHeight = mt[i]
    cnt += 1
print(cnt)

Fixed submission:
n = int(input())
maxHeight = 0
cnt = 0
mt = list(map(int, input().split()))
for i in range(n):
  if mt[i] >= maxHeight:
    maxHeight = mt[i]
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list()
f = 0
for i in range(n):
  a[i] = int(input())
k = int(input())
for i in range(n):
  for j in range(n):
    if i == j:
      continue
    if abs(a[i] - a[j]) > k:
      f = 1
if f == 0:
  print("Yay!")
else:
  print(":(")

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a > k:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li[i] = int(input())
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= min(li)

print(ans)



Fixed submission:
def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li.append(int(input()))
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= max(li)

print(ans)

Buggy python submission (verdict: Runtime Error):
def tenth(a):
  temp = a
  if temp % 10 == 0:
    return temp
  else:
    temp += 1

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

print(a + b + c + d + e)


Fixed submission:
def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li.append(int(input()))
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= max(li)

print(ans)

Buggy python submission (verdict: Runtime Error):
def tenth(int a):
  temp = a
  if temp % 10 == 0:
    return temp
  else:
    temp += 1

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

print(a + b + c + d + e)


Fixed submission:
def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li.append(int(input()))
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= max(li)

print(ans)

Buggy python submission (verdict: Runtime Error):
def tenth(int a):
  if a % 10 == 0:
    return a
  else:
    a += 1

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

print(a + b + c + d + e)


Fixed submission:
def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li.append(int(input()))
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= max(li)

print(ans)
Buggy python submission (verdict: Runtime Error):
acid = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
c = input()
print(acid(c))

Fixed submission:
acid = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
c = input()
print(acid[c])
Buggy python submission (verdict: Runtime Error):
n, q = list(map(int, input().split()))
s = input()
lr = []
for _ in range(q):
    lr.append(list(map(int, input().split())))
dp = [0]*(10^5+1)
for i in range(1, n):
    if s[i-1]=="A" and s[i]=="C":
        dp[i+1]=dp[i]+1
    else:
        dp[i+1]=dp[i]
for i in range(q):
    l = lr[i][0]
    r = lr[i][1]
    ans = dp[r] - dp[l]
    print(ans)

Fixed submission:
n, q = list(map(int, input().split()))
s = input()
dp = [0, 0]
for i in range(1, n):
    if s[i-1]=="A" and s[i]=="C":
        dp.append(dp[-1]+1)
    else:
        dp.append(dp[-1])
for i in range(q):
    l, r = map(int, input().split())
    ans = dp[r] - dp[l]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, q = list(map(int, input().split()))
s = input()
lr = []
for _ in range(q):
    lr.append(list(map(int, input().split())))
for i in range(q):
    print(s[lr[i][0]-1:lr[i][1]].count("AC"))

Fixed submission:
n, q = list(map(int, input().split()))
s = input()
dp = [0, 0]
for i in range(1, n):
    if s[i-1]=="A" and s[i]=="C":
        dp.append(dp[-1]+1)
    else:
        dp.append(dp[-1])
for i in range(q):
    l, r = map(int, input().split())
    ans = dp[r] - dp[l]
    print(ans)