Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mx = max(a)

dp = [0] * (mx+1)
for i in sorted(set(a)):
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and a.count(i) == 1:
        cnt += 1

print(cnt)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mx = max(a)

dp = [0] * (mx+1)
for i in sorted(set(a)):
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and a.count(i) == 1:
        cnt += 1

print(cnt)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mx = max(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in a:
    if dp[i] == 0 and a.count(i) == 1:
        cnt += 1

print(cnt)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
mx = max(a)

dp = [0] * (mx+1)
for i in sorted(a):
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in a:
    if dp[i] == 0 and a.count(i) == 1:
        cnt += 1

print(cnt)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
a, b = map(str, input().split())

ans = b * 100
ans *= a
ans /= 100
print(ans//1)

Fixed submission:
from decimal import Decimal, ROUND_DOWN
a, b = map(str, input().split())
a = Decimal(a)
b = Decimal(b)

print((a*b).quantize(Decimal("0"), rounding=ROUND_DOWN))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
A, B = [], []  # AにはXがとりうる値の最小値、Bには最大値を入れていく

for _ in range(n):
    a, b = map(int, input().split())
    A.append(a if n % 2 == 1 else a * 2)  # nが偶数だと、medianがとりうる値が0.5刻みになるので最初から2倍にしておく
    B.append(b if n % 2 == 1 else b * 2)

a = np.median(A)
b = np.median(B)

# medianのとりうる値の最小値と最大値の間に、カウントしたいmedianが１刻みで存在する
print(int(max(a, b) - min(a, b) + 1))

Fixed submission:
import numpy as np

n = int(input())
A, B = [], []  # AにはXがとりうる値の最小値、Bには最大値を入れていく

for _ in range(n):
    a, b = map(int, input().split())
    A.append(a if n % 2 == 1 else a * 2)  # nが偶数だと、medianがとりうる値が0.5刻みになるので最初から2倍にしておく
    B.append(b if n % 2 == 1 else b * 2)

a = np.median(A)
b = np.median(B)

# medianのとりうる値の最小値と最大値の間に、カウントしたいmedianが１刻みで存在する
print(int(max(a, b) - min(a, b) + 1))
Buggy python submission (verdict: Runtime Error):
t = list(input())

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
for i in range(1, len(t)-1):
    if t[i] == "?" and t[i-1] == "P":
        t[i] = "D"
    elif t[i] == "?" and t[i+1] == "D":
        t[i] = "P"
    elif t[i] == "?" and t[i+1] == "?":
        t[i] = "P"
        t[i+1] = "D"
    elif t[i] == "?":
        t[i] = "D"
if t[-1] == "?":
    t[-1] = "D"

print("".join(t))

Fixed submission:
t = list(input())

if len(t) == 1 and t[0] == "?":
    t[0] = "D"
    print(t[0])
    exit()

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
for i in range(1, len(t)-1):
    if t[i] == "?" and t[i-1] == "P":
        t[i] = "D"
    elif t[i] == "?" and t[i+1] == "D":
        t[i] = "P"
    elif t[i] == "?" and t[i+1] == "?":
        t[i] = "P"
        t[i+1] = "D"
    elif t[i] == "?":
        t[i] = "D"
if len(t) > 1:
    if t[-1] == "?":
        t[-1] = "D"

print("".join(t))

Buggy python submission (verdict: Runtime Error):
t = list(input())

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
for i in range(1, len(t)-1):
    if t[i-1] == "P":
        t[i] = "D"
    elif t[i+1] == "D":
        t[i] = "P"
    elif t[i+1] == "?":
        t[i] = "P"
        t[i+1] = "D"
    else:
        t[i] = "D"
if t[-1] == "?":
    t[-1] = "D"

print("".join(t))

Fixed submission:
t = list(input())

if len(t) == 1 and t[0] == "?":
    t[0] = "D"
    print(t[0])
    exit()

if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] = "P"
for i in range(1, len(t)-1):
    if t[i] == "?" and t[i-1] == "P":
        t[i] = "D"
    elif t[i] == "?" and t[i+1] == "D":
        t[i] = "P"
    elif t[i] == "?" and t[i+1] == "?":
        t[i] = "P"
        t[i+1] = "D"
    elif t[i] == "?":
        t[i] = "D"
if len(t) > 1:
    if t[-1] == "?":
        t[-1] = "D"

print("".join(t))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

cnt = 0
for i in range(n-1):
    for j in range(i+1, n):
        if (i + 1) + A[i] == (j + 1) - A[j]:
            cnt += 1

print(cnt)

Fixed submission:
from collections import Counter
n = int(input())
A = list(map(int, input().split()))

P = [i + a for i, a in enumerate(A, start=1)]
Q = [j - a for j, a in enumerate(A, start=1)]

Q = Counter(Q)

cnt = 0
for p in P:
    cnt += Q[p]

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

n = b if n > b else n
ans = 0
for x in range(n, 0, -1):
    if x > b:
        continue
    ans = max(a * x // b - a * (x // b), ans)

print(ans)

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

x = min(n, b-1)
ans = a * x // b - a * (x // b)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = int(input())
length = len(str(s))

ans = []
for i in range(length):
    for j in range(i, length):
        n = int(str(s)[i:j+1])
        if n % 2019 == 0:
            ans.append(n)

print(len(ans))

Fixed submission:
S = input()

mod = 2019
cnt = [0] * 2019
cur = 0  # 現在検討中の部分文字列
cnt[cur] = 1
d = 1   # 桁

for s in S[::-1]:
    cur += int(s) * d
    cur %= mod
    cnt[cur] += 1
    d *= 10
    d %= mod

ans = 0
for c in cnt:
    ans += c * (c-1) // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())

ans = 0
for p in range(1, k+1):
    for q in range(1, k+1):
        for r in range(1, k+1):
            ans += math.gcd(math.gcd(p, q), r)

print(ans)

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

ans = 0
for p in range(1, k+1):
    for q in range(1, k+1):
        for r in range(1, k+1):
            ans += math.gcd(math.gcd(p, q), r)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
a = list(map(int, input().split()))

c = dict(collections.Counter(a))

for i in a:
    temp = c[i] - 1
    ans = (temp * (temp - 1)) // 2
    for v in c.values():
        ans += (v * (v - 1)) // 2
    ans -= (c[i] * (c[i] - 1)) // 2
    print(ans)

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))

