Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    import math
    return math.gcd(a, b)


def pf(v):
    s, e = 3, v
    result = 2 if v & 1 == 0 else 1
    while v & 1 == 0:
        v >>= 1
    for i in range(s, e, 2):
        if v == 1:
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
    return result


a, b = list(map(int, input().split()))
print(pf(gcd(a, b)))


Fixed submission:
def gcd(a, b):
    while a != 0:
        a, b = b % a, a
    return b


def pf(v):
    result = 1
    for i in range(2, v + 1):
        if v < i * i:
            if v > 1:
                result += 1
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
    return result


a, b = list(map(int, input().split()))
print(pf(gcd(a, b)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ms = list(map(int, input().split()))
for i in range(0, 1000000001, 2):
  a = i
  for m in ms:
    a = 2 * m - a
  if i == a:
    result = i
    break

vv = ['%d' % a]
for m in ms[:-1]:
  a = 2 * m - a
  vv.append('%d' % a)
print(' '.join(vv))


Fixed submission:
n = int(input())
ms = list(map(int, input().split()))

a = sum(ms) - 2 * sum(ms[1::2])
vv = ['%d' % a]
for m in ms[:-1]:
  a = 2 * m - a
  vv.append('%d' % a)
print(' '.join(vv))
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
vs = list(map(int, input().split()))


def doit(vv, kk):
    if kk == 0:
        return 0
    return max(vv[0] + doit(vv[1:], kk - 1),
               vv[-1] + doit(vv[:-1], kk - 1),
               doit(vv[1:], kk - 2) if kk > 1 else 0,
               doit(vv[:-1], kk - 2) if kk > 1 else 0)


print(doit(vs, k))


Fixed submission:
import sys
sys.setrecursionlimit(101)

n, k = list(map(int, input().split()))
vs = list(map(int, input().split()))
memo = {}


def doit(l, r, kk):
    if kk == 0 or l > r:
        return 0
    if (l, r, kk) not in memo:
        memo[(l, r, kk)] = max(vs[l] + doit(l + 1, r    , kk - 1),
                           vs[r] + doit(l    , r - 1, kk - 1),
                                   doit(l + 1, r    , kk - 2) if kk > 1 else 0,
                                   doit(l    , r - 1, kk - 2) if kk > 1 else 0)
    return memo[(l, r, kk)]


print(doit(0, n - 1, k))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    while a:
        a, b = b % a, a
    return b


N = int(input())
A = list(map(int, input().split()))
b = -1

for i in range(N):
    a = gcd(r, A[i]) if r != 0 else A[i]
    if a < r:
        b = i
    r = a

r3 = 0
for i in range(N):
    if i == b - 1:
        continue
    r3 = gcd(r3, A[i]) if r3 != 0 else A[i]

r4 = 0
for i in range(N):
    if i == b:
        continue
    r4 = gcd(r4, A[i]) if r4 != 0 else A[i]

d = sorted([(gcd(A[i], A[i + 1]), i) for i in range(N - 1)])
t = d[0][1]
r1 = 0
for i in range(N):
    a = A[i-1] if i == t + 1 else A[i]
    if r1 == 0:
        r1 = a
    else:
        r1 = gcd(r1, a)
r2 = 0
for i in range(N):
    a = A[i+1] if i == t else A[i]
    if r2 == 0:
        r2 = a
    else:
        r2 = gcd(r2, a)
print(max(r1, r2, r3, r4))


Fixed submission:
def gcd(a, b):
    while a:
        a, b = b % a, a
    return b


N = int(input())
A = list(map(int, input().split()))
r = 0
b = -1

for i in range(N):
    a = gcd(r, A[i]) if r != 0 else A[i]
    if a < r:
        b = i
    r = a

r3 = 0
for i in range(N):
    if i == b - 1:
        continue
    r3 = gcd(r3, A[i]) if r3 != 0 else A[i]

r4 = 0
for i in range(N):
    if i == b:
        continue
    r4 = gcd(r4, A[i]) if r4 != 0 else A[i]

d = sorted([(gcd(A[i], A[i + 1]), i) for i in range(N - 1)])
t = d[0][1]
r1 = 0
for i in range(N):
    a = A[i-1] if i == t + 1 else A[i]
    if r1 == 0:
        r1 = a
    else:
        r1 = gcd(r1, a)
r2 = 0
for i in range(N):
    a = A[i+1] if i == t else A[i]
    if r2 == 0:
        r2 = a
    else:
        r2 = gcd(r2, a)
print(max(r1, r2, r3, r4))
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
v = a[0]
for aa in a[1:]:
    v = math.gcd(v, aa)
print(v)


Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


n = int(input())
a = list(map(int, input().split()))
v = a[0]
for aa in a[1:]:
    v = gcd(v, aa)
print(v)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split()))
c = 0
for i in range(1, N + 1):
    a = 0
    if (i + i) % K == 0:
        for j in range(1, N + 1):
            if (i + j) % K == 0:
                a += 1
    c += a * a
