Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
Lists = map(int,input().split())
sum = 0
for x in Lists:
  sum+=i/x
 
print(1/sum)


Fixed submission:
N = int(input())
Lists = map(int,input().split())
sum = 0
for x in Lists:
  sum+=1/x
 
print(1/sum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
Lists = map(int,input().split())
sum = 0
for x in Lists:
  sum+=i/x
 
print(i/sum)

Fixed submission:
N = int(input())
Lists = map(int,input().split())
sum = 0
for x in Lists:
  sum+=1/x
 
print(1/sum)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
for x in range(N-2):
  for y in range(x+1,x+1):
    for z in range(x+2,x+2):

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
ans = 0
for x in range(n-2):
  for y in range(x+1,x+2):
    for z in range(x+2,x+3):
      if p[x] >= p[y] and p[y] >= p[z]:
        ans+=1
      elif p[z] >= p[y] and p[y] >= p[x]:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
if s[0] == s[1]:
  print(Bad)
elif s[2] == s[1]:
  print(Bad)
elif s[3] == s[2]:
  print(Bab)
else:
  print(Good)

Fixed submission:
s = input()
if s[0] == s[1]:
  print('Bad')
elif s[2] == s[1]:
  print('Bad')
elif s[3] == s[2]:
  print('Bad')
else:
  print('Good')

Buggy python submission (verdict: Runtime Error):
S = input()
if s[0] == s[1] and s[2] == s[1] and s[3] == s[2]:
  print(Bad)
else:
  print(Good)

Fixed submission:
s = input()
if s[0] == s[1]:
  print('Bad')
elif s[2] == s[1]:
  print('Bad')
elif s[3] == s[2]:
  print('Bad')
else:
  print('Good')
Buggy python submission (verdict: Runtime Error):
A,B map(int,input().split())
goukei=3*A+B
print(int(goukei/2))

Fixed submission:
A,B =map(int,input().split())
goukei=3*A+B
print(int(goukei/2))
Buggy python submission (verdict: Runtime Error):
%import numpy as np
c1 = [int(i) for i in input().split()]
c2 = [int(i) for i in input().split()]
c3 = [int(i) for i in input().split()]
s = sum(c1) + sum(c2) + sum(c3)
print('Yes' if s % 3 == 0 else 'No')

Fixed submission:
N = int(input())
A = int(input())
print('Yes' if int(N % 500) <= A else 'No')
Buggy python submission (verdict: Runtime Error):
%import numpy as np
c1 = [int(i) for i in input().split()]
c2 = [int(i) for i in input().split()]
c3 = [int(i) for i in input().split()]
s = sum(c1) + sum(c2) + sum(c3)
print('Yes' if s % 3 == 0 else 'No')

Fixed submission:
import numpy as np
c = np.array([[int(i) for i in input().split()] for _ in range(3)])
b = np.sum(c) % 3 == 0
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
c = c.T
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
print('Yes' if b else 'No')

Buggy python submission (verdict: Runtime Error):
%import numpy as np
c1 = [int(i) for i in input().split()]
c2 = [int(i) for i in input().split()]
c3 = [int(i) for i in input().split()]
s = sum(c1) + sum(c2) + sum(c3)
print(s % 3 == 0)

Fixed submission:
import numpy as np
c = np.array([[int(i) for i in input().split()] for _ in range(3)])
b = np.sum(c) % 3 == 0
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
c = c.T
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
print('Yes' if b else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]+l[j] > l[k]: ans += 1
            else: break
print(ans)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
l = list(reversed(sorted(l)))
ans = 0
for i in range(1,n):
    start = 0
    for j in range(i+1,n):
        l2 = l[i]+l[j]
        for k in range(start, i):
            if l[k] < l2:
                start = k
                ans += i - k
                break
print(ans)
Buggy python submission (verdict: Runtime Error):
num = int(input())
a = list(map(int, input().split()))

count = 0
for i in a:
  c = 0
  while i != 0 and i % 2 == 0:
    i /= 2
    c += 1
  if c >= count:
    count = c
print(count)

Fixed submission:
num = list(input())

count = 0
for i in num:
  if i == '1':
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
num = int(input())
a = list(map(int, input().split()))

count = 0
for i in a:
  c = 0
  while i != 0 and i % 2 == 0:
    i /= 2
    c += 1
  if c <= count or count = 0:
    count = c
print(count)

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

carray = []
for i in a:
  c = 0
  while i != 0 and i % 2 == 0:
    i /= 2
    c += 1
  carray.append(c)
print(min(carray))
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, list(input()))
if a+b+c+d == 7: print(a,"+", b, "+", c, "+", d, sep="")
elif a+b+c-d == 7: print(a,"+", b, "+", c, "-", d, sep="")
elif a+b-c+d == 7: print(a,"+", b, "-", c, "+", d, sep="")
elif a-b+c+d == 7: print(a,"-", b, "+", c, "+", d, sep="")
elif a+b-c-d == 7: print(a,"+", b, "-", c, "-", d, sep="")
elif a-b-c+d == 7: print(a,"-", b, "-", c, "+", d, sep="")
elif a-b+c-d == 7: print(a,"-", b, "+", c, "-", d, sep="")
else: print(a,"-", b, "-", c, "-", d, sep="")1222

