Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02983 (python)

Fixed submission:
l,r=list(map(int, input().split()))
minmod=2018
if r-l>=2018:
	print(0)
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			minmod=min(minmod,(i*j)%2019)
	print(minmod)

Buggy submission (verdict: Runtime Error):
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print((minc*(minc+1))%2019)

Buggy submission (verdict: Runtime Error):
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print(minc*(minc+1)%2019)

Buggy submission (verdict: Runtime Error):
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print(minc*(minc+1))

Buggy submission (verdict: Runtime Error):
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
minc=min(c)
print(minc*minc+1))

Buggy submission (verdict: Runtime Error):
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
print(min(c)*(min(c)+1))
Problem p03031 (python)

Fixed submission:
n,m=map(int,input().split())
s=[] #全kについて、スイッチの状態を格納する。s[][]で呼び出し
for i in range(m):
	switch=[] #各kについて、スイッチの状態を一旦格納する
	k,*switch=map(int,input().split())
	#switch[i]はswitchの番号であり[1,n]なので、インデックスを1つずつ減らす
	for i in range(k):
		switch[i]-=1
	s.append(switch)
p=list(map(int,input().split()))

ans=0
#スイッチの2**n通りの状態に対して
for state in range(2**n):
	state=list(map(int,format(state,'b').zfill(n)))
	allon=1
	for i in range(m):
		count=0
		for j in range(len(s[i])):
			count+=state[s[i][j]]
		if count%2!=p[i]:
			allon=0
			break
	if allon==1:
		ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=[] #全kについて、スイッチの状態を格納する。s[][]で呼び出し
for i in range(m):
	switch=[] #各kについて、スイッチの状態を一旦格納する
	k,*switch=map(int,input().split())
	#switch[i]はswitchの番号であり[1,n]なので、インデックスを1つずつ減らす
	for i in range(k):
		switch[i]-=1
	s.append(switch)
p=list(map(int,input().split()))
'''
print(p) ->[1, 0]
print(s) ->[[0, 1, 4], [1, 2]]
'''
'''
state=format(4,'b')
state=state.zfill(n)
print(state)
print(s[1][1])
print(state[s[1][1]])
'''
count=0
for i in range(2**n):
	q=[] #各状態に対して、各電球につながっているスイッチのon数の偶奇を格納する配列
	state=format(i,'b')
	state=state.zfill(n)
	for i in range(m):
		on=0
		for j in range(k):
			on+=int(state[s[i][j]])
		on=on%2
		q.append(on)
		
	allon=1
	for i in range(m):
		if p[i]!=q[i]:
			allon=0
			break
	if allon:
		count+=1
print(count)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()

count = 0
for i in range(0, N - 2):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

count = 0
for i in range(0, N - 1):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                count += 1

print(count)
Problem p02922 (python)

