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

for _ in range(k):
    b = [0] * (n + 2)
    for i in range(n):
        b[max(0, i - a[i])] += 1
        b[min(n + 1, i + a[i] + 1)] -= 1
    a[0] = b[0]
    cnt = 1 if a[0] == n else 0
    for i in range(1, n):
        a[i] = a[i - 1] + b[i]
        if a[i] == n:
            cnt += 1

    if cnt == n:
        break

print(*a)


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

for _ in range(k):
    b = [0] * (n + 2)
    for i in range(n):
        b[max(0, i - a[i])] += 1
        b[min(n + 1, i + a[i] + 1)] -= 1
    a[0] = b[0]
    cnt = a[0]
    for i in range(1, n):
        a[i] = a[i - 1] + b[i]
        cnt += a[i]

    # print(*a)
    if cnt == n**2:
        break

print(*a)

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

for _ in range(k):
    b = [0] * (n + 2)
    for i in range(n):
        b[max(0, i - a[i])] += 1
        b[min(n + 1, i + a[i] + 1)] -= 1
    a[0] = b[0]
    cnt = 0
    for i in range(1, n):
        a[i] = a[i - 1] + b[i]
        if a[i] == n:
            cnt += 1

    if cnt == n:
        break

print(*a)


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

for _ in range(k):
    b = [0] * (n + 2)
    for i in range(n):
        b[max(0, i - a[i])] += 1
        b[min(n + 1, i + a[i] + 1)] -= 1
    a[0] = b[0]
    cnt = a[0]
    for i in range(1, n):
        a[i] = a[i - 1] + b[i]
        cnt += a[i]

    # print(*a)
    if cnt == n**2:
        break

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

two_pow = [1 << i for i in range(n + 1)]
is_possible = True
for i in range(n):
    if a[i] > two_pow[i] - 1:
        is_possible = False
        break
if a[n] > two_pow[n]:
    is_possible = False

s = 0
for i in range(n + 1):
    s += a[i] * two_pow[n - i]
if s > two_pow[n]:
    is_possible = False

b = [0] * (n + 1)
for i in range(n):
    b[i + 1] = (a[i] + b[i]) * 2

c = [0] * (n + 1)
c[n] = a[n]
ans = a[n]
for i in reversed(range(n)):
    if (c[i + 1] + 1) // 2 + a[i] + b[i] > two_pow[i]:
        is_possible = False
        break
    c[i] = min(c[i + 1], two_pow[i] - a[i] - b[i]) + a[i]
    ans += c[i]

# print(a)
# print(b)
# print(c)

if is_possible:
    print(ans)
else:
    print(-1)


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

is_possible = True
for i in range(n):
    if a[i] > 2**i - 1:
        is_possible = False
        break
if a[n] > 2**n:
    is_possible = False

s = 0
for i in range(n + 1):
    s += a[i] * (2**(n - i))
if s > 2**n:
    is_possible = False

b = [0] * (n + 1)
for i in range(n):
    b[i + 1] = (a[i] + b[i]) * 2

c = [0] * (n + 1)
c[n] = a[n]
ans = a[n]
for i in reversed(range(n)):
    if (c[i + 1] + 1) // 2 + a[i] + b[i] > 2**i:
        is_possible = False
        break
    c[i] = min(c[i + 1], 2**i - a[i] - b[i]) + a[i]
    ans += c[i]

# print(a)
# print(b)
# print(c)

if is_possible:
    print(ans)
else:
    print(-1)

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

is_possible = True
for i in range(n):
    if a[i] > 2**i - 1:
        is_possible = False
        break
if a[n] > 2**n:
    is_possible = False

s = 0
for i in range(n + 1):
    s += a[i] * (2**(n - i))
if s > 2**n:
    is_possible = False

b = [0] * (n + 1)
for i in range(n):
    b[i + 1] = (a[i] + b[i]) * 2

c = [0] * (n + 1)
c[n] = a[n]
ans = a[n]
for i in reversed(range(n)):
    if (c[i + 1] + 1) // 2 + a[i] + b[i] > 2**i:
        is_possible = False
        break
    c[i] = min(c[i + 1], 2**i - a[i] - b[i]) + a[i]
    ans += c[i]

# print(a)
# print(b)
# print(c)

if is_possible:
    print(ans)
else:
    print(-1)


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

