Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd


n, m = map(int, input().split())
s, t = input(), input()

l = (n * m) // gcd(n, m)
ln, lm = l // n, l // m
for i in range(l):
    if i % ln == i % lm == 0:
        if s[i // ln] != t[i // lm]:
            print(-1)
            break
else:
    print(l)


Fixed submission:
from math import gcd


def lcm(X, Y):  # 最小公倍数
    return (X * Y) // gcd(X, Y)

n, m = map(int, input().split())
s, t = input(), input()

l = lcm(n,m)
ln, lm = l // n, l // m
for i in range(0, l, lcm(ln, lm)):
    if s[i // ln] != t[i // lm]:
        print(-1)
        break
else:
    print(l)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

for i in range(1, int(m**0.5)+1)[::-1]:
    if (m % i == 0):
        if m / i >= n:
            ans = max(ans, i)
        if i >= n:
            ans = max(ans, m // i)
print(ans)


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

ans = 0
for i in range(1, int(m ** 0.5) + 1)[::-1]:
    if (m % i == 0):
        if m / i >= n:
            ans = max(ans, i)
        if i >= n:
            ans = max(ans, m // i)
print(ans)

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

for i in range(m // n + 1)[::-1]:
    if m % i == 0:
        print(i)
        break


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

ans = 0
for i in range(1, int(m ** 0.5) + 1)[::-1]:
    if (m % i == 0):
        if m / i >= n:
            ans = max(ans, i)
        if i >= n:
            ans = max(ans, m // i)
print(ans)
Buggy python submission (verdict: Runtime Error):
from copy import deepcopy

n, m, q = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]

cnt = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
    cnt[l][r] += 1

acc = cnt.deepcopy()
for i in range(n):
    for j in range(n):
        tmp = acc[i][j + 1] + acc[i + 1][j] - acc[i][j]
        acc[i + 1][j + 1] += tmp

for p, q in pq:
    p -= 1
    ans = acc[q][q] - acc[p][q] - acc[q][p] + acc[p][p]
    print(ans)


Fixed submission:
n, m, q = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]

cnt = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
    cnt[l][r] += 1

acc = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n):
    for j in range(n):
        tmp = acc[i][j + 1] + acc[i + 1][j] - acc[i][j]
        acc[i + 1][j + 1] = tmp + cnt[i + 1][j + 1]

for p, q in pq:
    p -= 1
    ans = acc[q][q] - acc[p][q] - acc[q][p] + acc[p][p]
    print(ans)

Buggy python submission (verdict: Runtime Error):
from copy import deepcopy

n, m, q = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]

cnt = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
    cnt[l][r] += 1

acc = cnt.deepcopy()
for i in range(n):
    for j in range(n):
        tmp = acc[i][j + 1] + acc[i + 1][j] - acc[i][j]
        acc[i + 1][j + 1] += tmp

for p, q in pq:
    p -= 1
    ans = acc[q][q] - acc[p][q] - acc[q][p] + acc[p][p]
    print(ans)


Fixed submission:
n, m, q = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]

cnt = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
    cnt[l][r] += 1

acc = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n):
    for j in range(n):
        tmp = acc[i][j + 1] + acc[i + 1][j] - acc[i][j]
        acc[i + 1][j + 1] = tmp + cnt[i + 1][j + 1]

for p, q in pq:
    p -= 1
    ans = acc[q][q] - acc[p][q] - acc[q][p] + acc[p][p]
    print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations

n, c = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]

dcnt = [[0] * c for _ in range(3)]
for i in range(n):
    for j in range(n):
        mod = (i + j) % 3
        dcnt[mod][c[i][j] - 1] += 1

ans = 10 ** 9
for color in permutations(range(c), 3):
    tmp = 0
    for tgt, cnt in zip(color, dcnt):
        tmp += sum(d[i][tgt] * cnt[i] for i in range(c))
    ans = min(ans, tmp)
print(ans)


Fixed submission:
from collections import defaultdict
from itertools import permutations

n, c = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]

dcnt = [defaultdict(int) for _ in range(3)]
for i, ci in enumerate(cmat, 1):
    for j, cij in enumerate(ci, 1):
        mod = (i + j) % 3
        dcnt[mod][cij - 1] += 1

