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

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
	
def main():
	N, Q = map(int, input().split())
	S = "_" + input() + "_"
	
	TD = []
	for _ in range(Q):
		tmp = input().split(" ")
		t = tmp[0]
		d = tmp[1]
		TD.append((t, d))
		
	TD.reverse()
	gake_L = 0
	gake_R = N - 1 + 2
	
	for i, val in enumerate(TD):
		t, d = val
		
		if d == "R":
			if t == S[gake_R-1]:
				gake_R -= 1
			if t == S[gake_L]:
				gake_L -= 1
		
		if d == "L":
			if t == S[gake_R]:
				gake_R += 1
			if t == S[gake_L+1]:
				gake_L += 1
	
	print(max(0, gake_R-gake_L-1))
	
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
	
def main():
	N, Q = map(int, input().split())
	S = input()
	
	TD = []
	for _ in range(Q):
		tmp = input().split(" ")
		t = tmp[0]
		d = tmp[1]
		TD.append((t, d))
		
	TD.reverse()
	gake_L = 0
	gake_R = N - 1
	
	for i, val in enumerate(TD):
		t, d = val
		
		if d == "R":
			if t == S[gake_R]:
				gake_R -= 1
		
		if d == "L":
			if t == S[gake_L]:
				gake_L += 1
	
	print(max(0, gake_R - gake_L+1))
	
	
if __name__ == "__main__":
	main()

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

def main():
	N, Q = map(int, input().split(" "))
	S = input()
	S = list(S)
	gorlm_num = [1] * len(S)
	
	skill = []
	for _ in range(Q):
		t, d = input().split(" ")
		#print(gorlm_num)
		ttmp = S.count(t)
		ttmp_sub = 0
		for _ in range(ttmp):
			try :
				tmpS = S[ttmp_sub+1:]
				ins = tmpS.index(t)
				ttmp_sub += ins
			except : a = "a"
			else : a = "a"
				
			#print(ins)
				
			tt = gorlm_num[ins]
			gorlm_num[ins] = 0
			if d == "R" and ins != len(S)-1:
				gorlm_num[ins+1] += tt
			if d == "L" and ins != 0:
				gorlm_num[ins-1] += tt
				
	ans = 0
	for i in gorlm_num:
		ans = ans + i
		
	print(ans)
	
if __name__ == "__main__":
	main()

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

def main():
	N, Q = map(int, input().split(" "))
	S = input()
	S = list(S)
	
	skill = []
	for _ in range(Q):
		t, d = input().split(" ")
		skill.append((t, d))
	
	gorlm_num = [1] * len(S)
	
	for i, val in enumerate(skill):
		t, d = val
		#print(gorlm_num)
		for j, vol in enumerate(S):
			if t == vol:
				tt = gorlm_num[j]
				gorlm_num[j] = 0
				if d == "R" and j != len(S)-1:
					gorlm_num[j+1] += tt
				if d == "L" and j != 0:
					if j != 0:
					gorlm_num[j-1] += tt
						
	ans = 0
	for i in gorlm_num:
		ans = ans + i
		
	print(ans)
	
if __name__ == "__main__":
	main()
Problem p03148 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,K = inputMap()
	sushi_mii = []
	sushi_kii = []
	syu = [[] for i in range(N)]
	for i in range(N):
		t,d = inputMap()
		t -= 1
		syu[t].append(d)

	for i in syu:
		if len(i) > 0:
			i.sort()
			i = i[::-1]
			for j,val in enumerate(i):
				if j == 0:
					sushi_mii.append(val)
				else:
					sushi_kii.append(val)

	sushi_mii.sort()
	sushi_mii = sushi_mii[::-1]
	sushi_kii.sort()
	sushi_kii = sushi_kii[::-1]

	sushi_mi = []
	sushi_ki = []
	for i,val in enumerate(sushi_mii):
		if i == 0:
			sushi_mi.append(val)
		else:
			tmp = sushi_mi[i-1]
			sushi_mi.append(tmp + val)

	for i,val in enumerate(sushi_kii):
		if i == 0:
			sushi_ki.append(val)
		else:
			tmp = sushi_ki[i-1]
			sushi_ki.append(tmp + val)

	ans = 0
	for i in range(1, min(len(sushi_mi), K)+1):
		x = 0
		tmp = 0
		if K - i > len(sushi_ki):
			continue

		tmp += sushi_mi[i-1]
		x = i

		if K - i > 0:
			tmp += sushi_ki[K - i-1]

		oishi = tmp + x * x
		if ans < oishi:
			ans = oishi
	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,K = inputMap()
	sushi_mi = []
	sushi_ki = []
	syu = {}
	for i in range(N):
		t,d = inputMap()
		if t in syu:
			sushi_ki.append(d)
		else:
			syu[t] = 1
			sushi_mi.append(d)

	sushi_mi.sort()
	sushi_mi = sushi_mi[::-1]
	sushi_ki.sort()
	sushi_ki = sushi_ki[::-1]

	ans = 0
	for i in range(1,K+1):
		tmp = 0
		for j in range(0,i):
			tmp += sushi_mi[j]
		for j in range(0,K-i):
			tmp += sushi_ki[j]

		tmp += i*i
		if tmp > ans:
			ans = tmp

	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
