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

Fixed submission:
n,m=map(int,input().split())
xy=[[] for _ in range(n+1)]
for _ in range(m):
    x,y,z=map(int,input().split())
    xy[x].append(y)
    xy[y].append(x)

from collections import deque

visited=[0]*(n+1)
count=0

for i in range(1,n+1):
    if visited[i]==0:
        stack=deque()
        stack.append(i)
        visited[i]+=1
        while stack:
            a=stack.pop()
            for j in xy[a]:
                if visited[j]==0:
                    visited[j]+=1
                    stack.append(j)
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
par = [i for i in range(N+1)]
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
for i in range(Q):
    x,y,z=map(int,input().split())
    unite(x,y)
    
for i in range(1,N+1):
    find(i)
print(len(set(par[1:])))

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
par = [i for i in range(N+1)]
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
for i in range(Q):
    x,y,z=map(int,input().split())
    unite(x,y)
    
for i in range(1,Q+1):
    find(i)
print(len(set(par[1:])))
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce
n=int(input())
A=list(map(int,input().split()))
def gcd(*numbers):
    return reduce(fractions.gcd,numbers)
print(gcd(*A))

Buggy submission (verdict: Runtime Error):
import fraction
from functools import reduce
n=int(input())
A=list(map(int,input().split()))
def gcd(*numbers):
    return reduce(fraction.gcd,numbers)
print(gcd(*A))
Problem p03221 (python)

Fixed submission:
n,m=map(int,input().split())
py1=[]
for i in range(m):
    py1.append(list(map(int,input().split()))+[i+1])
py=sorted(py1)

number_list=[]
number_list.append([str(0)]*(6-(len(list(str(py[0][0])))))+list(str(py[0][0]))+[str(0)]*(6-(len(list(str(1)))))+list(str(1))+[str(py[0][-1])])
k=2
for j in range(1,m):
    if py[j][0]==py[j-1][0]:
        number_list.append([str(0)]*(6-(len(list(str(py[j][0])))))+list(str(py[j][0]))+[str(0)]*(6-(len(list(str(k)))))+list(str(k))+[str((py[j][-1]))])    
        k+=1
    else:
        k=1
        number_list.append([str(0)]*(6-(len(list(str(py[j][0])))))+list(str(py[j][0]))+[str(0)]*(6-(len(list(str(k)))))+list(str(k))+[str(py[j][-1])])
        k+=1
     
number_list_sort=sorted(number_list,key=lambda x:int(x[-1]))
for l in range(m):
    print(''.join(number_list_sort[l][:-1]))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
py=[]
for i in range(m):
    py.append(list(map(int,input().split()))+[i+1])
py.sort()
number_list=[]
number_list.append([str(0)]*(6-(len(list(str(py[0][0])))))+list(str(py[0][0]))+[str(0)]*(6-(len(list(str(1)))))+list(str(1))+[str(py[0][-1])])
k=2
for j in range(1,m):
    if py[j][0]==py[j-1][0]:
        number_list.append([str(0)]*(6-(len(list(str(py[j][0])))))+list(str(py[j][0]))+[str(0)]*(6-(len(list(str(k)))))+list(str(k))+[str(py[j][-1])])    
        k+=1
    else:
        k=1
        number_list.append([str(0)]*(6-(len(list(str(py[j][0])))))+list(str(py[j][0]))+[str(0)]*(6-(len(list(str(k)))))+list(str(k))+[str(py[j][-1])])
        k+=1
