Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input(),split())
n = math.pow((c-a-b),2)
m = 4*a*b
if(a+b >= c)
    print("No")
else
    if(n > m)
        print("Yes")
    else
        print("No")

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input(),split())
n = math.pow((c-a-b),2)
m = 4*a*b
if(a+b >= c):
    print("No")
else:
    if(n > m):
        print("Yes")
    else:
        print("No")

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input(),split())
n = (c-a-b)**2
m = a*b*4
if(a+b >= c):
	print("No")
else:
	if(n < m):
		print("Yes")
	else:
		print("No")

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input(),split())
n = (c-a-b)**2
m = a*b*4
if((a+b) >= c):
	print("No")
else:
	if(n < m):
		print("Yes")
	else:
		print("No")

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(int,input(),split())
n = math.pow((c-(a-b)), 2)
m = a*b*4
if((a+b) >= c):
	print("no")
else:
	if(n < m):
		print("yes")
	else:
		print("no")

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(input(),split())
n = math.pow((c-(a-b)), 2)
m = a*b*4
if((a+b) >= c):
	print("no")
else:
	if(n < m):
		print("yes")
	else:
		print("no")

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b,c = map(input(),split())
n = math.Pow((c-(a-b)), 2)
m = a*b*4
if((a+b) >= c):
  print("no")
else:
  if(n < m):
     print("yes")
  else:
     print("no")

Fixed submission:
import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
adj = defaultdict(list)
col = defaultdict(int)
mx=0
edges = {}
def find_color(u , p):
	global mx , now
	cnt =0
	for i in adj[u]:
		cnt = cnt+1
		if i==p:
			continue
		find_color(i , u)
	mx = max(mx, cnt)
now =0
def dfs(u , p):
	global mx, now
	for i in adj[u]:
		if i==p:
			continue
		col[edges[i,u]]=now
		now =(now+1)%mx
	for i in adj[u]:
		if i==p:
			continue
		dfs(i , u)

def main():
	n = int(input())
	for i in range(n-1):
		x, y = map(int , input().split())
		adj[x].append((y))
		adj[y].append((x))
		edges[x,y]=i
		edges[y,x]=i
	find_color(1, 0)
	dfs(1, 0)
	print(mx)
	for i in range(n-1):
		print(col[i]+1)


if __name__ == "__main__":
	main()

Fixed submission:
import os
import sys
from collections import defaultdict
adj = defaultdict(list)
col = defaultdict(int)
sys.setrecursionlimit(1000000)
mx=0
edges = {}
def find_color(u , p):
	global mx , now
	cnt =0
	for i in adj[u]:
		cnt = cnt+1
		if i==p:
			continue
		find_color(i , u)
	mx = max(mx, cnt)
now =0
def dfs(u , p, prev):
	global mx, now
	for i in adj[u]:
		if i==p:
			continue
		if now == prev:
			now = (now+1)%mx
		col[edges[i,u]]=now
		now =(now+1)%mx
	for i in adj[u]:
		if i==p:
			continue
		dfs(i , u, col[edges[i, u]])

def main():
	n = int(input())
	for i in range(n-1):
		x, y = map(int , input().split())
		adj[x].append((y))
		adj[y].append((x))
		edges[x,y]=i
		edges[y,x]=i
	find_color(1, 0)
	dfs(1, 0,-1)
	print(mx)
	for i in range(n-1):
		print(col[i]+1)


if __name__ == "__main__":
	main()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
	for i , w in adj[u]:
		if i==p:
			continue
		dis[i]=dis[u]+w
		dis[i]=dis[i]%2
		dfs(i , u)
def main():
	n = int(input())
	for i in range(n-1):
		x, y , w = map(int , input().split())
		w = w%2
		adj[x].append([y , w])
		adj[y].append([x, w])
	dfs(1, 0)
	for i in range(1,n+1):
		print(dis[i])
if __name__ =="__main__":
	main()

Fixed submission:
import sys
import os
sys.setrecursionlimit(1000000)
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
	for i , w in adj[u]:
		if i==p:
			continue
		dis[i]=dis[u]+w
		dis[i]=dis[i]%2
		dfs(i , u)
