Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

count = 0
if(n < 3):
    print(0)
else:
    r_indexs = []
    g_indexs = []
    b_indexs = []
    for index, char in enumerate(s):
        if char == "R":
            r_indexs.append(index)
        elif char == "G":
            g_indexs.append(index)
        else:
            b_indexs.append(index)

    color_indexs = [r_indexs, g_indexs, b_indexs]

    for col_index in range(3):
        i_indexs_list = color_indexs[col_index]
        tmp_index1 = (col_index+1) % 3
        tmp_index2 = (col_index+2) % 3
        
        j_indexs_list = color_indexs[tmp_index1]
        k_indexs_list = color_indexs[tmp_index2]
        for i in i_indexs_list:
            for j in j_indexs_list:
                if i > j:
                    continue
                for k in k_indexs_list:
                    if i > k or j > k:
                        continue
                    if j-i != k-j:
                        count += 1
        
        j_indexs_list = color_indexs[tmp_index2]
        k_indexs_list = color_indexs[tmp_index1]
        for i in i_indexs_list:
            for j in j_indexs_list:
                if i > j:
                    continue
                for k in k_indexs_list:
                    if i > k or j > k:
                        continue                    
                    if j-i != k-j:
                        count += 1
        

print(count)


Fixed submission:
n = int(input())
s = input()

r_count = s.count('R')
g_count = s.count('G')
b_count = s.count('B')

discount = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        k = i + 2*(j-i)
        if k > n-1:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            discount += 1

print(r_count*g_count*b_count-discount)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

count = 0
if(n < 3):
    print(1)
else:
    for i in range(n-2):
        for j in range(i+1, n-1):
            if s[i] == s[j]:
                continue
            for k in range(j+1, n):
                if s[i] == s[k] or s[j] == s[k]:
                    continue
                if j-i != k-j:
                    count += 1
print(count)

Fixed submission:
n = int(input())
s = input()

r_count = s.count('R')
g_count = s.count('G')
b_count = s.count('B')

discount = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        k = i + 2*(j-i)
        if k > n-1:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            discount += 1

print(r_count*g_count*b_count-discount)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
vote_result_list = sorted(list(map(int,input().split())))[::-1]
border = sum(vote_result_list)/(4*M)
print("Yes" if vote_result_list[M-1] >= border else "No")

Fixed submission:
a,b,c = map(int,input().split())
a,b = b,a
a,c = c,a
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
vote_result_list = sorted(list(map(int,input().split())))[::-1]
border = sum(vote_result_list)//(4*M)
print("Yes" if vote_result_list[M] >= border else "No")

Fixed submission:
N, M = map(int, input().split())
vote_result_list = sorted(list(map(int,input().split())))[::-1]
border = sum(vote_result_list)/(4*M)
print("Yes" if vote_result_list[M-1] >= border else "No")

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
vote_result_list = sorted(list(map(int,input().split())))[::-1]
border = sum(vote_result_list)//(4*M)
print("Yes" if vote_result_list[M] >= border else "No")

Fixed submission:
N, M = map(int, input().split())
vote_result_list = sorted(list(map(int,input().split())))[::-1]
border = sum(vote_result_list)/(4*M)
print("Yes" if vote_result_list[M-1] >= border else "No")
Buggy python submission (verdict: Runtime Error):
def find_7(num):
	num_list = list(map(int, str(num)))
	count = 0
	for x in num_list:
		count += 1
		if x == 7:
			return "Yes"
		elif count == len(num_list):
			return "No"

if __name__ == '__main__':
	print (find_7())

Fixed submission:
num = input()

for x in num:
	if x == '7':
		print ("Yes")
		exit()

print ("No")
Buggy python submission (verdict: Runtime Error):
a, b, c = input().spilt()

if a>=b+c:
  print(0)

else:
  print(b+c-a)

Fixed submission:
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)
if a>=b+c:
    print(0)
     
else:
    print(b+c-a)
Buggy python submission (verdict: Runtime Error):
  GNU nano 4.3                                  main                                   変更済み  
a,b,c=map(int,input().split())
if a == b and a != c:
    print("Yes")
elif a == c and a != b:
    print("Yes")
elif b == c and b != a:
    print("Yes")
else:
    print("No")


Fixed submission:
a,b,c=map(int,input().split())
if a == b and a != c:
    print("Yes")
elif a == c and a != b:
    print("Yes")
elif b == c and b != a:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = input()

