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

Fixed submission:
import sys
#from math import gcd

#+++++

def gcd(a,b):
	if a < b:
		a,b=b,a
		
	while a != b:
		t=a%b
		if t == 0:
			return b
		else:
			a,b = b,t
	return a
	
def main():
	n = int(input())
	al = list(map(int, input().split()))
	
	if n == 2:
		return max(al)
	
	from_left=[0]*len(al)
	kk=al[0]
	for i, v in enumerate(al):
		kk=gcd(kk,v)
		from_left[i]=kk
	
	from_right=[0]*len(al)
	kk=al[-1]
	for i,v in enumerate(al[::-1]):
		kk=gcd(kk,v)
		from_right[i]=kk
	from_right=from_right[::-1]
	
	ans=0
	for i,_ in enumerate(al):
		if i == 0:
			vv=from_right[1]
		elif i == len(al)-1:
			vv=from_left[-2]
		else:
			a=from_right[i+1]
			b=from_left[i-1]
			#pa((a,b))
			vv=gcd(a,b)
		ans = max(ans, vv)
	print(ans)




#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
import sys

from math import gcd

#+++++
		
		
def main2():
	#print(gcd(100,55))
	
	n = int(input())
	al = list(map(int, input().split()))
	
	if n == 2:
		return max(al)
	
	nu=[0]*len(al)
	fi=0
	snd=0
	for i, _ in enumerate(nu):
		vv=al[0]
		for j, v in enumerate(al):
			if i==j:
				continue
			vv=gcd(vv, v)
		ans = max(ans, vv)
	
	print(ans)
	
def main():
	#print(gcd(100,55))
	
	n = int(input())
	al = list(map(int, input().split()))
	
	if n == 2:
		return max(al)
	
	from_left=[0]*len(al)
	kk=al[0]
	for i, v in enumerate(al):
		kk=gcd(kk,v)
		from_left[i]=kk
	
	from_right=[0]*len(al)
	kk=al[-1]
	for i,v in enumerate(al[::-1]):
		kk=gcd(kk,v)
		from_right[i]=kk
	from_right=from_right[::-1]
	
	ans=0
	#pa(from_right)
	#pa(from_left)
	#sayuukara
	for i,_ in enumerate(al):
		if i == 0:
			vv=from_right[1]
		elif i == len(al)-1:
			vv=from_left[-2]
		else:
			a=from_right[i+1]
			b=from_left[i-1]
			#pa((a,b))
			vv=gcd(a,b)
		ans = max(ans, vv)
	
	print(ans)




#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
Problem p03071 (python)

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	a,b = map(int, io().split())
	if a==b:
		ret=2*a
	else:
		c=max(a,b)
		ret=2*c-1

	return ret

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	a,b = map(int, io().split())
	if a==b:
		ret==2*a
	else:
		c=max(a,b)
		ret=2*c-1

	return ret

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))
Problem p03074 (python)

Fixed submission:
import sys
bbn=1000000007
	
#+++++
		
def main2():
	n, k = map(int, input().split())
	sl = input()
	dd=[]
	ddv=[]
	left= sl[0]
	count=0
	pre=left
	for c in sl:
		if c == pre:
			count+=1
		else:
			dd.append(count)
			ddv.append(pre)
			pre=c
			count=1
	dd.append(count)
	ddv.append(pre)
	
	pa(ddv)
	if k == 0:
		return max([v for v,c in zip(dd,ddv) if c == '1'])
	
	ll=[]
	for i,c in zip(dd,ddv):
		if c == '0':
			pass
			