ans = 1000 * n ** 2
for color in permutations(range(c), 3):
    tmp = 0
    for i, cnt in enumerate(dcnt):
        tmp += sum(d[k][color[i]] * cnt[k] for k in cnt)
    ans = min(ans, tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
n, h = map(int, input().split())
a, b = [], []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai), b.append(bi)
a.sort(), b.sort()

ans, amax = 0, a[-1]
for bi in b[::-1]:
    if bi <= amax or h <= 0:
        mod = (h + amax - 1) // amax
        break
    h -= bi
    ans += 1
print(ans + mod if h > 0 else ans)


Fixed submission:
n, h = map(int, input().split())
a, b = [], []
for _ in range(n):
    ai, bi = map(int, input().split())
    a.append(ai), b.append(bi)
a.sort(), b.sort()

ans, amax = 0, a[-1]
for bi in b[::-1]:
    if bi <= amax:
        print(ans + h // amax + (h % amax > 0))
        break
    if h <= 0:
        print(ans)
        break
    h -= bi
    ans += 1
else:
    print(ans + h // amax + (h % amax > 0))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt = {}

for i in a:
    if i in cnt.keys():
        cnt[i] += 1
    else:
        cnt[i] = 1

ans, k = 0, len(cnt) - k
for i in range(len(cnt) + 1):
    if 0 >= k:
        print(ans)
        break
    ans += cnt[i][1]
    k -= 1


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ball = [0]*n

for i in a:
    ball[i - 1] += 1
ball.sort(reverse=True)

ans = 0
if len(ball) > k:
    for i in range(k):
        ans += ball[i]
    ans = n - ans
print(ans)

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

for i in a:
    if i in ball.keys():
        ball[i] += 1
    else:
        ball[i] = 1

ball = sorted(ball.items(), key=lambda x: -x[1])

ans = 0
if len(ball) > k:
    for i in range(k):
        ans += ball[i][1]
    ans = n - ans
print(ans)


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ball = [0]*n

for i in a:
    ball[i - 1] += 1
ball.sort(reverse=True)

ans = 0
if len(ball) > k:
    for i in range(k):
        ans += ball[i]
    ans = n - ans
print(ans)

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

for i in a:
    if i in cnt.keys():
        cnt[i] += 1
    else:
        cnt[i] = 1

cnt = sorted(cnt.items(), key=lambda x: x[1])

ans, k = 0, len(cnt) - k
for i in range(len(cnt) + 1):
    if 0 >= k:
        print(ans)
        break
    ans += cnt[i][1]
    k -= 1


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ball = [0]*n

for i in a:
    ball[i - 1] += 1
ball.sort(reverse=True)

ans = 0
if len(ball) > k:
    for i in range(k):
        ans += ball[i]
    ans = n - ans
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = sorted(list(map(int, input().split())) + [0])

bit, cnt = [0] * 24, 1
for num in d:
    bit[(num - 12) * cnt + 12] += 1
    cnt *= -1

if any(i > 1 for i in bit):
    print(0)
    exit()
ans = [i for i, li in enumerate(bit * 2) if li == 1]
s = min(ans[i] - ans[i - 1] for i in range(1, len(ans)))
print(s)


Fixed submission:
from collections import Counter
from itertools import product


def solve(LIST):
    S = 24
    slvtmp = [i for i, li in enumerate(LIST * 2) if li == 1]
    for i in range(1, len(slvtmp)):
        S = min(S, slvtmp[i] - slvtmp[i - 1])
    return S


n = int(input())
d = Counter(list(map(int, input().split())) + [0])

if any(d[num] > (2 - (num in {0, 12})) for num in d):
    print(0)
    exit()

ans, cnt = [0] * 24, []
for num in d:
    if (num in {0, 12}) and d[num] == 1:
        ans[num] = 1 
    elif d[num] == 2:
        ans[num], ans[24 - num] = 1, 1
    elif d[num] == 1:
        cnt.append(num)

s = 0
if len(cnt) == 0:
    s = max(s, solve(ans))
for bit in product([1, -1], repeat=len(cnt)):
    tmp = ans[:]
    for bi, ci in zip(bit, cnt):
        tmp[(ci - 12) * bi + 12] = 1
    s = max(s, solve(tmp))
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

s = deque(input())

ans = 0
while len(s) > 1:
    if s[0] == s[-1]:
        s.pop()
        s.popleft()
    elif s[0] == 'x':
        s.popleft()
        ans += 1
    elif s[-1] == 'x':
        s.pop()
        ans += 1
    elif s[0] != s[1]:
        print(-1)
        break
else:
    print(ans)


Fixed submission:
from collections import deque

s = deque(input())

ans = 0
while len(s) > 1:
    if s[0] == s[-1]:
        s.pop()
        s.popleft()
    elif s[0] == 'x':
        s.popleft()
        ans += 1
    elif s[-1] == 'x':
        s.pop()
        ans += 1
    else:
        print(-1)
        break
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

for h in range(3501):
    for w in range(3501):
        bns = n * h * w
        bnb = 4 * h * w - n * (h + w)
        if bns % bnb == 0:
            print(h, w, bns // bnb)
            break


Fixed submission:
n = int(input())

for h in range(1, 3501):
    for w in range(1, 3501):
        bns = n * h * w
        bnb = 4 * h * w - n * (h + w)
        if bnb >= 1 and bns % bnb == 0:
            print(h, w, bns // bnb)
            exit()
Buggy python submission (verdict: Runtime Error):
from itertools import product

a, b, c, d, e, f = map(int, input().split())

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt = 0
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)


Fixed submission:
from itertools import product

a, b, c, d, e, f = map(int, input().split())

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt, ans = 0, (max(setw), 0)
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)

Buggy python submission (verdict: Runtime Error):
from itertools import product

a, b, c, d, e, f = map(int, input().split())

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt = 0
for w in setw:
    for s in sets:
        if cnt <= 100 * s / w <= e and s + w <= f:
            cnt = 100 * s / w
            ans = s + w, s
            if s == e * w // 100:
                print(*ans)
                exit()
else:
    print(*ans)


Fixed submission:
from itertools import product

a, b, c, d, e, f = map(int, input().split())

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt, ans = 0, (max(setw), 0)
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

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

b = deque([])
rev = 1
for i in a:
    if rev == 1:
        b.append(i)
        rev = -1
    elif rev == -1:
        b.appendleft(i)
        rev = 1

print(*(b if rev == 1 else b[::-1]))


Fixed submission:
from collections import deque

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

b = deque([])

rev = 1
for i in a:
    if rev == 1:
        b.append(i)
        rev = -1
    elif rev == -1:
        b.appendleft(i)
        rev = 1

b = list(b)
print(*(b if rev == 1 else b[::-1]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n, m = map(int, input().split())
ab = (list(map(int, input().split())) for _ in range(m))

cnt = Counter(sum(ab, []))
ans = all(cnt[i] % 2 == 0 for i in cnt)
print('YES' if ans else 'NO')


Fixed submission:
from collections import defaultdict

n, m = map(int, input().split())
ab = (list(map(int, input().split())) for _ in range(m))

cnt = defaultdict(int)
for a, b in ab:
    cnt[a] += 1
    cnt[b] += 1
ans = all(cnt[i] % 2 == 0 for i in cnt)
print('YES' if ans else 'NO')

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

n, m = map(int, input().split())
ab = (list(map(int, input().split())) for _ in range(m))

cnt = Counter(sum(ab, []))
ans =  all(cnt[i] % 2 == 0 for i in cnt)
print('YES' if ans else 'NO')


Fixed submission:
from collections import defaultdict

n, m = map(int, input().split())
ab = (list(map(int, input().split())) for _ in range(m))

cnt = defaultdict(int)
for a, b in ab:
    cnt[a] += 1
    cnt[b] += 1
ans = all(cnt[i] % 2 == 0 for i in cnt)
print('YES' if ans else 'NO')
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

cnt = 0
for _ in range(n):
    if m >= 2:
        m -= 2
        cnt += 1
for _ in range(m // 4):
    if m >= 4:
        m -= 4
        cnt += 1
print(cnt)


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

cnt = min(n, m // 2)
print(cnt + (m - cnt * 2) // 4)
Buggy python submission (verdict: Runtime Error):
from itertools import product


for bfo2, bfo1 in product(['S', 'W'], repeat=2):
    ans = [bfo2, bfo1]
    for i in s:
        if ((bfo1 == 'S' and i == 'o')
                or (bfo1 == 'W' and i == 'x')):
            ans.append(bfo2)
        elif ((bfo1 == 'S' and i == 'x')
                or (bfo1 == 'W' and i == 'o')):
            ans.append(*({'S', 'W'} - {bfo2}))
        bfo1, bfo2 = ans[-1], bfo1
    if ans[:2] == ans[-2:]:
        print(*ans[1:-1], sep='')
        break
else:
    print(-1)


Fixed submission:
def solve(bfo2, bfo1):
    ans = [bfo2, bfo1]
    for i in s:
        if ((bfo1 == 'S' and i == 'o')
                or (bfo1 == 'W' and i == 'x')):
            ans.append(bfo2)
        else:
            ans.append('S' if bfo2 == 'W' else 'W')
        bfo1, bfo2 = ans[-1], bfo1
    if ans[:2] == ans[-2:]:
        print(*ans[1:-1], sep='')
        exit()


n, s = int(input()), input()

for i in ['S', 'W']:
    for j in ['S', 'W']:
        solve(i, j)
print(-1)
Buggy python submission (verdict: Runtime Error):
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]

l, r, b, t = 0, w, 0, h
for x, y, a in xya:
    if a == 1:
        l = max(x, l)
    elif a == 2:
        r = min(x, r)
    elif a == 3:
        b = max(y, b)
    elif a == 4:
        t = min(y, u)
print(max(0, r - l) * max(0, t - b))


Fixed submission:
w, h, n = map(int, input().split())
xya = [map(int, input().split()) for _ in range(n)]

l, r, b, u = 0, w, 0, h
for x, y, a in xya:
    if a == 1:
        l = max(x, l)
    elif a == 2:
        r = min(x, r)
    elif a == 3:
        b = max(y, b)
    elif a == 4:
        u = min(y, u)
print(max(0,r - l) * max(0,u - b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

ans = 1
for i in range(1, n):
    if t[i] == t[i - 1]:
        ans = ans * t[i] % mod
    if t[i] == a[i]:
        l = i
        break
for i in range(n - 1)[::-1]:
    if a[i] == a[i + 1]:
        ans = ans * a[i] % mod
    if t[i] == a[i]:
        r = i
        break

if n == 1:
    print(int(t == a))
elif t[l] != max(t) or a[r] != max(a):
    print(0)
else:
    print(ans * pow(t[l], max(r - l - 1, 0), mod) % mod)


Fixed submission:
n = int(input())
t = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

ans, l, r = 1, 0, n - 1
for i in range(1, n):
    if t[i] == t[i - 1]:
        ans = ans * t[i] % mod
    if t[i] == a[i]:
        l = i
        break
for i in range(n - 1)[::-1]:
    if a[i] == a[i + 1]:
        ans = ans * a[i] % mod
    if t[i] == a[i]:
        r = i
        break

if t[l] != max(t) or a[r] != max(a) or max(t) != max(a):
    print(0)
else:
    print(ans * pow(t[l], max(r - l - 1, 0), mod) % mod)
Buggy python submission (verdict: Runtime Error):
strin = [input(), input(), input()]
l = ['a','b','c']
cnt, nxt = [0, 0, 0], 0
while True:
    lttr = strin[nxt][cnt[nxt]]
    cnt[nxt] += 1
    if cnt[nxt] >= len(strin[nxt]):
        print(l[nxt].upper())
    nxt = l.index(lttr)


Fixed submission:
strin = [input(), input(), input()]
l = ['a','b','c']
cnt, nxt = [0, 0, 0], 0
while True:
    lttr = strin[nxt][cnt[nxt]]
    cnt[nxt] += 1
    nxt = l.index(lttr)
    if cnt[nxt] >= len(strin[nxt]):
        print(l[nxt].upper())
        break
Buggy python submission (verdict: Time Limit Exceeded):
H, W, K = map(int, input().split())
S = [[int(c) for c in input()] for i in range(H)]

s = [[0 for i in range(W+1)] for j in range(H + 1)]
for i in range(H):
    for j in range(W):
        s[i+1][j+1] = s[i][j+1] + s[i+1][j] - s[i][j] + S[i][j]

n = H - 1
ans = 1 << 30
for i in range(2 ** n):
    horizon = [0]
    for j in range(n):
        if ((i >> j) & 1):
            horizon.append(j + 1)
    horizon.append(H)
    # hori = 横はどこで割るのか？
    y1 = 0
    y2 = 1
    vertical = 0
    length = len(horizon)
    # print("horizon", horizon)
    while (y2 <= W):
        # print(y1, y2)
        for i in range(length - 1):
            x2 = horizon[i + 1]
            x1 = horizon[i]
            sq = s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1]
            # print(sq, K)
            if (sq > K):
                if (y2 == 1):
                    break
                else:
                    vertical += 1
                    y1 = y2 - 1
        y2 += 1
    ans = min(ans, (vertical) + (length - 2))
print(ans)


Fixed submission:
H, W, K = map(int, input().split())
S = [[int(c) for c in input()] for i in range(H)]

s = [[0 for i in range(W+1)] for j in range(H + 1)]
for i in range(H):
    for j in range(W):
        s[i+1][j+1] = s[i][j+1] + s[i+1][j] - s[i][j] + S[i][j]

n = H - 1
ans = H * W
for i in range(2 ** n):
    horizon = [0]
    length = 2
    for j in range(n):
        if ((i >> j) & 1):
            horizon.append(j + 1)
            length += 1
    horizon.append(H)
    vertical = 0
    y1 = 0
    for y2 in range(1, W + 1):
        for k in range(length - 1):
            x2 = horizon[k + 1]
            x1 = horizon[k]
            sq = s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1]
            sq_pre = s[x2][y2 - 1] - s[x1][y2 - 1] - s[x2][y1] + s[x1][y1]

            if(sq > K):
                if(sq_pre > K):
                    vertical = 1e+9
                else:
                    vertical += 1
                    y1 = y2 - 1
                break
    if (vertical >= W):
        vertical = 1e+9
    ans = min(ans, (vertical) + (length - 2))
print(ans)
Buggy python submission (verdict: Runtime Error):
s1 = [input().split()]
s1 = s1[::-1]
print("".join(s1))



Fixed submission:
s1 = input().split()
s1 = s1[::-1]
print("".join(s1))

Buggy python submission (verdict: Runtime Error):
s1 = input()
s2 = input()
s3 = s2 + s1
print(s3)



Fixed submission:
s1 = input().split()
s1 = s1[::-1]
print("".join(s1))

Buggy python submission (verdict: Runtime Error):
s1 = input()
s2 = input()
print(s2 + s1)



Fixed submission:
s1 = input().split()
s1 = s1[::-1]
print("".join(s1))

Buggy python submission (verdict: Runtime Error):
s1 = input()
s2 = input()
print(s2 + s1)

Fixed submission:
s1 = input().split()
s1 = s1[::-1]
print("".join(s1))
Buggy python submission (verdict: Runtime Error):
l = ["Sunny", "Cloudy", "Rainy"]

s = input()

ind = 0
for t in  l:
  if s = t:
    break
  ind += 1
ind %= 2
print(l[ind])

Fixed submission:
l = ["Sunny", "Cloudy", "Rainy"]

s = input()

ind = 0
for t in  l:
  ind += 1
  if s == t:
    break
ind %= 3
print(l[ind])

Buggy python submission (verdict: Runtime Error):
l = ["Sunny", "Cloudy", "Rainy"]

s = input()

ind = 0
for t in  l:
  if s = t:
    break
  ind += 1
ind %= 2
print(l[ind]

Fixed submission:
l = ["Sunny", "Cloudy", "Rainy"]

s = input()

ind = 0
for t in  l:
  ind += 1
  if s == t:
    break
ind %= 3
print(l[ind])
Buggy python submission (verdict: Runtime Error):
N = int(intput())
print(N ** 3)

Fixed submission:
N = int(input())
a = N**3
print(a)

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

print(N ** 3)

Fixed submission:
N = int(input())
a = N**3
print(a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = input()
  
if s < 3200:
  print('red')
else:
  print(s)

Fixed submission:
N = int(input())
s = input()
  
if N < 3200:
  print('red')
else:
  print(s)
Buggy python submission (verdict: Runtime Error):
N = int(intput())
L = list(map(int, input().split())
L_inv = [1/l for l in L]
print(1 / sum(L_inv))

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
L_inv = [1/l for l in L]
print(1 / sum(L_inv))
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().spit())

print(min(b//a, c))


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

print(min(b//a, c))
Buggy python submission (verdict: Runtime Error):
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
    if cur == N:
        return  abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c)
    ret2 = dfs(cur + 1, a, b + l[cur], c)
    ret3 = dfs(cur + 1, a, b, c + l[cur])
    return min(ret0, ret1, ret2, ret3)

print(dfs(ret0, ret1, ret2, ret3))


Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
    if cur == N:
        return  abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))