Problem p03244 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N = int(input())
	V = input().split(" ")
	
	K = []
	G = []
	for i, val in enumerate(V):
		if i % 2 == 0:
			G.append(val)
		else:
			K.append(val)
	
	k = collections.Counter(K)
	k = sorted(k.items(), key=lambda x:x[1], reverse=True)
	g = collections.Counter(G)
	g = sorted(g.items(), key=lambda x:x[1], reverse=True)
	
	aaa, bbb = k[0]
	ccc, ddd = g[0]
	eee = -1
	fff = -1
	ggg = -1
	hhh = -1
	if len(k) > 1:
		eee, fff = k[1]
	if len(g) > 1:
		ggg, hhh = g[1]
	
	if aaa == ccc:
		if bbb > ddd and ggg != -1:
			g[0] = (ggg, hhh)
			g[1] = (ccc, ddd)
		elif bbb < ddd and eee != -1:
			k[0] = (eee, fff)
			k[1] = (aaa, bbb)
		elif ggg != -1:
			if fff >= hhh:
				k[0] = (eee, fff)
				k[1] = (aaa, bbb)
			else:
				g[0] = (ggg, hhh)
				g[1] = (ccc, ddd)
	
	#print(k)
	#print(g)
		
	ans = 0
	sono1 = 0
	sono2 = 0
	for a, b in enumerate(k):
		i, j = b
		if a == 0:
			sono1 = i
			continue
		ans += j
	
	for a, b in enumerate(g):
		i, j = b
		if a == 0:
			sono2 = i
			continue
		ans += j
		
	if ans > 0:
		print(ans)
	elif sono1 != sono2:
		print(ans)
	else:
		print(len(K))
		
		
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N = int(input())
	V = input().split(" ")
	
	K = []
	G = []
	for i, val in enumerate(V):
		if i % 2 == 0:
			G.append(val)
		else:
			K.append(val)
	
	k = collections.Counter(K)
	k = sorted(k.items(), key=lambda x:x[1], reverse=True)
	g = collections.Counter(G)
	g = sorted(g.items(), key=lambda x:x[1], reverse=True)
	
	aaa, bbb = k[0]
	ccc, ddd = g[0]
	
	if aaa == ccc:
		if bbb > ddd and len(g) > 0:
			tmp1, tmp2 = g[1]
			g[0] = (tmp1, tmp2)
			g[1] = (ccc, ddd)
		elif bbb <= ddd and len(k) > 0:
			tmp1, tmp2 = k[1]
			k[0] = (tmp1, tmp2)
			k[1] = (aaa, bbb)
	
	#print(k)
	#print(g)
		
	ans = 0
	sono1 = 0
	sono2 = 0
	for a, b in enumerate(k):
		i, j = b
		if a == 0:
			sono1 = i
			continue
		ans += j
	
	for a, b in enumerate(g):
		i, j = b
		if a == 0:
			sono2 = i
			continue
		ans += j
		
	if ans > 0:
		print(ans)
	elif sono1 != sono2:
		print(ans)
	else:
		print(len(K))
		
		
	
if __name__ == "__main__":
	main()