def main():
	n = int(input())
	for i in range(n-1):
		x, y , w = map(int , input().split())
		w = w%2
		adj[x].append([y , w])
		adj[y].append([x, w])
	dfs(1, 0)
	for i in range(1,n+1):
		print(dis[i])
if __name__ =="__main__":
	main()

Buggy python submission (verdict: Runtime Error):
# code like professional " write main function"
import os
import sys
from collections import defaultdict
adj = defaultdict(list)
col = defaultdict(int)
sys.setrecursionlimit(1000000)
mx=0
edges = {}
# finding maximum color we need it would be maximum neighbouring nodes of out of all the nodes
def find_color(u , p):
	global mx , now
	cnt =0
	for i in adj[u]:
		cnt = cnt+1
		if i==p:
			continue
		find_color(i , u)
	mx = max(mx, cnt)
now =0
# now color the edges 
def dfs(u , p, prev):
	global mx, now
	for i in adj[u]:
		if i==p:
			continue
		# if current color is equivalent to previous edge color use next color
		if now == prev:
			now = (now+1)%mx
		col[edges[i,u]]=now
		now =(now+1)%mx
	for i in adj[u]:
		if i==p:
			continue
		dfs(i , u, col[edges[i, u]])

def main():
	n = int(input())
	for i in range(n-1):
		x, y = map(int , input().split())
		adj[x].append((y))
		adj[y].append((x))
		edges[x,y]=i
		edges[y,x]=i
	find_color(1, 0)
	dfs(1, 0,-1)
	print(mx)
	for i in range(n-1):
		print(col[i]+1)


if __name__ == "__main__":
	main()

Fixed submission:
import sys
import os
sys.setrecursionlimit(1000000)
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
	for i , w in adj[u]:
		if i==p:
			continue
		dis[i]=dis[u]+w
		dis[i]=dis[i]%2
		dfs(i , u)
def main():
	n = int(input())
	for i in range(n-1):
		x, y , w = map(int , input().split())
		w = w%2
		adj[x].append([y , w])
		adj[y].append([x, w])
	dfs(1, 0)
	for i in range(1,n+1):
		print(dis[i])
if __name__ =="__main__":
	main()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
adj = defaultdict(list)
vis =[0 for i in range(1000000)]
dis =[0 for i in range(1000000)]
def dfs(u, p):
	for v, w in adj[u]:
		if v==p:
			continue
		dis[v]=dis[u]+w
		dfs(v, u)

def main():
	n = int(input())
	for i in range(n-1):
		a, b, w = map(int , input().split())
		adj[a].append((b, w))
		adj[b].append((a, w))

	q, k = map(int , input().split())
	dfs(k , 0)
	for i in range(q):
		x, y  =map(int , input().split())
		print(dis[x]+dis[y])

if __name__ == "__main__":
	main()

Fixed submission:
import sys
import os
from collections import defaultdict
adj = defaultdict(list)
vis =[0 for i in range(1000000)]
dis =[0 for i in range(1000000)]
def dfs(u, p):
	for v, w in adj[u]:
		if v==p:
			continue
		dis[v]=dis[u]+w
		dfs(v, u)

def main():
	n = int(input())
	for i in range(n-1):
		a, b, w = map(int , input().split())
		adj[a].append((b, w))
		adj[b].append((a, w))

	q, k = map(int , input().split())
	sys.setrecursionlimit(1000000)
	dfs(k , 0)
	for i in range(q):
		x, y  =map(int , input().split())
		print(dis[x]+dis[y])
#	rec_limit= sys.getrecursionlimit()
#	print(rec_limit)


if __name__ == "__main__":
	main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
tot=0
dp = [0 for i in range(n+4)]
for i in range(1, n+1):
	tot=tot+i
	if tot>=n:
		print(i)
		break

Fixed submission:
n = int(input())
tot=0
for i in range(1, n+1):
	tot=tot+i
	if tot>=n:
		print(i)
		break
Buggy python submission (verdict: Runtime Error):
@n, @a, @b, @c = gets.chomp.split(" ").map(&:to_i)

@l = []
@n.times do
  @l << gets.chomp.to_i
end
INF = 10**9

