Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
M = [list(map(int, input().split())) for _ in range(H)]

for i in range(H):
  for j in range(W-1):
    if M[i][j] & 1:
      print(i+1, j+1, i+1, j+2)
      M[i][j+1] += 1
for i in range(H-1):
  if M[i][W-1] & 1:
    print(i+1, j+1, i+2, j+1)
    M[i+1][j] += 1


Fixed submission:
H, W = map(int, input().split())
M = [list(map(int, input().split())) for _ in range(H)]

s = []
for i in range(H):
  for j in range(W-1):
    if M[i][j] & 1:
      s.append("{} {} {} {}".format(i+1, j+1, i+1, j+2))
      M[i][j+1] += 1
for i in range(H-1):
  if M[i][W-1] & 1:
    s.append("{} {} {} {}".format(i+1, W, i+2, W))
    M[i+1][W-1] += 1
print(len(s))
print("\n".join(s))

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
M = [list(map(int, input().split())) for _ in range(H)]

for i in range(H):
  for j in range(W-1):
  if M[i][j] & 1:
    print(i, j, i, j+1):
    M[i][j+1] += 1
for i in range(H-1):
  if M[i][W-1] & 1:
    print(i, j, i+1, j)
    M[i+1][j] += 1


Fixed submission:
H, W = map(int, input().split())
M = [list(map(int, input().split())) for _ in range(H)]

s = []
for i in range(H):
  for j in range(W-1):
    if M[i][j] & 1:
      s.append("{} {} {} {}".format(i+1, j+1, i+1, j+2))
      M[i][j+1] += 1
for i in range(H-1):
  if M[i][W-1] & 1:
    s.append("{} {} {} {}".format(i+1, W, i+2, W))
    M[i+1][W-1] += 1
print(len(s))
print("\n".join(s))
Buggy python submission (verdict: Runtime Error):
import numpy as np
p = map(int, input().split())
ps = list(map(lambda x, y: np.array([x, y]), p[::2], p[1::2]))+ [None, None]

ans = ""
for s, d, i in zip(ps[0:-1], ps[1:], range(2,4)):
  v = d - s
  s = d
  d = s + v.dot([[0,1], [-1,0]])
  ans += " ".join(map(str, d))
  ps[i] = d
print(ans[1:])


Fixed submission:
p = list(map(int, input().split()))
ps = list(zip(p[::2], p[1::2]))

ans = ""
for _ in range(2):
  v = list(map(lambda x, y: x - y, ps[1], ps[0]))
  v = [-v[1], v[0]]
  ps = [ps[1], list(map(lambda x, y: x + y, ps[1], v))]
  ans += " " + " ".join(map(str, ps[1]))

print(ans[0:])
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())

for _ in range(K):
  A, B, C = B+C, A+C, A+B

ans = A - B
if ans > 1e18:
  print("Unfair")
else:
  print(ans)


Fixed submission:
A, B, C, K = map(int, input().split())
  
ans = [A - B, B - A][K%2]
if ans > 1e18:
  print("Unfair")
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())

if 2 * C > A + B :
  print(A * X + B * Y)
else C < min(A, B):
  print(max(X, Y) * 2 * C)
else:
  print(min(X, Y) * 2 * C + (A if X > Y else B) * abs(X-Y))


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

print(min(min(X, Y) * 2 * C + (A if X > Y else B) * abs(X-Y), A * X + B * Y, max(X, Y) * 2 * C))

Buggy python submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())

print(mix(X, Y) * 2 * C + (A if X > Y else B) * abs(X-Y), A * X + B * Y, max(X, Y) * 2 * C)

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

print(min(min(X, Y) * 2 * C + (A if X > Y else B) * abs(X-Y), A * X + B * Y, max(X, Y) * 2 * C))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = map(int, input().split())

m = N // 2

for x in (a[m], a[m-1]):
  for i in range(m):
    print(x)


Fixed submission:
N = int(input())
a = sorted(map(lambda x, y: [int(y), x], range(1, N+1), input().split()))
 
m = N // 2
am = a[m][0]
amp = a[m-1][0]

a = sorted(zip(a, range(N)), key=lambda x:x[0][1])
for _, i in a:
  print(am if i < m else amp)