Problem p03251 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N, M, XX, YY = map(int, input().split(" "))
	X = input().split(" ")
	X = [int(s) for s in X]
	Y = input().split(" ")
	Y = [int(s) for s in Y]
	
	X.sort()
	Y.sort()
	
	if X >= Y:
		print("War")
		sys.exit()
	
	tmp = Y[0] - X[len(X)-1]
	if tmp < 1:
		print("War")
		sys.exit()
		
	for i in range(X[len(X)-1]+1, Y[0]+1):
		if i <= YY and XX < i:
			print("No War")
			sys.exit()
	
	print("War")
		
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left

def main():
	N, M, X, Y = map(int, input().split(" "))
	X = input().split(" ")
	X = [int(s) for s in X]
	Y = input().split(" ")
	Y = [int(s) for s in Y]
	
	X.sort()
	Y.sort()
	
	if X >= Y:
		print("War")
		sys.exit()
	
	tmp = Y[0] - X[len(X)-1]
	if tmp < 2:
		print("War")
		sys.exit()
		
	for i in range(X[len(X)-1]+1, Y[0]):
		if i <= Y and X < i:
			print("No War")
			sys.exit()
	
	
	print("War")
		
	
if __name__ == "__main__":
	main()
Problem p03282 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
	
def main():
	S = input()
	S = list(S)
	K = int(input())
	
	if len(S) == 1:
		print(S[0])
		sys.exit()
		
	tmp = -1
	for i, val in enumerate(S):
		if int(val) != 1:
			tmp = int(i)+1
			break
	
	if K >= tmp:
		print(S[tmp-1])
	else:
		print(1)
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
	
def main():
	S = input()
	S = list(S)
	K = int(input())
	
	if len(S) == 1:
		print(S[0])
	"""
	L = []
	for i in range(len(S)):
		if i == 0:
			tmp = int(S[i])
			if tmp == 1:
				L.append((i+1, tmp))
			else:
				tmp = (tmp ** ((5000 * 10000000000000)-1)) // 10
				L.append((i+1, tmp))
			continue
			
		_, base = L[i-1]
		tmp = int(S[i])
		if tmp == 1:
			tmp = 1
		else:
			tmp = (tmp ** ((5000 * 10000000000000)-1)) // 10
		L.append((i+1, tmp+base))
		
	for i in L:
		index, keta = i
		if i == 0:
			if K < keta:
				print(S[index])
				break
		if K < keta:
			print(S[index-1])
			break
			
	print(L)
	"""
	
	tmp = []
	for i in S:
		flg = False
		if int(i) == 1:
			tmp.append(1)
		else:	
			tmp.append(int(i))
			if flg = True:
				break
			flg = True
	
	a = np.random.randint(100)
	
	if len(tmp) < K:
		if a == 0
			print(tmp[-1])
		else:
			print(tmp[-2])
	else:
		tmp[K-1]
	
if __name__ == "__main__":
	main()
Problem p03283 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	N, M, Q = map(int, input().split(" "))
	N_list = [[0 for _ in range(N)] for _ in range(N)]
	
	for _ in range(M):
		l, r = map(int, input().split(" "))
		l -= 1
		r -= 1
		N_list[l][r] += 1
		
	#print(N_list)
	
	for i in range(N):
		for j in range(N):
			if i == 0 and j == 0:
				continue
			if i == 0:
				N_list[i][j] = N_list[i][j] + N_list[i][j-1]
				continue
			if j == 0:
				N_list[i][j] = N_list[i][j] + N_list[i-1][j]
				continue
			N_list[i][j] = N_list[i][j] + N_list[i-1][j] + N_list[i][j-1] - N_list[i-1][j-1]
			
	#print(N_list)
		
	for _ in range(Q):
		p, q = map(int, input().split(" "))
		p -= 1
		q -= 1
		
		a = 0
		b = 0
		c = 0
		if p != 0:
			a = N_list[q][p-1]
			b = N_list[p-1][q]
			c = N_list[p-1][p-1]
		ans = N_list[q][q] - a - b + c
		print(ans)
		
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
 