c = dict(collections.Counter(a))

sum = 0
for v in c.values():
    sum += (v * (v - 1)) // 2

for i in a:
    temp = c[i] - 1
    ans = (temp * (temp - 1)) // 2
    ans += sum
    ans -= (c[i] * (c[i] - 1)) // 2
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, m = map(int, input().split())
ref = list(map(int, input().split()))
micro = list(map(int, input().split()))
tk = [list(map(int, input().split())) for i in range(m)]

mini = 10 ** 6
for i in range(a):
    for j in range(b):
        s = ref[i] + micro[j]
        if s < mini:
            mini = s

amount = 10 ** 6
for i in tk:
    if ref[i[0]-1] + micro[i[1]-1] - i[2] < amount:
        amount = ref[i[0]-1] + micro[i[1]-1] - i[2]

print(min(mini, amount))


Fixed submission:
a, b, m = map(int, input().split())
ref = list(map(int, input().split()))
micro = list(map(int, input().split()))
tk = [list(map(int, input().split())) for i in range(m)]

mini = min(ref) + min(micro)

amount = 10 ** 6
for i in tk:
    if ref[i[0]-1] + micro[i[1]-1] - i[2] < amount:
        amount = ref[i[0]-1] + micro[i[1]-1] - i[2]

print(min(mini, amount))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, m = map(int, input().split())
ref = list(map(int, input().split()))
micro = list(map(int, input().split()))
tk = [list(map(int, input().split())) for i in range(m)]

mini = 10 ** 6
for i in range(a):
    for j in range(b):
        if ref[i] + micro[j] < mini:
            mini = ref[i] + micro[j]

amount = 10 ** 6
for i in tk:
    if ref[i[0]-1] + micro[i[1]-1] - i[2] < amount:
        amount = ref[i[0]-1] + micro[i[1]-1] - i[2]

