Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
lis = [input() for _ in range(n)]
lis.sort()
choice = list(itertools.combinations(range(n), 3))
count = 0
for ch in choice:
    master = set(['M','A','R','C','H'])
    se = set([lis[ch[0]][0],lis[ch[1]][0],lis[ch[2]][0]])
    #print(master,se,master - se)
    if len(master - se) == 2:
        count += 1
print(count)


Fixed submission:
import collections
import itertools
n = int(input())
li = []
for i in range(n):
    li.append(input()[0])

c = collections.Counter(li)
c_li = [c['M'],c['A'],c['R'],c['C'],c['H']]
#print(li,c,c_li)

count = 0
combination = list(itertools.combinations([0,1, 2, 3,4], 3))
for co in combination:
    tmp = 1
    for c in co:
        if c_li[c] == 0:
            tmp = 0
            break
        tmp *= c_li[c]
    count += tmp
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
lis = [input() for _ in range(n)]
lis.sort()
choice = list(itertools.combinations(range(n), 3))
count = 0
for ch in choice:
    master = ['M','A','R','C','H']
    for c in ch:
        if lis[c][0] in master:
            master.remove(lis[c][0])
        else:
            break
        if len(master) == 2:
            count += 1
print(count)

Fixed submission:
import collections
import itertools
n = int(input())
li = []
for i in range(n):
    li.append(input()[0])

c = collections.Counter(li)
c_li = [c['M'],c['A'],c['R'],c['C'],c['H']]
#print(li,c,c_li)

count = 0
combination = list(itertools.combinations([0,1, 2, 3,4], 3))
for co in combination:
    tmp = 1
    for c in co:
        if c_li[c] == 0:
            tmp = 0
            break
        tmp *= c_li[c]
    count += tmp
print(count)
Buggy python submission (verdict: Runtime Error):
import math
x,y = map(int,input().split())
print(int(math.log2(y/x))+1)

Fixed submission:
import math
x,y = map(int,input().split())
tmp = 1
while x*(2**tmp) <= y:
    tmp += 1
print(tmp)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
s_li = []
for si in s:
    s_li.append(alp.find(si))
t_li = []
for ti in t:
    t_li.append(alp.find(ti))
if max(s_li) < max(t_li):
    print('Yes')
elif max(set(s_li)-set(t_li)) < max(set(t_li)-set(s_li)):
    print('Yes')
elif set(s_li) == set(t_li) and len(s_li) < len(t_li):
    print('Yes')
else:
    print('No')


Fixed submission:
s = input()
t = input()
s_sorted = ''.join(sorted(s))
t_sorted = ''.join(sorted(t, reverse=True))
if s_sorted < t_sorted:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
d_li = list(map(int,input().split()))
d_li.sort()
m = int(input())
t_li = list(map(int,input().split()))
t_li.sort()
for t in t_li:
    ind = bisect.bisect_left(d_li, t)
    if ind > len(d_li) -1:
        print('NO')
        exit()
    if d_li[ind] == t:
        d_li = d_li[ind+1:]
        #print(d_li)
    else:
        print('NO')
        exit()
print('YES')


Fixed submission:
import bisect
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

import collections
d_cnt = collections.Counter(d_li)
t_cnt = collections.Counter(t_li)
#print(d_cnt,t_cnt)

for t in t_cnt.items():
    #print(d_cnt,d_cnt[t[0]],t[1])
    if d_cnt[t[0]] < t[1]:
        print('NO')
        exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
d_li = list(map(int,input().split()))
d_li.sort()
m = int(input())
t_li = list(map(int,input().split()))
t_li.sort()
for t in t_li:
    ind = bisect.bisect_left(d_li, t)
    if ind > len(d_li) -1:
        print('NO')
        exit()
    if d_li[ind] == t:
        d_li = d_li[ind+1:]
        #print(d_li)
    else:
        print('NO')
        exit()
print('YES')

Fixed submission:
import bisect
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

import collections
d_cnt = collections.Counter(d_li)
t_cnt = collections.Counter(t_li)
#print(d_cnt,t_cnt)

for t in t_cnt.items():
    #print(d_cnt,d_cnt[t[0]],t[1])
    if d_cnt[t[0]] < t[1]:
        print('NO')
        exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d_li = list(map(int,input().split()))
d_li.sort()
m = int(input())
t_li = list(map(int,input().split()))
t_li.sort()
for t in t_li:
    if t in d_li:
        d_li.remove(t)
    else:
        print('NO')
        exit()
print('YES')

Fixed submission:
import bisect
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