def main():
	N, M, Q = map(int, input().split(" "))
	N_list = [[0 for _ in range(N)] for _ in range(N)]
	
	for _ in range(M):
		l, r = map(int, input().split(" "))
		l -= 1
		r -= 1
		N_list[l][r] += 1
		
	#print(N_list)
	
	for i in range(N):
		for j in range(N):
			if i == 0 and j == 0:
				continue
			if i == 0:
				N_list[i][j] = N_list[i][j] + N_list[i][j-1]
				continue
			if j == 0:
				N_list[i][j] = N_list[i][j] + N_list[i-1][j]
				continue
			N_list[i][j] = N_list[i][j] + N_list[i-1][j] + N_list[i][j-1] - N_list[i-1][j-1]
			
	#print(N_list)
		
	for _ in range(Q):
		p, q = map(int, input().split(" "))
		p -= 1
		q -= 1
		
		a = 0
		b = 0
		c = 0
		if p != 0:
			a = N_list[q][p-1]
			b = N_list[p-1][q]
			c = N_list[p-1][p-1]
		ans = N_list[q][q] - a - b + c
		print(ans)
		
	
if __name__ == "__main__":
	main()
Problem p03292 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	A, B, C = map(int, input().split(" "))
	
	tmp = []
	tmp.append(A)
	tmp.append(B)
	tmp.append(C)
	tmp.sort()
	
	a = abs(tmp[1] - tmp[0])
	b = abs(tmp[2] - tmp[1])
		
	print(a + b)
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	A, B, C = map(int, input().split(" "))
	
	tmp = []
	tmp.append(A)
	tmp.append(B)
	tmp.append(C)
	tmp.sort()
	
	a = abs(tmp[1] - tmp[0])
	b = abs(tmp[2] - tmp[1])
		
	print(a + b)
	
if __name__ == "__main__":
	main()
Problem p03316 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	N = list(input())
	
	
	to = 0
	NN = ""
	for i in N:
		to += int(i)
		NN += i
	
	if int(NN) % to == 0:
		print("Yes")
	else:
		print("No")
	
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	N = list(input())
	
	to = 0
	for i in N:
		to += int(i)
	
	if N % to == 0:
		print("Yes")
	else:
		print("No")
	
	
if __name__ == "__main__":
	main()
Problem p03371 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	A,B,C,X,Y = map(int, input().split(" "))
	
	if C >= A and C >= B:
		
		print(A*X + B*Y)
		sys.exit()
	
	base = A*X + B*Y
	
	if X == Y:
		tmp = C * 2 * Y
		
		print(min(base, tmp))
		sys.exit()
	

	part1 = A*X
	part21 = C*2*Y
	part22 = B*Y
	tmp = min(part21,part22)
	tmp = part1 + tmp
	ans = min(base, tmp)
	#print(ans)
			
	part1 = C*2*X
	Y_tmp = Y-X
	if Y_tmp > 0:	
		part21 = C*2*Y_tmp
		part22 = B*Y_tmp
		tmp = min(part21,part22)
		tmp = part1 + tmp
	else:
		tmp = part1
	ans = min(ans, tmp)
	#print(ans)
	
	part1 = B*Y
	part21 = C*2*X
	part22 = A*X
	tmp = min(part21,part22)
	tmp = part1 + tmp
	ans = min(ans, tmp)
	#print(ans)
		
	part1 = C*2*Y
	X -= Y
	if X > 0:
		part21 = C*2*X
		part22 = A*X
		tmp = min(part21,part22)
		tmp = part1 + tmp
	else:
		tmp = part1
	ans = min(ans, tmp)
			
	print(ans)
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	A,B,C,X,Y = map(int, input().split(" "))
	
	if C >= A and C >= B:
		
		print(A*X + B*Y)
		sys.exit()
	
	base = A*X + B*Y
	
	if X == Y:
		tmp == C * 2 * Y
		
		print(min(base, tmp))
		sys.exit()
	
	if X < Y:
		if A <= C:
			part1 = A*X
			part21 = C*2*Y
			part22 = B*Y
			tmp = min(part21,part22)
			tmp = part1 + tmp
			print(min(base, tmp))
			sys.exit()
				
		else:
			part1 = C*2*X
			Y -= X
			part21 = C*2*Y
			part22 = B*Y
			tmp = min(part21,part22)
			tmp = part1 + tmp
			print(min(base, tmp))
			sys.exit()
	else:
		if B <= C:
			part1 = B*Y
			part21 = C*2*X
			part22 = A*X
			tmp = min(part21,part22)
			tmp = part1 + tmp
			print(min(base, tmp))
			sys.exit()
				
		else:
			part1 = C*2*Y
			X -= Y
			part21 = C*2*X
			part22 = A*X
			tmp = min(part21,part22)
			tmp = part1 + tmp
			print(min(base, tmp))
			sys.exit()
			
	