def dfs(cur, a, b, c)
  if cur == @n
    if [a, b, c].min > 0
      return (a - @a).abs + (b - @b).abs + (c - @c).abs - 30
    else
      return INF
    end
  end
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + @l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a , b + @l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + @l[cur]) + 10
  return [ret0, ret1, ret2, ret3].min
end

puts dfs(0, 0, 0, 0)

Fixed submission:
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))
Buggy python submission (verdict: Runtime Error):
z = input()
if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
  return "Yes"
else:
  return "No"

Fixed submission:
z = input()

if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
large_s = input()

con = 0
str_check = ""
for i in range(len(large_s)):
    z = large_s.find('hi', con, len(large_s))
    if (0 <= z):
        print(z)
        str_check += str(z)
        con += 2


if (str_check=='0' or str_check=='02' or str_check=='024' or str_check=='0246' or str_check=='02468'):
        print("Yes")
    else:
        print("No")


Fixed submission:
z = input()

if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
 large_s = input()

        con = 0
        str_check = ""
        for i in range(len(large_s)):
            z = large_s.find('hi', con, len(large_s))
            if (0 <= z):
                print(z)
                str_check += str(z)
                con += 2


        if (str_check=='0' or str_check=='02' or str_check=='024' or str_check=='0246' or str_check=='02468'):
                print("Yes")
        else:
            print("No")


Fixed submission:
z = input()

if z=='hi' or z=='hihi' or z=='hihihi' or z=='hihihihi' or z=='hihihihihi':
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
k = int(input())
x = int(input())

if k*500 < x:
    print("No")
else:
    print("Yes")


Fixed submission:
k,x=(int(x) for x in input().split())

if k*500 < x:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
k = input()
x = input()

if k*500 < x:
    print("no")
else:
    print("yes")


Fixed submission:
k,x=(int(x) for x in input().split())

if k*500 < x:
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
k = int(input())
x = int(input())

if k*500 < x:
    print("No")
else:
    print("Yes")


Fixed submission:
k,x=(int(x) for x in input().split())

if k*500 < x:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
A,B,M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m=[]
for i in range(M):
    array = list(map(int, input().strip().split()))
    m.append(array)

def hitachi02(a,b,m):
    results=[]
    for i in range(len(a)):
        for j in range(len(b)):
            for k in range(len(m)):
                if i+1 == m[k][0] and j+1 == m[k][1]:
                    cal = a[i]+b[j]-m[k][2]
                else:
                    cal = a[i]+b[j]
                results.append(cal)
    result=min(results)
    return result

result=hitachi02(a,b,m)
print(result)

Fixed submission:
A,B,M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m=[]
for i in range(M):
    array = list(map(int, input().strip().split()))
    m.append(array)

def hitachi02(a,b,m):
    results=[]
    cal01=min(a)+min(b)
    for k in range(len(m)):
        results.append(a[m[k][0]-1]+b[m[k][1]-1]-m[k][2])
    cal02=min(results)
    if cal01>=cal02:
        return cal02
    else:
        return cal01

result=hitachi02(a,b,m)
print(result)
Buggy python submission (verdict: Runtime Error):
def judge(check_string):

    HITACH_STRING = "hi"

    if not((1 <= len(check_string)) && (len(check_string) <= 10)):
        print("No")

    if HITACH_STRING in check_string:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    hitachi_string = input()
    judge(hitachi_string)

Fixed submission:
import re

def judge(check_string):

    # check length.
    if not((1 <= len(check_string)) and (len(check_string) <= 10)):
        print("No")

    # check character.
    allow_pattern = "[a-z]+"
    group = re.match(allow_pattern, check_string)

    HITACH_STRING = "^(hi){1,}$"

    if(re.match(HITACH_STRING, check_string)):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    hitachi_string = input()
    judge(hitachi_string)

Buggy python submission (verdict: Runtime Error):
s = input()
hi = 'hi'

if hi == s:
  return "Yes"
elif hi == hi * 2:
  return "Yes"
elif hi == hi * 3:
  return "Yes"
elif hi == hi ** 4:
  return "Yes"
elif hi == hi ** 5:
  retrn "Yes"
else:
  return "No"

Fixed submission:
s = input()