number_list_sort=sorted(number_list,key=lambda x:x[-1])
for l in range(m):
    print(''.join(number_list_sort[l][:-1])
Problem p02552 (python)

Fixed submission:
t=int(input())
if t==1:
    print("0")
else:
    print("1")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
g=[]
g.append(a*c)
g.append(a*d)
g.append(b*c)
g.append(b*d)
print(max(g))
Problem p02550 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N,X,M=map(int,input().split())

A=[0]*10**5
A[0]=X
D=dict()
#A=[X]
s=N
for i in range(1,N):
    a=A[i-1]**2%M
    if a in D:
        s=A.index(a)
        break
    else:
        #A.append(a)
        A[i]=a
        D[a]=0

if s==N:
    ans=sum(A)
else:
    A=A[:i]
    Z=[0]*(len(A)+1)
    for i in range(1,len(A)+1):
        Z[i]=Z[i-1]+A[i-1]  

    ans=0
    l=len(A)-s
    #ans+=sum(A[:s])
    ans+=Z[s]
    #S=sum(A[s:])
    S=Z[len(A)]-Z[s]
    T=(N-s)//l
    ans+=T*S
    K=N-s-l*T
    #ans+=sum(A[s:(s+K)])
    ans+=Z[s+K]-Z[s]


print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N,X,M=map(int,input().split())

A=[0]*M
A[0]=X
D=[0]*M

s=N
for i in range(1,N):
    a=A[i-1]**2%M
    if D[a] == 1:
        s=A.index(a)
        break
    else:
        A[i]=a
        D[a]=1

if s==N:
    ans=sum(A)
else:
    A=A[:i]
    
    ans=0
    l=len(A)-s
    ans+=sum(A[:s])
    S=sum(A[s:])
    T=(N-s)//l
    ans+=T*S
    K=N-s-l*T
    ans+=sum(A[s:(s+K)])


print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N,X,M=map(int,input().split())

A=[0]*M
A[0]=X
D=[0]*M

s=N
for i in range(1,N):
    a=A[i-1]**2%M
    if D[a] == 1:
        s=A.index(a)
        break
    else:
        A[i]=a
        D[a]=1

if s==N:
    ans=sum(A[:i])
else:
    A=A[:i]
    
    ans=0
    l=len(A)-s
    ans+=sum(A[:s])
    S=sum(A[s:])
    T=(N-s)//l
    ans+=T*S
    K=N-s-l*T
    ans+=sum(A[s:(s+K)])


print(ans)
Problem p02629 (python)

Fixed submission:
# -*- coding: utf-8 -*-

abc=[chr(i) for i in range(97,123)]

N=int(input())

#for n in range(1,100):
#N=n
ans=""

L=0
for i in range(1,12):
    if N >= 26**i:
        N-=26**i
    else:
        L=i
        break
#print(L,N)

if N==0:
    for i in range(L-1):
        ans+="z"
else:
    for i in range(L,1,-1):
        if N <= 26**(i-1):
            ans+="a"
        else:        
            for j in range(1,26):
                if 26**(i-1)*j < N and 26**(i-1)*(j+1) >= N:
                    ans+=abc[j]
                    N-=26**(i-1)*j
                    break
    ans+=abc[N-1]
print(ans)

"""
re=0
L=len(ans)
for i in range(L):
    ind=abc.index(ans[L-i-1])+1
    re+=ind*26**i

print(re)

if n!=re:
    print(n)
    break
"""

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

abc=[chr(i) for i in range(97,123)]

N=int(input())

ans=""

L=0
for i in range(1,12):
    if N > 26**i:
        N-=26**i
    else:
        L=i
        break
#print(L,N)
for i in range(L,1,-1):
    if N < 26**(i-1):
        ans+="a"
    else:        
       for j in range(1,26):
           if 26**(i-1)*j <= N and 26**(i-1)*(j+1) > N:
               ans+=abc[j]
               N-=26**(i-1)*j
               break
#print(L,N)
ans+=abc[N-1]
print(ans)
Problem p02659 (python)

Fixed submission:
# -*- coding: utf-8 -*-

A,B=input().split()

x=int(B[0])
y=int(B[2])
z=int(B[3])

ans=[0]*18
L=len(A)

for i in range(L):
    a=int(A[L-i-1])
    c=a*z
    ans[17-i]=c

for i in range(L):
    a=int(A[L-i-1])
    c=a*y
    ans[16-i]+=c

for i in range(L):
    a=int(A[L-i-1])
    c=a*x
    ans[15-i]+=c

S=0

for i in range(16):
    S+=ans[i]*10**(15-i)

if ans[16]*10+ans[17] > 100:
    S+=(ans[16]*10+ans[17])//100
print(int(S))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

A,B=input().split()
x=int(B[0])
y=int(B[2])
z=int(B[3])

ans1=str(int(A)*x)
ans2=str(int(A)*y)
ans3=str(int(A)*z)

ans=int(ans1)+int(ans2[:-1])+int(ans1[-2])
if int(ans2[-1])*10+int(ans2[-2:]) > 100:
    ans+=1
print(int(ans))
Problem p02879 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Nov  6 21:44:44 2019

@author: over-
"""

A,B=map(int,input().split())
if A<10 and B<10:
    print(A*B)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Nov  6 21:49:38 2019

@author: over-
"""

N=int(input())

ans=N
for i in range(1,10**12):
    if i > N: break
    if N%i == 0:
        A=(N/i-1)+(i-1)
        if A < ans:
            ans = A
            
print(int(A))
Problem p02659 (python)

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

a = int(a)
b1, b2 = b.split('.')

ans = a * (int(b1) * 100 + int(b2)) // 100
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a = int(input())
b = float(input())

print(math.floor(a*b))

Buggy submission (verdict: Runtime Error):
import math

a = int(input())
b = float(input())

print(math.floor(a*b))
Problem p02578 (python)

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

ans = 0
maxV = max(list)
maxI = list.index(maxV)

sumV = sum(list[maxI:len(list)])
maxM = maxV * (len(list)-maxI)
ans += maxM - sumV

if maxI != 0:
    for i in range(0,maxI):
        if i != maxI-1:
            x = list[i] - list[i+1]
            if x > 0:
                ans += x
                list[i+1] = list[i+1]+x
print(ans)

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

ans = 0
maxV = max(list)
maxI = list.index(maxV)

sumV = sum(list[maxI+1, len(list)])
maxM = maxV * (len(list)-1-maxI)
ans += maxM - sumV

if maxI != 0:
    for i in range(0,maxI):
        if i != maxI:
            x = list[i] - list[i+1]
            if x > 0:
                ans += x


print(ans)
Problem p02790 (python)

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

ans1 = ""
ans2 = ""
for i in range(b):
  ans1 = ans1 + str(a)

for i in range(a):
  ans2= ans2 + str(b)
  
list = []
list.append(ans1)
list.append(ans2)

list.sort()

print(list[0])

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

ans1 = ""
ans2 = ""
for i in range(b):
  ans1.append(a)

for i in range(a):
  ans2.append(b)
  
print(ans1, ans2)
Problem p02819 (python)

Fixed submission:
#--import&define---------------------
import math
import sys
input = sys.stdin.readline
def yes():
    print("Yes")
def no():
    print("No")

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime
#--以下解答---------------------------------
x = int(input())
prime_list = primes(10**6)

i = x
flag = True
while True:
    if prime_list[i] == True:
        print(i)
        sys.exit()
    i += 1

Buggy submission (verdict: Runtime Error):
#--import&define---------------------
import math
import sys
input = sys.stdin.readline
def yes():
    print("Yes")
def no():
    print("No")

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return is_prime
#--以下解答---------------------------------
x = int(input())
prime_list = primes(10**5)

i = x+1
flag = True
while flag == True:
    if prime_list[i] == True:
        print(i)
        sys.exit()
    i += 1
#
Problem p02835 (python)

Fixed submission:
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用した入力
# x,y = map(int,input().split())

#forを利用した入力
#l = []
#for i in range():
#    l.append(int(input()))
#--以下解答---------------------------------
x = input()
x = list(map(int,x.split()))
ans = 0
for i in range(3):
  ans += x[i]

if ans >= 22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用した入力
# x,y = map(int,input().split())

#forを利用した入力
#l = []
#for i in range():
#    l.append(int(input()))
#--以下解答---------------------------------
l = []
ans = 0
for i in range(3):
   ans += int(input())
if ans >= 22:
    print("bust")
else:
    print("win")
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
x = int(n/2)

if n%2 != 0:
    print("No")
elif s[:x] == s[x:]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
//不正解

n = int(input())
s = input()
x = int(n/2)

if n%2 != 0:
    print("No")
elif s[:x] == s[x+1:]:
    print("Yes")
else:
    print("No")
Problem p03075 (python)

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

if l[4]-l[0]>l[5]:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
#--import & define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--memo--------------------------------
#mapを利用した入力
# x,y = map(int,input().split())

#forを利用した入力
#l = []
#for i in range():
#    l.append(int(input()))
#    print(i,l)
#--------------------------------------
l = []
for i in range(6):
   l.append(int(input()))

if l[0]-l[1]>l[5] or l[1]-l[2]>l[5] or l[2]-l[3]>l[5] or l[3]-l[4]>l[5] or:
    no()
else:
    yes()

Buggy submission (verdict: Runtime Error):
l = []
for i in range(6):
   l.append(int(input()))
   print(i,l)

if l[0]-l[1]>l[5] or l[1]-l[2]>l[5] or l[2]-l[3]>l[5] or l[3]-l[4]>l[5] or:
    no()
else:
    yes()

Buggy submission (verdict: Runtime Error):
import math

def yes():
    print("Yes")
def no():
    print("No")

a,b,c,d,e,k = map(int,input().split())

if a-b > k or b-c > k or c-d > k or d-e > k:
    no()
else:
    yes()

Buggy submission (verdict: Runtime Error):
import math

def yes():
    print("Yes")
def no():
    print("No")

a,b,c,d,e,k = map(int,input().split())
if a-b > k or b-c > k or c-d > k or d-e > k:
    no()
else:
    yes()
Problem p03077 (python)

Fixed submission:
N,*A = map(int,open(0).read().split())
print((N+min(A)-1)//min(A) + 4)

Buggy submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648
#--以下解答---------------------------------

n = int(input())
l = []
# min = 2147483647
for i in range(5):
    l.append(int(input()))
    # min = l[i] if l[i]<min else min
minV = min(l)
print(int((n+minV-1)/min) +4)
# if n%min == 0:
#     print(n//min +4)
# else:
#     tmp = int(n//min) +1
#     print(tmp+4)

Buggy submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648
#--以下解答---------------------------------

n = int(input())
l = []
min = 2147483647
for i in range(n):
    l.append(int(input()))
    min = l[i] if l[i]<min else min

if n%min == 0:
    print(n/min+4)
else:
    tmp = int(n/min) +1
    print(tmp+4)

Buggy submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648
#--以下解答---------------------------------
#分からない

n = int(input())
l = []
min = 2147483647
for i in range(n):
    l.append(int(input()))
    min = l[i] if l[i]<min else min

if n%min == 0:
    print(n/min+4)
else:
    tmp = n/min +1
    print(n/tmp+4)

Buggy submission (verdict: Runtime Error):
#--import&define---------------------
import math

def yes():
    print("Yes")
def no():
    print("No")
#--my_library--------------------------------
#mapを利用したリストの入力
# x,y = map(int,input().split())

#forを利用したリストの入力
#l = []
#for i in range():
#    l.append(int(input()))

#intの最大値と最小値
#maxX = 2147483647
#minX =-2147483648 
#--以下解答---------------------------------
n = int(input())
l = []
min = 2147483647
for i in range(n):
   l.append(int(input()))
   min = l[i] if l[i]<min else min

if n%min == 0:
    print(int(n/min)+4)
else:
    tmp = int(n/min) +1
    print(tmp+4)
Problem p02596 (python)

Fixed submission:
k=int(input())
num=7%k
ans=-1

if k%2==0 or k%5==0:
	ans=-1
else:
	for i in range(1,k+10):
		# print(num)
		if num==0:
			ans=i
			break
		num=(num*10+7)%k

print(ans)

Buggy submission (verdict: Runtime Error):
k=int(input())
num=7%k
L=0
ans=-1


if k%7==0:
	L=(9*k)/7
else:
	L=9*k

if L%2==0 or L%5==0:
	ans=-1
else:
	for i in range(10**5):
		if (num*10)%L==1:
			ans=i
			break
		num=10**i %L
print(ans)
Problem p02622 (python)

Fixed submission:
s=str(input())
t=str(input())
length=len(s)
count=0
for i in range(length):
	if s[i]==t[i]:
		pass
	else:
		count+=1
print(count)

Buggy submission (verdict: Runtime Error):
s=str(input())
t=str(input())
length=len(s)
count=0
for i in range(s):
	if s[i]==t[i]:
		pass
	else:
		count+=1
print(count)
Problem p02623 (python)

Fixed submission:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,m,k=input2()
A=input_array()
B=input_array()
acc_A=[0]
acc_B=[0]

for i in range(n):
	acc_A.append(A[i]+acc_A[i])
for i in range(m):
	acc_B.append(B[i]+acc_B[i])

ans=0
tmp_m=m
for i in range(n+1):
	if acc_A[i]>k:
		break
	for j in range(tmp_m,-1,-1):
		if acc_B[j]<=k-acc_A[i]:
			ans=max(i+j,ans)
			tmp_m=j #探索開始地点の更新
			break
print(ans)

Buggy submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
n,m,k=input2()
A=input_array()
B=input_array()

ca=0
cb=0
count=0
SUM=0
for i in range(n+m):
	if ca >= n:
		SUM+=B[cb]
		cb+=1
	elif cb >= m:
		SUM+=A[ca]
		ca+=1
	elif A[ca]<=B[cb]:
		SUM+=A[ca]
		ca+=1
	else:
		SUM+=B[cb]
		cb+=1

	if SUM >k:
		break
	else:
		count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,m,k=input2()
A=input_array()
B=input_array()

ca=0
cb=0
count=0
SUM=0
for i in range(10**5):
	if A[ca]<=B[cb]:
		SUM+=A[ca]
		ca+=1
	else:
		SUM+=B[cb]
		cb+=1

	if SUM >=k:
		break
	else:
		count+=1
print(count)
Problem p02659 (python)

Fixed submission:
#入力:N,M(int:整数)
def input2():
	return map(float,input().split())
  
a,b=input2()
ans=int(a)*round(b*100)
print(int(ans//100))

Buggy submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(float,input().split())
  
  
a,b=input2()
print(math.floor(a*b))
Problem p02699 (python)

Fixed submission:
from math import factorial as fact
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			while tmp%i==0:
				cnt+=1
				tmp//=i
			count+=1
	if tmp!=1:
		count+=1

	return count
			


s,w=input2()
if w >=s:
	print("unsafe")
else:
	print("safe")

# a,b,c,d=input2()

# for i in range(1,101):
# 	if i%2==1:
# 		c-=b
# 		if c<=0:
# 			print("Yes")
# 			break
# 	else:
# 		a-=d
# 		if a<=0:
# 			print("No")
# 			break

Buggy submission (verdict: Runtime Error):
from math import factorial as fact
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			while tmp%i==0:
				cnt+=1
				tmp//=i
			count+=1
	if tmp!=1:
		count+=1

	return count
			


s,w=input2()
if w >=s2:
	print("unsafe")
else:
	print("safe")

# a,b,c,d=input2()

# for i in range(1,101):
# 	if i%2==1:
# 		c-=b
# 		if c<=0:
# 			print("Yes")
# 			break
# 	else:
# 		a-=d
# 		if a<=0:
# 			print("No")
# 			break
Problem p02785 (python)

Fixed submission:
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


H,K=input2()
h=input_array()

if K>=H:
	print(0)
elif K<=0:
	print(sum(h))
else:
	sorted_h=sorted(h)
	print(sum(sorted_h[:-K]))

Buggy submission (verdict: Runtime Error):
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


H,K=input2()
h=input_array()

for _ in range(K):
	max_h=max(h)
	h.remove(max_h)
attacks=sum(h)

print(attacks)
Problem p02831 (python)

Fixed submission:
import math
import fractions
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))




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


a,b=input2()

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))




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


a,b=input2()

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))




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


a,b=input2()

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))




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


a,b=input2()

print(lcm(a,b))