if __name__ == "__main__":
	main()
Problem p03425 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def main():
    N = int(input())
    s = []
    
    for i in range(N):
        tmp = input()
        s.append(tmp)
        
    m = 0
    a = 0
    r = 0
    c = 0
    h = 0
    for i in s:
        if i[0] == "M":
            m += 1
        elif i[0] == "A":
            a += 1
        elif i[0] == "R":
            r += 1
        elif i[0] == "C":
            c += 1
        elif i[0] == "H":
            h += 1
            
    #print("{} {} {} {} {}".format(m, a,r,c,h))
    total = (a*m*c) + (a*m*r) + (a*m*h) + (a*c*r) + (a*c*h) + (a*r*h) + (m*c*r) + (m*c*h) + (m*r*h) + (c*r*h)
            
    print(total)
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def main():
    N = int(input())
    s = []
    
    for i in range(N):
        tmp = input()
        s.append(tmp)
        
    m = 0
    a = 0
    r = 0
    c = 0
    h = 0
    for i in s:
        if s[0] == "M":
            m += 1
        elif s[0] == "A":
            a += 1
        elif s[0] == "R":
            r += 1
        elif s[0] == "C":
            c += 1
        elif s[0] == "H":
            h += 1
            
    ans = 0
    total = (a*b*c) + (a*b*d) + (a*b*e) + (a*c*d) + (a*c*e) + (a*d*e) + (b*c*d) + (b*c*e) + (b*d*e) + (c*d*e)
            
    print(total)
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def main():
    N = int(input())
    s = []
    
    for i in range(N):
        tmp = input()
        s.append(tmp)
        
    m = 0
    a = 0
    r = 0
    c = 0
    h = 0
    for i in s:
        if s[0] == "M":
            m += 1
        elif s[0] == "A":
            a += 1
        elif s[0] == "R":
            r += 1
        elif s[0] == "C":
            c += 1
        elif s[0] == "H":
            h += 1e
            
    ans = 0
    total = (a*b*c) + (a*b*d) + (a*b*e) + (a*c*d) + (a*c*e) + (a*d*e) + (b*c*d) + (b*c*e) + (b*d*e) + (c*d*e)
            
    print(total)
	
if __name__ == "__main__":
	main()
Problem p03474 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	A, B = map(int, input().split(" "))
	S = input()
	tmp = S.split("-")
	
	if len(tmp) != 2:
		print("No")
		sys.exit()
	
	if tmp[0].isdecimal() == False or tmp[1].isdecimal() == False:
		print("No")
		sys.exit()
	
	if len(tmp[0]) == A and len(tmp[1]) == B:
		print("Yes")
	else:
		print("No")
	
	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	A, B = map(int, input().split(" "))
	S = input()
	tmp = S.split("-")
	
	if tmp[0].isdecimal() == False or tmp[1].isdecimal() == False:
		print("No")
		sys.exit()
	
	if len(tmp[0]) == A and len(tmp[1]) == B:
		print("Yes")
	else:
		print("No")
	
	
if __name__ == "__main__":
	main()
Problem p03502 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    n = int(input())
    N = list(str(n))
    
    tmp = 0
    for i in N:
        tmp += int(i)
        
    if n % tmp == 0:
        print("Yes")
    else:
        print("No")
            	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    n = int(input())
    N = list(str(n))
    
    tmp = 0
    for i in N:
        tmp += i
        
    if n % tmp == 0:
        print("Yes")
    else:
        print("No")
            	
if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    n = int(input)
    N = list(str(n))
    
    tmp = 0
    for i in N:
        tmp += i
        
    if n % tmp == 0:
        print("Yes")
    else:
        print("No")
            	
if __name__ == "__main__":
	main()