def main():
	n, k = map(int, input().split())
	sl = input()
	al=[]
	if sl[0]=='0':
		al.append(0)
	p=sl[0]
	count=1
	for c in sl[1:]:
		if c == p:
			count+=1
		else:
			al.append(count)
			count=1
			p=c
	else:
		al.append(count)
		if sl[-1]=='0':
			al.append(0)
			
	#pa(al)
	
	if 2*k+1 >= len(al):
		print(n)
		return 
	
	ret = al[0]
	for i in range(k):
		ret += al[2*i+1]
		ret += al[2*i+2]
	#pa(ret)
	rs=ret
	for i in range(k, (len(al)//2)):
		rs += al[2*i+1]
		rs += al[2*i+2]
		rs -= al[2*(i-k)+1]
		rs -= al[2*(i-k)]
		ret = max(rs, ret)
		#pa(rs)
	print(ret)
		
			
			
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n,k= map(int, io().split())
	s=[int(i) for i in io()[:n]]
	init=s[0]
	ll=[]
	m=0
	pre=init
	for c in s:
		if c == pre:
			m+=1
		else:
			ll.append(m)
			m=1
			pre=c
	ll.append(m)
	
	#print(ll)
	off= 1 if init==1 else 0
	if len(ll)<=2*k + off:
		return n
	pre=sum(ll[:2*k+off])
	rr_max=pre
	for i in range(len(ll)//2 - k):
		cc=pre - ll[2*i] - ll[2*i+1] + ll[2*(k+i)+off]+ll[2*(k+i)+1+off]
		rr_max = max(rr_max, cc)
		pre=cc
	return rr_max


#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))
Problem p03078 (python)

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

from heapq import heappush, heappop
def io_generator():
	return input()

#+++++++++++++++++++
	
class Foo(object):
	def __init__(self, value, state):
		self.state = state
		self.value = value

	def __lt__(self, other):
		return self.value > other.value

def get_c(aa,ab,ac, amm):
	if ac < amm[2]-1:
		ret=[[aa,ab,ac+1]]
	else:
		ret=[]
		
	if ab<amm[1]-1:# and ab >= ac:
		ret.append([aa,ab+1,ac])
	
	if aa<amm[0]-1:# and aa >= ab and aa >= ac:
		ret.append([aa+1,ab,ac])
	return ret
	
def gv(al,bl,cl,s):
	return al[s[0]]+bl[s[1]]+cl[s[2]]
	
def lss(l):
	return '_'.join([str(i) for i in l])
	
def main(io):
	x,y,z,k=map(int, io().split())
	ml=[x,y,z]
	al =list(map(int, io().split()))
	al.sort(reverse=True)
	bl =list(map(int, io().split()))
	bl.sort(reverse=True)
	cl =list(map(int, io().split()))
	cl.sort(reverse=True)
	init=[0,0,0]
	ggv=lambda l : gv(al,bl,cl,l)
	
	qq = []
	heappush(qq,Foo(ggv(init), init))
	
	ol=set()
	ol.add(lss(init))
	
	for _ in range(k):
		ff=heappop(qq)
		vv=ff.value
		cs=ff.state
		nc=get_c(cs[0],cs[1],cs[2],ml)
		print(vv)
		for ns in nc:
			if lss(ns) in ol:
				continue
			else:
				heappush(qq, Foo(ggv(ns), ns))
				ol.add(lss(ns))
	return 1

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	#print (main(io))
	main(io)

Buggy submission (verdict: Runtime Error):
import unittest
import abc123d as tester

def ioByFile(fn='inputFile.txt'):
	with open(fn) as f:
		for line in f:
			yield line

def getCorrect(fn='correct.txt'):
	with open(fn) as f:
		return f.read()

class InputTests(unittest.TestCase):
	def _calFUT(self, io):
		return str(tester.main(io))+'\n'
		
	def test_it(self):
		testInput=ioByFile()
		io=lambda : next(testInput)
		actual = self._calFUT(io)
		
		self.assertEqual(actual,getCorrect())

if __name__ == "__main__":
	unittest.main()

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

from heapq import heappush, heappop
def io_generator():
	return input()

#+++++++++++++++++++
	
class Foo(object):
	def __init__(self, value, state):
		self.state = state
		self.value = value

	def __lt__(self, other):
		return self.value > other.value

def get_c(aa,ab,ac, amm):
	if ac < amm[2]-1:
		ret=[[aa,ab,ac+1]]
	else:
		ret=[]
		
	if ab<amm[1]-1:# and ab >= ac:
		ret.append([aa,ab+1,ac])
	
	if aa<amm[0]-1:# and aa >= ab and aa >= ac:
		ret.append([aa+1,ab,ac])
	return ret
	
def gv(al,bl,cl,s):
	return al[s[0]]+bl[s[1]]+cl[s[2]]
	
def main(io):
	x,y,z,k=map(int, io().split())
	ml=[x,y,z]
	al =list(map(int, io().split()))
	al.sort(reverse=True)
	bl =list(map(int, io().split()))
	bl.sort(reverse=True)
	cl =list(map(int, io().split()))
	cl.sort(reverse=True)
	init=[0,0,0]
	ggv=lambda l : gv(al,bl,cl,l)
	
	qq = []
	heappush(qq,Foo(ggv(init), init))
	
	ol=set()
	ol.add(init)
	
	for _ in range(k):
		ff=heappop(qq)
		vv=ff.value
		cs=ff.state
		nc=get_c(cs[0],cs[1],cs[2],ml)
		print(vv)
		for ns in nc:
			if ns in ol:
				continue
			else:
				heappush(qq, Foo(ggv(ns), ns))
				ol.add(ns)
	return 1

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	#print (main(io))
	main(io)
Problem p03087 (python)

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

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n,q=map(int, io().split())
	s=list(io())
	
	ss=[0 for _ in s]
	sss=ss.copy()
	for i, c in enumerate(s[1:],1):
		if s[i-1]=='A' and s[i]=='C':
			ss[i]=1
		sss[i] = ss[i] + sss[i-1]
	
	for i in range(q):
		r, l=map(int, io().split())
		#rr=sum(ss[r-1:l])-ss[l-1]
		rr=sss[l-1]-sss[r-1]
		#ret.append(str(rr))
		print(rr)
	
#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	#print (main(io))
	main(io)

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

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n,q=map(int, io().split())
	s=list(io())
	
	ss=[0 for _ in s[:-1]]
	for i, (c, cn) in enumerate(zip(s, s[1:])):
		if c=='A' and cn=='C':
			ss[i]=1
	
	#ret=[]
	for i in range(q):
		r,l=map(int, io().split())
		rr=sum(ss[r-1:l])-ss[l-1]
		#ret.append(str(rr))
		print(rr)
		
	#return "\n".join(ret)
	
#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	#print (main(io))
	main(io)

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

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n,q=map(int, io().split())
	s=list(io())
	
	ss=[0 for _ in s[:-1]]
	for i, (c, cn) in enumerate(zip(s, s[1:])):
		if c=='A' and cn=='C':
			ss[i]=1
	
	#ret=[]
	for i in range(q):
		r,l=map(int, io().split())
		rr=sum(ss[r-1:l])-ss[l-1]
		#ret.append(str(rr))
		print(rr)
		
	#return "\n".join(ret)
	
	
#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	#print (main(io))
	main(io)

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

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n,q=map(int, io().split())
	s=list(io())
	
	ss=[0 for _ in s[:-1]]
	for i, (c, cn) in enumerate(zip(s, s[1:])):
		if c=='A' and cn=='C':
			ss[i]=1
	
	ret=[]
	for i in range(q):
		r,l=map(int, io().split())
		rr=sum(ss[r-1:l])-ss[l-1]
		ret.append(str(rr))
		
	return "\n".join(ret)
	
	
#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

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

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n,q=map(int, io().split())
	s=list(io())
	
	ss=[0 for _ in s[:-1]]
	for i, (c, cn) in enumerate(zip(s, s[1:])):
		if c=='A' and cn=='C':
			ss[i]=1
	
	print(ss)
	ret=[]
	for i in range(q):
		r,l=map(int, io().split())
		rr=sum(ss[r-1:l])-ss[l-1]
		ret.append(str(rr))
		
	return "\n".join(ret)
	
	
#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))
Problem p03164 (python)

Fixed submission:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
LIN=lambda : list(IN())
mod=1000000007
inf = 10**12
#+++++

def main():
	#a = int(input())
	n, max_w = IN()
	#s = input()
	dp_v = [inf] * (10**5 + 100)
	dp_v[0] = 0
	for _ in range(n):
		add_v = []
		w, v = IN()
		for i, cv in enumerate(dp_v):
			if dp_v[i] == inf:
				continue
			if dp_v[i] + w < dp_v[i+v]:
				add_v.append((i+v, dp_v[i] + w))
		for i, nv in add_v:
			dp_v[i] = nv
			
	for i, min_w in enumerate(dp_v[::-1]):
		if min_w <= max_w:
			v=len(dp_v)-i-1
			return v
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
LIN=lambda : list(IN())
mod=1000000007
inf = 10**12
#+++++

def main():
	#a = int(input())
	n, max_w = IN()
	#s = input()
	dp_v = [inf] * (10**5)
	dp_v[0] = 0
	for _ in range(n):
		add_v = []
		w, v = IN()
		for i, cv in enumerate(dp_v):
			if dp_v[i] == inf:
				continue
			if dp_v[i] + w < dp_v[i+v]:
				add_v.append((i+v, dp_v[i] + w))
		for i, nv in add_v:
			dp_v[i] = nv
	for i, min_w in enumerate(dp_v[::-1]):
		if min_w <= max_w:
			v=len(dp_v)-i-1
			return v
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
Problem p03240 (python)

Fixed submission:
import sys
bbn=1000000007
	
#+++++
		
def main():
	n = int(input())
	pl=101
	
	ff=[0]*pl
	for i in range(pl):
		ff[i]=[0]*pl
	
	v=[]
	v0=[]
	for i in range(n):
		x, y, h = map(int, input().split())
		if h > 0:
			v.append([x,y,h])
		else:
			v0.append([x,y,h])
		
	
	tt=0
	for i, [xi, yi, hi] in enumerate(v):
		for [xj, yj, hj] in v[i+1:]:
			tt+=1
			for px in range(pl):
				for py in range(pl):
					ihp=hi+abs(px-xi)+abs(py-yi)
					jhp=hj+abs(px-xj)+abs(py-yj)
					if ihp==jhp:
						ff[px][py]+=1
	
	for i, [xi, yi, hi] in enumerate(v):
		for [xj, yj, hj] in v0:
			tt+=1
			for px in range(pl):
				for py in range(pl):
					ihp=hi+abs(px-xi)+abs(py-yi)
					jhp=hj+abs(px-xj)+abs(py-yj)
					if ihp<=jhp:
						ff[px][py]+=1
								
	for i, vl in enumerate(ff):
		for j, va in enumerate(vl):
			if va == tt:
				[x,y,h]=v[0]
				rh=h+abs(x-i)+abs(y-j)
				print(i,j,rh)
				return
	if len(v)	== 0:		
		raise NameError('HiThere')
	print(0,0,1)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
import sys
bbn=1000000007
	
#+++++
		
def main():
	n = int(input())
	pl=101
	
	ff=[0]*pl
	for i  in range(pl):
		ff[i]=[0]*pl
	
	v=[]
	for i in range(n):
		x, y, h = map(int, input().split())
		v.append([x,y,h])
	
	tt=0
	for i, [xi, yi, hi] in enumerate(v):
		for [xj, yj, hj] in v[i+1:]:
			tt+=1
			for px in range(pl):
				for py in range(pl):
					ihp=hi+abs(px-xi)+abs(py-yi)
					jhp=hj+abs(px-xj)+abs(py-yj)
					if ihp==jhp:
						ff[px][py]+=1
	
	for i, vl in enumerate(ff):
		for j, va in enumerate(vl):
			if va == tt:
				[x,y,h]=v[0]
				rh=h+abs(x-i)+abs(y-j)
				print(i,j,rh)
				return
				
	raise NameError('HiThere')
	print(0,0,1)
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
Problem p03244 (python)

Fixed submission:
import sys
from collections import defaultdict

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	al = list(IN())
	odd_dd=defaultdict(lambda : 0)
	odd_dd[-1]=0
	even_dd=defaultdict(lambda :0)
	even_dd[-1]=0
	
	for i, v in enumerate(al):
		if i%2==0:
			odd_dd[v] += 1
		else:
			even_dd[v] += 1
	
	odd_ll=[(odd_dd[key], key) for key in odd_dd.keys()]
	even_ll=[(even_dd[key], key) for key in even_dd.keys()]
	
	odd_ll.sort(reverse=True)
	even_ll.sort(reverse=True)
	kk=n//2
	pa(odd_ll)
	pa(even_ll)
	
	#先頭が同じ
	if odd_ll[0][1] == even_ll[0][1]:
		ra=(kk-odd_ll[0][0])+(kk-even_ll[1][0])
		rb=(kk-odd_ll[1][0])+(kk-even_ll[0][0])
		return min(ra, rb)
	else:
		ret= (kk-odd_ll[0][0])+(kk-even_ll[0][0])
		return ret
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	al = list(IN())
	odd_dd=defaultdict(lambda : 0)
	even_dd=defaultdict(lambda :0)
	for i, v in enumerate(al):
		if i%2==0:
			odd_dd[v] += 1
		else:
			even_dd[v] += 1
	
	odd_ll=[(odd_dd[key], key) for key in odd_dd.keys()]
	even_ll=[(even_dd[key], key) for key in even_dd.keys()]
	
	odd_ll.sort(reverse=True)
	even_ll.sort(reverse=True)
	kk=n//2
	pa(odd_ll)
	pa(even_ll)
	#全部同じ
	if len(odd_ll)==1 and len(even_ll)==1:
		a=4/0
		if odd_ll[0][1]==even_ll[0][1]:
			return kk
		else:
			return 0
	
	if odd_ll[0][1] == even_ll[0][1]:
		if odd_ll[0][0] >= even_ll[0][0]:
			return (kk-odd_ll[0][0])+(kk-even_ll[1][0])
		else:
			return (kk-odd_ll[1][0])+(kk-even_ll[0][0])
	else:
		return (kk-odd_ll[0][0])+(kk-even_ll[0][0])
	
	#pa(odd_ll)
	#print(str(a+b+c)+s)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
Problem p03330 (python)

Fixed submission:
import sys

#+++++

def naiseki(va,vb):
	return sum([a*b for a,b in zip(va,vb)])

def main():
	n , c = map(int, input().split())
		
	ccc=[0]*c
	for i in range(c):
		ccc[i]=[0]*c
	for i in range(c):
		temp=list(map(int,input().split()))
		#ccc[i]=temp
		for j,v in enumerate(temp):
			ccc[j][i]=v
		
	pa(ccc)
		
	ddl=[0,0,0]
	for i in range(3):
		ddl[i]=[0]*c
		
	for i in range(1,n+1):
		ll=list(map(int, input().split()))
		for j, color_v in enumerate(ll,start=1):
			group=(i+j)%3
			ddl[group][color_v-1]+=1
			
	pa('_____ddl_____')
	for i in range(3):
		pa(ddl[i])
		
	rrb=[0]*3
	for i in range(3):
		rrb[i]=[0]*c	
		for j in range(c):
			rrb[i][j]=(naiseki(ddl[i], ccc[j]),j)
			
	pa('____rrb_____')
	for i in range(3):
		pa(rrb[i])
	
	c=[0]	* 3
	for i in range(3):
		rrb[i].sort()
		aa=rrb[i][:3]
		c[i]=aa
		
	pa('____ c _____')
	for i in range(3):
		pa(c[i])
		
	mm=None
	for i in range(3):
		for j in range(3):
			for k in range(3):
				ii=c[0][i][1]
				ji=c[1][j][1]
				ki=c[2][k][1]
				if ii !=ji and ji!=ki and ki!=ii:
					temp=c[0][i][0]+c[1][j][0]+c[2][k][0]
					#pa(temp)
					mm = temp if mm is None else min(mm,temp)
					
	return mm
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N,C = map(int, raw_input().split())
da=[]
db=[]
dc=[]

colorGrid = [map(int, raw_input().split()) for _ in range(C)]

dataGrid = [map(int, raw_input().split()) for _ in range(N)]

for i in range(N):
	for j in range(N):
		d=i+j+2
		inn=dataGrid[i][j]
		if d%3==0:
			da.append(inn)
		elif d%3==1:
			db.append(inn)
		else:
			dc.append(inn)

ka=range(C)
kb=range(C)
kc=range(C)
du = lambda oc, tc : colorGrid[oc][dc]
for i in range(C):
	ka[i]=sum([du(oc, i) for oc in da])
	kb[i]=sum([du(oc, i) for oc in db])
	kc[i]=sum([du(oc, i) for oc in dc])	


ra=ka.sort()[0:3]
rb=kb.sort()[0:3]
rc=kc.sort()[0:3]

mm=-1
for i in range(3):
	for j in range(3):
		for k in range(3):
			d=ra[i]+rb[j]+rc[k]
			if mm == -1 or d< mm:
				mm=d

print mm
Problem p03331 (python)

Fixed submission:
a=input()

al=[int(c) for c in list(str(a))]

sal=sum(al)
ret= sal if sal > 1 else 10
print(ret)

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

al=[int(c) for c in list(str(a))]

sal=sum(al)
return sal if sal > 1 else 10
Problem p03385 (python)

Fixed submission:
import sys

#+++++


def main():
	s = input()
	#a ='Yes' if ''.join(sorted(s)) == 'abc' else 'No'
	for c in 'abc':
		if c not in s:
			print('No')
			return 
	print('Yes')
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
import sys

#+++++


def main():
	s = input()
	a = ''.join(sorted(s)) == 'abc'
	if a:
		print('Yes')
	else:
		print('No')
	#print(' '.join([str(v) for v in l]))
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		#input = sys.stdin.readline
        pass
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
import sys

#+++++


def main():
	s = input()
	a = ''.join(sorted(s)) == 'abc'
	if a:
		print('Yes')
	else:
		print('No')
	#print(' '.join([str(v) for v in l]))
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		#input = sys.stdin.readline
        pass
			
	ret = main()
	if ret is not None:
		print(ret)

Buggy submission (verdict: Runtime Error):
import sys

#+++++


def main():
	s = input()
	a = ''.join(sorted(s)) == 'abc'
	if a:
		print('Yes')
	else:
		print('No')
	#print(' '.join([str(v) for v in l]))
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)