Fixed submission:
A,B = map(int,input().split())
ans = 0
if B>1:
    while B>(A-1)*ans+A:
        ans+=1
    print(ans+1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
A = int(A)
B = int(B)
ans = 0
while B > (A-1)*ans + A :
  ans += 1
print(ans)
Problem p02628 (python)

Fixed submission:
n,k=(int(x) for x in input().split())
mylist=list(map(int, input().strip().split()))
mylist.sort()
num=0
suma=0
while num < k:
    suma=suma+mylist[num]
    num += 1
print(suma)

Buggy submission (verdict: Runtime Error):
n,k=(int(x) for x in input.split())
array = list(map(int, input().strip().split()))
print(f'{n} {k}')
print(sum(array[0:k]))
Problem p04043 (python)

Fixed submission:
a,b,c=(int(x) for x in input().split())
mylist=[a,b,c]
if mylist.count(5) == 2:
    if mylist.count(7) == 1:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
#ABC042B
N,L=map(int,input().split())

a=[]
for i in range(N)
    a.append(input())
    
a.sort()

print(''.join(a))

Buggy submission (verdict: Runtime Error):
#ABC042B
N,L=map(int,input().split())

a=[]
for i in range(n)
    a.append(input())
    
a.sort()

print(''.join(a))
Problem p04044 (python)

Fixed submission:
# 入力
N,L=map(int,input().split())

l=[]
for i in range(N):
  l.append(input())

# ソート
l.sort()

# 出力
print(''.join(l))

Buggy submission (verdict: Runtime Error):
#ABC042B
n,l=map(int,input().split())

a=[]
for i in range(n)
    a.append(input())
    
a.sort()

print(''.join(mylist))

Buggy submission (verdict: Runtime Error):
n,l=(int(x) for x in input().split())
sente1=input()
sente2=input()
sente3=input()
mylist=[sente1,sente2,sente3]
mylist.sort()
a=''.join(mylist)
print(a)

Buggy submission (verdict: Runtime Error):
l,n=(int(x) for x in input().split())
sente1=input()
sente2=input()
sente3=input()
mylist=[sente1,sente2,sente3]
mylist.sort()
print(''.join(mylist))

Buggy submission (verdict: Runtime Error):
n,l=(int(x) for x in input().split())
sente1=input()
sente2=input()
sente3=input()
mylist=[sente1,sente2,sente3]
mylist.sort()
print(''.join(mylist))

Buggy submission (verdict: Runtime Error):
l,n=(int(x) for x in input().split())
sente1=input()
sente2=input()
sente3=input()
mylist=[sente1,sente2,sente3]
mylist.sort()
print(''.join(mylist))

Buggy submission (verdict: Runtime Error):
#ABC042B
l,n=(int(x) for x in input().split())
sente1=input()
sente2=input()
sente3=input()
mylist=[sente1,sente2,sente3]
mylist.sort()
print(''.join(mylist))
Problem p04045 (python)

Fixed submission:
# ABC042C
N,K=map(int,input().split())
out=N
N=str(N)
a = list(map(int, input().split()))
while 1<2:
    N1=N
    i=0
    for i in range(len(a)):
        if str(a[i]) in N:
            N=int(N) 
            N+=1
            N=str(N)
    if N1==N:
        break

print(N)

Buggy submission (verdict: Runtime Error):
#ABC042C
N,K=map(int,input().split())
N=str(N)
N_len=len(N)
a=[]
out=N
for i in range(K):
    a.append(input())
for i2 in range(N_len):    
    for i3 in range(K):
        if N[i2]==a[i3]:
            out += 1
print(out)
Problem p02614 (python)

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

masme = []
for i in range(H):
    masme.append(list(input()))

#print(masme)

h_p = []
for h in range(pow(2,H)):
    h_p.append(str(bin(h))[2:].zfill(H))

#print(h_p)

w_p = []
for w in range(pow(2,W)):
    w_p.append(str(bin(w))[2:].zfill(W))

#print(w_p)

def count(mas):
    ans = 0
    for i in mas:
        for j in i:
            if( j == "#"):
                ans += 1
    return ans

def delete_row(mas, i):
    ilist = list(i)
    #print(ilist)
    ans = []
    for n in range(H):
        #print(ilist[n])
        if ilist[n] == "0":
            ans.append(mas[n])
            #print(ans)
    return ans

def delete_column(mas, i):
    ilist = list(i)
    ans = []
    for row in mas:
        #print(row)
        tmp_row=[]
        for n in range(W):
            if(ilist[n] == "0"):
                tmp_row.append(row[n])
        #print(tmp_row)
        ans.append(tmp_row)
    return ans


ans_cnt = 0
for h in h_p:
    for w in w_p:
        tmp = delete_row(masme, h)
        tmp2= delete_column(tmp, w)
        cnt = count(tmp2)
        if(cnt == K):
            ans_cnt += 1

print(ans_cnt)

Buggy submission (verdict: Runtime Error):
H=2
W=3
K=2

masme = [
[".",".","#"],
["#","#","#"]
]

H, W, K =  [int(i) for i in input().split()]

masme = []
for i in range(H):
    masme.append(list(input()))

#print(masme)

h_p = []
for h in range(pow(2,H)):
    h_p.append(str(bin(h))[2:].zfill(H))

#print(h_p)

w_p = []
for w in range(pow(2,W)):
    w_p.append(str(bin(w))[2:].zfill(W))

#print(w_p)

def count(mas):
    ans = 0
    for i in mas:
        for j in i:
            if( j == "#"):
                ans += 1
    return ans

def delete_row(mas, i):
    ilist = list(i)
    #print(ilist)
    ans = []
    for n in range(len(ilist)):
        #print(ilist[n])
        if ilist[n] == "0":
            ans.append(mas[n])
            #print(ans)
    return ans

def delete_column(mas, i):
    ilist = list(i)
    ans = []
    for row in mas:
        #print(row)
        tmp_row=[]
        for n in range(len(ilist)):
            if(ilist[n] == "0"):
                tmp_row.append(row[n])
        #print(tmp_row)
        ans.append(tmp_row)
    return ans

newmas = delete_column(masme, "010")

#print(newmas)

ans_cnt = 0
for h in h_p:
    for w in w_p:
        tmp = delete_row(masme, h)
        tmp2= delete_column(tmp, w)
        cnt = count(tmp2)
        if(cnt == K):
            ans_cnt += 1

print(ans_cnt)
Problem p02658 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n = input()
n_list = sorted([int(i) for i in input().split()])
value = 1
for i in n_list:
    value = value * i
    if value > 10 ** 18:
        value = -1
        break
print(value)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n = input()
n_list = [int(i) for i in input().split()]
value = 1
for i in n_list
    value = value * i


if value > 10**18:
    value = -1
print(value)
Problem p02663 (python)

Fixed submission:
import sys
input = sys.stdin.readline

h1, m1, h2, m2, k = map(int, input().split())

h_time = (h2 - h1 -1) * 60
m_time = (60 - m1) + m2

rest_time = (h_time + m_time) - k
print(rest_time)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

h1, m1, h2, m2, k = input.split()

h_time = (h2 - h1 -1) * 60
m_time = (60 - m1) + m2

rest_time = (h_time + m_time) - k
print(rest_time)
Problem p02993 (python)

Fixed submission:
s = input()

state = "Good"
for i in range(3):
    if s[i] == s[i + 1]:
        state = "Bad"
        print(state)
        break
if  state == "Good":
    print("Good")

Buggy submission (verdict: Runtime Error):
import numpy as np


def taste(N, L):
    all_abs = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    all_base = np.array([L + i - 1 for i in range(1, N + 1)])

    return all_abs, all_base

N, L = map(int, input().split())

all_abs, all_base = taste(N, L)

N_1_all = all_base[np.min(all_abs) != all_abs]

re = np.sum(N_1_all)
print(re)
Problem p02994 (python)

Fixed submission:
import numpy as np
 
 
def taste(N, L):
    all_abs = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    all_base = np.array([L + i - 1 for i in range(1, N + 1)])
 
    return all_abs, all_base
 
N, L = map(int, input().split())
 
all_abs, all_base = taste(N, L)
 
N_1_all = all_base[np.min(all_abs) != all_abs]
 
re = np.sum(N_1_all)
print(re)

Buggy submission (verdict: Runtime Error):
import numpy as np


def taste(N, L):
    all_abs = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    all_base = np.array([L + i - 1 for i in range(1, N + 1)])

    return all_abs, all_base

N, L = map(int, input().input())

all_abs, all_base = taste(N, L)

N_1_all = all_base[np.min(all_abs) != all_abs]

re = np.sum(N_1_all)
print(re)

Buggy submission (verdict: Runtime Error):

import numpy as np

N, L = map(int, input().input())


def taste(N, L):
    all = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    return all

tastes = taste(N, L)
import numpy as np

N, L = map(int, input().input())


def taste(N, L):
    all = np.array([np.abs(L + i - 1) for i in range(1, N + 1)])
    return all

tastes = taste(N, L)
all = tastes[np.min(tastes) != tastes]

re = np.sum(all)
print(re)
all = tastes[np.min(tastes) != tastes]

re = np.sum(all)
print(re)
Problem p03455 (python)

Fixed submission:
import sys
input = sys.stdin.readline

a, b = map(int, input().split())
print("Even" if (a*b) % 2 == 0 else "Odd")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

a, b = input().split()
print("Odd" if (a*b) % 2 == 0 else "Even")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

a, b = input().split()
"Odd" if (a*b) % 2 == 0 else "Even"
Problem p03493 (python)

Fixed submission:
import sys
input = sys.stdin.readline

print(input().count("1"))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

list = [map(int, input().split())]
print(sum(list))
Problem p03494 (python)

Fixed submission:
import sys
input = sys.stdin.readline

N = input()
B = map(int, input().split())

answer = float("inf")
for i in B:
    answer = min(answer, len(bin(i)) - bin(i).rfind("1") - 1)
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N = input()
B = map(int, input().split())

answer = None
for i in B:
    answer = min(answer, len(bin(i)) - bin(i).rfind("1") - 1)
print(answer)
Problem p02613 (python)

Fixed submission:
N = int(input())
l = [input() for _ in range(N)]
ch = {'AC': 0, 'WA':0, 'TLE':0, 'RE':0}

for key, value in ch.items():
  ch[key] = l.count(key)

for key, value in ch.items():
  print(key + ' x ' + str(value))

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [input() for _ in range(N)]
ch = {'AC': 0, 'WA':0, 'TLE':0, 'RE':0}

for key, value in ch.items():
  ch[key] = l.count(key)

for key, value in ch.items():
  print(key + ' x ' + value)
Problem p02696 (python)

Fixed submission:
def f(a, b, x):
  return int(a*x/b) - (a*int(x/b))
A, B, N = map(int, input().split())
print(f(A, B, min(B-1, N)))

Buggy submission (verdict: Runtime Error):
def f(a, b, x):
  return int(a*x/b) - (a*int(x/b))
A, B, N = map(int, input().split())
print(f(A, B, min(B-1, N))

Buggy submission (verdict: Runtime Error):
A, B, N = map(int, input().split())
f = [int(A*x/B)-(A * int(x/B)) for x range(N+1)]
print(max(f))

Buggy submission (verdict: Runtime Error):
A, B, N = map(int, input().split())
f = [int(A*x/B) - (A * int(x/B)) for x range(N+1)]
print(max(f))
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

flag = True
for i in range(len(S)):
    if(S[i] != T[i]):
        flag = False

if(flag):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N, K = input().split()
N = int(N)
K = int(K)

array = input().split()
for i in range(len(array)):
    array[i] = int(array[i])

now = 1

history = []
start_number = -1

for i in range(K):
    history.append(now)
    now = array[now - 1]
    if(now in history):
        start_number = now
        break

if not(start_number == -1):
    start_ind = history.index(start_number)
    length = len(history) - start_ind
    mod = (K - start_ind) % length
    now = history[start_ind + mod]

print(now)
Problem p02684 (python)

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

array = input().split()
for i in range(len(array)):
    array[i] = int(array[i])

now = 1

history = []
sethistory = set()
start_number = -1

for i in range(K):
    history.append(now)
    sethistory.add(now)
    now = array[now - 1]
    if(now in sethistory):
        start_number = now
        break

if not(start_number == -1):
    start_ind = history.index(start_number)
    length = len(history) - start_ind
    mod = (K - start_ind) % length
    now = history[start_ind + mod]

print(now)

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

array = input().split()
for i in range(len(array)):
    array[i] = int(array[i])

now = 1

history = set()
start_number = -1

for i in range(K):
    history.add(now)
    now = array[now - 1]
    if(now in history):
        start_number = now
        break

if not(start_number == -1):
    start_ind = history.index(start_number)
    length = len(history) - start_ind
    mod = (K - start_ind) % length
    now = history[start_ind + mod]

print(now)

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

array = input().split()
for i in range(len(array)):
    array[i] = int(array[i])

now = 1

history = set()
start_number = -1

for i in range(K):
    history.append(now)
    now = array[now - 1]
    if(now in history):
        start_number = now
        break

if not(start_number == -1):
    start_ind = history.index(start_number)
    length = len(history) - start_ind
    mod = (K - start_ind) % length
    now = history[start_ind + mod]

print(now)
Problem p02741 (python)

Fixed submission:
k=int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])

