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

Fixed submission:
n = int(input())
flag = True
ans = 1
now = n
count = 1


for i in range(10000):
    if n > 2**i:
        pass
    elif n == 1:
        print(1)
        break
    elif n == 2**i:
        print(4*(2**(i)//2)-1)
        break
    else:
        print(4*(2**(i-1)//2)-1)
        break

Buggy submission (verdict: Runtime Error):
for i in range(10000):
    if n > 2**i:
        pass
    elif n == 1:
        print(1)
    elif n == 2**i:
        print(4*(2**(i)//2)-1)
        break
    else:
        print(4*(2**(i-1)//2)-1)
        break
Problem p02789 (python)

Fixed submission:
n, nn = map(int, input().split())
if n == nn:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
nn = n = int(input())
if n == nn:
  print("Yes")
else:
  print("No")
Problem p03076 (python)

Fixed submission:
l = []
x = 2147483647
index = 0
for i in range(5):
   l.append( int(input()) )
   n = int(l[i]%10)
   if n>0 and n<x:
      x = n
      index = i

ans = 0
for i in range(5):
    if i == index:
        ans += l[i]
    elif l[i]%10 != 0:
        ans += int(l[i]/10)*10 +10
    else:
        ans += l[i]

print(ans)

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の最大値
#x = 2147483647
#--以下解答---------------------------------
l = []
ansL = []
x = 2147483647
index = 0
for i in range(5):
   l.append( int(input()) )
   ansL.append( int(l[i]%10) )
   if ansL[i]>0 and ansL[i]<x:
      index = i

print(l)
ans = 0
for i in range(5):
    if i == dex:
        ans += l[i]
    elif l[i]%10 != 0:
        ans += int(l[i]/10)*10 +10
    else:
        ans += l[i]
    print(ans)

print(ans)
Problem p03078 (python)

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

x,y,z,k = map(int,input().split())
lisa = sorted(map(int,input().split()))
lisb = sorted(map(int,input().split()))
lisc = sorted(map(int,input().split()))

ab = sorted(a+b for a in lisa for b in lisb)[:-k-1:-1]
abc = sorted(ab+c for ab in ab[:k] for c in lisc)[:-k-1:-1]

print(*abc, sep="\n")

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

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ab = sorted(x+y for x in a for y in b)[:-k-1:-1]
abc = sorted(ab+c for ab in ab[:k] for c in c)[:-k-1:-1]

print(*abc, sep="\n")

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

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ab = sorted(a+b for a in a for b in b)[:-k-1:-1]
abc = sorted(ab+c for ab in ab[:k] for c in c)[:-k-1:-1]

print(*abc, sep="\n")
Problem p02536 (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()))

class UnionFind():
	"""docstring for UnionFind"""
	def __init__(self, n):
		self.parents = [-1]*n

	def find(self,x):
		if self.parents[x] < 0: #自分が親である時
			return x
		else: #自分が子供である時
			self.parents[x]=self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		# 各要素の親要素を返す
		x=self.find(x)
		y=self.find(y)

		if x==y:
			return
		if self.parents[x] > self.parents[y]:
			x,y=y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x
		# print(self.parents)
n,m=input2()
AB=[input_array() for _ in range(m)]


uf = UnionFind(n)
for ab in AB:
	a=ab[0]
	b=ab[1]
	uf.union(a-1,b-1)

ans=0
for i in uf.parents:
	if i < 0:
		ans+=1
print(ans-1)

Buggy submission (verdict: Runtime Error):
#入力: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=input2()
AB=[input_array() for _ in range(m)]


uf = UnionFind(n)
for ab in AB:
	a=ab[0]
	b=ab[1]
	uf.union(a-1,b-1)

ans=0
for i in uf.parents:
	if i < 0:
		ans+=1
print(ans-1)
Problem p02576 (python)

Fixed submission:
import math

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

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,x,t=input2()
ans=(math.ceil(n/x))*t
print(ans)

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

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,x,t=input2()
ans=(math.ceil(n/x))*t
print(ans)
Problem p02612 (python)

Fixed submission:

n=int(input())
for i in range(1000,10001,1000):
	num=i-n
	if num >=0:
		print(num)
		break

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1000,10001,1000):
	num=i-n
	if num >=0:
      print(num)
      break
Problem p02614 (python)

Fixed submission:
from itertools import product

def input2():
	return map(int,input().split())
  
h,w,k=input2()
C=[list(input()) for _ in range(h)]





ans=0

for row_bit in product(range(2),repeat=h): #[行]0:赤なし，1:赤あり
	for col_bit in product(range(2),repeat=w): #[列]0:赤なし，1:赤あり
		count=0
		# 以下，黒("#")の個数判定
		for row in range(h):
			for col in range(w):
				if C[row][col]=="#" and (row_bit[row]==0 and col_bit[col]==0):
					count+=1
		if count==k:
			ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
H,W,K=input2()
c=[list(input()) for _ in range(H)]

ans=0
print(c)

for row_line in product(range(2),repeat=H): #[行]0:そのまま，1:赤く塗る
	for col_line in product(range(2), repeat=W): #[列]0:そのまま，1:赤く塗る
		# 黒("#")の数え上げ
		cnt=0
		for row in range(H):
			for col in range(W):
				if c[row][col]=="#" and row_line[row]==0 and col_line[col]==0:
					cnt+=1

		if cnt==K:
			ans+=1
print(ans)
Problem p02615 (python)

Fixed submission:
import heapq

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

n=int(input())
A=input_array()
sortA=sorted(A,reverse=True) #降順にソート

ans=0
q=[]
heapq.heappush(q,-sortA[0])

for i in range(1,n):
	tmp=heapq.heappop(q)
	tmp*=-1
	ans+=tmp
	heapq.heappush(q,-sortA[i])
	heapq.heappush(q,-sortA[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

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

n=int(input())
A=input_array()
sortA=sorted(A,reverse=True) #降順にソート

ans=0
q=[]
heapq.heappush(q,-sortA[0])

for i in range(1,n):
	tmp=heapq.heappop(q)
	tmp*=-1
	ans+=tmp
	heapq.heappush(q,-sortA[i])
	heapq.heappush(q,-sortA[i])
	print(q)
print(ans)
Problem p02630 (python)

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

n=int(input())
a=input_array()
q=int(input())
BC=[input_array() for _ in range(q)]
SUM=sum(a)

A=[0]*(10**5+1)
for i in a:
	A[i]+=1

for bc in BC:
	diff= bc[1]-bc[0]
	SUM+=diff*A[bc[0]]
	A[bc[1]]+=A[bc[0]]
	A[bc[0]]-=A[bc[0]]
	print(SUM)

Buggy submission (verdict: Runtime Error):
A=[0]*(10**5+1)
for i in a:
	A[i]+=1

for bc in BC:
	diff= bc[1]-bc[0]
	SUM+=diff*A[bc[0]]
	A[bc[1]]+=A[bc[0]]
	A[bc[0]]-=A[bc[0]]
	print(SUM)

Buggy submission (verdict: Runtime Error):
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n=int(input())
a=input_array()
q=int(input())
BC=[input_array() for _ in range(q)]
SUM=sum(a)

A=[0]*10**5
for i in a:
	A[i]+=1

for bc in BC:
	diff= bc[1]-bc[0]
	SUM+=diff*A[bc[0]]
	A[bc[1]]+=A[bc[0]]
	A[bc[0]]-=A[bc[0]]
	print(SUM)
Problem p02641 (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()))
  
x,n=input2()
p=sorted(input_array())
q=[0]*102
result=[10000,-1]
for i in range(n):
	q[p[i]]=1
for i in range(102):
	if q[i]==0:
		num=abs(i-x)
		if num<result[0]:
			result=[num,i]
print(result[1])

Buggy submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
x,n=input2()
p=sorted(input_array())
q=[0]*102
result=[10000,-1]
for i in range(n):
	q[p[i]]=1
for i in range(102):
	if q[i]==0:
		num=abs(i-x)
		if num<result[0]:
			result=[num,i]
print(result[1])
Problem p02658 (python)

Fixed submission:
import sys

#入力: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()))
  
n=input1()
A=input_array()
if 0 in A:
	print(0)
	sys.exit()
ans=1

for a in A:
	ans=ans*a
	if ans > 10**18:
		break

if ans > 10**18:
	print(-1)
else:
	print(ans)

Buggy submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
n=int(input())
A=input_array()
MAX=10**18
ans=A[0]

for i in range(1,len(A)):
	ans*=A[i]
	if ans==0:
		break
	elif ans>MAX:
		ans=-1
		break
	else:
		pass

print(ans)
Problem p02684 (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,k=input2()
A=input_array()

# ある地点から循環に陥る
judge=[True]*n
tmps=[1] #循環手前
count=0 #参照地点

for i in range(2*(10**5)+1):
	if judge[count]==True:
		judge[count]=False
		count=A[count]-1
		tmps.append(count+1)
	else:
		break

loop_st=tmps.index(tmps[-1])
loops=tmps[loop_st:-1]


if k<loop_st:
	print(tmps[k])
else:
	k=k-loop_st
	k%=len(loops)
	print(loops[k])

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

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

# ある地点から循環に陥る
judge=[True]*n
tmps=[1] #循環手前
count=0 #参照地点

for i in range(2*(10**5)+1):
	if judge[count]==True:
		judge[count]=False
		count=A[count]-1
		tmps.append(count+1)
	else:
		break

loop_st=tmps[-1]
loops=tmps[loop_st:-1]


if k<loop_st:
	print(tmps[k])
else:
	k=k-loop_st
	k%=len(loops)
	print(loops[k])

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

# ある地点から循環に陥る
tmps=[1] #循環手前
loops=[] #循環
st=0 #循環が始まる地点
count=0 #参照地点

for i in range(10**5):
	if A[count] not in tmps:
		tmps.append(A[count])
	elif (A[count] in tmps) and (A[count] not in loops):
		loops.append(A[count])
		st=i
	else:
		break
	count=A[count]-1


if k<=st:
	print(tmps[k-1])
else:
	ans=(k-(st-1))%len(loops)
	print(loops[ans])
Problem p02730 (python)

Fixed submission:
S = str(input())

N=len(S)

s1=S[:int((N-1)/2)]
s2=S[int((N+3)/2-1):]

if S==S[::-1] and s1==s1[::-1] and s2==s2[::-1]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
S = str(input())

N=len(S)

s1=S[:(N-1)/2]
s2=S[(N+3)/2:]

if s1==s2:
	print("Yes")
else:
	print("No")
Problem p02761 (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=input2()
sc_list=[]
for _ in range(m):
	sc_list.append(input_array())

result=0
flag=True
result_dict={}
for sc in sc_list:
	sc0=sc[0]
	sc1=sc[1]
	if n!=1 and sc0==1 and sc1==0:
		#2桁以上かつ先頭が0である
		flag=False
		break
	elif sc0 in result_dict:
		if result_dict[sc0]==sc1:
			#既に入力済である場合
			continue
		else:
			#数字の衝突
			flag=False
			break
	else:
		result+=10**(n-sc0)*sc1
		result_dict[sc0]=sc1

if len(str(result))<n:
	result+=10**(n-1)

if flag:
	print(result)
else:
	print(-1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
lines=[]
lines_s=[]
ans=0
for line in range(M):
	s,c=map(int,input().split())
	if N>=s and s not in lines_s:
		ans+=c*(10**(N-s))
		lines.append([s,c])
		lines_s.append(s)
	elif [s,c] in lines:
		continue

	else:
		break

if len(ans)==N:
	print(ans)
else:
	print(-1)
Problem p02767 (python)

Fixed submission:
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


n=input1()
X=input_array()

min_p=min(X)
max_p=max(X)
b_p=10000
p=[]
for i in range(min_p,max_p):
	s=0
	for j in X:
		s+=(j-i)**2
	p.append(s)
	# if s>b_p:
	# 	break
	# else:
	# 	b_p=s

if p==[]:
	print(0)
else:
	print(min(p))

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


n=input1()
X=input_array()

min_p=min(X)
max_p=max(X)
b_p=10000
p=[]
for i in range(min_p,max_p):
	s=0
	for j in X:
		s+=(j-i)**2
	p.append(s)
	# if s>b_p:
	# 	break
	# else:
	# 	b_p=s
print(min(p))
Problem p02772 (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()))





N=input1()
A=input_array()
flag=True
for x in A:
	if x%2==0:
		if x%3==0 or x%5==0:
			continue
		else:
			flag=False
			break
if flag:
	print("APPROVED")
else:
	print("DENIED")

Buggy submission (verdict: Runtime Error):
N=input1()
A=input_array()
flag=True
for x in A:
	if x%2==0:
		if x%3==0 or x%5==0:
			continue
		else:
			flag=False
			break
if flag:
	print("APPROVED")
else:
	print("DENIED")
Problem p02838 (python)

Fixed submission:
import numpy as np

n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1) # 自分がnp.sumを利用したがどうしても正解になれなかった。なぜ？
    s += 2 ** i * c1 * (n - c1)
    arr >>= 1

print(s % mod)

Buggy submission (verdict: Runtime Error):
import math
import fractions
import sys
import itertools
import numpy as np
#入力: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()))


N=input1()
A=np.array(input_array())
mod=10**9-7
s=0

for i in range(60):
	c1=np.count_nonzero(A & 1)
	s+=2**i*c1*(n-c1)
	A = A >> 1

print(s % mod)

Buggy submission (verdict: Runtime Error):
import math
import fractions
import sys
import itertools
import numpy as np
#入力: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()))


N=input1()
A=np.array(input_array())
mod=10**9-7
s=0

for i in range(60):
	c1=np.count_nonzero(A & 1)
	s+=2**i*c1*(n-c1)
	A = A >> 1

print(s % mod
Problem p02900 (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
			


A,B=input2()
gcd=fractions.gcd(A,B)
# ch=ch(gcd)
print(factorization(int(gcd))+1)

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):
	arr=[]
	tmp=n
	count=0
	for i in range(2,int(-(-n**0.5//1))+1):
		if tmp%i==0:
			cnt=0
			count+=1
			while tmp%i==0:
				cnt+=1
				tmp//=i
		if tmp==1:
			break
	return count+1
			


A,B=input2()
gcd=math.gcd(A,B)
# ch=ch(gcd)
print(factorization(int(gcd)))
#素数を数える
Problem p02911 (python)

Fixed submission:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
n,k,q=input2()
A=[int(input()) for _ in range(q)]

P=[0]*n


for a in A:
	P[a-1]+=1

for p in P:
	if p >q-k:
		print("Yes")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
import sys

t = input()
n = t[3::]
point = range(len(n))
point = t[1]
for i in t[2]:
  point[n[i]]-=1
for j in point:
  if point[j]>0:
    print("Yes")
  else:
    print("No")
Problem p02922 (python)

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

a,b=input2()
count=1
if b<=1:
	print(0)
else:
	for i in range(1,21):
		count=count-1+a
		if count>=b:
			print(i)
			break

Buggy submission (verdict: Runtime Error):
a,b=input2()
count=1

for i in range(1,21):
	count=count-1+a
	if count>=b:
		print(i)
		break
Problem p02947 (python)

Fixed submission:
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
from collections import deque

#入力: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(range(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 prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
	
def count_str(m):
	tmp={}
	for i in range(10):
		if i in tmp:
			tmp[i]=1
		else:
			tmp[i]+=1
	return tmp
		


n=input1()
s=[]
for i in range(n):
	s.append(str(input()))
str_dict={"".join(sorted(s[0])):0}
count=0
for i in range(1,n):
	now_d="".join(sorted(s[i]))
	if now_d in str_dict:
		str_dict[now_d]+=1
		count+=str_dict[now_d]
	else:
		str_dict[now_d]=0
print(count)

Buggy submission (verdict: Runtime Error):
counter={}
ans=0
for i in range(n):
	ss = sorted(s[i])
	ss=("").join(ss)
	if ss not in counter:
		counter[ss]=0
	else:
		counter[ss]+=1
		ans+=counter[ss]

print(ans)
Problem p02982 (python)

Fixed submission:
import math

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

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

def euclid(y,z,d):
	result=0
	for i in range(d):
		result+=(y[i]-z[i])**2
	return math.sqrt(result)


n,d=input2()
X=[input_array() for _ in range(n)]

count=0
for i in range(n):
	for j in range(i+1,n):
		distance=euclid(X[i],X[j],d)
		if (distance%1) == 0:
			count+=1
print(count)

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

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
def euclid(y,z,d):
	result=0
	for i in range(d):
		result+=(y[i]-z[i])**2
	return math.sqrt(result)


n,d=input2()
X=[input_array() for _ in range(n)]

count=0
for i in range(n):
	for j in range(i+1,n):
		distance=euclid(X[i],X[j],d)
		if (distance%1) == 0:
			count+=1
print(count)
Problem p02993 (python)

Fixed submission:
s=list(str(input()))
f=True
for i in range(1,4):
	if s[i-1]==s[i]:
		f=False
		break
	else:
		continue
if f:
	print("Good")
else:
	print("Bad")

Buggy submission (verdict: Runtime Error):
s=list(int(input()))
f=True
for i in range(1,4):
	if s[i-1]==s[i]:
		f=False
		break
	else:
		continue
if f:
	print("Good")
else:
	print("Bad")
Problem p03029 (python)

Fixed submission:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
a,p=input2()
ans=((a*3)+p)//2
print(ans)

Buggy submission (verdict: Runtime Error):
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
a,p=input2()
ans=((A*3)+p)//2
print(ans)
Problem p03037 (python)

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

N,M=input2()
L,R=[],[]
for i in range(M):
	l,r=input2()
	L.append(l)
	R.append(r)

MIN=0
MAX=N

for j in range(M):
	if L[j]>MIN:
		MIN=L[j]
	if R[j]<MAX:
		MAX=R[j]

if MAX<MIN:
	print(0)
else:
	print((MAX-MIN)+1)

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

N,M=input2()
L,R=[],[]
for i in range(M):
	l,r=input2()
	L.append(l)
	R.append(r)

MIN=0
MAX=N

for j in range(M):
	if L[j]>MIN and :
		MIN=L[j]
	if R[j]<MAX:
		MAX=R[j]

if MAX<MIN:
	print(0)
else:
	print((MAX-MIN)+1)
Problem p03076 (python)

Fixed submission:
import math

dish=[int(input()) for _ in range(5)]
count={str(i%10):[] for i in range(10,-1,-1)}
for t in dish:
	one=t%10
	count[str(one)].append(t)

ans=0
d=0
for k,v in count.items():
	if v!=[]:
		for c in v:
			if d>3:
				ans+=c
			else:
				ans+=math.ceil(c/10)*10
				d+=1
print(int(ans))

Buggy submission (verdict: Runtime Error):
dish=[int(input()) for _ in range(5)]
count={str(i%10):[] for i in range(10,-1,-1)}
for t in dish:
	one=t%10
	count[str(one)].append(t)

ans=0
d=0
for k,v in count.items():
	if v!=[]:
		for c in v:
			if d>3:
				ans+=c
			else:
				ans+=math.ceil(c/10)*10
				d+=1
print(int(ans))