def a(N):
	for c in N:
  		if c = "7":
    		return "Yes"
    return "No"
 
print(a(N))

Fixed submission:
N = input()

def a(N):
	for c in N:
		if c == "7":
			return "Yes"
	return "No"
 
print(a(N))
Buggy python submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
Hi = sorted(list(map(int,input().split())))

if N <= K:
    print(0)
else:
    for num in range(K):
        Hi.pop((num+1)*-1)
    print(sum(Hi))

Fixed submission:
N,K = list(map(int,input().split()))
Hi = list(map(int,input().split()))
Hi.sort()
Hi.reverse()

del Hi[:K]
print(sum(Hi))

Buggy python submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
Hi = sorted(list(map(int,input().split())))

if len(Hi) <= K:
    print(0)
else:
    for num in range(K):
        Hi.pop((num+1)*-1)
    print(sum(Hi))

Fixed submission:
N,K = list(map(int,input().split()))
Hi = list(map(int,input().split()))
Hi.sort()
Hi.reverse()

del Hi[:K]
print(sum(Hi))
Buggy python submission (verdict: Runtime Error):
S = input()

def kaibun(string):
    count = 0
    strli = list(string)
    for i in range(len(string)/2):
        if strli[i] == strli [-i-1]:
            continue
        else:
            count += 1
    return count

print(kaibun(S))

Fixed submission:
S = input()

def kaibun(string):
    count = 0
    strli = list(string)
    for i in range(len(string)//2):
        if strli[i] == strli [-i-1]:
            continue
        else:
            count += 1
    return count

print(kaibun(S))
Buggy python submission (verdict: Time Limit Exceeded):
K = input()

#ユーグリッド互除法（再起）
def gcd(p, q):
  # ユーグリッド互除法
  if (p%q==0):
    return q
  else:
    return gcd(q, p%q)

ans = 0

#すべての組合せ(n^3)
abc_list = []
for a in range(1, int(K)+1):
  for b in range(1, int(K)+1):
    for c in range(1, int(K)+1):
        gcd_ab = gcd(a, b)
        gcd_abc = gcd(gcd_ab, c)
        ans += gcd_abc

print(ans)

Fixed submission:
import itertools
K = int(input())

#ユーグリッド互除法（再起）
def gcd(p, q):
  # ユーグリッド互除法
  if (p%q==0):
    return q
  else:
    return gcd(q, p%q)

ans = 0

for abc in itertools.combinations_with_replacement([i+1 for i in range(K)], 3):
  a,b,c = abc
  gcd_ab = gcd(a, b)
  gcd_abc = gcd(gcd_ab, c)

  # 組み合わせ数を補整する
  if a == b == c:
    ans += gcd_abc
  elif a==b or b==c or a==c:
    ans += gcd_abc*3
  else:
    ans += gcd_abc * 6

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K = input()

#すべての組合せをリスト化する
abc_list = []
for a in range(1, int(K)+1):
  for b in range(1, int(K)+1):
    for c in range(1, int(K)+1):
      abc_list.append([a, b, c])

#ユーグリッド互除法（再起）
def gcd(p, q):
  # ユーグリッド互除法
  if (p%q==0):
    return q
  else:
    return gcd(q, p%q)

# 回答
ans = 0
for lis in abc_list:
  a = lis[0]
  b = lis[1]
  c = lis[2]

  gcd_ab = gcd(a, b)
  gcd_abc = gcd(gcd_ab, c)

  ans += gcd_abc

print(ans)

Fixed submission:
import itertools
K = int(input())

#ユーグリッド互除法（再起）
def gcd(p, q):
  # ユーグリッド互除法
  if (p%q==0):
    return q
  else:
    return gcd(q, p%q)

ans = 0

for abc in itertools.combinations_with_replacement([i+1 for i in range(K)], 3):
  a,b,c = abc
  gcd_ab = gcd(a, b)
  gcd_abc = gcd(gcd_ab, c)

  # 組み合わせ数を補整する
  if a == b == c:
    ans += gcd_abc
  elif a==b or b==c or a==c:
    ans += gcd_abc*3
  else:
    ans += gcd_abc * 6

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K = input()

#すべての組合せをリスト化する
abc_list = []
for a in range(1, int(K)+1):
  for b in range(1, int(K)+1):
    for c in range(1, int(K)+1):
      abc_list.append([a, b, c])

#ユーグリッド互除法（再起）
def gcd(A, B):
  # p >= q とする
  if A >= B:
    p = A
    q = B
  else:
    p = B
    q = A
  
  # ユーグリッド互除法
  if (p%q==0):
    return q
  else:
    return gcd(q, p%q)

# 回答
ans = 0
for lis in abc_list:
  a = lis[0]
  b = lis[1]
  c = lis[2]

  gcd_ab = gcd(a, b)
  gcd_abc = gcd(gcd_ab, c)

  ans += gcd_abc

print(ans)

Fixed submission:
import itertools
K = int(input())

#ユーグリッド互除法（再起）
def gcd(p, q):
  # ユーグリッド互除法
  if (p%q==0):
    return q
  else:
    return gcd(q, p%q)

ans = 0

for abc in itertools.combinations_with_replacement([i+1 for i in range(K)], 3):
  a,b,c = abc
  gcd_ab = gcd(a, b)
  gcd_abc = gcd(gcd_ab, c)

  # 組み合わせ数を補整する
  if a == b == c:
    ans += gcd_abc
  elif a==b or b==c or a==c:
    ans += gcd_abc*3
  else:
    ans += gcd_abc * 6

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
rank = list(map(int, input().split()))
rank.sort(reverse=True)
cnt = 0

for r in rank:
  if r >= (sum(rank)//(4*m)):
    cnt += 1
    if cnt = m:
      break

if cnt >= m :
  print('Yes')
else:
  print('No')

Fixed submission:
n, m = map(int, input().split())
rank = list(map(int, input().split()))
rank.sort(reverse=True)
cnt = 0

for r in rank:
  if r >= (sum(rank)/(4*m)):
    cnt += 1
    if cnt >= m:
      break

if cnt >= m :
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import math

K = int(input())
ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):

            ans += math.gcd(math.gcd(a, b), c)

print(ans)

Fixed submission:
import math

K = int(input())
ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):

            ans += math.gcd(math.gcd(a, b), c)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