Buggy submission (verdict: Runtime Error):
k=int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])k

Buggy submission (verdict: Runtime Error):
k=int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k+1])
Problem p02718 (python)

Fixed submission:
a,b = map(int,input().split())
c = list(map(int,input().split()))
sum = 0
for i in c:
  sum = sum + i
vote = (1/(4*b))*sum
count = 0
for j in c:
  if j>=vote:
    count = count + 1

if count>=b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = list(map(int,input().split()))
sum = 0
for i in range(0,n,1):
  sum = sum + c[i]
count = 0
vote = (1/(4*b))*sum
for j in c:
  if j>=vote:
    count = count + 1
if count>=b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = list(map(int,input().split()))
sum = 0
for i in c:
  sum = sum + i
count = 0
vote = (1/(4*b))*sum
for j in c:
  if j>=vote:
    count = count + 1
if count>=b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = list(map(int,input().split()))
sum = 0
for i in range c:
  sum = sum + i
count = 0
vote = (1/(4*b))*sum
for j in c:
  if j>=vote:
    count = count + 1
if count>=b:
  print("Yes")
else:
  print("No")
Problem p02705 (python)

Fixed submission:
print(6.283*int(input()))

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int, input().split()))
bosses = [0] * N

for i in A_list:
    bosses[i-1] += 1