is_possible = True
for i in range(n):
    if a[i] > 2**i - 1:
        is_possible = False
        break
if a[n] > 2**n:
    is_possible = False

s = 0
for i in range(n + 1):
    s += a[i] * (2**(n - i))
if s > 2**n:
    is_possible = False

b = [0] * (n + 1)
for i in range(n):
    b[i + 1] = (a[i] + b[i]) * 2

c = [0] * (n + 1)
c[n] = a[n]
ans = a[n]
for i in reversed(range(n)):
    if (c[i + 1] + 1) // 2 + a[i] + b[i] > 2**i:
        is_possible = False
        break
    c[i] = min(c[i + 1], 2**i - a[i] - b[i]) + a[i]
    ans += c[i]

# print(a)
# print(b)
# print(c)

if is_possible:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n, k = map(int, input().split())
a = list(map(lambda x: int(x) - 1, input().split()))

now = 0
while k > 0:
    if k & 1:
        now = a[now]

    a_next = [-1] * n
    for i in range(n):
        a_next[i] = a[a[i]]

    a = copy.copy(a_next)
    k = k >> 1

ans = now + 1
print(ans)


Fixed submission:
n, k = map(int, input().split())
a = list(map(lambda x: int(x) - 1, input().split()))

loop = [0]
s = {0}
while a[loop[-1]] not in s:
    s.add(a[loop[-1]])
    loop.append(a[loop[-1]])

idx = loop.index(a[loop[-1]])
# print(idx, loop)

if k < len(loop):
    ans = loop[k] + 1
else:
    ans = loop[(k - idx) % (len(loop) - idx) + idx] + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]


def func(x):
    ret = []
    for i in range(len(x)):
        if len(ret) == 0:
            ret.append(x[i])
        else:
            if ret[-1] == '(' and x[i] == ')':
                ret.pop()
            else:
                ret.append(x[i])
    l = r = 0
    for i in range(len(ret)):
        if ret[i] == '(':
            l += 1
        else:
            r += 1
    return (r, l)  # ) (


t = []
for i in range(n):
    r, l = func(s[i])
    # print((r, l), '<-', s[i])
    if r + l == 0:
        continue
    t.append((r, l))
t.sort()
# print(*t, sep='\n')

is_possible = True
r, l = t[0]
if r != 0:
    is_possible = False
else:
    for i in range(1, len(t)):
        r_i, l_i = t[i]
        if r_i <= l:
            l -= r_i
            l += l_i
        else:
            is_possible = False
    if l != 0:
        is_possible = False

ans = 'Yes' if is_possible else 'No'
print(ans)


Fixed submission:
n = int(input())
s = [input() for _ in range(n)]


def bracket(x):
    # f: final sum of brackets '(':+1, ')': -1
    # m: min value of f
    f = m = 0
    for i in range(len(x)):
        if x[i] == '(':
            f += 1
        else:
            f -= 1
        m = min(m, f)
    # m <= 0
    return f, m


def func(l):
    # l = [(f, m)]
    l.sort(key=lambda x: -x[1])
    v = 0
    for fi, mi in l:
        if v + mi >= 0:
            v += fi
        else:
            return -1
    return v


l1 = []
l2 = []
for i in range(n):
    fi, mi = bracket(s[i])
    if fi >= 0:
        l1.append((fi, mi))
    else:
        l2.append((-fi, mi - fi))

v1 = func(l1)
v2 = func(l2)
if v1 == -1 or v2 == -1:
    ans = 'No'