max_val = max(a)

for i in range(n):
    if max_val > a[i]:
        print(max_val)

    elif max_val == a[i]:
        temp = a[i]
        a[i] = 0
        print(max(a))
        a[i] = temp

Fixed submission:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

max_val = max(a)
max_total = a.count(max_val) - 1

for i in range(n):
    if max_val > a[i]:
        print(max_val)

    elif max_val == a[i] and max_total != 0:
        print(max_val)
        max_total -= 1
    else:
        temp = a[i]
        a[i] = 0
        print(max(a))
        a[i] = temp

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

#print(a)

for i in range(n):
    temp = a[i]
    a[i] = 0
    print(max(a))
    a[i] = temp

Fixed submission:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

max_val = max(a)
max_total = a.count(max_val) - 1

for i in range(n):
    if max_val > a[i]:
        print(max_val)

    elif max_val == a[i] and max_total != 0:
        print(max_val)
        max_total -= 1
    else:
        temp = a[i]
        a[i] = 0
        print(max(a))
        a[i] = temp
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

n, blue = map(int, input().split())

red = n - blue

waru = 10**9+7

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


for i in range(1, blue+1):
    ans = cmb(red+1, i) * cmb(blue-1, i-1)
    print(ans%waru)


Fixed submission:
import sys
sys.setrecursionlimit(100000)

n, blue = map(int, input().split())

red = n - blue

waru = 10**9+7

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for i in range(1, blue+1, 1):
    if red + 1 < i:
        print(0) 
    else:
        ans = cmb(red+1, i) * cmb(blue-1, i-1)
        #print(i)
        print(ans%waru)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

n, blue = map(int, input().split())

red = n - blue

waru = 10**9+7

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


for i in range(1, blue+1):
    ans = cmb(red+1, i) * cmb(blue-1, i-1)
    print(ans%waru)


Fixed submission:
import sys
sys.setrecursionlimit(100000)

n, blue = map(int, input().split())

red = n - blue

waru = 10**9+7

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for i in range(1, blue+1, 1):
    if red + 1 < i:
        print(0) 
    else:
        ans = cmb(red+1, i) * cmb(blue-1, i-1)
        #print(i)
        print(ans%waru)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
ans = []
for i in range(n):
    a, b = map(int,input().split())
    for j in range(b):
        ans.append(a)
#print(ans)

ans.sort()

print(ans[k - 1])

Fixed submission:
n, k = map(int,input().split())
ans = [0]*100000
for i in range(n):
    a, b = map(int,input().split())
    ans[a-1] += b
#print(ans)

counter = 0