for boss in bosses:
    print(boss)
Problem p02706 (python)

Fixed submission:
n, m = map(int, input().split())
A = sum(list(map(int, input().split())))
if A <= n:
    print(n-A)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = sum(list(map(int, input(.split()))))
if A <= n:
    print(n-A)
else:
    print(-1)
Problem p02630 (python)

Fixed submission:
hyou = [0]*100001

N =  int(input())
a_data = [int(x) for x in input().split()]
Q = int(input())
b_data = [[int(x) for x in input().split()] for _ in range(Q)]

# 数列を分類
for x in a_data:
    hyou[x] += 1
# 現段階の合計を求める。
total = 0
for i,x in enumerate(hyou):
    total += i*x

# 操作と合計
for before_value,after_value in b_data:
    total += (after_value - before_value) * hyou[before_value] 
    # 数値の入れ替え
    hyou[after_value] = hyou[before_value] + hyou[after_value] 
    hyou[before_value] = 0

    # 合計を出力
    print(total)

Buggy submission (verdict: Runtime Error):
import numpy as np

hyou = [0]*100001
keisuu = np.array(list(range(0,100001)))

N =  int(input())
a_data = [int(x) for x in input().split()]
Q = int(input())
b_data = [[int(x) for x in input().split()] for _ in range(Q)]