print(c)


Fixed submission:
N, K = list(map(int, input().split()))
c = N // K
d = 0
for i in range(1, N + 1):
    if K % 2 == 0 and i % K == K // 2:
        d += 1
print(c ** 3 + d ** 3)
Buggy python submission (verdict: Time Limit Exceeded):
import os, sys, re, math

N = int(input())
A = [int(n) for n in input().split()]

sa = ''
for s in sorted(A):
    sa += '%s ' % (A.index(s) + 1)
print(sa.strip())

Fixed submission:
import os, sys, re, math

N = int(input())
A = [int(n) for n in input().split()]

ta = [(A[i], i + 1) for i in range(N)]
sa = sorted(ta, key=lambda k: k[0])

result = ''
for s in sa:
    result += '%s ' % s[1]
print(result.strip())

Buggy python submission (verdict: Time Limit Exceeded):
import os, sys, re, math

N = int(input())
A = [int(n) for n in input().split()]

print(' '.join(['%s' % (A.index(s) + 1) for s in sorted(A)]))


Fixed submission:
import os, sys, re, math

N = int(input())
A = [int(n) for n in input().split()]

ta = [(A[i], i + 1) for i in range(N)]
sa = sorted(ta, key=lambda k: k[0])

result = ''
for s in sa:
    result += '%s ' % s[1]
print(result.strip())
Buggy python submission (verdict: Time Limit Exceeded):
import os, sys, re, math

N = int(input())

print(sum([i for i in range(1, N)]))


Fixed submission:
import os, sys, re, math

N = int(input())