import collections
d_cnt = collections.Counter(d_li)
t_cnt = collections.Counter(t_li)
#print(d_cnt,t_cnt)

for t in t_cnt.items():
    #print(d_cnt,d_cnt[t[0]],t[1])
    if d_cnt[t[0]] < t[1]:
        print('NO')
        exit()
print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
for i in range(1,3501):
    for j in range(1,3501):
        for k in range(1,3501):
            if 4/n == 1/i+1/j+1/k:
                print(i,j,k)
                exit()

Fixed submission:
a = int(input())
for b in range(1,3501):
    for c in range(1,3501):
        if ((4*b*c)/a)-c-b == 0:
            continue
        k = b*c/(((4*b*c)/a)-c-b)
        if k <= 0:
            continue
        if k == int(k):
            print(b,c,int(k))
            exit()
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
n = int(input())
a_list = [int(input()) for _ in range(n)]
def calc_ans(start_num, count, max_count, all_list):
    ans = all_list[start_num-1]
    if ans == 2:
        print(count)
    elif count == max_count:
        print('-1')
    else:
        calc_ans(ans, count+1, max_count, all_list)
calc_ans(1, 1, n, a_list)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
n = int(input())
a_list = [int(input()) for _ in range(n)]
def calc_ans(start_num, count, max_count, all_list):
    ans = all_list[start_num-1]
    if ans == 2:
        print(count)
    elif count == max_count:
        print('-1')
    else:
        calc_ans(ans, count+1, max_count, all_list)
calc_ans(1, 1, n, a_list)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = [int(input()) for _ in range(n)]
def calc(start_num, count, max_count, all_list):
    ans = all_list[start_num-1]
    if ans == 2:
        print(count)
    elif count == max_count:
        print('-1')
    else:
        calc(ans, count+1, max_count, all_list)
calc(1, 1, n, a_list)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
n = int(input())
a_list = [int(input()) for _ in range(n)]
def calc_ans(start_num, count, max_count, all_list):
    ans = all_list[start_num-1]
    if ans == 2:
        print(count)
    elif count == max_count:
        print('-1')
    else:
        calc_ans(ans, count+1, max_count, all_list)
calc_ans(1, 1, n, a_list)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = [int(input()) for _ in range(n)]
def calc(start_num, count, max_count, all_list):
    ans = all_list[start_num-1]
    if ans == 2:
        print(count)
    elif count == max_count:
        print('-1')
    else:
        calc(ans, count+1, max_count, all_list)
calc(1, 1, n, a_list)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
n = int(input())
a_list = [int(input()) for _ in range(n)]
def calc_ans(start_num, count, max_count, all_list):
    ans = all_list[start_num-1]
    if ans == 2:
        print(count)
    elif count == max_count:
        print('-1')
    else:
        calc_ans(ans, count+1, max_count, all_list)
calc_ans(1, 1, n, a_list)
Buggy python submission (verdict: Runtime Error):
import sys
a,b,c = map(int,input().split())
if a == b == c:
    print(-1)
    sys.eixt()
count = 0
while a%2 == 0 and b%2 == 0 and c%2 == 0:
    x = (b+c)//2
    y = (a+c)//2
    z = (a+b)//2
    a,b,c = x,y,z
    count+=1
    #print(a,b,c)
print(count)

Fixed submission:
import sys
a,b,c = map(int,input().split())
if a == b == c and a%2 == b%2 == c%2== 0:
    print(-1)
    sys.exit()
count = 0
while a%2 == 0 and b%2 == 0 and c%2 == 0:
    x = (b+c)//2
    y = (a+c)//2
    z = (a+b)//2
    a,b,c = x,y,z
    count+=1
    #print(a,b,c)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if kx + ky + kz == s and 0 <= kz <= k:
            count += 1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for kx in range(0, k+1):
    for ky in range(0, k+1):
        kz = s - kx -ky
        if 0 <= kz <= k and kx + ky + kz == s:
            count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
flag = True
if n%2 == 1:
    for i in range(0,n,2):
        if i == 0:
            if li.count(0) != 1:
                flag = False
        else:
            if li.count(i) != 2:
                flag = False
else:
    for i in range(1,n,2):
        if li.count(i) != 2:
            flag = False
if not flag:
    print(0)
    exit()

