Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h,w = map(int , input().split(" "))

if h == 1 or w == 1;
    a = 1
elif h % 2 == 0:
    a = int(h * w / 2)
else:
    a = int(w * (h+1)/2) - int(w/2)

print(a)

Fixed submission:
h,w = map(int , input().split(" "))

if h == 1 or w == 1:
    a = 1
elif h % 2 == 0:
    a = int(h * w / 2)
else:
    a = int(w * (h+1)/2) - int(w/2)

print(a)
Buggy python submission (verdict: Runtime Error):
import math

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

d = c - a - b

if d > 0 && d**2 > 4*a*b:
    print('Yes')
else:
    print('No')

Fixed submission:
import math

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

d = c - a - b

if d > 0 and d**2 > 4*a*b:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
if a + b + 2 * math.sqrt(a*b) < c:
    print('Yes')
else:
    print('No')

Fixed submission:
import math

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

d = c - a - b

if d > 0 and d**2 > 4*a*b:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

tmp = 0
for i in range(N):
    for j in range(i+1, N):
        tmp += A[i]*A[j]
print(tmp % (10**9+7))


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

mem = []
h = 0
for i in range(N-1, -1, -1):
    h += A[i]
    mem.append(h)

tmp = 0
for i in range(N-1):
    tmp += A[i]*mem[-(i+1+1)]
print(tmp % (10**9+7))
Buggy python submission (verdict: Runtime Error):
import math
import string
N = int(input())
alphabet = list(string.ascii_lowercase)
for i in range(1,11+1):
    if 27**i >= N: break
I = i