s = (1 + (N - 1)) * (N // 2)
if (N - 1) % 2 == 1:
    s -= N // 2

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
import os, sys, re, math

N = int(input())
S = []
for i in range(N):
    S.append(''.join(sorted(input())))

count = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        if S[i] == S[j]:
            count += 1
print(count)


Fixed submission:
import os, sys, re, math

N = int(input())
S = dict()
for i in range(N):
    w = ''.join(sorted(input()))
    if w in S:
        S[w] += 1
    else:
        S[w] = 1

count = 0
for (w, n) in S.items():
    if n > 1:
        count += (n * (n - 1)) // 2
print(count)
Buggy python submission (verdict: Runtime Error):
import os, sys, re, math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

(A, B, C, D) = [int(n) for n in input().split()]

minC = (A + (C - 1)) // C
maxC = B // C

minD = (A + (D - 1)) // D
maxD = B // D

CD = lcm(C, D)
minCD = (A + (CD - 1)) // CD
maxCD = B // CD

countC = maxC - minC + 1
countD = maxD - minD + 1
countCD = maxCD - minCD + 1

print(B - A - (countC + countD - countCD) + 1)


Fixed submission:
import os, sys, re, math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

(A, B, C, D) = [int(n) for n in input().split()]

minC = (A + (C - 1)) // C
maxC = B // C

minD = (A + (D - 1)) // D
maxD = B // D

CD = lcm(C, D)
minCD = (A + (CD - 1)) // CD
maxCD = B // CD

countC = maxC - minC + 1
countD = maxD - minD + 1
countCD = maxCD - minCD + 1

print(B - A - (countC + countD - countCD) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
import os, sys, re, math

(N, M) = [int(n) for n in input().split()]

cards = set([(i + 1) for i in range(N)])
for i in range(M):
    (L, R) = [int(n) for n in input().split()]
    if min(cards) > R or max(cards) < L:
        cards = {}
        break
    cards -= set([(i + 1) for i in range(L - 1)])
    cards -= set([(i + 1) for i in range(R, N)])

print(len(cards))


Fixed submission:
import os, sys, re, math

(N, M) = [int(n) for n in input().split()]

minC = 1
maxC = N
for i in range(M):
    (L, R) = [int(n) for n in input().split()]
    minC = max(minC, L)
    maxC = min(maxC, R)

print(max((maxC - minC + 1), 0))
Buggy python submission (verdict: Runtime Error):
import os, sys, re, math

(N, K) = [int(n) for n in input().split()]

lk = math.log2(K - 1)

p = 0
for i in range(1, N + 1):
    if i >= K:
        p += 1.0
    else:
        p += (0.5 ** (int(lk - math.log2(i) + 1)))

print(p / N)


Fixed submission:
import os, sys, re, math

(N, K) = [int(n) for n in input().split()]

if K == 1:
    print(1)
else:
    lk = math.log2(K - 1)
    p = 0
    for i in range(1, N + 1):
        if i >= K:
            p += 1.0
        else:
            p += (0.5 ** (int(lk - math.log2(i) + 1)))
    print(p / N)

Buggy python submission (verdict: Runtime Error):
import os, sys, re, math

(N, K) = [int(n) for n in input().split()]

lk = math.log2(K - 1)

p = 0
for i in range(1, N + 1):
    if i >= K:
        p += 1.0
    else:
        p += (0.5 ** (int(lk - math.log2(i) + 1)))
    print(int(lk - math.log2(i) + 1))

print(p / N)


Fixed submission:
import os, sys, re, math

(N, K) = [int(n) for n in input().split()]

if K == 1:
    print(1)
else:
    lk = math.log2(K - 1)
    p = 0
    for i in range(1, N + 1):
        if i >= K:
            p += 1.0
        else:
            p += (0.5 ** (int(lk - math.log2(i) + 1)))
    print(p / N)
Buggy python submission (verdict: Time Limit Exceeded):
import os, sys, re, math

S = input()

count = 0
while True:
    s = S.replace('01', '').replace('10', '')
    if s == S:
        break
    count += len(S) - len(s)
    S = s

print (count)    


Fixed submission:
import os, sys, re, math

S = input()

s1 = S.replace('1', '')
s2 = S.replace('0', '')

print (min(len(s1), len(s2)) * 2)

Buggy python submission (verdict: Time Limit Exceeded):
import os, sys, re, math

S = input()

count = 0
while True:
    i = S.find('01')
    if i >= 0:
        S = S[:i] + S[i+2:]
        count += 2
        continue
    i = S.find('10')
    if i >= 0:
        S = S[:i] + S[i+2:]
        count += 2
        continue
    break

print (count)    


Fixed submission:
import os, sys, re, math

S = input()

s1 = S.replace('1', '')
s2 = S.replace('0', '')

print (min(len(s1), len(s2)) * 2)
Buggy python submission (verdict: Runtime Error):
import os, sys, re, math

from functools import reduce
def lcm(vals):
    return reduce((lambda x, y: (x * y) // math.gcd(x, y)), vals, 1)

lines = sys.stdin.readlines()

n = int(lines[0])
a = [int(k) for k in lines[1].split()]

m = lcm(a) - 1
print (sum([m % k for k in a]))


Fixed submission:
import os, sys, re, math

from functools import reduce
from fractions import gcd
def lcm(vals):
    return reduce((lambda x, y: (x * y) // gcd(x, y)), vals, 1)

lines = sys.stdin.readlines()

n = int(lines[0])
a = [int(k) for k in lines[1].split()]

m = lcm(a) - 1
print (sum([m % k for k in a]))
Buggy python submission (verdict: Runtime Error):
d = [0] * 200001
n = input()
aaa = list(map(int, input().split(' ')))
ans = 'YES'
for a in aaa:
  d[a] += 1
  if d[a] >= 2:
    ans = 'NO'
print(ans)

Fixed submission:
d = {}
n = input()
aaa = list(map(int, input().split(' ')))
ans = 'YES'
for a in aaa:
  d[a] = d.get(a, 0) + 1
  if d[a] >= 2:
    ans = 'NO'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 9)

# 昔同じ問題を atcoder で見た？
n = int(input())
edges = []
paths = {}
for i in range(n-1):
    a, b = list(map(int, input().split(' ')))
    edges.append((a, b))
    paths[a] = paths.get(a, []) + [b]
    paths[b] = paths.get(b, []) + [a]
# print(edges)
# print(paths)
colors = {}  # (a->b) 1 とか
current = 1
biggest = 1
def f(current, prev, prev_color):
    global biggest
    color = 0
    for vertex in paths[current]:
        if vertex == prev:
            continue
        color += 1
        if color == prev_color:
            color += 1
        biggest = max(biggest, color)
        colors[(current, vertex)] = color
        f(vertex, current, color)
f(1, None, None)

print(biggest)
for a, b in edges:
    print(colors[(a, b)])
# TLE のみ？

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)

# 昔同じ問題を atcoder で見た？
n = int(input())
edges = []
paths = {}
for i in range(n-1):
    a, b = list(map(int, input().split(' ')))
    edges.append((a, b))
    paths[a] = paths.get(a, []) + [b]
    paths[b] = paths.get(b, []) + [a]
# print(edges)
# print(paths)
colors = {}  # (a->b) 1 とか
current = 1
biggest = 1
def f(current, prev, prev_color):
    global biggest
    color = 0
    for vertex in paths[current]:
        if vertex == prev:
            continue
        color += 1
        if color == prev_color:
            color += 1
        biggest = max(biggest, color)
        colors[(current, vertex)] = color
        f(vertex, current, color)
f(1, None, None)

print(biggest)
for a, b in edges:
    print(colors[(a, b)])
# pypy3

Buggy python submission (verdict: Runtime Error):
# 昔同じ問題を atcoder で見た？
n = int(input())
edges = []
paths = {}
for i in range(n-1):
    a, b = list(map(int, input().split(' ')))
    edges.append((a, b))
    paths[a] = paths.get(a, []) + [b]
    paths[b] = paths.get(b, []) + [a]
# print(edges)
# print(paths)
colors = {}  # (a->b) 1 とか
current = 1
biggest = 1
def f(current, prev, prev_color):
    global biggest
    color = 0
    for vertex in paths[current]:
        if vertex == prev:
            continue
        color += 1
        if color == prev_color:
            color += 1
        biggest = max(biggest, color)
        colors[(current, vertex)] = color
        f(vertex, current, color)
f(1, None, None)

print(biggest)
for a, b in edges:
    print(colors[(a, b)])

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)

# 昔同じ問題を atcoder で見た？
n = int(input())
edges = []
paths = {}
for i in range(n-1):
    a, b = list(map(int, input().split(' ')))
    edges.append((a, b))
    paths[a] = paths.get(a, []) + [b]
    paths[b] = paths.get(b, []) + [a]
# print(edges)
# print(paths)
colors = {}  # (a->b) 1 とか
current = 1
biggest = 1
def f(current, prev, prev_color):
    global biggest
    color = 0
    for vertex in paths[current]:
        if vertex == prev:
            continue
        color += 1
        if color == prev_color:
            color += 1
        biggest = max(biggest, color)
        colors[(current, vertex)] = color
        f(vertex, current, color)
f(1, None, None)

print(biggest)
for a, b in edges:
    print(colors[(a, b)])
# pypy3
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(n//2):
  ans += 1
printt(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, (n+1)//2):
  ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int, input().split(' ')))
ans = 1
m = max(set(ls))
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
if ans != 0:
    for i in range(1, m+1):
        if d.get(i, 0) == 0:
            ans = 0
            break
        ans = (ans * (d[i-1] ** d[i])) % 998244353
print(ans)


Fixed submission:
n = int(input())
ls = list(map(int, input().split(' ')))
m = max(set(ls))
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
ans = 0 if (ls[0] != 0 or d.get(0) >= 2) else 1
for i in range(1, m+1):
    if i not in d:
        ans = 0
    ans = (ans * (d.get(i-1, 0) ** d.get(i, 0))) % 998244353 
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = list(map(int, input().split(' ')))
ans = 1
if ls[0] != 0:
    ans = 0
m = max(set(ls))
if m > n:
    ans = 0
# d = {i: ls.count(i) for i in range(m+1)}
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
if ans != 0:
    for i in range(1, m+1):
        ans = (ans * (d[i-1] ** d[i]) % 998244353) % 998244353
print(ans)


Fixed submission:
n = int(input())
ls = list(map(int, input().split(' ')))
m = max(set(ls))
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
ans = 0 if (ls[0] != 0 or d.get(0) >= 2) else 1
for i in range(1, m+1):
    if i not in d:
        ans = 0
    ans = (ans * (d.get(i-1, 0) ** d.get(i, 0))) % 998244353 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int, input().split(' ')))
ans = 1
if ls[0] != 0:
    ans = 0
m = max(set(ls))
d = {i: ls.count(i) for i in range(m+1)}
for i in range(1, m+1):
    ans = (ans * (d[i-1] ** d[i]) % 998244353) % 998244353
print(ans)


Fixed submission:
n = int(input())
ls = list(map(int, input().split(' ')))
m = max(set(ls))
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
ans = 0 if (ls[0] != 0 or d.get(0) >= 2) else 1
for i in range(1, m+1):
    if i not in d:
        ans = 0
    ans = (ans * (d.get(i-1, 0) ** d.get(i, 0))) % 998244353 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ls = list(map(int, input().split(' ')))
ans = 1
if ls[0] != 0:
    ans = 0
m = max(ls)
d = {i: ls.count(i) for i in range(m+1)}
for i in range(1, m+1):
    ans = (ans * d[i-1] ** d[i]) % 998244353
print(ans)


Fixed submission:
n = int(input())
ls = list(map(int, input().split(' ')))
m = max(set(ls))
d = {}
for l in ls:
    d[l] = d.get(l, 0) + 1
ans = 0 if (ls[0] != 0 or d.get(0) >= 2) else 1
for i in range(1, m+1):
    if i not in d:
        ans = 0
    ans = (ans * (d.get(i-1, 0) ** d.get(i, 0))) % 998244353 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
edges = list(map(int, input().split(' ')))
edges= sorted(edges)[::-1]
ans = 0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      if edges[i] < edges[j] + edges[k]:
        ans += 1
      else:
        break
print(ans)

Fixed submission:
import bisect
n = int(input())
edges = sorted(list(map(int, input().split(' '))))
ans = 0
for i in range(n-1, -1, -1):
  for j in range(i-1, -1, -1):
    limit = edges[i] - edges[j]
    if limit < edges[j]:
      index = bisect.bisect_right(edges, limit)
      ans += max(0, j - index)  # maxいらんかも
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect
N, M = list(map(int, input().split(' ')))
As = list(map(int, input().split(' ')))
# osoi
As = sorted([-a for a in As])
while M:
    hoge = -As.pop(0) // 2
    M -= 1
    while M and As and hoge < As[1]:
        hoge = hoge // 2
        M -= 1
    bisect.insort(As, -hoge)
print(-sum(As))


Fixed submission:
d = dict(
    Sunny='Cloudy',
    Cloudy='Rainy',
    Rainy='Sunny'
)
print(d[input()])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
# a= 4, 1, 2, 3
# b= 1, 2, 3, 4 # modのmaxは 0, 1, 2, 3 なので最大6
# ----------
#    0, 1, 2, 3 
#print(int(n*(n-1)/2))  # 合わない...
print(sum([b%a for a, b in zip([i for i in range(1, n+1)], [n] + [i for i in range(1, n)])]))

Fixed submission:
n = int(input())
#答えが違う
#print(int(n*(n-1)/2))  # 合わない...
#print(int(n*(n-1)//2))  # 合わない...
print(n*(n-1)//2)
Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split(' ')))
print((a+b) // 2 if a + b % 2 == 0 else 'IMPOSSIBLE)

Fixed submission:
a, b = map(int, raw_input().split(' '))
print (a + b) / 2 if (a + b) % 2 == 0 else 'IMPOSSIBLE'
Buggy python submission (verdict: Time Limit Exceeded):
# pencil and paper !
# n = 3 (x, y, z = 山, a, b, c = ダム)
# x = a - b + c
# y = a + b - c
# z = -a + b + c
# 
# n = 5
# x = a - b + c - d + e
# 両隣は + , それ以降は -, +, -, +
n = int(input())
aaa = list(map(int, input().split(' ')))
ans = []
for i in range(n):
    r = 1
    temp = 0
    for j in range(n):
        temp += (aaa[(i+j) % n ] * r)
        r *= -1
    ans.append(str(temp))
print(' '.join(ans))

Fixed submission:
# pencil and paper !
# n = 3 (x, y, z = 山, a, b, c = ダム)
# x = a - b + c
# y = a + b - c
# z = -a + b + c
# 
# n = 5
# x = a - b + c - d + e
# y = a + b - c + d - e
# 両隣は + , それ以降は -, +, -, +
# z =-a + b + c - d + e
#
# 1e5 * 1e5だけど
# 2つめ以降は前のを利用で 1e5 * 1 
# y + x = 2a
# y = 2a - x
#
# z + y  = 2b
# z = 2b - y
n = int(input())
aaa = list(map(int, input().split(' ')))
ans = []
for i in range(n):  # 1e5
    r = 1
    temp = 0
    if not ans:
        for j in range(n):  # 1e5
            temp += (aaa[(i+j) % n ] * r)
            r *= -1
    else:
        temp = 2 * aaa[(i-1) % n] - ans[-1] 
    ans.append(temp)
print(' '.join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
k, n = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
ct = 0
ans = 1
i = 0
while ct <= n:
  ct += l[i]
  ans += (ct <= n)
  i += 1
print(ans)

Fixed submission:
k, n = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
ct = 0
ans = 1
i = 0
while ct <= n and i < len(l):
  ct += l[i]
  ans += (ct <= n)
  i += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = list(map(int, input().split(' ')))
hoge = abs(y/x) == 1
print('%.6f %s' % ((w*h) / 2, int(hoge)))


Fixed submission:
w, h, x, y = list(map(int, input().split(' ')))
hoge = w / 2 == x
fuga = h / 2 == y
print('%.6f %s' % ((w*h) / 2, int(hoge and fuga)))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split(' ')))
aaa = []
for i in range(m):
    aaa.append(int(input()))