print(min(mini, amount))

Fixed submission:
a, b, m = map(int, input().split())
ref = list(map(int, input().split()))
micro = list(map(int, input().split()))
tk = [list(map(int, input().split())) for i in range(m)]

mini = min(ref) + min(micro)

amount = 10 ** 6
for i in tk:
    if ref[i[0]-1] + micro[i[1]-1] - i[2] < amount:
        amount = ref[i[0]-1] + micro[i[1]-1] - i[2]

print(min(mini, amount))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, m = map(int, input().split())
ref = list(map(int, input().split()))
micro = list(map(int, input().split()))
tk = [list(map(int, input().split())) for i in range(m)]

amount = set()
for i in range(a):
    for j in range(b):
        amount.add(ref[i] + micro[j])


for i in tk:
    amount.add(ref[i[0]-1] + micro[i[1]-1] - i[2])

print(min(amount))

Fixed submission:
a, b, m = map(int, input().split())
ref = list(map(int, input().split()))
micro = list(map(int, input().split()))
tk = [list(map(int, input().split())) for i in range(m)]

mini = min(ref) + min(micro)

amount = 10 ** 6
for i in tk:
    if ref[i[0]-1] + micro[i[1]-1] - i[2] < amount:
        amount = ref[i[0]-1] + micro[i[1]-1] - i[2]

print(min(mini, amount))
Buggy python submission (verdict: Runtime Error):
from collections import deque
s = input()
q = int(input())
former = deque()
latter = deque()

flg = False
for i in range(q):
    p = list(map(str, input().split()))
    if p[0] == "1":
        flg = True if flg == False else False
        continue
    else:
        if (p[1] == "1" and not flg) or (p[1] == "2" and flg):
            former.appendleft(p[2])
        else:
            latter.append(p[2])

ans = former + deque(s) + latter
ans = "".join(ans)
print(ans if not flg else ans[::-1])

Fixed submission:
from collections import deque

s = deque(str(input()))
q = int(input())

t = 0
for i in range(q):
    o = list(map(str, input().split()))
    if o[0] == "1":
        t += 1
    else:
        if o[1] == "1" and t%2 == 0 or o[1] == "2" and t%2 == 1:
            s.appendleft(o[2])
        else:
            s.append(o[2])

if t%2 == 1:
    s.reverse()

print("".join(s))
Buggy python submission (verdict: Runtime Error):
n, r = map(itn, input().split())

if n >= 10:
  print(r)
else:
  print(r + 100 * (10 - n))

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

if n >= 10:
    print(r)
else:
    print(r + 100*(10-n))
Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce
n, a, b = map(int, input().split())


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

print((pow(2, n) - cmb(n, a) - cmb(n, b) - 1) % (pow(10, 9)+7))

Fixed submission:
n, a, b = map(int, input().split())
mod = pow(10, 9) + 7


def cmb(n,r):
    mod = 10**9+7
    ans = 1
    for i in range(r):
        ans *= n-i
        ans %= mod
    for i in range(1,r+1):
        ans *= pow(i,mod-2,mod)
        ans %= mod
    return ans


total = pow(2, n, mod) - cmb(n, a) - cmb(n, b) - 1
print(total % mod)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input() for _ in range(n))

l = list(set(s))

if len(l) == len(s):
    s.sort()
    for i in s:
        print(i)
    exit()

count = [0] * len(l)
for i, v in enumerate(l):
    count[i] = s.count(v)

m = max(count)
indexes = [i for i, x in enumerate(count) if x == m]

ans = [0] * len(indexes)
for i, v in enumerate(indexes):
    ans[i] = l[v]

ans.sort()

for i in ans:
    print(i)

Fixed submission:
import collections

n = int(input())
s = list(input() for _ in range(n))

c = dict(collections.Counter(s))
m = max(c.values())
ans = [k for k, v in c.items() if v == m]

ans.sort()
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input() for _ in range(n))

l = list(set(s))

if len(l) == len(s):
    s.sort()
    for i in s:
        print(i)
    exit()