while(k > 0):
    k -= ans[counter]
    counter += 1

print(counter)
    
#1
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
b = []
c = []
d = []
for i in range(n):
    temp = list(map(int, input().split()))
    a.append(temp[0])
    b.append(temp[1])


for i in range(m):
    temp = list(map(int, input().split()))
    c.append(temp[0])
    d.append(temp[1])

ans = []

for i in range(n):
    min_dis = 1000
    for j in range(m):

        distance = abs(c[j] - a[i]) + abs(d[j] - b[i])

        #print("学生{}, {} チェックポイント{}, {}".format(a[i], b[i], c[j], d[j]))
        #print("距離番号{} = {}".format(j, distance))
        
        if min_dis > distance:
            min_dis = distance
            min_num = j
            #print("更新")
        
    ans.append(min_num)
    
for i in range(n):
    print(ans[i] + 1)


Fixed submission:
n, m = map(int, input().split())
a = []
b = []
c = []
d = []
for i in range(n):
    temp = list(map(int, input().split()))
    a.append(temp[0])
    b.append(temp[1])


for i in range(m):
    temp = list(map(int, input().split()))
    c.append(temp[0])
    d.append(temp[1])

ans = []

for i in range(n):
    min_dis = 10 ** 9
    for j in range(m):

        distance = abs(c[j] - a[i]) + abs(d[j] - b[i])

        #print("学生{}, {} チェックポイント{}, {}".format(a[i], b[i], c[j], d[j]))
        #print("距離番号{} = {}".format(j, distance))
        
        if min_dis > distance:
            min_dis = distance
            min_num = j
            #print("更新")
        
    ans.append(min_num)
    
for i in range(n):
    print(ans[i] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int,input().split())

c = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i + j + k == S:
                c += 1
                break


print(c)

Fixed submission:
k, s = map(int, input().split())
c = 0

for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            c += 1
print(c)

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

c = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i + j + k == S:
                c += 1

print(c)

Fixed submission:
k, s = map(int, input().split())
c = 0

for i in range(k+1):
    for j in range(k+1):
        z = s - i - j
        if z >= 0 and z <= k:
            c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
n = [int(i+1) for i in range(input())]

total = 0
for i in n:
  	if (n % 3 =! 0) and (n % 5 =! 0):
      	total += i
        
print(total)

Fixed submission:
total = 0
for i in range(int(input())):
  if int((i+1) % 3) != 0:
    if int((i+1) % 5) != 0:
    	total += i+1
        
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
dic = {}
def mygcd(x, y):
    if (x, y) in dic:
        return dic[(x, y)]
    if y == 0:
        dic[(x, y)] = x
        return x
    else:
        res = mygcd(y, x % y) #再帰定義
        dic[(x, y)] = res
        return res
ans = 0
for i in range(K, 0, -1):
    for j in range(K, 0, -1):
        tmp_gcd = mygcd(i, j)
        for k in range(K, 0, -1):
            ans += mygcd(tmp_gcd, k)
print(ans)      

Fixed submission:
import math
K = int(input())
ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            tmp_gcd = math.gcd(i, j)
            tmp_gcd = math.gcd(tmp_gcd, k)
            if i == j == k:
                ans += tmp_gcd
            elif i == j or i == k or j == k:
                ans += tmp_gcd * 3
            else:
                ans += tmp_gcd * 6
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
from fractions import gcd
ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        tmp_gcd = gcd(i, j)
        for k in range(1, K + 1):
            ans += gcd(tmp_gcd, k)
print(ans)

Fixed submission:
import math
K = int(input())
ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            tmp_gcd = math.gcd(i, j)
            tmp_gcd = math.gcd(tmp_gcd, k)
            if i == j == k:
                ans += tmp_gcd
            elif i == j or i == k or j == k:
                ans += tmp_gcd * 3
            else:
                ans += tmp_gcd * 6
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_lis = list(map(int, input().split()))
n_a = []
for a in a_lis:
    if a in n_a:
        print('NO')
        exit()
    n_a.append(a)
print('YES')

Fixed submission:
import collections
n = int(input())
a_lis = list(map(int, input().split()))
a_cnt = collections.Counter(a_lis)
for v in a_cnt.values():
    if v >= 2:
        print('NO')
        exit()
print('YES')
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(5000)
n, k = map(int, input().split())
p_lis = list(map(int, input().split()))
def calc_ex(num):
    return (num - 1) * 0.5 + 1
cur_num = 0
for i in range(k):
    cur_num += p_lis[i]