Buggy python submission (verdict: Runtime Error):
d = dict()

def getv():
  M = int(input())
  for x in range(M):
    n = input()
    if d.get(n) is None:
      d[n] = 0
    d[n] += 1

getv(1)
getv(-1)

print(sorted(d, key=lambda x:x[1], reverse=True)[0])

Fixed submission:
d = dict()

def getv(a):
  M = int(input())
  for x in range(M):
    n = input()
    if d.get(n) is None:
      d[n] = 0
    d[n] += a

getv(1)
getv(-1)

print(max(0,d[sorted(d, key=lambda x:d[x], reverse=True)[0]]))
Buggy python submission (verdict: Runtime Error):
S = list(input())
N = [str(int(N[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))

Fixed submission:
S = list(input())
N = [str(int(S[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))

Buggy python submission (verdict: Runtime Error):
N = list(input())
N = [str(int(N[0]) - 1)] + ["9"] * (len(N)-1)
print("{:.0f}".format(sum(map(int, N)))

Fixed submission:
S = list(input())
N = [str(int(S[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))

Buggy python submission (verdict: Runtime Error):
N = list(input())
N = [str(int(N[0]) - 1)] + ["9"] * (len(N)-1)
print("{:.0f}".format(eval("".join(N))))

Fixed submission:
S = list(input())
N = [str(int(S[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))

Buggy python submission (verdict: Runtime Error):
N = list(input())
N = [str(int(N[0]) - 1)] + [9] * (len(N)-1)
print("{:.0f}".format(eval("".join(N))))

Fixed submission:
S = list(input())
N = [str(int(S[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))
Buggy python submission (verdict: Runtime Error):
C = [list(map(int, input().split()))  for _ in range(3)]

for i in range(2):
  for j in range(2):
    if C[i][j] - C[i][j+1] != C[i+1][j] - C[i+1][j+1] :
    break
    if C[j][i] - C[j+1][i] != C[j][i+1] - C[j+1][i+1] :
      break
else:
  print("Yes")
  out = True
if not out:
  print("No")


Fixed submission:
C = [list(map(int, input().split()))  for _ in range(3)]

x = [list() for _ in range(2)]
y = [list() for _ in range(2)]
for i in range(3):
  for j in range(2):
    x[j].append(C[i][j] - C[i][j+1])
    y[j].append(C[j][i] - C[j+1][i])

out = False
for j in range(2):
  if min(x[j]) != max(x[j]):
    break
  if min(y[j]) != max(y[j]):
    break
else:
  print("Yes")
  out = True
if not out:
  print("No")
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x%y)

g = Y / gcd(X, Y)

if g == 1:
  print("-1")
else:
  if g == 2:
    g = 3
  else:
    g = 2
  ans = X * g
  if ans <= 1e18:
	print(ans)
  else:
    print("-1")

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x%y)

g = Y / gcd(X, Y)

if g == 1:
  print("-1")
else:
  if g == 2:
    g = 3
  else:
    g = 2
  ans = X * g
  if ans <= 1e18:
    print(ans)
  else:
    print("-1")
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  *p = x, y
else:
  print("Yes")

Fixed submission:
import math
N = int(input())

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  p = x, y
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
N = input()
d = dict()
for x in map(int, input().split())
	if d.get(x) is None:
    	d[x] = 0
	d[x] += 1

print(sum((min(d[x], abs(d[x]-x) for x in d))))


Fixed submission:
N = input()
d = dict()
for x in map(int, input().split()):
  if d.get(x) is None:
    d[x] = 0
  d[x] += 1

print(sum((d[x]-x if d[x]>=x else d[x]) for x in d))
Buggy python submission (verdict: Runtime Error):
ABCD = list(map(int, input()))
op ="+-"
for i in range(pow(2, 3)):
  v = i
  f = str(ABCD[j])
  for j in range(3):
    f += op[v%2] + ABCD[j]
    v //= 2
  if eval(f) == 7:
    print("{}=7", f)
    break


Fixed submission:
ABCD = input()
op ="+-"
for i in range(pow(2, 3)):
  v = i
  f = str(ABCD[0])
  for j in range(1,4):
    f += op[v%2] + ABCD[j]
    v //= 2
  if eval(f) == 7:
    print("{}=7".format(f))
    break
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

B = [list(map(int, input().split())) for _ in range(M)][::-1]

S = []
pt = []
G = [-1] * (N+1)
idx = 0
cnt = 0
for pair in B:
    d = []
    for i, x in enumerate(pair):
        if G[x] >= 0:
            d.append(G[x])

    if len(d) <= 0:
        pt.append(1)
        for x in pair:
            G[x] = idx
        idx += 1
    elif len(d) == 1:
        pt.append(G.count(d[0]))
        for x in pair:
            G[x] = d[0]
    else:
        if d[0] == d[1]:
            pt.append(0)
        else:
            pt.append(G.count(d[0]) * G.count(d[1]))
            for i, x in enumerate(G):
                if x == d[1]:
                    G[i] = d[0]

cnt = 0
for x in pt[::-1]:
    cnt += x
    print(cnt)


Fixed submission:
N, M = map(int, input().split())
print("{:.0f}".format((1900 * M + 100 * (N-M)) / pow(1/2, M)))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

Ss = [[-1 if c == "#" else 0 for c in input()] for _ in range(H)]

def plus(i, j):
  if 0 <= i < H and 0 <= j < W:
    if Ss[i][j] >= 0:
      Ss[i][j] += 1

for i in range(H):
  for j in range(W):
    for x, y in ((x,y) for x in range(-1, 2) for y in range(-1, 2):
      if x != 0 or y != 0:
        plus(i, j)

for i in range(H):
  for j in range(W):
    print("#" if Ss[i][j] == -1 else Ss[i][j], end="")


Fixed submission:
H, W = map(int, input().split())
 
Ss = [[-1 if c == "#" else 0 for c in input()] for _ in range(H)]
 
def plus(i, j):
  if 0 <= i < H and 0 <= j < W:
    if Ss[i][j] >= 0:
      Ss[i][j] += 1
 
for i in range(H):
  for j in range(W):
    if Ss[i][j] != -1:
      continue
    for x, y in ((x,y) for x in range(-1, 2) for y in range(-1, 2)):
      if x != 0 or y != 0:
        plus(i+x, j+y)
 
for i in range(H):
  for j in range(W):
    print("#" if Ss[i][j] == -1 else Ss[i][j], end="")
  print()
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

class Bridge:
    def __init__(self, nodeA, nodeB):
        self.edges = [BridgeEdge(nodeA), BridgeEdge(nodeB)]

class BridgeEdge:
    def __init__(self, node):
        self.node = node
        self.judge = 0

class Node:
    def __init__(self, id):
        self.id = id
        self.bridges = []
    def addEdge(self, bridgeEdge):
        self.bridges.append(bridgeEdge)


nodes = [Node(i) for i in range(N+1)]
bridges = []
for A, B in (map(int, input().split()) for _ in range(M)):
    b = Bridge(nodes[A], nodes[B])
    nodes[A].addEdge(b.edges[1])
    nodes[B].addEdge(b.edges[0])
    bridges.append(b)


s = [(None, nodes[1], 1)]
idx = 0
while idx < len(s):
    pre, cur, level = s[idx]
    idx += 1

    if level > N * 2:
        break

    for nxt in cur.bridges:
        if not pre is nxt.node:
            nxt.judge += 1
            s.append((cur, nxt.node, level+1))

cnt = 0
for bd in bridges:
    if sum(1 for b in bd.edges if b.judge <= 1) > 0:
        cnt += 1

print(cnt)


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

class Bridge:
    def __init__(self, nodeA, nodeB):
        self.edges = [BridgeEdge(nodeA), BridgeEdge(nodeB)]

class BridgeEdge:
    def __init__(self, node):
        self.node = node
        self.judge = 0

class Node:
    def __init__(self, id):
        self.id = id
        self.bridges = []
    def addEdge(self, bridgeEdge):
        self.bridges.append(bridgeEdge)


nodes = [Node(i) for i in range(N+1)]
bridges = []
for A, B in (map(int, input().split()) for _ in range(M)):
    b = Bridge(nodes[A], nodes[B])
    nodes[A].addEdge(b.edges[1])
    nodes[B].addEdge(b.edges[0])
    bridges.append(b)


s = [(None, nodes[1], 1)]
idx = 0
while idx < len(s):
    pre, cur, level = s[idx]
    idx += 1

    if level > N * 2:
        break

    for nxt in cur.bridges:
        if not pre is nxt.node and nxt.judge < 2:
            nxt.judge += 1
            s.append((cur, nxt.node, level+1))

cnt = 0
for bd in bridges:
    if sum(1 for b in bd.edges if b.judge <= 1) > 0:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
VS = [(Y, Y*(2/q), q) for Y, q in ((int(input()), q) for q in (0.25, 0.5, 1, 2))]
N = int(input())
tanka = 0
for Y, _, q in sorted(VS, key=lambda x:x[1], reverse=True):
  u = N // q
  N -= q * u
  tanka += Y * u
  if N <= 0:
    break

print(tanka)


Fixed submission:
VS = [(Y, Y*(2//q), q) for Y, q in zip(map(int, input().split()), (0.25, 0.5, 1, 2))]
N = int(input())
#print(VS)
tanka = 0
for Y, _, q in sorted(VS, key=lambda x:x[1], reverse=False):
  u = N // q
  N -= q * u
  #print((q, u))
  tanka += Y * int(u)
  if N <= 0:
    break
 
print(tanka)
Buggy python submission (verdict: Runtime Error):
X = set()
for x in input():
  X.add(x.encode("sjis")[0])
X = sorted(X)
codeA = "a".encode("sjis")[0]
codes = [bytes(codeA + i).decode("sjis") for i in range(26)]
codes.append("None")

print(codes(sum([1 for i, x in enumerate(X) if x == codes[i]])))


Fixed submission:
X = set()
for x in input():
  X.add(x)
X = sorted(X)
c = bytes(["a".encode("sjis")[0] + sum([1 for i, x in enumerate(X) if x.encode("sjis")[0] == "a".encode("sjis")[0] + i])]).decode("sjis")

if c.encode("sjis")[0] > "z".encode("sjis")[0]:
  c = "None"

print(c)

Buggy python submission (verdict: Runtime Error):
X = set()
for x in input():
  X.append(x)
X = sorted(X)
if X[0] != "a":
  c = "a"
else:
  c = ["a".enocode("sjis")[0] + sum([1 for i, x in enumerate(X) if x.encode("sjis")[0] == "a".encode("sjis")[0] + i])].decode("sjis")

if c.endode("sjis")[0] > "z".encode("sjis")[0]:
  c = "None"

print(c)

Fixed submission:
X = set()
for x in input():
  X.add(x)
X = sorted(X)
c = bytes(["a".encode("sjis")[0] + sum([1 for i, x in enumerate(X) if x.encode("sjis")[0] == "a".encode("sjis")[0] + i])]).decode("sjis")

if c.encode("sjis")[0] > "z".encode("sjis")[0]:
  c = "None"

print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(map(int, input().split()), reverse=True)
 
p = [(i, x) for i, x, y in zip(range(N-1), A[:-1], A[1:]) if x == y]
print(p[0][1] * (p[1][1] if p[0][0] + 1 < p[1][0] else p[2][1]))


Fixed submission:
N = int(input())

ans = 1
cnt = 2
w = 0
for Ai in sorted(map(int, input().split()), reverse=True):
  if w != Ai:
    w = Ai
  else:
    ans *= w
    cnt -= 1
    if cnt <= 0:
      break
    w = 0

print(ans if cnt <= 0 else 0)

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

p = [x for x, y in zip(A[:-1], A[1:]) if x == y]
print(p[0] * p[1])


Fixed submission:
N = int(input())

ans = 1
cnt = 2
w = 0
for Ai in sorted(map(int, input().split()), reverse=True):
  if w != Ai:
    w = Ai
  else:
    ans *= w
    cnt -= 1
    if cnt <= 0:
      break
    w = 0

print(ans if cnt <= 0 else 0)
Buggy python submission (verdict: Runtime Error):
N = int(input())

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

g = 1
for x in (int(input()) for _ in range(N)):
  g = g * x / gcd(g, x)
print(g)


Fixed submission:
N = int(input())

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

g = 1
for x in (int(input()) for _ in range(N)):
  g = g * x // gcd(g, x)
print(g)

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

g = 0
for x in (map(int, input()) for _ in range(N)):
  g = gcd(g, x)
print(g)


Fixed submission:
N = int(input())

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

g = 1
for x in (int(input()) for _ in range(N)):
  g = g * x // gcd(g, x)
print(g)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
N = int(input())

i = 0
buf = [0] * W
k = 1
for x, ai in aip(range(1, N+1), map(int, input().split())):
  for _ in range(ai)
	buf[i] = x
    i += 1
    if i >= W:
      print(" ".join(buf[::k]))
      i = 0
      k = -k



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

i = 0
buf = [0] * W
k = 1
for x, ai in zip(range(1, N+1), map(int, input().split())):
  for _ in range(ai):
    buf[i] = x
    i += 1
    if i >= W:
      print(" ".join(map(str, buf[::k])))
      i = 0
      k = -k
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = map(int, input().split())

s = sum(a)

w = None
for i in a[:-1]:
  s -= 2 * a
  if w is None:
    w = s
  else:
    w = min(w, s)
print(w)


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

s = sum(a)

w = None
for ai in a[:-1]:
  s -= 2 * ai
  if w is None:
    w = abs(s)
  else:
    w = min(w, abs(s))
print(w)
Buggy python submission (verdict: Runtime Error):
S = input()
for i in range(S//2, 0, -1):
  if S.find(S[:i], i) == i:
    break
print(i)


Fixed submission:
S = input()
for i in range((len(S)-1)//2, 0, -1):
  if S.find(S[:i], i) == i:
    break
print(i*2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
B = [0] + [int(input()) for _ in range(N)]

x = 1
cnt = 0
while True:
  x = B[x]
  cnt += 1
  if x == 2:
    break
  if x == 1:
    cnt = -1
    break
print(cnt)


Fixed submission:
N = int(input())
B = [0] + [int(input()) for _ in range(N)]

x = 1
cnt = 0
dic = {x}
while True:
  x = B[x]
  cnt += 1
  if x == 2:
    break
  if {x} <= dic:
    cnt = -1
    break
  dic.add(x)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
M, N = map(int, input().split())
def fraction(N):
  a = N
  for x in range(N-1,1,-1):
    a *= x
  return a

p = abs(M - N)
if p < 2:
  print(fraction(M) * fraction(N) * (2 - p) % (1000000007))
else:
  print(0)
        

Fixed submission:
M, N = map(int, input().split())
def fraction(N):
  a = N
  for x in range(N-1,1,-1):
    a = a * x % (1000000007)
  return a

p = abs(M - N)
if p < 2:
  print(fraction(M) * fraction(N) * (2 - p) % (1000000007))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    elif cnt > 0:
      ansOne += 1
      cnt = 0
    
  else:
    ansAny += 1
    continue

print("{} {}".format(max(ansOne, 1), min(len(c), ansOne + ansAny))
  




Fixed submission:
N = int(input())


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input().split())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    else:
      if cnt > 0:
        ansOne += 1
        cnt = 0
      i+=1
    
  else:
    ansAny += 1

if ansAny <= 0:
  ansOne += 1
print("{} {}".format(max(ansOne, 1), ansOne + ansAny))
Buggy python submission (verdict: Runtime Error):
N = int(input())
s =[int(input()) for _ in range(N)]
S = sum(s)
print(S-min([x for x in s if x % 10!=0]+[[0,S][(S%10)*1]]))



Fixed submission:
N = int(input())
ssum = 0
not10min = -1
for si in (int(input()) for _ in range(N)):
  ssum += si
  if si % 10 != 0:
    if not10min < 0:
      not10min = si
    else:
      not10min = min(not10min, si)

if ssum % 10 ==0:  
  if not10min >= 0:
    ssum -= not10min
  else:
    ssum = 0
print(ssum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s =[int(input()) for _ in range(N)]

if sum(s) % 10 != 0:
  s -= min([for x in s if x % 10 == 0] + [s])

print(s)


Fixed submission:
N = int(input())
ssum = 0
not10min = -1
for si in (int(input()) for _ in range(N)):
  ssum += si
  if si % 10 != 0:
    if not10min < 0:
      not10min = si
    else:
      not10min = min(not10min, si)

if ssum % 10 ==0:  
  if not10min >= 0:
    ssum -= not10min
  else:
    ssum = 0
print(ssum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s =[int(input()) for _ in range(N)]

if sum(s) % 10 != 0:
  s -= min([for x in s if s % 10 == 0] + [s])

print(s)


Fixed submission:
N = int(input())
ssum = 0
not10min = -1
for si in (int(input()) for _ in range(N)):
  ssum += si
  if si % 10 != 0:
    if not10min < 0:
      not10min = si
    else:
      not10min = min(not10min, si)

if ssum % 10 ==0:  
  if not10min >= 0:
    ssum -= not10min
  else:
    ssum = 0
print(ssum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ssum = 0
not10min = -1
for si in map(int(input()) for _ in range(N)):
  ssum += si
  if si % 10 != 0:
    if not10min < 0:
      not10min = si
    else:
      not10min = min(not10min, si)

if ssum % 10 ==0:  
  if not10min >= 0:
    ssum -= not10min
  else:
    ssum = 0
print(ssum)



Fixed submission:
N = int(input())
ssum = 0
not10min = -1
for si in (int(input()) for _ in range(N)):
  ssum += si
  if si % 10 != 0:
    if not10min < 0:
      not10min = si
    else:
      not10min = min(not10min, si)

if ssum % 10 ==0:  
  if not10min >= 0:
    ssum -= not10min
  else:
    ssum = 0
print(ssum)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
    while all([A % 2 == 0, B % 2 == 0, C % 2 == 0]):
        A, B, C = ((B+C)//2, (A+C)//2, (A+B)//2)
	count += 1
print(count)


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

if any([A % 2, B % 2, C % 2]):
	print(0)
	exit()

if A == B == C:
	print(-1)
	exit()

count = 0
while True:
	if any([A % 2, B % 2, C % 2]):
		break
	A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
	count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N, T = input().split()

f = None
p = None
ans = 0
for t in map(int, input().split())
  if f is None:
    f = t
    p = t - f

  ans += T
  rest = p + T - (t - f)
  if rest > 0:
    ans -= rest

  p = t - f

print(ans)

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

f = None
p = None
ans = 0
for t in map(int, input().split()):
  if f is None:
    f = t
    p = f - T

  ans += T
  rest = p + T - (t - f)
  if rest > 0:
    ans -= rest
  p = t - f

print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
a = map(int, input().split())

def f(x):
  cnt = 0
  cur = 0
  for ai in a:
    cur += ai
    cur *= x
    if cur < 0:
      cnt += 1 - ai
    x *= -1
  print(cnt)

print(min(f(1), f(-1))

Fixed submission:
N = input()
a = list(map(int, input().split()))
 
def f(x):
  cnt = 0
  cur = 0
  for ai in a:
    cur += ai
    cur *= x
    if cur <= 0:
      cnt += 1 - cur
      cur = 1
    cur *= x
    x *= -1
  return cnt
 
print(min(f(1), f(-1)))
Buggy python submission (verdict: Runtime Error):
O = input()
E = input()

tail = len(O) - len(E)

print("".join((x + y for x, y in zip([O, O[:-1]][tail], E) + ["", O[-1]][tail])


Fixed submission:
O = input()
E = input()

tail = len(O) - len(E)

print("".join((x + y for x, y in zip([O, O[:-1]][tail], E))) + ["", O[-1]][tail])

Buggy python submission (verdict: Runtime Error):
O = input()
E = input()

tail = len(E) - len(O)

print("".join((x + y for x, y in zip([O, O[:-1]][tail], E) + ["", O[-1]][tail])

Fixed submission:
O = input()
E = input()

tail = len(O) - len(E)

print("".join((x + y for x, y in zip([O, O[:-1]][tail], E))) + ["", O[-1]][tail])
Buggy python submission (verdict: Runtime Error):
x = int(input())

t = (-1 + math.sqrt(1 + 8 * x))
if t % 2 == 0:
  print(t//2)
else:
  print(t//2+1)


Fixed submission:
import math
x = int(input())

t = (-1 + math.sqrt(1 + 8 * x))
if t % 2 == 0:
  print(int(t)//2)
else:
  print(int(t)//2+1)