count = [0] * len(l)
for i, v in enumerate(l):
    count[i] = s.count(v)

m = max(count)
indexes = [i for i, x in enumerate(count) if x == m]

ans = []
for i in indexes:
    ans.append(l[i])

ans.sort()

for i in ans:
    print(i)

Fixed submission:
import collections

n = int(input())
s = list(input() for _ in range(n))

c = dict(collections.Counter(s))
m = max(c.values())
ans = [k for k, v in c.items() if v == m]

ans.sort()
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input() for _ in range(n))

l = list(set(s))

count = [0] * len(l)
for i, v in enumerate(l):
    count[i] = s.count(v)

m = max(count)
indexes = [i for i, x in enumerate(count) if x == m]

ans = []
for i in indexes:
    ans.append(l[i])

ans.sort()

for i in ans:
    print(i)

Fixed submission:
import collections

n = int(input())
s = list(input() for _ in range(n))

c = dict(collections.Counter(s))
m = max(c.values())
ans = [k for k, v in c.items() if v == m]

ans.sort()
for i in ans:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input() for _ in range(n))

l = list(set(s))

count = []
for i in l:
    count.append(s.count(i))


indexes = [i for i, x in enumerate(count) if x == max(count)]

ans = []
for i in indexes:
    ans.append(l[i])

ans.sort()

for i in ans:
    print(i)

Fixed submission:
import collections

n = int(input())
s = list(input() for _ in range(n))

c = dict(collections.Counter(s))
m = max(c.values())
ans = [k for k, v in c.items() if v == m]

ans.sort()
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N, K = map(int, input().split())
P = list(map(int, input().split()))

A = list(accumulate(P))

largest = A[2]
point = 0
for i in range(K, N):
    if largest < A[i] - A[i-K]:
        largest = A[i] - A[i-K]
        point = i

ans = 0
for j in range(point - K + 1, point+1):
    p = P[j]
    ans += (((p + 1) * p) / 2) / p

print(ans)

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

p = list(map(lambda x: x * (x+1) /2 /x, p))

for i in range(1, n):
    p[i] = p[i-1] + p[i]

m = p[k-1]
for i in range(k, n):
    a = p[i] - p[i-k]
    if m < a:
        m = a

print(m)

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    l = tuple(map(lambda x: x * (x + 1) * 1 / 2 * 1 / x, p))
    ans = [0] * (n - k + 1)
    for i in range(n - k + 1):
        ans[i] = sum(l[i:i + k])
    print(max(ans))

if __name__ == "__main__":
    resolve()

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

p = list(map(lambda x: x * (x+1) /2 /x, p))

for i in range(1, n):
    p[i] = p[i-1] + p[i]

m = p[k-1]
for i in range(k, n):
    a = p[i] - p[i-k]
    if m < a:
        m = a

print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

l = tuple(map(lambda x: x * (x + 1) * 1 / 2 * 1 / x, p))

ans = [0] * (n - k + 1)
for i in range(n - k + 1):
    ans[i] = sum(l[i:i + k])

print(max(ans))

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

p = list(map(lambda x: x * (x+1) /2 /x, p))

for i in range(1, n):
    p[i] = p[i-1] + p[i]

m = p[k-1]
for i in range(k, n):
    a = p[i] - p[i-k]
    if m < a:
        m = a

print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

l = list(map(lambda x: x * (x+1) * 1/2 * 1/x, p))

ans = [0] * (n-k+1)
for i in range(n-k+1):
    ans[i] = sum(l[i:i+k])

print(max(ans))

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

p = list(map(lambda x: x * (x+1) /2 /x, p))

for i in range(1, n):
    p[i] = p[i-1] + p[i]

m = p[k-1]
for i in range(k, n):
    a = p[i] - p[i-k]
    if m < a:
        m = a

print(m)
Buggy python submission (verdict: Runtime Error):
from functools import lru_cache
h = int(input())
count = 0

while n==1:
  n = h//2
  count +=1

@lru_cache(maxsize=100000)
def f(n):
    if n < 1:
        return 3
    else:
        return f(n - 1)*2 + 1

print(f(count))