max_nums = cur_num
max_nums_i = i
for i in range(len(p_lis) - k):
    cur_num -= p_lis[i]
    cur_num += p_lis[i + k]
    if max_nums < cur_num:
        max_nums = cur_num
        max_nums_i = i + 1
res = 0
for i in range(max_nums_i, max_nums_i + k):
    res += calc_ex(p_lis[i])
print(res)    

Fixed submission:
n, k = map(int, input().split())
p_lis = list(map(int, input().split()))
def calc_ex(num):
    return (num - 1) * 0.5 + 1
cur_num = 0
for i in range(k):
    cur_num += p_lis[i]
max_nums = cur_num
max_nums_i = 0
for i in range(len(p_lis) - k):
    cur_num -= p_lis[i]
    cur_num += p_lis[i + k]
    if max_nums < cur_num:
        max_nums = cur_num
        max_nums_i = i + 1
res = 0
for i in range(max_nums_i, max_nums_i + k):
    res += calc_ex(p_lis[i])
print(res)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p_lis = list(map(int, input().split()))
def calc_ex(num):
    return (num - 1) * 0.5 + 1
cur_num = 0
for i in range(k):
    cur_num += p_lis[i]
max_nums = cur_num
max_nums_i = i
for i in range(len(p_lis) - k):
    cur_num -= p_lis[i]
    cur_num += p_lis[i + k]
    if max_nums < cur_num:
        max_nums = cur_num
        max_nums_i = i + 1
res = 0
for i in range(max_nums_i, max_nums_i + k):
    res += calc_ex(p_lis[i])
print(res)    

Fixed submission:
n, k = map(int, input().split())
p_lis = list(map(int, input().split()))
def calc_ex(num):
    return (num - 1) * 0.5 + 1
cur_num = 0
for i in range(k):
    cur_num += p_lis[i]
max_nums = cur_num
max_nums_i = 0
for i in range(len(p_lis) - k):
    cur_num -= p_lis[i]
    cur_num += p_lis[i + k]
    if max_nums < cur_num:
        max_nums = cur_num
        max_nums_i = i + 1
res = 0
for i in range(max_nums_i, max_nums_i + k):
    res += calc_ex(p_lis[i])
print(res)
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())

lcm = a * b / math.gcd(a, b)
print(int(lcm))

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

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while x % y != 0:
            z = x % y
            x = y
            y = z
        else:
            return z

lcm = a * b / gcd(a, b)
print(int(lcm))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
i = 0
while i < len(a):
    while a[i] != i + 1:
        cnt += 1
        a.pop(i)
        if len(a) == 0:
            break
    i += 1
if a == []:
    print(-1)
else:
    print(cnt)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
i = 0
j = 0
f_flg = 0
while i < len(a) and j < len(a):
    while a[j] != i + 1:
        cnt += 1
        j += 1
#         print(j)
        if j > len(a) - 1:
            if f_flg == 0:
                print(-1)
                exit()
            break
    f_flg = 1
    i += 1
    j += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
g = [[-1] * 15 for _ in range(15)]
n = int(input())
for i in range(n):
    m = int(input())
    for j in range(m):
        a, x = map(int, input().split())
        a -= 1
        g[i][a] = x
def count_ones_by_minus(num):
    count = 0
    while num:
        num &= num -1
        count += 1
    return count
for i in range(1 << n):
    for j in range(n):
        if i >> j & 1:
            d[j] = 1
    ok = True
    for j in range(n):
        if d[j]:
            for k in range(n):
                if g[j][k] == -1:
                    continue
                if g[j][k] != d[k]:
                    ok = False
        if ok:
            ans = max(ans, count_ones_by_minus(i))
    print(ans)  

Fixed submission:
g = [[-1] * 15 for _ in range(15)]
n = int(input())
for i in range(n):
    m = int(input())
    for j in range(m):
        a, x = map(int, input().split())
        a -= 1
        g[i][a] = x
def count_ones_by_minus(num):
    count = 0
    while num:
        num &= num -1
        count += 1
    return count
ans = 0
for i in range(1 << n):
    d = [0] * n
    for j in range(n):
        if i >> j & 1:
            d[j] = 1
    ok = True
    for j in range(n):
        if d[j]:
            for k in range(n):
                if g[j][k] == -1:
                    continue
                if g[j][k] != d[k]:
                    ok = False
    if ok:
        ans = max(ans, count_ones_by_minus(i))
print(ans)