dp = [1] * (n + 3)
for i in range(1, n+1):
    dp[i]  = dp[i-1] if i not in aaa else 0
    dp[i] += dp[i-2] if i >= 2 and i not in aaa else 0
    dp[i] = dp[i] % int(1e9 + 7)
print(dp[n])

Fixed submission:
n, m = list(map(int, input().split(' ')))
aaa = [0] * (n + 3)
for i in range(m):
    aaa[int(input())] = True

dp = [1] * (n + 3)
for i in range(1, n+1):  # 1e5
    if not aaa[i]:
        dp[i]  = dp[i-1]
        if i >= 2:
            dp[i] += dp[i-2]
        dp[i] = dp[i] % int(1e9 + 7)
    else:
        dp[i] = 0
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split(' ')))
orig_a = input()
for _ in range(k):
  s, e = list(map(int, input().split(' '))) # TLEかも
  a = orig_a[s-1:e]
  print(a.count('AC'))


Fixed submission:
n, k = list(map(int, input().split(' ')))
orig_a = input()
acs = {}
for i in range(n):
  if i < 1:
    acs[i] = 0
  else:
    acs[i] = acs[i-1] + (orig_a[i-1: i+1] == 'AC')
for _ in range(k):
  s, e = list(map(int, input().split(' ')))
  print(acs[e-1] - acs[s-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input()) // 2
ns = list(map(int, input().split()))
a = [ns[i] for i in range(len(ns)) if i % 2 == 0]
b = [ns[i] for i in range(len(ns)) if i % 2 == 1]
sa = set(a)
sb = set(b)
ca = sorted([(a.count(s), s) for s in sa])[::-1]
cb = sorted([(b.count(s), s) for s in sb])[::-1]  # [(出た回数, num)]
if ca[0][1] != cb[0][1]:
    print(n-ca[0][0] + n-cb[0][0])
else:
    if len(ca) == 1 and len(cb) == 1:
        print(n)
    elif len(ca) == 1:
        print(n-ca[0][0] + n-cb[1][0])
    else:
        print(n-ca[1][0] + n-cb[0][0])

Fixed submission:
n = int(input()) // 2
ns = list(map(int, input().split()))

a = [ns[i] for i in range(len(ns)) if i % 2 == 0]
b = [ns[i] for i in range(len(ns)) if i % 2 == 1]
#ca = sorted([(a.count(s), s) for s in sa])[::-1]
#cb = sorted([(b.count(s), s) for s in sb])[::-1]  # [(出た回数, num)]
# countが遅かったので
da = {}
db = {}
for s in a:
    da[s] = da.get(s, 0) + 1
for s in b:
    db[s] = db.get(s, 0) + 1
ca = sorted([(v, k) for k, v in da.items()])[::-1]
cb = sorted([(v, k) for k, v in db.items()])[::-1]

if ca[0][1] != cb[0][1]:
    print(n-ca[0][0] + n-cb[0][0])
else:
    if len(ca) == 1 and len(cb) == 1:
        print(n)
    elif len(ca) == 1 and len(cb) > 1:
        print(n-ca[0][0] + n-cb[1][0])
    elif len(ca) > 1 and len(cb) == 1:
        print(n-ca[1][0] + n-cb[0][0])
    else:
        print(min(n-ca[1][0] + n-cb[0][0], n-ca[0][0] + n-cb[1][0]))  # ?
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split(' ')))
MOD = int(1e9 + 7)
seeds = []
p = 2
while p*p > M:
  while M % p == 0:
    seeds.append(p)
    M = M // p
  p += 1
if M > 1:
  seeds.append(M)
 
def comb(n, k):
  ans = 1
  for i in range(1, k + 1):
    ans = (ans * (n + 1 - i) // i)
  return ans
 
ans = 1
hogehoge = set(seeds)
for i in hogehoge:
  a_ct = seeds.count(i)
  ans = (ans * comb(a_ct + N-1, min(a_ct, N-1))) % MOD
print(ans)


Fixed submission:
a, b, c = list(map(int, input().split(' ')))
print (max(a, b, c) * 9 + a + b + c)