Fixed submission:
from functools import lru_cache
h = int(input())
count = 0

while h > 1:
  h = h//2
  count +=1

@lru_cache(maxsize=100000)
def f(n):
    if n < 1:
        return 1
    else:
        return f(n - 1)*2 + 1

print(f(count))
Buggy python submission (verdict: Time Limit Exceeded):
H, N = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]

dp = [float("INF")] * 10 ** 5
dp[0] = 0

for h in range(H):
    for a, b in AB:
        dp[h+a] = min(dp[h] + b, dp[h+a])

print(min(dp[H:]))

Fixed submission:
H, N = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]

dp = [float("INF")] * (H+1)
dp[0] = 0  # 添字：敵HP、　配列の中身：敵HPを削るのに必要な最小のMP

# 配るDP
for h in range(H):
    for a, b in ab:
        target = min(H, h + a)  # target: DPのうち、書き換える部分の添字。Hを超えた部分は考察する必要なし
        dp[target] = min(dp[target], dp[h] + b)

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

ab = str(a * int(b))
ba = str(b * int(a))

ans = [ab, ba].sort

print(ans[0])

Fixed submission:
a, b = map(int, input().split())
 
ab = str(a) * int(b)
ba = str(b) * int(a)
 
ans = sorted([ab, ba])
print(ans[0])
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
x = sorted([list(map(int, input().split())) for i in range(n)])
y = copy.deepcopy(x)

j = 0
while j < len(x)-1:
    if x[j][0]+x[j][1] > x[j+1][0]-x[j+1][1]:
        y.pop(j+1)
        j += 2
        continue
    j += 1

print(len(y))

Fixed submission:
N = int(input())
XL = [list(map(int, input().split())) for i in range(N)]
LR = [[x - l, x + l] for x, l in XL]

LR.sort(key=lambda x: x[1])

ans = 0
prev = -float("INF")
for l, r in LR:
    if prev <= l:
        ans += 1
        prev = r

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
c = {"r": p, "s": r, "p": s}

ans = 0
for i in range(k):
    tmp = str()
    for j, v in enumerate(t):
        if j % k == i:
            tmp += v
    flg = True
    for l in range(len(tmp)-1):
        if flg:
            ans += c[tmp[l]]
        if tmp[l] == tmp[l+1]:
            flg = not flg
            continue
        if tmp[l] != tmp[l+1]:
            flg = True
    ans += c[tmp[-1]] if flg else 0
print(ans)


Fixed submission:
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

d = {"r": p, "s": r, "p": s}  # key: value = 筐体が出す手: 勝つともらえる点数
ans = 0
wins = [False] * k  # 剰余の周期ごとに、前回の勝ち負けを管理。勝ってたらTrueにして次回は負けないといけない。

for i in range(n):
    # kの剰余を使って周期ごとに管理。例えば剰余１の周期だけ見ると、出す手がずっと同じだと○×○×となる。
    # 出す手が前と異なるときは気にせず点数を追加する。
    if not wins[i % k] or t[i] != t[i-k]:
        ans += d[t[i]]
        wins[i % k] = True
    else:
        wins[i % k] = False

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
A = str()
 
for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
A = str()				# ""にするとREになる
 
for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
 
for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
A = ""
 
for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
A = ""
 
for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
A = ''
 
for i in range(N):
    A += S[i] + T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
n = int(input())
s, t = input().split()
ans = ""
for i in range(n):
  ans += s[i] + t[i]
print(ans)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
n = int(input())
s, t = input().split()
a = ""

for i in range(n):
    a += s[i] + t[i]
    
print(a)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
A = ""

for i in range(N):
    A += S[i] + T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
A = ""

for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答

Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()	#空白で区切る
A = ""

for i in range(N):	# :を忘れてハマった
    A += S[i]
    A += T[i]
    
print(A)

Fixed submission:
A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答
Buggy python submission (verdict: Runtime Error):
N = int(input())
S, T = [input().split()]
A = ""

for i in N
	A += S[i]
	A += T[i]
    
print(A)

Fixed submission:
N = int(input())
S, T = input().split()
A = str()
 
for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)