if s == 'hi':
  print('Yes')
elif s == 'hihi':
  print('Yes')
elif s == 'hihihi':
  print('Yes')
elif s == 'hihihihi':
  print('Yes')
elif s == 'hihihihihi':
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()

if 'hi' in s:
  return 'Yes'
else:
  return 'No'

Fixed submission:
s = input()

if s == 'hi':
  print('Yes')
elif s == 'hihi':
  print('Yes')
elif s == 'hihihi':
  print('Yes')
elif s == 'hihihihi':
  print('Yes')
elif s == 'hihihihihi':
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
R = []
for i in range(1,N+1):
  dx = A.index(str(i))
  R.append(str(dx+1))

out = ' '.join(R)
print(out)

Fixed submission:
N = int(input())
odd = 0
same = 0
for x in range(1,N+1,1):
  if x % 2 == 0:
    same += 1
  else:
    odd += 1
print(odd / (odd + same))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
R = []
for i in range(1,N+1):
  dx = A.index(str(i))
  R.append(str(dx+1))

out = ' '.join(R)
print(out)

Fixed submission:
N = int(input())
odd = 0
same = 0
for x in range(1,N+1,1):
  if x % 2 == 0:
    same += 1
  else:
    odd += 1
print(odd / (odd + same))
Buggy python submission (verdict: Time Limit Exceeded):
import copy


def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    for i in range(len(a)):
        b = copy.deepcopy(a)
        b.pop(i)
        print(max(b))


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    b = sorted(a)
    for i in range(len(a)):
        if a[i] == b[-1]:
            print(b[-2])
        else:
            print(b[-1])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
count = 0
out = 0
for i in range(len(S_list)-1):
    #print(i)
    if S_list[i]=='h':
        if S_list[i+1]=='i':    
            if i+2 > len(S_list)-1:
                count += 1                
            else:
                if S_list[i+2]=='i':
                    out += 1

if count >0 and out ==0:
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()

List = ['hihi', 'hi', 'hihihi', 'hihihihi', 'hihihihihi']

if S in List:
  print('Yes')
  
else:
  print('No')

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

S_list = list(S)

for i in range(len(S_list)-1):
    if S_list[i]=='h':
        if S_list[i+1]=='i':    
            try:
                letter = S_list[i+2]
            except IndexError:
                pass
                if letter!='i':                    
                    print('Yes')
                    break
else:
    print('No')

Fixed submission:
S = input()

List = ['hihi', 'hi', 'hihihi', 'hihihihi', 'hihihihihi']

if S in List:
  print('Yes')
  
else:
  print('No')

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

S_list=list(S)
for i in range(S_list):
  if S_list[i]=='h':
    if S_list[i+1] == 'i':
      if S_list[i+1] != 'i':
        print('Yes')
    
else:
  print('No')

Fixed submission:
S = input()

List = ['hihi', 'hi', 'hihihi', 'hihihihi', 'hihihihihi']

if S in List:
  print('Yes')
  
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
if s.search("hi") != -1:
    print("Yes")
else:
    print("No")

Fixed submission:
import re
s = input()
if s == "hi" or s=="hihi" or s=="hihihi" or s=="hihihihi" or s== "hihihihihi": 
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
X,n = map(int,input().split(" "))
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
 print(Base_10_to_n(X, n))

Fixed submission:
X,n = map(int,input().split(" "))
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
a=Base_10_to_n(X, n)
print(len(str(a)))
Buggy python submission (verdict: Runtime Error):
_, _, M = map(int, input().split())
# price list
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
# min price
min_price = min(a_list) + min(b_list)
for _ in range(M):
  x, y, c = map(int, input().split())
  discount_price = a_list[x] + b_list[y] - c
  if discount_price < min_price:
    min_price = discount_price
print(min_price)

Fixed submission:
_, _, M = map(int, input().split())
# price list
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
# min price
min_price = min(a_list) + min(b_list)
for _ in range(M):
  x, y, c = map(int, input().split())
  discount_price = a_list[x-1] + b_list[y-1] - c
  min_price = min(min_price, discount_price)
print(min_price)