ans = ''
n = N
for i in range(I, 0, -1):
    ans += alphabet[n//(26**i)-1]
    n -= (26**i)
if n%26 > 0:
    ans += alphabet[n%26-1]
print(ans)

Fixed submission:
import string
N = int(input())
alphabet = list(string.ascii_lowercase)

n = N
idxs = []
while n > 0:
    n -= 1
    idxs.append(n%26)
    n //= 26

ans = ''
for i in idxs[::-1]:
    ans += alphabet[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = map(int, input().split())
ans = 1
for a in A:
    ans *= a

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

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

if 0 in A:
    print(0)
    exit()

ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
h = {}
ans = 0
for row in AB:
    if row[0] in h:
        h[row[0]].append(row[1])
    else:
        h[row[0]] = [row[1]]
    if row[1] in h:
        h[row[1]].append(row[0])
    else:
        h[row[1]] = [row[0]]
ans += sum([1 for i in range(1, N+1) if i not in h.keys()])
for hidx, otherh in h.items():
    if H[hidx-1] > max([H[idx-1] for idx in otherh]):
        ans += 1
print(ans)

Fixed submission:
import numpy as np
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
h = {}
ans = 0
for row in AB:
    if row[0] in h:
        h[row[0]].append(row[1])
    else:
        h[row[0]] = [row[1]]
    if row[1] in h:
        h[row[1]].append(row[0])
    else:
        h[row[1]] = [row[0]]
ans += sum([1 for i in range(1, N+1) if i not in h.keys()])
for hidx, otherh in h.items():
    if H[hidx-1] > max([H[idx-1] for idx in otherh]):
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
for a in range(0, 10**4):
    for b in range(0, 10**4):
        if X == a**5 - b**5:
            print(a, b)
            exit()
        elif X == a**5 + b**5:
            print(a, -b)
            exit()
        elif X == a**5 - (10**4 - b)**5:
            print(a, 10**4 - b)
            exit()
        elif X == -a**5 - (10**4 - b)**5:
            print(-a, 10**4 - b)
            exit()

Fixed submission:
X = int(input())
for a in range(0, 10**3):
    for b in range(0, 10**3):
        if X == a**5 - b**5:
            print(a, b)
            exit()
        elif X == a**5 + b**5:
            print(a, -b)
            exit()
        elif X == -a**5 - (10**4 - b)**5:
            print(-a, 10**4 - b)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int, input().split())
ans = 0
for x in range(N+1):
    tmp = math.floor(A*x/B) - A*math.floor(x/B)
    if tmp < ans:
        break
    ans = tmp
print(ans)

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


def f(x):
    return math.floor(A*x/B) - A * math.floor(x/B)


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

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = map(int, input().split())
print(max([math.floor(A*x/B) - A*math.floor(x/B) for x in range(N+1)]))

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


def f(x):
    return math.floor(A*x/B) - A * math.floor(x/B)


print(f(min(B-1, N)))
Buggy python submission (verdict: Runtime Error):
S = input()
ans = 0

for n in range(3, len(S)):
    for i in range(len(S)-n):
        ans += 1 if int(S[i:i+n+1]) % 2019 == 0 else 0

print(ans)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = input()

print(s if a => 3200 else 'red')

Fixed submission:
a = int(input())
s = input()

print(s if a >= 3200 else 'red')

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

print(input() if a => 3200 else 'red')

Fixed submission:
a = int(input())
s = input()

print(s if a >= 3200 else 'red')

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

print(input() if a => 3200, else 'red')

Fixed submission:
a = int(input())
s = input()

print(s if a >= 3200 else 'red')
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = input()

count = N
for i in range(N):
    c = 0
    for s1 in S[i:]:
        c += 0 if s1 == 'W' else 1
    for s2 in S[:i]:
        c += 0 if s2 == 'E' else 1
    count = c if c < count else count
    if count == 1:
        break

print(count)

Fixed submission:
A, B = map(int, input().split())
print(max(A+B, A-B, A*B))
Buggy python submission (verdict: Runtime Error):
h,w,m = map(int, input().split())
mp =  [[0 for i in range(h)] for j in range(w)]
for i in range(m):
  l =list(map(int, input().split()))
  mp[l[1]-1][l[0]-1] = 1
mx = 0
for y in range(w):
  for x in range(h):
    cn = 0
    #X軸について
    for xx in range(h):
      cn += mp[y][xx]
    #Y軸について
    for yy in range(w):
      if yy != y:
        cn += mp[yy][x]
    if cn > mx:
      mx = cn
print(mx)

Fixed submission:
n,x,t = map(int, input().split())
q,m = divmod(n,x)
if m > 0:
    q += 1
print(q * t)
Buggy python submission (verdict: Time Limit Exceeded):
x,k,d = list(map(int, input().split()))
x = abs(x)
for i in range(k,0,-1):
  if x > 0:
    x -= d
  else:
    x += d * (i % 2)
    break
print(abs(x))


Fixed submission:
x,k,d = list(map(int, input().split()))
x = abs(x)
a,b = divmod(x, d)
a = min(a, k)
x -= a * d
#print('a=',a)
#print('x=',x)
#print('ka=',k-a)
x -= d * ((k-a) % 2)
print(abs(x))
Buggy python submission (verdict: Runtime Error):
n,d = list(map(int, input().split()))
c=0
d *= d
for i in range(n):
  x,y = list(map(int, input().split()))
  x *= x
  y *= y
  y += x
  if y <= d:
    c += 1
print(c)

Fixed submission:
k = int(input())
d1 = k % 10
mae = 0
sd = [0]*10
cnt = 0
if not d1 in (1, 3, 7, 9):
  print(-1)
  exit()
for i in range(1,10) :
  sd[d1 * i % 10] = i
#print(sd)

for j in range(999999):
  d2 = 7 - mae % 10
  s = str(sd[d2] * k + mae)
#  print("mae ", mae,"",sd[d2] * k )
#  print("s1=",s)
  for i in range(len(s)-1, -1, -1):
#    print("s[",i,"]=",s[i])
    if (s[i]) == "7":
      cnt += 1
    else:
      s = s[0:i+1]
      mae = int(s)
#      print("s2=",s)
      break
#    print("i= ",i)
    if i == 0 :
      print(cnt)
      exit()
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())

for k in range(K):
    if X >= 0:
        X = X - abs(D)
    else:
        X = X + abs(D)

print(abs(X))

Fixed submission:
X, K, D = map(int, input().split())
X = abs(X)
D = abs(D)
if X > K * D:
    X = X - K*D
else:
    quo = X//D
    X = X - D*quo
    res = K - quo
    if res % 2 == 1:
        X = X - D
    else:
        pass

print(abs(X))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        ans += a[i] % (10 ** 9 + 7) * a[j] % (10 ** 9 + 7)
print(ans % (10 ** 9 + 7))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = sum(a) ** 2
for i in a:
    ans -= i ** 2
print((ans // 2) % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
h, w, m = map(int, input().split())
s = []
bb = [[0] * (w + 1) for _ in range(h + 1)]
r = [0] * (h + 1)
c = [0] * (w + 1)
for i in range(m):
    bh, bw = map(int, input().split())
    s.append([bh, bw])
    bb[bh][bw] = 1
    r[bh] += 1
    c[bw] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count))

Fixed submission:
h, w, m = map(int, input().split())
s = []
r = [0] * (h + 1)
c = [0] * (w + 1)
for i in range(m):
    bh, bw = map(int, input().split())
    s.append([bh, bw])
    r[bh] += 1
    c[bw] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count))

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