Fixed submission:
a, b, c, d = map(int, list(input()))
if a+b+c+d == 7: print(a,"+", b, "+", c, "+", d, "=7", sep="")
elif a+b+c-d == 7: print(a,"+", b, "+", c, "-", d, "=7", sep="")
elif a+b-c+d == 7: print(a,"+", b, "-", c, "+", d, "=7", sep="")
elif a-b+c+d == 7: print(a,"-", b, "+", c, "+", d, "=7", sep="")
elif a+b-c-d == 7: print(a,"+", b, "-", c, "-", d, "=7", sep="")
elif a-b-c+d == 7: print(a,"-", b, "-", c, "+", d, "=7", sep="")
elif a-b+c-d == 7: print(a,"-", b, "+", c, "-", d, "=7", sep="")
else: print(a,"-", b, "-", c, "-", d, "=7", sep="")
Buggy python submission (verdict: Runtime Error):
import math
import sys
a, b, c = map(int, input().split())
lcm = (a * b)//(math.gcd(a,b))
for i in [x*a for x in range(1, lcm+1)]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")


Fixed submission:
import fractions, sys
a, b, c = map(int, input().split())
for i in [x*a for x in range(1, a*b//fractions.gcd(a,b)+1)]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")

Buggy python submission (verdict: Runtime Error):
import math
import sys
a, b, c = map(int, input().split())
lcm = a*b//math.gcd(a,b)
for i in [x*a for x in range(1, lcm+1)]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")


Fixed submission:
import fractions, sys
a, b, c = map(int, input().split())
for i in [x*a for x in range(1, a*b//fractions.gcd(a,b)+1)]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")

Buggy python submission (verdict: Runtime Error):
import math, sys
a, b, c = map(int, input().split())
for i in [x*a for x in range(1, a*b//math.gcd(a,b))]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")


Fixed submission:
import fractions, sys
a, b, c = map(int, input().split())
for i in [x*a for x in range(1, a*b//fractions.gcd(a,b)+1)]:
    if i % b == c:
        print("YES")
        sys.exit()
print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()
while(1):
    print(s)
    if s.endswith('dream'):
        s = s[:-5]
    elif s.endswith('dreamer'):
        s = s[:-7]
    elif s.endswith('eraser'):
        s = s[:-6]
    elif s.endswith('erase'):
        s = s[:-5]
    else:
        print("NO")
        quit()
    if s == '':
        break
print("YES")

Fixed submission:
s = input()
while(1):
    if s.endswith('dream'):
        s = s[:-5]
    elif s.endswith('dreamer'):
        s = s[:-7]
    elif s.endswith('eraser'):
        s = s[:-6]
    elif s.endswith('erase'):
        s = s[:-5]
    else:
        print("NO")
        quit()
    if s == '':
        break
print("YES")
Buggy python submission (verdict: Runtime Error):
n, d = [int(x) for x in input().split()]

for i in range(n):
    if (2 * d + 1) * i >= n:
        ans = i
        break
print(ans)


Fixed submission:
n, d = [int(x) for x in input().split()]

for i in range(n+1):
    if (2 * d + 1) * i >= n:
        ans = i
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for i in range(n)]
m = str(max(A))
ANS = []

for i in range(n):
    if i == A.index(max(A)):
        ans = A[:]
        ans.pop(i)
        ANS.append(str(max(ans)))
    else:
        ANS.append(m)

print('\n'.join(ANS))

Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
B = A[:]
B.sort()

a_max = B[len(B)-1]
a_next = B[len(B)-2]

for i in range(n):
    if A[i] != a_max:
        print(a_max)
    else:
        print(a_next)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for i in range(n)]
m = max(A)

for i in range(n):
    if i == A.index(max(A)):
        ans = A[:]
        ans.pop(i)
        print(max(ans))
    else:
        print(m)


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
B = A[:]
B.sort()

a_max = B[len(B)-1]
a_next = B[len(B)-2]

for i in range(n):
    if A[i] != a_max:
        print(a_max)
    else:
        print(a_next)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for i in range(n)]

for i in range(n):
    ans = A[:]
    ans.pop(i)
    print(max(ans))


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
B = A[:]
B.sort()

a_max = B[len(B)-1]
a_next = B[len(B)-2]

for i in range(n):
    if A[i] != a_max:
        print(a_max)
    else:
        print(a_next)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(x) for x in input().split()]
B = [0] * n

for i in reversed(range(n)):
    if i + 1 > n // 2:
        B[i] = A[i]
        # iの倍数が書かれた箱に入っているボールの個数はOK
    else:
        # iの倍数が書かれた箱に入っているボールの個数
        c = n // (i+1)
        s = 0
        for j in range(c):
            s += B[(i+1)*(j+1)-1]
        if s % 2 == A[i]:
            continue
        else:
            B[i] = 1

print(sum(B))
for i in range(len(B)):
    if B[i] == 1:
        if sum(B[i:]) > 1:
            print(i + 1, end=' ')
        else:
            print(i + 1)



Fixed submission:
n = int(input())
A = [int(x) for x in input().split()]
B = [0] * n

for i in reversed(range(n)):
    if i + 1 > n // 2:
        B[i] = A[i]
        # iの倍数が書かれた箱に入っているボールの個数はOK
    else:
        # iの倍数が書かれた箱に入っているボールの個数
        c = n // (i+1)
        s = 0
        for j in range(c):
            s += B[(i+1)*(j+1)-1]
        if s % 2 == A[i]:
            continue
        else:
            B[i] = 1

ans = sum(B)
print(ans)
count = 0
for i in range(len(B)):
    if B[i] == 1:
        count += 1
        if count == sum:
            print(i + 1)
        else:
            print(i + 1, end=' ')
Buggy python submission (verdict: Runtime Error):
A = [int(input()) for i in range(5)]
B = [A[i] % 10 for i in range(5)]
C = [10 - B[i] for i in range(5) if B[i] != 0]

ans = 0
for i in range(5):
    ans += A[i]
    if B[i]: ans += 10 - B[i]

print(ans - max(C))

Fixed submission:
A = [int(input()) for i in range(5)]
B = [A[i] % 10 for i in range(5)]
C = [10 - B[i] for i in range(5) if B[i] != 0]
if C == []:
    C.append(0)

ans = 0
for i in range(5):
    ans += A[i]
    if B[i]: ans += 10 - B[i]

print(ans - max(C))
Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

A.sort(reverse=True); B.sort(reverse=True); C.sort(reverse=True)

ans = []
for i in A:
    for j in B:
        for l in C:
            ans.append(i+j+l)
ans.sort(reverse=True)

for i in range(k):
    print(ans[i])


Fixed submission:
x, y, z, k = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

A.sort(reverse=True); B.sort(reverse=True); C.sort(reverse=True)

ans = []
for i in A:
    for j in B:
        ans.append(i+j)
ans.sort(reverse=True)
ans = ans[:k]
ans1 = []
for i in C:
    for j in ans:
        ans1.append(i+j)
ans1.sort(reverse=True)
for i in range(k):
    print(ans1[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, q = [int(x) for x in input().split()]
s = input()

for i in range(q):
    l, r = [int(x) for x in input().split()]
    t = s[l-1:r]
    print(t.count('AC'))


Fixed submission:
import bisect

n, q = [int(x) for x in input().split()]
s = input()

index = []
for i in range(len(s)-1):
    if s[i:i+2] == 'AC':
        index.append(i)

for i in range(q):
    l, r = [int(x) for x in input().split()]
    print(bisect.bisect_right(index, r-2) - bisect.bisect_left(index, l-1))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = 0
while '01' in s or '10' in s:
    s_next = s.replace('01', '')
    ans += len(s) - len(s_next)
    s = s_next
    s_next = s.replace('10', '')
    ans += len(s) - len(s_next)
    s = s_next
print(ans)


Fixed submission:
s = input()

ans = 0

s_0 = s.replace('0', '')
n_0 = len(s) - len(s_0)
s_1 = s.replace('1', '')
n_1 = len(s) - len(s_1)

print(2 * min(n_0, n_1))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import bisect

a, b, q = [int(x) for x in input().split()]
s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
#x = [int(input()) for i in range(q)]

s_que = deque(s)
s_que.appendleft(-10 ** 12)
s_que.append(10 ** 12)

t_que = deque(t)
t_que.appendleft(-10 ** 12)
t_que.append(10 ** 12)

for i in range(q):
    x = int(input())
    k = bisect.bisect_left(s_que, x)
    sb = s_que[k]
    sa = s_que[k-1]
    j = bisect.bisect_left(t_que, x)
    tb = t_que[j]
    ta = t_que[j-1]

    y = []
    for h in [sa, sb]:
        for g in [ta, tb]:
            y.append(abs(x-h) + abs(h-g))
    for h in [ta, tb]:
        for g in [sa, sb]:
            y.append(abs(x-h) + abs(h-g))

    print(min(y))


Fixed submission:
#from collections import deque
import bisect

a, b, q = [int(x) for x in input().split()]
s = [-10**12] + [int(input()) for i in range(a)] + [10**12]
t = [-10**12] + [int(input()) for i in range(b)] + [10**12]
#x = [int(input()) for i in range(q)]

#s_que = deque(s)
#s_que.appendleft(-10 ** 12)
#s_que.append(10 ** 12)

#t_que = deque(t)
#t_que.appendleft(-10 ** 12)
#t_que.append(10 ** 12)

for i in range(q):
    x = int(input())
    k = bisect.bisect_left(s, x)
    sb = s[k]
    sa = s[k-1]
    j = bisect.bisect_left(t, x)
    tb = t[j]
    ta = t[j-1]

    y = []
    for h in [sa, sb]:
        for g in [ta, tb]:
            y.append(abs(x-h) + abs(h-g))
    for h in [ta, tb]:
        for g in [sa, sb]:
            y.append(abs(x-h) + abs(h-g))

    print(min(y))

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

a, b, q = [int(x) for x in input().split()]
s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
x = [int(input()) for i in range(q)]

s_que = deque(s)
s_que.appendleft(-10 ** 12)
s_que.append(10 ** 12)

t_que = deque(t)
t_que.appendleft(-10 ** 12)
t_que.append(10 ** 12)

for i in x:
    k = bisect.bisect_left(s_que, i)
    sb = s_que[k]
    sa = s_que[k-1]
    j = bisect.bisect_left(t_que, i)
    tb = t_que[j]
    ta = t_que[j-1]

    y = []
    for h in [sa, sb]:
        for g in [ta, tb]:
            y.append(abs(i-h) + abs(h-g))
    for h in [ta, tb]:
        for g in [sa, sb]:
            y.append(abs(i-h) + abs(h-g))

    print(min(y))


Fixed submission:
#from collections import deque
import bisect

a, b, q = [int(x) for x in input().split()]
s = [-10**12] + [int(input()) for i in range(a)] + [10**12]
t = [-10**12] + [int(input()) for i in range(b)] + [10**12]
#x = [int(input()) for i in range(q)]

#s_que = deque(s)
#s_que.appendleft(-10 ** 12)
#s_que.append(10 ** 12)

#t_que = deque(t)
#t_que.appendleft(-10 ** 12)
#t_que.append(10 ** 12)

for i in range(q):
    x = int(input())
    k = bisect.bisect_left(s, x)
    sb = s[k]
    sa = s[k-1]
    j = bisect.bisect_left(t, x)
    tb = t[j]
    ta = t[j-1]

    y = []
    for h in [sa, sb]:
        for g in [ta, tb]:
            y.append(abs(x-h) + abs(h-g))
    for h in [ta, tb]:
        for g in [sa, sb]:
            y.append(abs(x-h) + abs(h-g))

    print(min(y))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
z = []
for i in range(n):
    x, y = [int(x) for x in input().split()]
    z.append([x, y])
    z.sort(reverse=True)

a = []
b = []
for i in range(n // 2):
    a.append(z[2 * i][0])
    b.append(z[2 * i + 1][1])
if n % 2 == 1:
    a.append(z[len(z) - 1][0])

print(sum(a) - sum(b))


Fixed submission:
n = int(input())
#z = [[int(x) for x in input().split()] for i in range(n)]
z = []
t = 0
for i in range(n):
    x, y = [int(x) for x in input().split()]
    t += y
    z.append(x + y)
z.sort(reverse=True)

s = 0
for i in range(n // 2):
    s += z[2 * i]
if n % 2 == 1:
    s += z[len(z) - 1]

print(s - t)

#アルゴリズムが間違っている

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    x, y = [int(x) for x in input().split()]
    a.append([x, y])
    a.sort(reverse=True)

b = 0
for i in range(n // 2):
    b += a[2 * i][0] - a[2 * i + 1][1] 
if n % 2 == 1:
    b += a[len(a) - 1][0]

print(b)


Fixed submission:
n = int(input())
#z = [[int(x) for x in input().split()] for i in range(n)]
z = []
t = 0
for i in range(n):
    x, y = [int(x) for x in input().split()]
    t += y
    z.append(x + y)
z.sort(reverse=True)

s = 0
for i in range(n // 2):
    s += z[2 * i]
if n % 2 == 1:
    s += z[len(z) - 1]

print(s - t)

#アルゴリズムが間違っている
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
   return map(int, stdin.readline().split())
lines = stdin.readlines()

a = input()
b = input()
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
   print("YES")
else:
   print("NO")

Fixed submission:
#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
   return map(int, stdin.readline().split())
#lines = stdin.readlines()

a = input()
b = input()
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
   print("YES")
else:
   print("NO")
Buggy python submission (verdict: Runtime Error):
import collections
import sys
import itertools
from tqdm import tqdm
from pprint import pprint

def read_a_integer():
    return int(sys.stdin.readline())

def read_a_list(dtype):
    return list(map(dtype, sys.stdin.readline().split()))

def brute_force(N, D):
    def get_distance(G):
        queue = collections.deque()
        queue.append(1)
        distance = [-1] * N
        distance[0] = 0

        while queue:
            u = queue.popleft()
            for v in G[u]:
                if distance[v-1] == -1:
                    distance[v-1] = distance[u-1] + 1
                    queue.append(v)
        return distance

    ans = 0
    all_edges = [(u, v) for u in range(1, N+1) for v in range(1+u, N+1)]
    for graph in tqdm(itertools.combinations(all_edges, N - 1)):
        G = collections.defaultdict(list)
        # print(graph)
        # graph = [(1,4),(1,7),(3,4),(4,5),(4,6),(2,3)]
        for u, v in graph:
            G[u].append(v)
            G[v].append(u)
        # print(G)
        # exit(0)
        distance = get_distance(G)
        # print(distance)
        if distance == D:
            ans += 1
            print("-" * 50)
            pprint(G)
            print("-" * 50)
        # break
    print(ans)


def main():
    N = read_a_integer()
    D = read_a_list(int)
    if D[0] != 0:
        print(0)
        return
    counter = collections.Counter(D)
    if counter[0] != 1:
        print(0)
        return
    max_D = max(D)
    ans = 1
    for i in range(2, max_D + 1):
        if i not in counter:
            print(0)
            return
        ans = (ans * (counter[i-1] ** counter[i])) % 998244353
    print(ans)
    # brute_force(N, D)

        


if __name__ == "__main__":
    main()


Fixed submission:
import collections
import sys
def read_a_integer():
    return int(sys.stdin.readline())

def read_a_list(dtype):
    return list(map(dtype, sys.stdin.readline().split()))


def main():
    N = read_a_integer()
    D = read_a_list(int)
    if D[0] != 0:
        print(0)
        return
    counter = collections.Counter(D)
    if counter[0] != 1:
        print(0)
        return
    max_D = max(D)
    ans = 1
    for i in range(2, max_D + 1):
        if i not in counter:
            print(0)
            return
        ans = (ans * (counter[i-1] ** counter[i])) % 998244353
    print(ans)
    # brute_force(N, D)

        


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys


def check(A, B):
    if A > 8 or B > 8:
        return False
    return True


ret = check(
    int(sys.stdin.readline()),
    int(sys.stdin.readline()))
if ret:
    print('Yay!')
else:
    print(':(')

Fixed submission:
import sys


def check(A, B):
    if A > 8 or B > 8:
        return False
    return True


ret = check(*tuple(map(int, sys.stdin.readline().split())))
if ret:
    print('Yay!')
else:
    print(':(')

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


def check(A, B):
    if A > 8 or B > 8:
        return False
    return True


ret = check(
    int(sys.stdin.readline()),
    int(sys.stdin.readline()))
if ret:
    print('Yay!')
else:
    print(':(')

Fixed submission:
import sys


def check(A, B):
    if A > 8 or B > 8:
        return False
    return True


ret = check(*tuple(map(int, sys.stdin.readline().split())))
if ret:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
import sys

a, b = tuple([int(x)for x in sys.stdin.readline().split()])
diff = max(a, b) - min(a, b)

c = 0
for i in range(1, 1000):
    if diff == i:
        print(c - a)
        break
    c += i

Fixed submission:
import sys

N = int(sys.stdin.readline())                                                                                                                                                        
if N < 1000:
    print('ABC')
else:
    print('ABD')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from fractions import gcd

X, Y = map(int, sys.stdin.readline().split())
R = 1

while True:
    R *= X
    if R >= 10**18:
        print(-1)
        break
    if R % Y != 0:
        print(R)
        break

Fixed submission:
import sys

def main():
    X, Y = map(int, sys.stdin.readline().split())
    if X == Y:
        print(-1)
        return
    R = 1
    while True:
        R *= X
        if R >= 10**18:
            print(-1)
            return
        if R % Y != 0:
            print(R)
            return

main()