Buggy python submission (verdict: Runtime Error):
A, B, M = map(int, input().split())
# price list
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
# min price
min_price = min(a_list) + min(b_list)
for m in range(M):
  x, y, c = map(int, input().split())
  discount_price = a_list[x] + b_list[y] - c
  if discount_price < min_price:
    min_price = discount_price
print(min_price)

Fixed submission:
_, _, M = map(int, input().split())
# price list
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
# min price
min_price = min(a_list) + min(b_list)
for _ in range(M):
  x, y, c = map(int, input().split())
  discount_price = a_list[x-1] + b_list[y-1] - c
  min_price = min(min_price, discount_price)
print(min_price)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
def is_easy(steps):
  for i, step in enumerate(steps):
    if i % 2 == 0 and step == 'L':
      return 'No'
  	elif i % 2 == 1 and step == 'R':
      return 'No'
	return 'Yes'
  
steps = input()
print(is_easy(steps))

Fixed submission:
# coding: utf-8
def is_easy(steps):
    for i, step in enumerate(steps):
        if i % 2 == 0 and step == 'L':
            return 'No'
        elif i % 2 == 1 and step == 'R':
            return 'No'
    return 'Yes'
  
steps = input()
print(is_easy(steps))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import numpy as np
step_strings = {'L': 0, 'U': 1, 'D': 2, 'R': 3}
steps = input()
steps = np.array([step_strings[s] for s in steps])
steps_index = (np.arange(steps.size) + 1) % 2
if steps[steps_index == 0].max() < 3 and steps[steps_index == 1].min() > 0:
	print('Yes')
else:
  	print('No')

Fixed submission:
# coding: utf-8
def is_easy(steps):
    for i, step in enumerate(steps):
        if i % 2 == 0 and step == 'L':
            return 'No'
        elif i % 2 == 1 and step == 'R':
            return 'No'
    return 'Yes'
  
steps = input()
print(is_easy(steps))
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
S_lists = [input() for i in range(N)]

S_dict = {}

for S in S_lists:
    S_list = list(S)
    S_list.sort()

    S_str = "".join(S_list)
    if S_str in S_dict.keys():
        S_dict[S_str] = S_dict[S_str] + 1
    else:
        S_dict[S_str] = 1

answer = 0
for v in S_dict.values():
    if v > 1:
        answer += int(math.factorial(v) / 2)

print(answer)


Fixed submission:
N = int(input())
S_lists = [input() for i in range(N)]

S_dict = {}

for S in S_lists:
    S_list = list(S)
    S_list.sort()

    S_str = "".join(S_list)
    if S_str in S_dict.keys():
        S_dict[S_str] = S_dict[S_str] + 1
    else:
        S_dict[S_str] = 1

answer = 0
for v in S_dict.values():
    if v > 1:
        answer += int(v * (v - 1) / 2)

print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, M = [int(x) for x in input().split()]
A_price_list = [int(x) for x in input().split()]
B_price_list = [int(x) for x in input().split()]

discount_list = [[0 for j in range(B)] for i in range(A)]

for i in range(M):
    x, y, c = ([int(x) for x in input().split()])
    discount_list[x-1][y-1] = max(discount_list[x-1][y-1], c)


amount = 9999999999999999999999999
for i in range(A):
    for j in range(B):
        tmp_amount = A_price_list[i] + B_price_list[j] - discount_list[i][j]
        amount = min(amount, tmp_amount)

print(amount)

Fixed submission:
A, B, M = [int(x) for x in input().split()]
A_price_list = [int(x) for x in input().split()]
B_price_list = [int(x) for x in input().split()]

discount_list = []

for i in range(M):
    x, y, c = [int(x) for x in input().split()]
    discount_list.append([x-1, y-1, c])


amount = min(A_price_list) + min(B_price_list)

for x, y, c in discount_list:
    tmp_price = A_price_list[x] + B_price_list[y] - c
    amount = min(tmp_price, amount)

print(amount)
Buggy python submission (verdict: Runtime Error):
N = input()
S = input()

N = int(N)

if N % 2 == 1:
  print("No")
elif list(S)[0:N//2] == list(S)[N//2:N]:
  print("Yes")
else:
  print("No")


Fixed submission:
r = input()
r = int(r) ** 2
print(r)