if n%2 == 1:
    print(2**((n-1)//2))
else:
    print(2**(n//2))

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

c = collections.Counter(li)
#print(c)
# Counter({'a': 4, 'c': 2, 'b': 1})
#print(c.items())
# dict_items([('a', 4), ('b', 1), ('c', 2)])
count_list = list(c.items())
count_list.sort()
keys = set(c.keys())
#print(keys,{i for i in range(n) if i%2 == 1})
#print(count_list)
flag = True
if n%2 == 1:
    if keys != {i for i in range(n) if i%2 == 0}:
        print(0)
        exit()
    for i,c in enumerate(count_list):
        #print(c[0],c[1])
        if c[0] == 0:
            if c[1]!=1:
                flag = False
        else:
            if c[1]!=2:
                flag = False
else:
    if keys != {i for i in range(n) if i%2 == 1}:
        print(0)
        exit()
    for i in count_list:
        if i[1] != 2:
            flag = False
if not flag:
    print(0)
    exit()

ans_tmp = 0
if n%2 == 1:
    ans_tmp = 2**((n-1)//2)
else:
    ans_tmp = 2**(n//2)
print(ans_tmp%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
flag = True
if n%2 == 1:
    for i in range(0,n,2):
        if i == 0:
            if li.count(0) != 1:
                flag = False
        else:
            if li.count(i) != 2:
                flag = False
else:
    for i in range(1,n,2):
        if li.count(i) != 2:
            flag = False
if not flag:
    print(0)
    exit()

if n%2 == 1:
    print(2**((n-1)//2))
else:
    print(2**(n//2))

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

c = collections.Counter(li)
#print(c)
# Counter({'a': 4, 'c': 2, 'b': 1})
#print(c.items())
# dict_items([('a', 4), ('b', 1), ('c', 2)])
count_list = list(c.items())
count_list.sort()
keys = set(c.keys())
#print(keys,{i for i in range(n) if i%2 == 1})
#print(count_list)
flag = True
if n%2 == 1:
    if keys != {i for i in range(n) if i%2 == 0}:
        print(0)
        exit()
    for i,c in enumerate(count_list):
        #print(c[0],c[1])
        if c[0] == 0:
            if c[1]!=1:
                flag = False
        else:
            if c[1]!=2:
                flag = False
else:
    if keys != {i for i in range(n) if i%2 == 1}:
        print(0)
        exit()
    for i in count_list:
        if i[1] != 2:
            flag = False
if not flag:
    print(0)
    exit()

ans_tmp = 0
if n%2 == 1:
    ans_tmp = 2**((n-1)//2)
else:
    ans_tmp = 2**(n//2)
print(ans_tmp%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
count = 0
a_li = []
b_li = []
for i,l in enumerate(li):
    a_li.append([i+1,l])
    b_li.append([l,i+1])
for a in a_li:
    if a in b_li:
        count += 1
print(count//2)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
count = 0
#print(li)
for i,l in enumerate(li):
    #print(i,l-1,li[l-1])
    if li[l-1] == i+1:
        count+= 1
print(count//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
li = []
tmp = []
for i in range(n):
    num = i+1
    t = int(input())
    if t == 0:
        li.append(tmp)
        tmp = []
    else:
        tmp += [num]*t
li.append(tmp)
for l in li:
    ans += len(l)//2
#print(li)
print(ans)

Fixed submission:
n = int(input())
ans = 0
li = []
tmp = 0
for i in range(n):
    t = int(input())
    if t == 0:
        li.append(tmp)
        tmp = 0
    else:
        tmp += t
li.append(tmp)
for l in li:
    ans += l//2
#print(li)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
li = []
tmp = []
for i in range(n):
    num = i+1
    t = int(input())
    if t == 0:
        li.append(tmp)
        tmp = []
    else:
        tmp += [num]*t
li.append(tmp)
for l in li:
    ans += len(l)//2
#print(li)
print(ans)

Fixed submission:
n = int(input())
ans = 0
li = []
tmp = 0
for i in range(n):
    t = int(input())
    if t == 0:
        li.append(tmp)
        tmp = 0
    else:
        tmp += t
li.append(tmp)
for l in li:
    ans += l//2
#print(li)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b = map(int,input().split())
if a > 0:
    print('Positive')
    sys.exit()
if b >= 0:
    print('Zero')
    sys.exit()
minus_count = 0
for i in range(a,b+1):
    if i < 0:
        minus_count += 1
if minus_count%2 == 1:
    print('Negative')
else:
    print('Positive')

Fixed submission:
import sys
a,b = map(int,input().split())
if a > 0:
    print('Positive')
    sys.exit()
if b >= 0:
    print('Zero')
    sys.exit()
if (b-a+1)%2 == 1:
    print('Negative')
else:
    print('Positive')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b = map(int,input().split())
minus_count = 0
for i in range(a,b+1):
    if i == 0:
        print('Zero')
        sys.exit()
    if i < 0:
        minus_count += 1
if minus_count%2 == 1:
    print('Negative')
else:
    print('Positive')

Fixed submission:
import sys
a,b = map(int,input().split())
if a > 0:
    print('Positive')
    sys.exit()
if b >= 0:
    print('Zero')
    sys.exit()
if (b-a+1)%2 == 1:
    print('Negative')
else:
    print('Positive')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b = map(int,input().split())
base = 1
if a > 0 and b > 0:
    print('Positive')
    sys.exit()
for i in range(a,b+1):
    if i == 0:
        print('Zero')
        sys.exit()
    base = base * i
if base > 0:
    print('Positive')
elif base < 0:
    print('Negative')

Fixed submission:
import sys
a,b = map(int,input().split())
if a > 0:
    print('Positive')
    sys.exit()
if b >= 0:
    print('Zero')
    sys.exit()
if (b-a+1)%2 == 1:
    print('Negative')
else:
    print('Positive')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b = map(int,input().split())
base = 1
for i in range(a,b+1):
    if i == 0:
        print('Zero')
        sys.exit()
    base = base * i
if base > 0:
    print('Positive')
elif base < 0:
    print('Negative')

Fixed submission:
import sys
a,b = map(int,input().split())
if a > 0:
    print('Positive')
    sys.exit()
if b >= 0:
    print('Zero')
    sys.exit()
if (b-a+1)%2 == 1:
    print('Negative')
else:
    print('Positive')

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
base = 1
for i in range(a,b+1):
    base = base * i
if base > 0:
    print('Positive')
elif base < 0:
    print('Negative')
else:
    print('Zero')

Fixed submission:
import sys
a,b = map(int,input().split())
if a > 0:
    print('Positive')
    sys.exit()
if b >= 0:
    print('Zero')
    sys.exit()
if (b-a+1)%2 == 1:
    print('Negative')
else:
    print('Positive')
Buggy python submission (verdict: Runtime Error):

import math

alphabets = [chr(i) for i in range(97, 97+26)]

N = int(input())

a = 0
for i in range(1, 12):
    if math.pow(26, i) >= N:
        break
    N -= int(math.pow(26, i))

ans = ''
for j in range(i):
    b = N // int(math.pow(26, i-j-1))
    if i-j != 1:
        ans += alphabets[b]
    else:
        ans += alphabets[b-1]
    N = N % int(math.pow(26, i-j-1))
print(ans)

Fixed submission:
import math

alphabets = [chr(i) for i in range(97, 97+26)]

N = int(input())

def run(n):
    a = 0
    for i in range(1, 12):
        if math.pow(26, i) >= n:
            break
        n -= int(math.pow(26, i))

    ans = ''
    for j in range(i-1):
        b = n // int(math.pow(26, i-j-1))
        amari = n % int(math.pow(26, i-j-1))
        if amari == 0:
            b -= 1
        ans += alphabets[b]
        n = n % int(math.pow(26, i-j-1))
    ans += alphabets[n-1]
    return ans
    
print(run(N))
Buggy python submission (verdict: Runtime Error):
input_count = 0

A, B = input().split()

A = int(A)
if '.' in B:
    B_a = int(B.split('.')[0])
    B_b_size = len(B.split('.')[1])
    B_b =  int(B.split('.')[1])
else:
    B_a = int(B)
    B_b_size = 0
    B_b = 1
ans_a = A * B_a
ans_b = A * math.pow(10, -1*B_b_size) * B_b
ans = ans_a + int(ans_b)
print(ans)


Fixed submission:

import math

A, B = input().split()

A = int(A)
if '.' in B:
    B_a = int(B.split('.')[0])
    B_b_size = len(B.split('.')[1])
    B_b =  int(B.split('.')[1])
else:
    B_a = int(B)
    B_b_size = 0
    B_b = 0
if B_b_size == 0:
    ans = A * B_a
elif B_b_size == 1:
    ans_a = A * B_a
    ans_b = A * B_b 
    ans_b = ans_b // 10
    ans = ans_a + ans_b
else:
    ans_a = A * B_a
    ans_b = A * B_b 
    ans_b = ans_b // 100
    ans = ans_a + ans_b
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C, K = list(map(int, input().split()))

if A >= K:
  print(A)
elif A + B >= K:
  print(A)
else:
  print(A - (K - (A + B)))

Fixed submission:
s = input()
t = input()

if len(s) != len(t) - 1:
  print("No")
elif s != t[:-1]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

dist = {}
for idx, d in enumerate(A):
  dist[idx+1] = d

n = 1
hist = [1]
flag = True
for i in range(K):
  n = dist[n]
  if n in hist:
    flag = False
    break
  hist.append(n)
if flag:
  print(n)
else:
  start = hist.index(n)
  loop = hist[hist.index(n):]
  print(loop[(K - start) % len(loop)])


Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

dist = {}
for idx, d in enumerate(A):
  dist[idx+1] = d

n = 1
hist = [1]
already = {1}
flag = True
for i in range(K):
  n = dist[n]
  if n in already:
    flag = False
    break
  already.add(n)
  hist.append(n)
if flag:
  print(n)
else:
  start = hist.index(n)
  loop = hist[start:]
  print(loop[(K - start) % len(loop)])

Buggy python submission (verdict: Time Limit Exceeded):

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

dist = {}
for idx, d in enumerate(A):
  dist[idx+1] = d

n = 1
hist = [1]
flag = True
for i in range(K):
  n = dist[n]
  if n in hist:
    flag = False
    break
  hist.append(n)
if flag:
  print(n)
else:
  start = hist.index(n)
  loop = hist[hist.index(n):]
  print(loop[(K - start) % len(loop)])


Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

dist = {}
for idx, d in enumerate(A):
  dist[idx+1] = d

n = 1
hist = [1]
already = {1}
flag = True
for i in range(K):
  n = dist[n]
  if n in already:
    flag = False
    break
  already.add(n)
  hist.append(n)
if flag:
  print(n)
else:
  start = hist.index(n)
  loop = hist[start:]
  print(loop[(K - start) % len(loop)])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))

agents = {}
n_pair = 0

for i, a in enumerate(a_list):
  x = i - a
  if x not in agents:
    agents[x] = []
  agents[x].append(i)

for i, a in enumerate(a_list):
  x = i + a
  if x in agents:
    for j in agents[x]:
      if i != j:
        n_pair += 1
print(n_pair)

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

agents = {}
n_pair = 0

for i, a in enumerate(a_list):
  x = i - a
  if x not in agents:
    agents[x] = 0
  agents[x] += 1

for i, a in enumerate(a_list):
  x = i + a
  if x in agents:
    n_pair += agents[x]
print(n_pair)
Buggy python submission (verdict: Runtime Error):
s = int(input())
w = int(input())

if w >= s:
    print('unsafe')
else:
    print('safe')

Fixed submission:
s, w = map(int, input().split())

if w >= s:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
lcm = int(A/math.gcd(A,B) * B)
print(lcm)

Fixed submission:
import fractions
A, B = map(int, input().split())
lcm = int(A/fractions.gcd(A,B) * B)
print(lcm)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)

import math
N, X = map(int, input().split())
Y = list(map(int, input().split()))
ans = abs(Y[0]-X)
for i in range(1,N):
    ans = math.gcd(ans, abs(Y[i]-X))

print(ans)

Fixed submission:
import fractions
N, X = map(int, input().split())
Y = list(map(int, input().split()))
ans = abs(Y[0]-X)
for i in range(1,N):
    ans = fractions.gcd(ans, abs(Y[i]-X))

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
Y = list(map(int, input().split()))
ans = abs(Y[0]-X)
for i in range(1,N):
    ans = math.gcd(ans, abs(Y[i]-X))

print(ans)

Fixed submission:
import fractions
N, X = map(int, input().split())
Y = list(map(int, input().split()))
ans = abs(Y[0]-X)
for i in range(1,N):
    ans = fractions.gcd(ans, abs(Y[i]-X))

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
x = list(map(int, input().split()))
ans = abs(x[0]-X)
for i in range(1,N):
    ans = math.gcd(ans, abs(x[i]-X))

print(ans)

Fixed submission:
import fractions
N, X = map(int, input().split())
Y = list(map(int, input().split()))
ans = abs(Y[0]-X)
for i in range(1,N):
    ans = fractions.gcd(ans, abs(Y[i]-X))

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

N=int(input())
A=Counter(list(map(int,input().split())))
Q=int(input())

import numpy as np
for _ in range(Q):
    B,C=map(int,input().split())
    A[C]+=A[B]
    A[B]=0
    print(sum(np.array(list(A.keys())) * np.array(list(A.values()))))

Fixed submission:
from collections import Counter

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
init=sum(A)
A=Counter(A)

for _ in range(Q):
    B,C=map(int,input().split())
    A[C]+=A[B]
    init=init-(B*A[B])+(C*A[B])
    print(init)
    A[B]=0
Buggy python submission (verdict: Runtime Error):
N=input()
N=N.replace('7')
print('Yes' if len(N)<3 else 'No')

Fixed submission:
N=input()
N=N.replace('7','')
print('Yes' if len(N)<3 else 'No')