# 数列を分類
for x in a_data:
    hyou[x] += 1
# 操作と合計
for before_value,after_value in b_data:
    # 数値の入れ替え
    hyou[after_value] = hyou[before_value] + hyou[after_value] 
    hyou[before_value] = 0

    # 合計を求めて出力
    hyou_array = np.array(hyou)
    total = np.dot(hyou_array,keisuu)
    print(total)

Buggy submission (verdict: Runtime Error):
import numpy as np

hyou = [0]*100001
keisuu = np.array(list(range(0,100001)))

N =  int(input())
a_data = [int(x) for x in input().split()]
Q = int(input())
b_data = [[int(x) for x in input().split()] for _ in range(Q)]

# 数列を分類
for x in a_data:
    hyou[x] += 1
# 操作と合計
for before_value,after_value in b_data:
    # 数値の入れ替え
    hyou[after_value] = hyou[before_value] + hyou[after_value] 
    hyou[before_value] = 0

    # 合計を求めて出力
    hyou_array = np.array(hyou)
    total = np.dot(hyou_array,keisuu)
Problem p02657 (python)

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

print(a*b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

print(a*b)
Problem p02730 (python)

Fixed submission:
def hantei(s):
    rev_s = s[::-1]

    for x in range(len(s)):
        if s[x] != rev_s[x]:
            return False
    
    return True

s = input()

if hantei(s) and hantei(s[:int((len(s)-1)/2)]) and hantei(s[int((len(s)+3)/2)-1:]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
ef hantei(s):
    rev_s = s[::-1]

    for x in range(len(s)):
        if s[x] != rev_s[x]:
            return False
    
    return True

s = input()

if hantei(s) and hantei(s[:int((len(s)-1)/2)]) and hantei(s[int((len(s)+3)/2)-1:]):
    print("Yes")
else:
    print("No")
Problem p02811 (python)

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

total = K * 500

if total >= X:
    print("Yes") 
else:
    print("No")

Buggy submission (verdict: Runtime Error):
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

def lcm(x, y):
    return (x * y) // gcd(x, y)

[N,M] = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

skoubaisu = 1
for x in a:
    skoubaisu = lcm(skoubaisu,x)

if M*2 <= skoubaisu:
  print(0)
else:
  print(M//skoubaisu+1)
Problem p02630 (python)

Fixed submission:
summ=0
mapper=dict()
n=int(input())
arr=[int(i) for i in input().split()]
for i in range(0,n):
    temp=arr[i]
    if temp not in mapper:
        mapper[temp]=0
    mapper[temp]+=1
    summ+=temp
q=int(input())
for i in range(0,q):
    temp,temp1=[int(j) for j in input().split()]
    if((temp in mapper) and  temp1 not in mapper):
        summ-=temp*mapper[temp]
        summ+=temp1*mapper[temp]
        mapper[temp1]=0
        mapper[temp1]+=mapper[temp]
        mapper.pop(temp)
    elif((temp in mapper) and (temp1 in mapper)):
        summ-=temp*mapper[temp]
        summ+=temp1*mapper[temp]
        val=mapper[temp]
        mapper.pop(temp)
        mapper[temp1]=mapper[temp1]+val
    print(summ)

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	uint64_t sum=0;
	map<int,int>mapper;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int temp;
		cin>>temp;
		if(mapper.find(temp)==mapper.end()){
			mapper[temp]=0;
		}
		mapper[temp]++;
		sum+=temp;
	}
	int q;
	cin>>q;
	for(int i=0;i<q;i++){
		int temp,temp1;
		cin>>temp>>temp1;
		if(mapper.find(temp1)==mapper.end()){
			sum-=temp*mapper[temp];
			sum+=temp1*mapper[temp];
			mapper[temp1]=mapper[temp];
			mapper.erase(temp);
		}else{
			sum-=temp*mapper[temp];
			sum+=temp1*mapper[temp];
			int val=mapper[temp];
			mapper.erase(temp);
			mapper[temp1]=mapper[temp1]+val;
		}
		cout<<sum<<"\n";
	}
}
Problem p02658 (python)

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

x=a[0]

if 0 not in a:
    for i in range (1,n):
        x=x*a[i]
        if x > pow(10,18):
            print(-1)
            exit()           
    print(x)         
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
a,b=map(str,input().split())
a=int(a)
b=float(b)

#x=int(a*b)
x=math.floor(a*b)
print(x)
Problem p02718 (python)

Fixed submission:
N, M = map(int,input().split())
li = list(map(int, input().split()))

c = sum(li) / (4*M)
res = 0
for l in li:
    if l >= c:
        res += 1
if res >= M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
li = list(map(int, input().split()))

c = sum(li) / 4*M
res = 0
for l in li:
    res += 1 if l >= c
if res == M:
    print('Yes')
else:
    print('No')
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int,input().split()))

count = 1
D = 0
for i in range(N):
  D += L[i]
  if D <= X:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int,input().split()))

i = 0
D = 0
while D <= X and i <= N:
    D += L[i]
    i += 1
print(i)