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

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()
f = na()
a.sort()
f.sort()

def ok(h, a, f, k):
    n = len(a)
    s = 0
    for i in range(n):
        s += max(0, a[i]-h//f[n-1-i])
    return s <= k


low = -1; high = 2000000000000
while high - low > 1:
    h = high+low>>1
    if ok(h, a, f, k):
        high = h
    else:
        low = h
print(high)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()
f = na()
a.sort()
f.sort()

def ok(h, a, f, k):
    n = len(a)
    s = 0
    for i in range(n):
        s += max(0, a[i]-h//f[n-1-i])
    return s <= k


low = -1; high = 2000000000000
while high - low > 1:
    h = high+low>>1
    if ok(h, a, f, k):
        high = h
    else:
        low = h
print(high)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
a.sort(reverse=True)

for d in range(n):
    for i in range(1<<d):
        if a[i] <= a[i+(1<<i)]:
            print("No")
            sys.exit(0)
print("Yes")


Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
a.sort(reverse=True)

done = [False] * (1<<n)
b = [a[0]]
done[0] = True
for d in range(n):
    j = 0
    for i in range(1<<d):
        while j < 1<<n and (done[j] or b[i] <= a[j]):
            j += 1
        if j == 1<<n:
            print("No")
            sys.exit(0)
        b.append(a[j])
        done[j] = True
    b.sort(reverse=True)
print("Yes")
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

s = 0
for i in range(n):
    s += 1/a[i]
print(f"{1/s:.14f}")


Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

s = 0
for i in range(n):
    s += 1/a[i]
print("{:.14f}".format(1/s))
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
v = na()
v.sort()

s = 0
for i in range(n):
    s = s * 0.5 + v[i]
    if i == 0:
        s += v[i]
print(f"{s*0.5:.14f}")

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
v = na()
v.sort()

s = 0
for i in range(n):
    s = s * 0.5 + v[i]
    if i == 0:
        s += v[i]
print("{:.14f}".format(s*0.5))
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
ab = []
for i in range(n):
    ab.append(na())

ab.sort(key=itemgetter(0))

pq = []
import  heapq

ans = 0
p = 0
for i in range(m+1):
    while p < n and ab[p][0] <= i:
        heapq.heappush(pq, -ab[p][1])
        p += 1

    if len(pq) == 0:
        continue

    ans -= heapq.heappop(pq)

print(ans)


Fixed submission:
import sys
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
ab = []
for i in range(n):
    ab.append(na())

ab.sort(key=itemgetter(0))

pq = []
import  heapq

ans = 0
p = 0
for i in range(m+1):
    while p < n and ab[p][0] <= i:
        heapq.heappush(pq, -ab[p][1])
        p += 1

    if len(pq) == 0:
        continue

    ans -= heapq.heappop(pq)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()

co = []
for i in range(n):
    co.append(na())

co.sort(key=itemgetter(1))
for i in range(n):
    co[i][1] = i

# print(co)
ft = [0] * (n + 5)

co.sort(key=itemgetter(0), reverse=True)

ups = [0] * n
downs = [0] * n

def addfenwick(ft, i, v):
    if v == 0 or i < 0: return
    i += 1
    while i < len(ft):
        ft[i] += v
        i += i&-i

def sumfenwick(ft, i):
    s = 0
    i += 1
    while i > 0:
        s += ft[i]
        i -= i&-i
    return s

for i in range(n):
    c = co[i]
    downs[n-1-i] = sumfenwick(ft, c[1])
    ups[n-1-i] = i - downs[n-1-i]
    addfenwick(ft, c[1], 1)

ft = [0] * (n+5)
co = co[::-1]

ans = 0
mod = 998244353
for i in range(n):
    c = co[i]
    d = sumfenwick(ft, c[1])
    u = i - d

    # print(d, u, ups[i], downs[i])
    ans += (pow(2, d, mod)-1) * (pow(2, ups[i], mod)-1) * pow(2, u+downs[i], mod)
    ans += (pow(2, u, mod)-1) * (pow(2, downs[i], mod)-1) * pow(2, d+ups[i], mod)
    ans -= (pow(2, d, mod)-1) * (pow(2, ups[i], mod)-1) * (pow(2, downs[i], mod)-1) * (pow(2, u, mod)-1)
    ans += pow(2, n-1, mod)
    addfenwick(ft, c[1], 1)

ans %= mod
if ans < 0:
    ans += mod
print(ans)



Fixed submission:
import sys
from operator import itemgetter

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()

co = []
for i in range(n):
    co.append(na())

co.sort(key=itemgetter(1))
for i in range(n):
    co[i][1] = i

# print(co)
ft = [0] * (n + 5)

co.sort(key=itemgetter(0), reverse=True)

ups = [0] * n
downs = [0] * n

def addfenwick(ft, i, v):
    if v == 0 or i < 0: return
    i += 1
    while i < len(ft):
        ft[i] += v
        i += i&-i

def sumfenwick(ft, i):
    s = 0
    i += 1
    while i > 0:
        s += ft[i]
        i -= i&-i
    return s

for i in range(n):
    c = co[i]
    downs[n-1-i] = sumfenwick(ft, c[1])
    ups[n-1-i] = i - downs[n-1-i]
    addfenwick(ft, c[1], 1)

ft = [0] * (n+5)
co = co[::-1]

mod = 998244353
ps = [0] * (n+5)
ps[0] = 1
for i in range(1, n+4):
    ps[i] = ps[i-1] * 2 % mod

ans = 0
for i in range(n):
    c = co[i]
    d = sumfenwick(ft, c[1])
    u = i - d

    # print(d, u, ups[i], downs[i])
    ans += (ps[d]-1) * (ps[ups[i]]-1) * ps[u+downs[i]]
    ans += (ps[u]-1) * (ps[downs[i]]-1) * ps[d+ups[i]]
    ans -= (ps[d]-1) * (ps[ups[i]]-1) * (ps[downs[i]]-1) * (ps[u]-1)
    ans += ps[n-1]
    addfenwick(ft, c[1], 1)

ans %= mod
if ans < 0:
    ans += mod
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

k = ni()
x, y = na()

def go(x, y, k):
    if x < 0:
        res = go(-x, y, k)
        for u in res:
            u[0] = -u[0]
        return res
    if y < 0:
        res = go(x, -y, k)
        for u in res:
            u[1] = -u[1]
        return res

    if (x+y) % 2 == 1 and k % 2 == 0:
        return None

    ops = []
    while x+y >= 2*k and x >= k:
        ops.append([k, 0])
        x -= k
    while x + y >= 2 * k and y >= k:
        ops.append([0, k])
        y -= k
    if (x+y) % k == 0:
        while x >= k:
            ops.append([k, 0])
            x -= k
        while y >= k:
            ops.append([0, k])
            y -= k
        if x > 0 and y > 0:
            ops.append([x, y])
        return ops

    if (x+y) % 2 == 0:
        mid = (x + y) // 2
        if mid <= x:
            ops.append([mid, -(k-mid)])
            ops.append([x-mid, y+(k - mid)])
        else:
            ops.append([x+(k-mid), mid-x])
            ops.append([-(k-mid), y-(mid-x)])
        return ops

    if x >= k:
        ops.append([k, 0])
        res = go(x-k, y, k)
        ops.extend(res)
        return ops

    ops.append([x, k-x])
    res = go(0, y-(k-x), k)
    ops.extend(res)
    return ops

res = go(x, y, k)
if not res:
    print(-1)
    sys.exit(0)

print(len(res))
cx, cy = 0, 0
for o in res:
    cx += o[0]
    cy += o[1]
    print(cx, cy)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

k = ni()
x, y = na()

def go(x, y, k):
    if (x+y) % 2 != 0 and k % 2 == 0:
        return None
    if x < 0:
        res = go(-x, y, k)
        for u in res:
            u[0] = -u[0]
        return res
    if y < 0:
        res = go(x, -y, k)
        for u in res:
            u[1] = -u[1]
        return res

    ops = []
    while x+y >= 2*k and x >= k:
        ops.append([k, 0])
        x -= k
    while x + y >= 2 * k and y >= k:
        ops.append([0, k])
        y -= k
    if (x+y) % k == 0:
        while x >= k:
            ops.append([k, 0])
            x -= k
        while y >= k:
            ops.append([0, k])
            y -= k
        if x > 0 and y > 0:
            ops.append([x, y])
        return ops

    if (x+y) % 2 == 0:
        mid = (x + y) // 2
        if mid <= x:
            ops.append([mid, -(k-mid)])
            ops.append([x-mid, y+(k - mid)])
        else:
            ops.append([x+(k-mid), mid-x])
            ops.append([-(k-mid), y-(mid-x)])
        return ops

    if x >= k:
        ops.append([k, 0])
        res = go(x-k, y, k)
        ops.extend(res)
        return ops

    ops.append([x, k-x])
    res = go(0, y-(k-x), k)
    ops.extend(res)
    return ops

res = go(x, y, k)
if not res:
    print(-1)
    sys.exit(0)

print(len(res))
cx, cy = 0, 0
for o in res:
    cx += o[0]
    cy += o[1]
    print(cx, cy)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
g = []
for i in range(n):
    g.append([])
for i in range(m):
    u, v = na()
    g[u-1].append(v-1)

s, t = na()
s -= 1;
t -= 1

ds = [[9999999999] * n for i in range(3)]
ds[0][s] = 0

q = Queue()
q.put((0, s))
while not q.empty():
    r, cur = q.get_nowait()
    nr = (r+1) % 3
    for e in g[cur]:
        # print(nr, e)
        if ds[nr][e] > ds[r][cur] + 1:
            ds[nr][e] = ds[r][cur] + 1
            q.put((nr, e))
if ds[0][t] >= 0:
    print(ds[0][t]//3)
else:
    print(-1)


Fixed submission:
import sys
from queue import Queue

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
g = []
for i in range(n):
    g.append([])
for i in range(m):
    u, v = na()
    g[u-1].append(v-1)

s, t = na()
s -= 1;
t -= 1

ds = [[9999999999] * n for i in range(3)]
ds[0][s] = 0

q = Queue()
q.put((0, s))
while not q.empty():
    r, cur = q.get_nowait()
    nr = (r+1) % 3
    for e in g[cur]:
        # print(nr, e)
        if ds[nr][e] > ds[r][cur] + 1:
            ds[nr][e] = ds[r][cur] + 1
            q.put((nr, e))
if ds[0][t] < 99999999:
    print(ds[0][t]//3)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a, b, c, d = na()

def gcd(a, b):
    return a if b == 0 else gcd(b, b%a)

def cou(b, c, d):
    g = gcd(c, d)
    return b - b//c - b//d + b//(c//g*d)

print(cou(b, c, d) - cou(a-1, c, d))

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a, b, c, d = na()

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

def cou(b, c, d):
    g = gcd(c, d)
    return b - b//c - b//d + b//(c//g*d)

print(cou(b, c, d) - cou(a-1, c, d))
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
# last sum
if k > (n-1)*(n-2)//2:
    print("-1")
else:
    cur = (n-1)*(n-2)//2-k
    ps = []
    for i in range(n-1, 1, -1):
        h = i*(i-1)//2
        if cur // h > 0:
            ps.append(*([i]*(cur//h)))
            cur %= h
    assert cur == 0
    es = []
    for i in range(1, n):
        es.append((1, i+1))
    c = 2
    for p in ps:
        for i in range(p):
            for j in range(p):
                if i < j:
                    es.append((c+i, c+j))
        c += p
    print(len(es))
    for e in es:
        print(e[0], e[1])


Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
# last sum
if k > (n-1)*(n-2)//2:
    print("-1")
else:
    es = []
    cur = (n-1)*(n-2)//2-k
    for c in range(2, n+1):
        for d in range(2, n+1):
            if c < d and cur > 0:
                es.append((c, d))
                cur -= 1
    for i in range(1, n):
        es.append((1, i+1))
    print(len(es))
    for e in es:
        print(e[0], e[1])
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

q = ni()

lh = []
hh = []
ln = 0
hn = 0
ls = 0
hs = 0
off = 0
for z in range(q):
    line = na()
    if line[0] == 1:
        _, a, b = line
        off += b

        if len(lh) > 0:
            mid = -lh[0]
            if a <= mid:
                heapq.heappush(lh, -a)
                ls += a
                ln += 1
            else:
                heapq.heappush(hh, a)
                hs += a
                hn += 1
        else:
            heapq.heappush(lh, -a)
            ls += a
            ln += 1

        while ln < hn:
            mx = heapq.heappop(hh)
            hs -= mx
            hn -= 1
            ls += mx
            ln += 1
            heapq.heappush(lh, -mx)

        while ln > hn + (ln+hn)%2:
            mx = -heapq.heappop(lh)
            ls -= mx
            ln -= 1
            heapq.heappush(hh, mx)
            hs += mx
            hn += 1
    else:
        lls = -lh[0]*ln - ls
        hhs = hs - (-lh[0]*hn)
        print(-lh[0], lls+hhs+off)

Fixed submission:
import sys
import heapq

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

q = ni()

lh = []
hh = []
ln = 0
hn = 0
ls = 0
hs = 0
off = 0
for z in range(q):
    line = na()
    if line[0] == 1:
        _, a, b = line
        off += b

        if len(lh) > 0:
            mid = -lh[0]
            if a <= mid:
                heapq.heappush(lh, -a)
                ls += a
                ln += 1
            else:
                heapq.heappush(hh, a)
                hs += a
                hn += 1
        else:
            heapq.heappush(lh, -a)
            ls += a
            ln += 1

        while ln < hn:
            mx = heapq.heappop(hh)
            hs -= mx
            hn -= 1
            ls += mx
            ln += 1
            heapq.heappush(lh, -mx)

        while ln > hn + (ln+hn)%2:
            mx = -heapq.heappop(lh)
            ls -= mx
            ln -= 1
            heapq.heappush(hh, mx)
            hs += mx
            hn += 1
    else:
        lls = -lh[0]*ln - ls
        hhs = hs - (-lh[0]*hn)
        print(-lh[0], lls+hhs+off)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
pys = []
for i in range(m):
    x = na()
    x = [x[0], x[1], i]
    pys.append(x)

pys.sort()
pp = -1
lid = 0
ans = [0] * m
for i in range(m):
    if pys[i][0] == pp:
        lid += 1
    else:
        lid = 1
    ans[pys[i][2]] = pys[i][0] * 1000000 + lid
    pp = pys[i][0]
for v in ans:
    print(f"{v:012d}")


Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
pys = []
for i in range(m):
    x = na()
    x = [x[0], x[1], i]
    pys.append(x)

pys.sort()
pp = -1
lid = 0
ans = [0] * m
for i in range(m):
    if pys[i][0] == pp:
        lid += 1
    else:
        lid = 1
    ans[pys[i][2]] = pys[i][0] * 1000000 + lid
    pp = pys[i][0]
for v in ans:
    print("{:012d}".format(v))
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
def tr(x):
    if "DEBUG" in globals(): sys.stderr.write(f"{x}\n")

x = ni()
if x == 1:
    print("Hello World")
else:
    a, b = na()
    print(a+b)


Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

x = ni()
if x == 1:
    print("Hello World")
else:
    a = ni()
    b = ni()
    print(a+b)

Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
def tr(x):
    if "DEBUG" in globals(): sys.stderr.write(f"{x}\n")

x = ni()
if x == 1:
    print("Hello World")
else:
    a = ni()
    b = ni()
    print(a+b)
    

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

x = ni()
if x == 1:
    print("Hello World")
else:
    a = ni()
    b = ni()
    print(a+b)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces
def tr(x):
    if "DEBUG" in globals(): sys.stderr.write(f"{x}\n")

n, t = na()

mincost = 99999999999999
for i in range(n):
    c, u = na()
    if u <= t:
        mincost = min(mincost, c)

if mincost == 99999999999999:
    print("TLE")
else:
    print(mincost)


Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, t = na()

mincost = 99999999999999
for i in range(n):
    c, u = na()
    if u <= t:
        mincost = min(mincost, c)

if mincost == 99999999999999:
    print("TLE")
else:
    print(mincost)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []
for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 99999999
for i in range(1<<D):
    ct = 0
    score = 0
    for j in range(D):
        if i>>j&1:
            score += c[j]
            score += p[j] * (j+1) * 100
            ct += p[j]
    while score < G:
        for j in range(D-1, -1, -1):
            if i>>j&1: continue
            for k in range(p[j]):
                if score < G:
                    score += (j+1)*100
                    ct += 1
    ans = min(ans, ct)
print(ans)


Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []
for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 99999999
for i in range(1<<D):
    ct = 0
    score = 0
    for j in range(D):
        if i>>j&1:
            score += c[j]
            score += p[j] * (j+1) * 100
            ct += p[j]
    for j in range(D-1, -1, -1):
        if i>>j&1: continue
        if score >= G: break
        g = (j+1)*100
        got = (G-score+g-1)//g
        score += min(got, p[j]) * g
        ct += min(got, p[j])
    ans = min(ans, ct)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a = ni()
b = ni()

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

a, b = na()

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")