h, w, m = map(int, input().split())
bb = [[0] * w for _ in range(h)]
mx = 0
for _ in range(m):
    bh, bw = map(int, input().split())
    bb[bh - 1][bw - 1] = 1
smr = np.sum(bb,axis=1)
bb.pop(np.argmax(smr))
smc = np.sum(bb,axis=0)
print(max(smr) + max(smc))

Fixed submission:
h, w, m = map(int, input().split())
s = []
r = [0] * (h + 1)
c = [0] * (w + 1)
for i in range(m):
    bh, bw = map(int, input().split())
    s.append([bh, bw])
    r[bh] += 1
    c[bw] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count))
Buggy python submission (verdict: Runtime Error):
s = input()
cnt = 0
ans = []
for i in s:
    if i == 'R':
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
print(max(ans))

Fixed submission:
s = input()
if s == 'RRR':
    print(3)
elif s == 'RRS' or s == 'SRR':
    print(2)
elif s == 'SSS':
    print(0)
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
if k % 2 == 0:
    print(-1)
    exit()
elif k == 1 or k == 7:
    print(1)
    exit()
sv = 7
ans = 1
while True:
    if sv == 0:
        break
    sv = (sv * 10 + 7) % k
    ans += 1
print(ans)

Fixed submission:
k = int(input())
sv = 7
for i in range(1, 10**6 + 1):
    if sv % k == 0:
        print(i)
        exit()
    sv = (sv * 10 + 7) % k
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for h in range(1,n + 1):
    ans = 0
    for x in range(1, int((n/2)**0.5) + 1):
        for y in range(1, int((n/2)**0.5) + 1):
            for z in range(1, int((n/2)**0.5) + 1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == h:
                    ans += 1
    print(ans)

Fixed submission:
n = int(input())
ANS =[0 for _ in range(n)]
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            if x**2 + y**2 + z**2 + x*y + y*z + z*x > n:
                continue
            ANS[(x**2 + y**2 + z**2 + x*y + y*z + z*x) - 1] += 1
for i in ANS:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    for i, j in enumerate(a):
        if j == b:
            a[i] = c
    print(sum(a))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
q = int(input())
sm = sum(a)
hm = [0] * (10 ** 5 + 1)
for i in a:
    hm[i] += 1
for _ in range(q):
    b, c = map(int, input().split())
    sm += (c - b) * hm[b]
    hm[c] += hm[b]
    hm[b] = 0
    print(sm)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= A[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1
for i in range(n):
    ans *= A[i]
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
a = list(map(int, input().split()))
dst = [1]
ans = 1
for _ in range(k):
    if a[ans - 1] not in set(dst):
        dst.append(a[ans - 1])
        ans = a[ans - 1]
    else:
        index = dst.index(a[ans - 1])
        ld = len(dst[:index])
        cyc = len(dst[index:])
        print(dst[(ld - 1) + (k + 1 - ld) % cyc] if (k + 1 - ld) % cyc != 0 else dst[-1])
        exit()
print(dst[-1])

Fixed submission:
n, k = map(int,input().split())
a = list(map(int, input().split()))
flg = [True] * n
dst = [1]
twn = 0
for _ in range(k):
    if flg[twn]:
        dst.append(a[twn])
        flg[twn] = False
        twn = a[twn] - 1
    else:
        index = dst.index(a[twn])
        ld = len(dst[:index])
        cyc = len(dst[index:])
        print(dst[(ld - 1) + (k + 1 - ld) % cyc] if (k + 1 - ld) % cyc != 0 else dst[-1])
        exit()
print(dst[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
a = list(map(int, input().split()))
dst = [1]
ans = 1
for _ in range(k):
    if a[ans - 1] not in dst:
        dst.append(a[ans - 1])
        ans = a[ans - 1]
    else:
        index = dst.index(a[ans - 1])
        ld = len(dst[:index])
        cyc = len(dst[index:])
        print(dst[(ld - 1) + (k + 1 - ld) % cyc] if (k + 1 - ld) % cyc != 0 else dst[-1])
        exit()
print(dst[-1])

Fixed submission:
n, k = map(int,input().split())
a = list(map(int, input().split()))
flg = [True] * n
dst = [1]
twn = 0
for _ in range(k):
    if flg[twn]:
        dst.append(a[twn])
        flg[twn] = False
        twn = a[twn] - 1
    else:
        index = dst.index(a[twn])
        ld = len(dst[:index])
        cyc = len(dst[index:])
        print(dst[(ld - 1) + (k + 1 - ld) % cyc] if (k + 1 - ld) % cyc != 0 else dst[-1])
        exit()
print(dst[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
bs = list(map(int, input().split()))
for i in range(n):
    print(bs.count(i + 1))

Fixed submission:
n = int(input())
bs = list(map(int, input().split()))
sb = [0] * n
for i in bs:
    sb[i - 1] += 1
for i in sb:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input() for _ in range(n))
ss = sorted(list(set(s)))
dpl = []
for i in ss:
    dpl.append(s.count(i))
for j in range(len(dpl)):
    if dpl[j] == max(dpl):
        print(ss[j])

Fixed submission:
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
mv = max(dic.values())
for s, v in sorted(dic.items()):
    if v == mv:
        print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sq = list(map(int, input().split()))
for _ in range(n):
    c = sq.pop()
    if c in sq:
        print('NO')
        exit()
print('YES')

Fixed submission:
n = int(input())
sq = list(map(int, input().split()))
st = set(sq)
if len(sq) == len(st):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
    if min(p[:i + 1]) == p[i]:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
mnm = 2 * 10**5
ans = 0
for i in p:
    if i <= mnm:
        mnm = i
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ss = sorted([sorted(input()) for _ in range(n)])
ans = 0
start = 0
for i in range(start, n - 1):
    for j in range(i + 1, n):
        if ss[i] == ss[j]:
            ans += 1
        else:
            start = j
            break
print(ans)

Fixed submission:
n = int(input())
ss = sorted([sorted(input()) for _ in range(n)])
ans = 0
cnt = 1
for i in range(n - 1):
    if ss[i] != ss[i + 1]:
        ans += cnt * (cnt - 1) // 2
        cnt = 0
    cnt += 1
ans += cnt * (cnt - 1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ss = sorted([sorted(input()) for _ in range(n)])
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        #print(i, ss[i], j, ss[j])
        if ss[i] == ss[j]:
            ans += 1
        else:
            break
print(ans)

Fixed submission:
n = int(input())
ss = sorted([sorted(input()) for _ in range(n)])
ans = 0
cnt = 1
for i in range(n - 1):
    if ss[i] != ss[i + 1]:
        ans += cnt * (cnt - 1) // 2
        cnt = 0
    cnt += 1
ans += cnt * (cnt - 1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ss = [sorted(input()) for _ in range(n)]
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        if ss[i] == ss[j]:
            ans += 1
print(ans)

Fixed submission:
n = int(input())
ss = sorted([sorted(input()) for _ in range(n)])
ans = 0
cnt = 1
for i in range(n - 1):
    if ss[i] != ss[i + 1]:
        ans += cnt * (cnt - 1) // 2
        cnt = 0
    cnt += 1
ans += cnt * (cnt - 1) // 2
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1, n + 1):
    if 10 <= i < 100 or 1000 <= i < 10000:
        continue
    else:
        ans += 1
print(ans)

Fixed submission:
a, b, c = map(int,input().split())
print(b + c - a if b + c - a > 0 else 0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1, n + 1):
    if 10 <= i < 100 or 1000 <= i < 10000 or i == 100000:
        continue
    else:
        ans += 1
print(ans)

Fixed submission:
a, b, c = map(int,input().split())
print(b + c - a if b + c - a > 0 else 0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n + 1):
    if 10 <= i < 100 or 1000 <= i < 10000 or i == 100000:
        continue
    else:
        ans += 1
print(ans)

Fixed submission:
a, b, c = map(int,input().split())
print(b + c - a if b + c - a > 0 else 0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n + 1):
    if 10 <= i < 100 or 1000 <= i < 10000 or i == 100000:
        ans += 0
    else:
        ans += 1
print(ans)

Fixed submission:
a, b, c = map(int,input().split())
print(b + c - a if b + c - a > 0 else 0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n + 1):
    if 10 <= i < 100 or 1000 <= i < 10000 or i == 100000:
        ans = ans
    else:
        ans += 1
print(ans)

Fixed submission:
a, b, c = map(int,input().split())
print(b + c - a if b + c - a > 0 else 0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(int(input()) for _ in range(n))
for i in range(n):
    aa = a.copy()
    del aa[i]
    print(max(aa))

Fixed submission:
n = int(input())
a = list(int(input()) for _ in range(n))
aa = sorted(a.copy())
mx, sd = aa[n - 1], aa[n - 2]
for i in a:
    print(mx if i < mx else sd)
Buggy python submission (verdict: Time Limit Exceeded):
l, r = map(int, input().split())
ans = 2019
for i in range(l, r):
    for j in range(i + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
print(ans)

Fixed submission:
l, r = map(int, input().split())
ans = 2019
for i in range(l, min(l + 2019, r)):
    for j in range(i + 1, min(l + 2020, r + 1)):
        ans = min(ans, (i * j) % 2019)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
cnt = 0
ACGT = {"A", "C", "G", "T"}
ANS = []
for i in s:
    if i in ACGT:
        cnt += 1
    elif i not in ACGT:
        ANS.append(cnt)
        cnt = 0
print(max(ANS))

Fixed submission:
s = input()
ans = 0
ACGT = {"A", "C", "G", "T"}
for i in range(len(s)):
    for j in range(i + 1, len(s) + 1):
        if set(s[i:j]) <= ACGT:
            ans = max(ans, len(s[i:j]))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
SMs = []
for i in range(2, n // 2 + 1):
    SMs.append(sum(list(map(int, str(i)))) + sum(list(map(int, str(n-i)))))
print(min(SMs))

Fixed submission:
n = int(input())
SMs = []
for i in range(2, n // 2 + 2):
    SMs.append(sum(list(map(int, str(i)))) + sum(list(map(int, str(n-i)))))
print(min(SMs))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
hdg = S[1:N].count('E')
for i in range(1,N):
    if S[i] = 'E':
        hdg_chgd -= 1
    if S[i-1] = 'W':
        hdg_chgd += 1
print(min(hdg, hdg_chgd))


Fixed submission:
N = int(input())
S = input()
hdg = S[1:N].count('E')
hdg_chgd = hdg
hdg_chg_nrs =[]
for i in range(1,N):
    if S[i] == 'E':
        hdg_chgd -= 1
    if S[i-1] == 'W':
        hdg_chgd += 1
    hdg_chg_nrs.append(hdg_chgd)
hdg_chgd_f = min(hdg_chg_nrs)
print(min(hdg, hdg_chgd_f))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
hdg_chg_nrs = []
for i in range(len(S)):
    hdg_chg = S[0:i].count('W') + S[i+1:N].count('E')
    hdg_chg_nrs.append(hdg_chg)
print(min(hdg_chg_nrs))


Fixed submission:
N = int(input())
S = input()
hdg = S[1:N].count('E')
hdg_chgd = hdg
hdg_chg_nrs =[]
for i in range(1,N):
    if S[i] == 'E':
        hdg_chgd -= 1
    if S[i-1] == 'W':
        hdg_chgd += 1
    hdg_chg_nrs.append(hdg_chgd)
hdg_chgd_f = min(hdg_chg_nrs)
print(min(hdg, hdg_chgd_f))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
hdg_chg_nrs = []
for i in range(len(S)):
    hdg_chg = S[0:i].count('W') + S[i+1:N].count('E')
    hdg_chg_nrs.append(hdg_chg)
print(min(hdg_chg_nrs))


Fixed submission:
N = int(input())
S = input()
hdg = S[1:N].count('E')
hdg_chgd = hdg
hdg_chg_nrs =[]
for i in range(1,N):
    if S[i] == 'E':
        hdg_chgd -= 1
    if S[i-1] == 'W':
        hdg_chgd += 1
    hdg_chg_nrs.append(hdg_chgd)
hdg_chgd_f = min(hdg_chg_nrs)
print(min(hdg, hdg_chgd_f))
Buggy python submission (verdict: Runtime Error):
N = int(input())
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
    if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:
        print('No')
        exit()
print('Yes')

Fixed submission:
num_list = list(map(int, input().split()))
if (num_list[0] * num_list[1]) % 2 == 1:
    print('Odd')
else:
    print('Even')

Buggy python submission (verdict: Runtime Error):
n = int(input())
plcs = [list(map(int,input().split())) for _ in range(n)]
A = [0, 0, 0]
for i in range(n):
    A = [plcs[i][j] - A[j] for j in range(3)]
    if A[0] >= A[1] + A[2] and A[0] % 2 == (abs(A[1]) + abs(A[2])) % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Fixed submission:
num_list = list(map(int, input().split()))
if (num_list[0] * num_list[1]) % 2 == 1:
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n + 1 - i):
        for k in range(n + 1 - i - j):
            if 10000 * k + 5000 * j + 1000 * i == y and k + j + i == n:
                print(k, j, i)
                exit()
print(-1, -1, -1)

Fixed submission:
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n + 1 - i):
        if 10000 * (n - i - j) + 5000 * j + 1000 * i == y:
            print(n - i - j, j, i)
            exit()
print(-1, -1, -1)