else:
    ans = 'Yes' if v1 == v2 else 'No'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def get_divisor(n: int) -> list:
    divisor = []
    for i in range(1, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            divisor.append(i)
            if n // i != i:
                divisor.append(n // i)
    # divisor.sort() # if you want sorted divisors
    return divisor


x = int(input())
cand = get_divisor(x)
# print(cand)
for d in cand:
    a = d
    b = 0
    while a**5 - b**5 < x:
        a += 1
        b += 1
    if a**5 - b**5 == x:
        print(a, b)
        break

    is_found = False
    for i in range(1, d):
        a = i
        b = i - d
        if a**5 - b**5 == x:
            print(a, b)
            is_found = True
            break
    if is_found:
        break

    a = 0
    b = -d
    while a**5 - b**5 < x:
        a -= 1
        b -= 1
    if a**5 - b**5 == x:
        print(a, b)
        break


Fixed submission:
def get_divisor(n: int) -> list:
    divisor = []
    for i in range(1, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            divisor.append(i)
            if n // i != i:
                divisor.append(n // i)
    # divisor.sort() # if you want sorted divisors
    return divisor


x = int(input())
cand = get_divisor(x)
# print(cand)
for d in cand:
    if d**5 == x:
        print(d, 0)
    elif d**5 < x:
        a = d
        b = 0
        while a**5 - b**5 < x:
            a += 1
            b += 1
        if a**5 - b**5 == x:
            print(a, b)
            break

        a = 0
        b = -d
        while a**5 - b**5 < x:
            a -= 1
            b -= 1
        if a**5 - b**5 == x:
            print(a, b)
            break
    else:
        if d % 2 == 0 and (d // 2)**5 + (d // 2)**5 > x:
            continue
        if d % 2 == 1 and ((d + 1) // 2)**5 + (d // 2)**5 > x:
            continue
        a = d
        b = 0
        while a**5 - b**5 > x:
            a -= 1
            b -= 1
            # print(a, b, a**5 - b**5)
        if a**5 - b**5 == x:
            print(a, b)
            break

        a = 0
        b = -d
        while a**5 - b**5 > x:
            a += 1
            b += 1
        if a**5 - b**5 == x:
            print(a, b)
            break
Buggy python submission (verdict: Runtime Error):
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
cond = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    a -= 1
    b -= 1
    cond.append((a, b, c, d))


def calc(l):
    score = 0
    for a, b, c, d in cond:
        if l[b] - l[a] == c:
            score += d
    return score


ans = 0
l = [0] * n
l[0] = 1


def dfs(l_len):
    if l_len == n:
        ans = max(ans, calc(l))
        return

    for i in range(l[l_len - 1], m + 1):
        l[l_len] = i
        dfs(l_len + 1)


dfs(0)
print(ans)


Fixed submission:
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
cond = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    a -= 1
    b -= 1
    cond.append((a, b, c, d))


def calc(l):
    score = 0
    for a, b, c, d in cond:
        if l[b] - l[a] == c:
            score += d
    return score


ans = 0
for l in combinations_with_replacement(range(1, m + 1), n):
    cand = calc(l)
    ans = max(ans, cand)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from copy import copy
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

n = int(input())
a = list(map(int, input().split()))

graph = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

ans = [0] * n


def dfs(v, v_p, dp):
    # print(v, v_p, dp)
    ans[v] = len(dp)
    for v_next in graph[v]:
        if v_next == v_p:
            continue

        # print(dp)
        dp2 = copy(dp)
        if a[v_next] > dp2[-1]:
            dp2.append(a[v_next])
            dfs(v_next, v, dp2)
            dp2 = dp2[:len(dp2) - 1]
        else:
            idx = bisect_left(dp2, a[v_next])
            past = dp2[idx]
            dp2[idx] = a[v_next]
            dfs(v_next, v, dp2)
            dp2[idx] = past


dfs(0, -1, [a[0]])
print(*ans, sep='\n')


Fixed submission:
import sys
from copy import copy
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

n = int(input())
a = list(map(int, input().split()))

graph = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    graph[u].append(v)
    graph[v].append(u)

ans = [0] * n
dp = [float('inf')] * n
dp[0] = a[0]


def dfs(v, v_p, dp_len):
    # print(v, v_p, dp)
    ans[v] = dp_len
    for v_next in graph[v]:
        if v_next == v_p:
            continue

        # print(dp)
        if a[v_next] > dp[dp_len - 1]:
            past = dp[dp_len]
            dp[dp_len] = a[v_next]
            dfs(v_next, v, dp_len + 1)
            dp[dp_len] = past
        else:
            idx = bisect_left(dp, a[v_next])
            # always idx < dp_len
            past = dp[idx]
            dp[idx] = a[v_next]
            dfs(v_next, v, dp_len)
            dp[idx] = past


dfs(0, -1, 1)
print(*ans, sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

k = int(input())
d = {}

ans = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            if (a, b, c) in d:
                ans += d[(a, b, c)]
            else:
                d[(a, b, c)] = gcd(a, gcd(b, c))
                ans += d[(a, b, c)]

print(ans)


Fixed submission:
def GCD(a, b):
    return a if b == 0 else GCD(b, a % b)


k = int(input())

ans = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        ab = GCD(a, b)
        if ab == 1:
            ans += k
            continue
        for c in range(1, k + 1):
            ans += GCD(ab, c)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k, c = map(int, input().split())
s = list(input())
# print(s)

dp = [0] * (n + 1)
for i in reversed(range(n)):
    j = min(i + c + 1, n)
    if s[i] == 'o':
        dp[i] = max(dp[j] + 1, dp[i + 1])
    else:
        dp[i] = max(dp[j], dp[i + 1])

# print(dp)


def check(idx):
    if s[idx] == 'x':
        return False

    s[idx] = 'x'
    dp_ = [0] * (idx + 2)
    dp_[idx + 1] = dp[idx + 1]
    for i in reversed(range(idx + 1)):
        j = min(i + c + 1, idx + 1)
        if s[i] == 'o':
            dp[i] = max(dp[j] + 1, dp[i + 1])
        else:
            dp[i] = max(dp[j], dp[i + 1])
        if dp[i] >= k:
            s[idx] = 'o'
            return False

    s[idx] = 'o'
    return True


for i in range(n):
    if check(i):
        print(i + 1)


Fixed submission:
n, k, c = map(int, input().split())
s = list(input())
# print(s)

dp1 = [0] * (n + 1)
for i in reversed(range(n)):
    j = min(i + c + 1, n)
    if s[i] == 'o':
        dp1[i] = max(dp1[j] + 1, dp1[i + 1])
    else:
        dp1[i] = max(dp1[j], dp1[i + 1])

dp2 = [0] * (n + 1)
for i in range(n):
    j = max(i - c - 1, -1)
    if s[i] == 'o':
        dp2[i] = max(dp2[j] + 1, dp2[i - 1])
    else:
        dp2[i] = max(dp2[j], dp2[i - 1])

# print(dp1)
# print(dp2)


def check(idx):
    if s[idx] == 'x':
        return False

    if dp1[idx + 1] + dp2[idx - 1] >= k:
        return False
    else:
        return True


for i in range(n):
    if check(i):
        print(i + 1)
Buggy python submission (verdict: Runtime Error):
n, x, y = map(int, input().split())
x -= 1
y -= 1

ans = [0] * n
for i in range(n):
    for j in range(i + 1, n):
        d = min(abs(i - j),
                abs(i - x) + 1 + abs(y - j),
                abs(i - y) + 1 + abs(x - j))
        ans[dist[i][j]] += 1

for k in range(1, n):
    print(ans[k])


Fixed submission:
from heapq import heappush, heappop


def dijkstra(graph: list, n: int, v_s: int, INF: int = float('inf')) -> list:
    # graph[v_from] = [v_to, ...]
    dist = [INF] * n

    dist[v_s] = 0
    heap = [(0, v_s)]  # heap = [(dist[v], v), ...]
    while heap:
        _, v_from = heappop(heap)
        for v_to in graph[v_from]:
            dist_cand = dist[v_from] + 1
            if dist_cand < dist[v_to]:
                dist[v_to] = dist_cand
                heappush(heap, (dist[v_to], v_to))
    return dist


n, x, y = map(int, input().split())
x -= 1
y -= 1
g = [[] for _ in range(n)]
for i in range(n):
    if i - 1 >= 0:
        g[i].append(i - 1)
    if i + 1 < n:
        g[i].append(i + 1)
g[x].append(y)
g[y].append(x)

d = [dijkstra(g, n, i) for i in range(n)]
# print(*d, sep='\n')

ans = [0] * n
for i in range(n):
    for j in range(i + 1, n):
        ans[d[i][j]] += 1

for k in range(1, n):
    print(ans[k])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

s = input()
q = int(input())

d = deque(list(s))
for _ in range(q):
    qi = input()
    if len(qi) == 1:
        # query 1
        d.reverse()
    else:
        # query 2
        _, f, c = qi.split()
        if f == '1':
            d.appendleft(c)
        else:
            d.append(c)

ans = ''.join(list(d))
print(ans)


Fixed submission:
from collections import deque

s = input()
q = int(input())
is_reverse = False

d = deque(list(s))
for _ in range(q):
    qi = input()
    if len(qi) == 1:
        # query 1
        is_reverse = not is_reverse
    else:
        # query 2
        _, f, c = qi.split()
        f1 = f == '1'
        if f1 == is_reverse:
            d.append(c)
        else:
            d.appendleft(c)

d = list(d)
if is_reverse:
    d = d[::-1]
ans = ''.join(d)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

s = input()
q = int(input())
is_reverse = False

d = deque(list(s))
for _ in range(q):
    qi = input()
    if len(qi) == 1:
        # query 1
        d.reverse()
    else:
        # query 2
        _, f, c = qi.split()
        if f == '1':
            d.appendleft(c)
        else:
            d.append(c)

ans = ''.join(d)
print(ans)


Fixed submission:
from collections import deque

s = input()
q = int(input())
is_reverse = False

d = deque(list(s))
for _ in range(q):
    qi = input()
    if len(qi) == 1:
        # query 1
        is_reverse = not is_reverse
    else:
        # query 2
        _, f, c = qi.split()
        f1 = f == '1'
        if f1 == is_reverse:
            d.append(c)
        else:
            d.appendleft(c)

d = list(d)
if is_reverse:
    d = d[::-1]
ans = ''.join(d)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
r1, c1, r2, c2 = map(int, input().split())

MOD = 10**9 + 7
MAX = r2 + c2 + 10
fact = [1] * (MAX + 1)  # i!
finv = [1] * (MAX + 1)  # (i!)^{-1}
iinv = [1] * (MAX + 1)  # i^{-1}
for i in range(2, MAX + 1):
    fact[i] = fact[i - 1] * i % MOD
    iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * iinv[i] % MOD


def comb(n: int, k: int) -> int:
    if n < k or n < 0 or k < 0:
        return 0
    return (fact[n] * finv[k] % MOD) * finv[n - k] % MOD


def func(a, b):
    res = 0
    for i in range(a + 1):
        res += comb(i + b + 1, i + 1)
        res %= MOD
    return res


ans = func(r2, c2) - func(r2, c1 - 1) - func(r1 - 1, c2) + func(r1 - 1, c1 - 1)
ans %= MOD
print(ans)


Fixed submission:
r1, c1, r2, c2 = map(int, input().split())

MOD = 10**9 + 7
MAX = r2 + c2 + 10
fact = [1] * (MAX + 1)  # i!
finv = [1] * (MAX + 1)  # (i!)^{-1}
iinv = [1] * (MAX + 1)  # i^{-1}
for i in range(2, MAX + 1):
    fact[i] = fact[i - 1] * i % MOD
    iinv[i] = MOD - iinv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * iinv[i] % MOD


def comb(n: int, k: int) -> int:
    if n < k or n < 0 or k < 0:
        return 0
    return (fact[n] * finv[k] % MOD) * finv[n - k] % MOD


def func(a, b):
    res = 0
    for i in range(a + 1):
        res += comb(i + b + 1, i + 1)
        res %= MOD
    return res


ans = func(r2, c2) - func(r2, c1 - 1) - func(r1 - 1, c2) + func(r1 - 1, c1 - 1)
ans %= MOD
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def GCD(a: int, b: int) -> int:
    return a if b == 0 else GCD(b, a % b)


def LCM(a: int, b: int) -> int:
    return a * b // GCD(a, b)


n, m = map(int, input().split())
a = list(map(lambda x: int(x) // 2, input().split()))

a_lcm = a[0]
for i in range(1, n):
    a_lcm = LCM(a_lcm, a[i])

flag = True
for i in range(n):
    if (a_lcm // a[i]) % 2 == 0:
        flag = False
        break

if flag:
    ans = ((m // a_lcm) + 1) // 2
else:
    ans = 0
print(ans)


Fixed submission:
def GCD(a: int, b: int) -> int:
    return a if b == 0 else GCD(b, a % b)


def LCM(a: int, b: int) -> int:
    return a * b // GCD(a, b)


n, m = map(int, input().split())
a = list(map(lambda x: int(x) // 2, input().split()))

a_lcm = a[0]
for i in range(1, n):
    a_lcm = LCM(a_lcm, a[i])
    if a_lcm > m:
        break

if a_lcm <= m:
    flag = True
    for i in range(n):
        if (a_lcm // a[i]) % 2 == 0:
            flag = False
            break

    if flag:
        ans = ((m // a_lcm) + 1) // 2
    else:
        ans = 0
else:
    ans = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9 + 7
n = int(input())
c = list(map(int, input().split()))
c.sort()

if n > 1:
    ans = 0
    for i in range(n):
        m = (1 << (n - 1)) + (1 << (n - 2)) * (n - 1 - i)
        ans += c[i] * m
        ans %= MOD

    for i in range(n):
        ans *= 2
        ans %= MOD
else:
    ans = c[0] * 2
    ans %= MOD
print(ans)


Fixed submission:
MOD = 10**9 + 7
n = int(input())
c = list(map(int, input().split()))
c.sort()

if n > 1:
    ans = 0
    x = (1 << (n - 1)) % MOD
    y = (1 << (n - 2)) % MOD
    for i in range(n):
        m = x + (y * (n - 1 - i)) % MOD
        m %= MOD
        ans += c[i] * m
        ans %= MOD

    for i in range(n):
        ans *= 2
        ans %= MOD
else:
    ans = c[0] * 2
    ans %= MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
s, t = map(int, input().split())
print(s + t)


Fixed submission:
s, t = input().split()
print(t + s)
Buggy python submission (verdict: Runtime Error):
n, m, v, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()


def check(x):
    if x > n - p:
        return True

    for i in range(x + 1, n - p + 1):
        if a[x] + m < a[i]:
            return False

    if v - x - p > 0:
        cnt = 0
        for i in range(x + 1, n - p + 1):
            cnt += min((a[x] + m) - a[i], m)

        if (cnt // (v - x - p)) >= m:
            return True
        else:
            return False
    else:
        return True


lb = -1  # False
ub = n - 1  # True
while ub - lb > 1:
    mid = (ub + lb) // 2
    if check(mid):
        ub = mid
    else:
        lb = mid

# print(a)
# print(lb, ub)
ans = n - ub
print(ans)


Fixed submission:
n = int(input())


def make3board(x):
    # 3x3のクォリティー2の敷き詰め方
    # aab
    # d.b
    # dcc
    m = x // 3
    base = ["aab", "d.b", "dcc"]
    board = []
    for i in range(m):
        sl = "..." * i
        sr = "..." * (m - 1 - i)
        for bj in base:
            board.append(sl + bj + sr)
    return board


def make4board(x):
    # 4x4のクォリティー3の敷き詰め方
    # aagh
    # bbgh
    # cdee
    # cdff
    m = x // 4
    base = ["aagh", "bbgh", "cdee", "cdff"]
    board = []
    for i in range(m):
        sl = "...." * i
        sr = "...." * (m - 1 - i)
        for bj in base:
            board.append(sl + bj + sr)
    return board


def make5board(x):
    # 5x5のクォリティー3の敷き詰め方
    # aadde
    # bbg.e
    # ccgff
    # ..abc
    # ..abc
    m = x // 5
    base = ["aadde", "bbg.e", "ccgff", "..abc", "..abc"]
    board = []
    for i in range(m):
        sl = "....." * i
        sr = "....." * (m - 1 - i)
        for bj in base:
            board.append(sl + bj + sr)
    return board


def make7board(x):
    # 7x7のクォリティー3の敷き詰め方
    # aabbcc.
    # dd.dd.c
    # ..d..dc
    # ..d..db
    # dd.dd.b
    # ..d..da
    # ..d..da
    m = x // 7
    base = [
        "aabbcc.", "dd.dd.c", "..d..dc", "..d..db", "dd.dd.b", "..d..da",
        "..d..da"
    ]
    return board


def concat_board(board1, board2):
    # クォリティーが同じ２つのboardを対角線上に配置して繋ぐ
    # A..
    # .BB
    # .BB
    x, y = len(board1), len(board2)
    board = []
    sr = '.' * y
    board += [board1[i] + sr for i in range(x)]
    sl = '.' * x
    board += [sl + board2[i] for i in range(y)]
    return board


board = []
if n % 3 == 0:
    board = make3board(n)
elif n % 4 == 0:
    board = make4board(n)
elif n % 5 == 0:
    board = make5board(n)
elif n == 7 or n == 11:
    board7 = [
        "aabbcc.", "dd.dd.c", "..d..dc", "..d..db", "dd.dd.b", "..d..da",
        "..d..da"
    ]
    board = concat_board(board7, make4board(n - 7))
else:
    for x in range(4, n, 4):
        y = n - x
        if y % 5 == 0:
            board = concat_board(make4board(x), make5board(y))
            break

if len(board) != 0:
    print(*board, sep='\n')
else:
    print(-1)