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

Fixed submission:
o = list(input())
e = list(input())
ans = ""

olen = len(o)
num = olen - len(e)
if num==0:
    for n in range(olen):
        ans += o[n] + e[n]
else:
    for n in range(len(e)):
        ans += o[n] + e[n]
    ans += o[olen-1]
print(ans)

Buggy submission (verdict: Runtime Error):
o = list(input())
e = list(input())
ans = ""

num = len(o) - len(e)
if num==0:
    for n in range(len(o)):
        ans += o[n] + e[n]
else:
    for n in range(len(o)):
        ans += o[n] + e[n]
    ans += e[len(o)-1]
print(ans)

Buggy submission (verdict: Runtime Error):
o = list(input())
e = list(input())
ans = ""

num = len(o)
if num%2==0:
    for n in range(num):
        ans += o[n] + e[n]
else:
    for n in range(num):
        ans += o[n] + e[n]
    ans += o[num-1]
print(ans)
Problem p03826 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
s1 = a*b
s2 = c*d

if s1 > s2:
    print(s1)
else:
    print(s2)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input()split())
s1 = a*b
s2 = c*d

if s1 > s2:
    print(s1)
else:
    print(s2)
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
d = list(map(int,input().split()))
 
bound = 0
ans = 1
 
for i in d:
    bound += i
    if bound >x:
        break
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
d = list(map(int,input().split()))
 
bound = 0
ans = 1
 
for i in d:
    bound += i
    if bound >x:
        break
        ans += 1
print(ans)
n,x = map(int,input().split())
d = list(map(int,input().split()))

bound = 0
ans = 1

for i in d:
    bound += i
    if bound >x:
        break
    ans += 1
print(ans)
Problem p03043 (python)

Fixed submission:
def pow2(n):
	res = 1
	for i in range(0, n):
		res *= 2
	return res

counter = [0]
N, K = map(int, raw_input().split())
for i in range(1, N+1):
	m = i
	cnt = 0
	while m < K:
		m *= 2
		cnt += 1
	counter.append(cnt)
sum = 0
for i in range(1, N+1):
	sum += pow2(counter[1]-counter[i])
dv = N*pow2(counter[1])
print float(sum)/float(dv)

Buggy submission (verdict: Runtime Error):
def pow2(n):
	res = 1
	for i in range(0, n):
		res *= 2
	return res

counter = [0]
N, K = map(int, raw_input().split())
for i in range(1, N+1):
	m = i
	cnt = 1
	while m < K:
		m *= 2
		cnt += 1
	counter.append(cnt)
sum = 0L
for i in range(1, N+1):
	sum += long(pow2(count[1]-count[i]))
sum *= 10000000000
dv = long(N)*long(pow2(count[1]))

print sum
print dv
Problem p03103 (python)

Fixed submission:
from operator import itemgetter

N, M = map(int, raw_input().split())
drinklist = []
for i in range(0, N):
	drinklist.append(map(int, raw_input().split()))
drinklist = sorted(drinklist, key=itemgetter(0))
sum = 0
drink = M
for i in range(0, N):
	if drink < drinklist[i][1]:
		sum += drink * drinklist[i][0]
		break
	else:
		sum += drinklist[i][1] * drinklist[i][0]
		drink -= drinklist[i][1]

print sum

Buggy submission (verdict: Runtime Error):
def quicksort(lst):
	if lst == []: return []
	elif len(lst) == 1: return lst
	else:
		pivot = lst[0][0]
		leftlist = []
		rightlist = []
		for i in range(0, len(lst)):
			if lst[i][0] < pivot:
				leftlist.append(lst[i])
			else:
				rightlist.append(lst[i])
		newleft = quicksort(leftlist)
		newright = quicksort(rightlist)
		newleft.extend(newright)
		return newleft

N, M = map(int, raw_input().split())
drinklist = []
for i in range(0, N):
	drinklist.append(map(int, raw_input().split()))
drinklist = quicksort(drinklist)

sum = 0
drink = M
for i in range(0, N):
	if drink < drinklist[i][1]:
		sum += drink * drinklist[i][0]
		break
	else:
		sum += drinklist[i][1] * drinklist[i][0]
		drink -= drinklist[i][1]

print sum

Buggy submission (verdict: Runtime Error):
def quicksort(lst):
	if lst == []: return []
	elif len(lst) == 1: return lst
	else:
		pivot = lst[0][0]
		leftlist = []
		rightlist = []
		for i in range(0, len(lst)):
			if lst[i][0] < pivot:
				leftlist.append(lst[i])
			else:
				rightlist.append(lst[i])
		newleft = quicksort(leftlist)
		newright = quicksort(rightlist)
		newleft.extend(newright)
		return newleft

N, M = map(int, raw_input().split())
drinklist = []
for i in range(0, N):
	drinklist.append(map(int, raw_input().split()))
drinklist = quicksort(drinklist)
print drinklist
sum = 0
drink = M
for i in range(0, N):
	if drink < drinklist[i][1]:
		sum += drink * drinklist[i][0]
		break
	else:
		sum += drinklist[i][1] * drinklist[i][0]
		drink -= drinklist[i][1]

print sum
Problem p03126 (python)

Fixed submission:
N, M = map(int, raw_input().split())
menu = []
for i in range(0, M):
	menu.append(0)
for i in range(0, N):
	answer = map(int, raw_input().split())
	for j in range(1, answer[0]+1):
		menu[answer[j]-1] += 1
cnt = 0
for i in range(0, M):
	if menu[i] == N: cnt += 1

print cnt

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
menu = []
for i in range(0, M):
	menu.append(0)
for i in range(0, N):
	answer = map(int, raw_input().split())
	for j in range(1, answer[0]+1):
		menu[answer[i]-1] += 1
cnt = 0
for i in range(0, M):
	if menu[i] == N: cnt += 1

print cnt
Problem p03324 (python)

Fixed submission:
D, N = map(int, raw_input().split())
ans = ''
if N == 100: ans = '101'
else: ans = str(N)

for i in range(0, D):
	ans = ans + '00'
print ans

Buggy submission (verdict: Runtime Error):
D, N = map(int, raw_input().split())
if D == 0:
	if N == 100: print 101
	else: print N
if D == 2:
	if N == 100: print 1010000
	else: print str(N) + '0000'
if D == 1:
	n = ((N-1)/9)*10+(N%9)+1
	print str(n)*'00'
Problem p03328 (python)

Fixed submission:
a, b = map(int, raw_input().split())
x = b - a
sum = 0
for i in range(1, x+1):
	sum += i
print sum - b

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
b - a = x
sum = 0
for i in range(1, x+1):
	sum += i
print sum - b
Problem p03486 (python)

Fixed submission:
s = input()
t = input()
slist = []
for i in range(0, len(s)):
	slist.append(s[i])
tlist = []
for i in range(0, len(t)):
	tlist.append(t[i])
slist.sort()
tlist.sort(reverse = True)
news = ''
for i in range(0, len(slist)):
	news = news + slist[i]
newt = ''
for i in range(0, len(tlist)):
	newt = newt + tlist[i]
if news < newt: print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
slist = []
for i in range(0, len(s)):
	slist.append(s[i])
tlist = []
for i in range(0, len(t)):
slist.sort()
tlist.sort(reverse = True)
news = ''
for i in range(0, len(slist)):
	news = news + slist[i]
newt = ''
for i in range(0, len(tlist)):
	newt = newt + tlist[i]
if news < newt: print('Yes')
else: print('No')
Problem p03681 (python)

Fixed submission:
def fct(n):
	v = 1
	for i in range(1, n+1):
		v = (v * i) % 1000000007
	return v
N, M = map(int, input().split())
ans = 0
if N == M:
	v = fct(N)
	ans = (v*v*2)%1000000007
elif abs(N-M) == 1:
	ans = (fct(N)*fct(M))%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
def fct(n):
	v = 1
	for i in range(1, n+1):
		v = (v * i) % 1000000007
	return v
N, M = map(int, input().split())
ans = 0
if N == M:
	v = fct(N)
	ans = (v*v*2)%1000000007
elif abs(N-M) == 1:
	ans = (fct(N)*fct(M))%1000000007
print ans
Problem p03737 (python)

Fixed submission:
s1, s2, s3 = input().split()
ans = str(chr(ord(s1[0])-32)) + str(chr(ord(s2[0])-32)) + str(chr(ord(s3[0])-32))
print(ans)

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = map(int, input().split())
ans = str(chr(ord(s1[0])-32)) + str(chr(ord(s2[0])-32)) + str(chr(ord(s3[0])-32))
print(ans)
Problem p03738 (python)

Fixed submission:
A = input()
B = input()
if len(A) > len(B): print('GREATER')
elif len(A) < len(B): print('LESS')
else:
	for i in range(0, len(A)):
		if A[i] > B[i]:
			print('GREATER')
			break
		if A[i] < B[i]:
			print('LESS')
			break
		if i == len(A)-1:
			print('EQUAL')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A > B: print('GREATER')
if A < B: print('LESS')
if A == B: print('EQUAL')
Problem p03777 (python)

Fixed submission:
a, b = input().split()
if a == b: print('H')
else: print('D')

Buggy submission (verdict: Runtime Error):
a, b = input().split()
if a == b: print 'H'
else: print 'D'
Problem p03796 (python)

Fixed submission:
N = int(input())
ans = 1
for i in range(1, N+1):
	ans = (ans * i) % 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 1
for i in range(1, N+1):
	ans = (ans * i) % 1000000007
print ans
Problem p03861 (python)

Fixed submission:
a, b, x = map(int, raw_input().split())
ans = 0
if a == 0: ans = b/x + 1
else: ans = b/x - (a-1)/x
print ans

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
ans = 0
if a == 0: ans = b/x + 1
else: ans = b/x - (a-1)/x
print ans
Problem p03943 (python)

Fixed submission:
a, b, c = map(int, input().split())
if a == b+c or b == a+c or c == a+b: print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b+c or b == a+c or c == a+b: print 'Yes'
else: print 'No'

Buggy submission (verdict: Runtime Error):
anslist = ['Yes', 'No']
a, b, c = map(int, input.split())
print(anslist[(a+b+c)%2])
Problem p03963 (python)

Fixed submission:
def main():
	inpt = raw_input().split()
	n = int(inpt[0])
	k = int(inpt[1])
	ans = k
	for i in range(1, n):
		ans *= k - 1
	print ans
	
main()

Buggy submission (verdict: Runtime Error):
def exp(x, n):
	if n == 0:
		return 1
	else:
		return x * exp(x, n-1)

def main():
	inpt = raw_input().split()
	n = int(inpt[0])
	k = int(inpt[1])
	print k * exp(k-1, n-1)
	
main()
Problem p04030 (python)

Fixed submission:
S = input()
ans = ''
for i in range(0, len(S)):
	if S[i] == 'B':
		if ans != '': ans = ans[0:len(ans)-1]
	else:
		ans = ans + S[i]
print(ans)

Buggy submission (verdict: Runtime Error):
def keyb(s):
	ans = ""
	for i in range(0, len(s)):
		if s[i] == 'B':
			ans.pop()
		else:
			ans.append(s[i])
	return ans

def main():
	s = raw_input()
	print keyb(s)

main()
Problem p02999 (python)

Fixed submission:
a,b = map(int,input().split())
if a < b:
  print(0)
else :
  print(10)

Buggy submission (verdict: Runtime Error):
if input() < input():
  print(0)
else :
  print(1)

Buggy submission (verdict: Runtime Error):
x,a = map(int(input.split()))
if x<a:
  print(0)
else :
  print(10)
Problem p03001 (python)

Fixed submission:
w,h,x,y = map(int, input().split())
print('{:.6f} {}'.format(w*h/2, 1 if x+x==w and y+y==h else 0))

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int,input.split())
s = float((w*h) / 2)
if x+x==w and y+y ==h:
  print(s+"1")
else:
  print(s + "0")

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int,input.split())
s = float((w*h) / 2)
if x==y:
  print(s+"1")
else:
  print(s + "0")
Problem p03005 (python)

Fixed submission:
N, K = map(int,input().split())
if K==1: print(0)
else: print(N-K)

Buggy submission (verdict: Runtime Error):
N,K = map(input.split())

if K==1:
  print(0)
else : 
  print(N % K)

Buggy submission (verdict: Runtime Error):
N,K = input.split()

if K==1 or N < K or N==K :
  print("0")
else : 
  print(N % K)

Buggy submission (verdict: Runtime Error):
N,K = input.split()
if K==1 :
  print("0")
else : 
  print(N%K)
Problem p03006 (python)

Fixed submission:
from collections import Counter
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
 
counter = Counter(((b1[0] - b2[0], b1[1] - b2[1])for b1 in xy for b2 in xy if b1 != b2))
print(N - (list(counter.most_common())+[(0,0)])[0][1])

Buggy submission (verdict: Runtime Error):
b = [
    [int(s) for s in input().split(' ')]
    for i in range(N)
]
b.sort(key=lambda p: p[1])
b.sort(key=lambda p: p[0])
d = {}
d_max = 0
for i in range(N):
    for j in range(i + 1, N):
        p = b[j][0] - b[i][0]
        q = b[j][1] - b[i][1]
        if not p in d:
            d[p] = {}
        d[p][q] = (d[p][q] if q in d[p] else 0) + 1
        d_max = max([d_max, d[p][q]])
print(N - d_max)

Buggy submission (verdict: Runtime Error):
n = input()
arrx = []
arry = []
for i in range(n):
  arrx[i].append(input())
  arry[i].append(input())
b = set()
c = set()
for i in range(n-1):
  b.add(arrx[i+1]-arr[i])
  c.add(arry[i+1]-arr[i])
if len(b)==len(c):
  print(len(b))
elif len(b)>len(c):
  pint(len(b))
else  :
  print(len(c))
Problem p03029 (python)

Fixed submission:
a, p = map(int, input().split())
print(int((a*3 + p)/2))

Buggy submission (verdict: Runtime Error):
a, p = map(int, input().split())
apple = a*3 + p
return int(apple/2)

Buggy submission (verdict: Runtime Error):
a, p = map(int, input().split())
apple = a*3 + p
return apple/2
Problem p03156 (python)

Fixed submission:
# _*_ coding:utf-8 _*_
#  Atcoder_AISingProgramming_Contest-B
#  TODO https://aising2019.contest.atcoder.jp/tasks/aising2019_b

def solveProblem(problemSeed,FirstScore,SecondScore,ScoreList):
	firstBarrier = 0
	secondBarrier = 0
	lastBarrier = 0
	for problemNo in range(0,len(ScoreList),+1):
		problemScore = ScoreList[problemNo]
		if problemScore <= FirstScore:
			firstBarrier = firstBarrier + 1
		elif ( FirstScore+1 <= problemScore ) and ( problemScore <= SecondScore):
			secondBarrier = secondBarrier + 1
		else : # secondScore + 1 <= problemScore
			lastBarrier = lastBarrier + 1
	problemPattern = min(firstBarrier, secondBarrier,lastBarrier)
	answer = problemPattern
	return answer


if __name__ == '__main__':
	N = int(input().strip())
	A,B = map(int,input().strip().split(' '))
	Ps = list(map(int,input().strip().split(' ')))
	solution = solveProblem(N,A,B,Ps)
	print("{}".format(solution))

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_
#  Atcoder_AISingProgramming_Contest-B
#  TODO https://aising2019.contest.atcoder.jp/tasks/aising2019_b

def solveProblem(problemSeed,FirstScore,SecondScore,ScoreList):
	firstBarrier = 0
	secondBarrier = 0
	lastBarrier = 0
	for problemNo in range(0,len(ScoreList),+1):
		problemScore = ScoreList(problemNo)
		if problemScore <= FirstScore:
			firstBarrier = firstBarrier + 1
		elif ( FirstScore+1 <= problemScore ) and ( problemScore <= SecondScore):
			secondBarrier = secondBarrier + 1
		else : # secondScore + 1 <= problemScore
			lastBarrier = lastBarrier + 1
	problemPattern = firstBarrier * secondBarrier * lastBarrier
	answer = problemPattern
	return answer


if __name__ == '__main__':
	N = int(input().strip())
	A,B = map(int,input().strip().split(' '))
	Ps = list(map(int,input().strip().split(' ')))
	solution = solveProblem(N,A,B,Ps)
	print("{}".format(solution))
Problem p03200 (python)

Fixed submission:
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest029-A
#  https://agc029.contest.atcoder.jp/tasks/agc029_a

def  irr_operation(givenString):

	allLength = len(givenString)
	allRange = range(0,allLength)
	bCounter =0
	bPosition = []
	for i in allRange:
		if givenString[i] == 'B':
			bPosition.append(i)
			bCounter=bCounter+1

	collectPosition =[]
	bLength = len(bPosition)
	bRange = range(allLength-bLength,allLength)
	for i in bRange:
		collectPosition.append(i)

	bLengthRange = range(0,bLength)
	diffPosition = 0
	for i in bLengthRange:
		diffPosition = diffPosition+(collectPosition[i]-bPosition[i])

	answer = diffPosition
	return answer


if __name__ == '__main__':
	bwstring = input()
	solution=irr_operation(bwstring)
	print(solution)

Buggy submission (verdict: Runtime Error):
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest029-B
#  https://agc029.contest.atcoder.jp/tasks/agc029_b
from collections import Counter

def  maxCountPair(n_ballCount,a_ballDatas):
	a_ballDatas.sort(reverse=True)
	ballDictBox = Counter(a_ballDatas)
	ballCountRange = range(0,n_ballCount)
	pairCount = 0
	for i in ballCountRange:
		getBallNumber = a_ballDatas[i]
		getBallNumberBin = getBallNumber.bit_length()
		nextTwoPower = 2**getBallNumberBin
		diffNumber = nextTwoPower - getBallNumber
		if 1 <= ballDictBox[diffNumber] :
			if getBallNumber != diffNumber:
				pairCount = pairCount + 1
				ballDictBox[getBallNumber]=ballDictBox[getBallNumber]-1
				ballDictBox[diffNumber] = ballDictBox[diffNumber]-1
			else:
				if 2 <= ballDictBox[diffNumber]:
					pairCount = pairCount + 1
					ballDictBox[diffNumber]=ballDictBox[diffNumber]-2
	answer = pairCount
	return answer


if __name__ == '__main__':
	n_ballCount=int(input())
	a_ballDatas=list((map(int,input().split(" "))))
	solution=maxCountPair(n_ballCount,a_ballDatas)
	print(solution)
Problem p03035 (python)

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

if a>=13:
    print(b)
elif a>=6:
    print(int(b/2))
else:
    print(0)

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

if a>=13:
    print(b)
elif a>=6:
    print(int(b/2))
else:
    print(0)

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

if a>=13:
    print(b)
elif a>=6:
    print(int(b/2)
else:
    print(0)
Problem p03860 (python)

Fixed submission:
print("A" + input()[8] + "C")

Buggy submission (verdict: Runtime Error):
print("A{}C".format(input()[8])
Problem p04044 (python)

Fixed submission:
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=sorted[input() for i in range(n)]
print(*s,sep="")
Problem p03000 (python)

Fixed submission:
n,x = input().split()
n,x = int(n), int(x)
L = [int(x) for x in input().split()]

D = [0 for _ in range(n + 1)]

for i in range(1, n + 1):
  D[i] = D[i-1] + L[i-1]

res = [True if D[i] <= x else False for i in range(n + 1)]

print(sum(res))

Buggy submission (verdict: Runtime Error):
n,x = input().split()
n,x = int(n), int(x)
L = [int(x) for x in input().split()]

D = [0 for _ in range(N)]

for i in range(1, N):
  D[i] = D[i-1] + L[i-1]

res = [True if D[i] <= x else False for i in range(N)]

print(sum(res))
Problem p03037 (python)

Fixed submission:
n,m=map(int,input().split())
a=0
b=n*10**9
for i in range(m):
  x,y=map(int,input().split())  
  a=max(a,x)
  b=min(b,y)
if b>=a:
  ans=b-a+1
  print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=0
b=n*10**9
A=True
for i in range(m):
  x,y=map(int,input().split())
    a=max(a,x)
    b=min(b,y)
if b>=a:
  ans=b-a+1
  print(ans)
else:
  print(0)
Problem p03069 (python)

Fixed submission:
n=int(input())
s=input()
bres=0
wres=0
blst=[]
wlst=[]
for i in range(n):
    if s[i]=='#':
        bres+=1
    blst.append(bres)
for i in range(n-1,-1,-1):
    if s[i]=='.':
        wres+=1
    wlst.append(wres)
wlst=wlst[::-1]
ans=10**9
blst.insert(0,0)
wlst.insert(n,0)
for i in range(n+1):
    ans=min(blst[i]+wlst[i],ans)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
B=True
if s=='.'*n:
    B=False
if B:
    num=list(s).index('#')
    if num!=n-1:
        for i in range(num,n-1):
            if s[i]=='.' and s[i+1]=='#':
                A=True
                l=n-i-1
        moji=s[num:]
        lst=dict(Counter(moji).items())
        a=lst['#'];b=lst['.']
        if a==0 or b==0:
            print(0)
        else:
            if s[-1]=='#':
                print(min(a-l,b))
            else:
                print(min(a,b))
    else:
        print(0)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
B=True
if s=='.'*n:
    B=False
if B:
    num=list(s).index('#')
    for i in range(n-1):
        if s[i:]=='#'*(n-i):
            A=True
            l=n-i
            break
    if num!=n-1:
        moji=s[num:]
        lst=dict(Counter(moji).items())
        a=lst['#'];b=lst['.']
        if a==0 or b==0:
            print(0)
        else:
            if A:
                print(min(a-l,b))
            else:
                print(min(a,b))
    else:
        print(0)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
A=False
for i in range(n-1):
    if s[i]=='#':
        num=i
        A=True
        break
if A:
    moji=s[num:]
    lst=dict(Counter(moji).items())
    a=lst['#'];b=lst['.']

    if a==0 or b==0:
        print(0)
    else:
        if s[-1]=='#':
            print(min(a-1,b))
        else:
            print(min(a,b))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
A=False
for i in range(n-1):
    if s[i]=='#':
        num=i
        A=True
        break
if A:
    moji=s[num:]
    lst=dict(Counter(moji).items())
    a=lst['#'];b=lst['.']

    if a==0 or b==0:
        print(0)
    else:
        if s[-1]=='#':
            print(min(a-1,b))
        else:
            print(min(a,b))
else:
    print(0)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a+a-1,a+b,b+b-1))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
lst=[1]
for i in range(1,n):
    if s[i]!=s[i-1]:
        lst.append(1)
    else:
        lst[-1]=lst[-1]+1
p=2*k
L=[0]
for i in lst:
  L.append(L[-1]+i)
l=len(L)
ans=0
if s=='1'*n:
    ans=n
else:
    if s[0]=='1':
        if l%2==0:
            q=(l-p)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
        else:
            L.append(0)
            q=(l-p+1)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
    else:
        L.insert(0,0)
        if l%2==1:
            L.insert(0,0)
            q=(l-p+1)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
        else:
            L.append(0)
            q=(l-p+2)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a+a-1,a+b,b+b-1)
Problem p03096 (python)

Fixed submission:
N=int(input())
lst=[0]
mod=10**9+7
for i in range(N):
  a=int(input())
  if lst[-1]==a:
    continue
  else:
    lst.append(a)
length=len(lst)
L=[0]*(2*10**5+1);DP=[0]*(length-1)
DP.insert(0,1)
for i in range(1,length):
  if L[lst[i]]==0:
    DP[i]=DP[i-1]%mod
    L[lst[i]]=i
  else:
    j=L[lst[i]]
    DP[i]=(DP[i-1]+DP[j])%mod
    L[lst[i]]=i
print(DP[-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
lst=[0]
mod=10**9+7

for i in range(N):
  a=int(input())
  if lst[-1]==a:#直前と同じ色はlstに入れない（圧縮）
    continue　
  else:
    lst.append(a)
#今、lstのindexと石の個数は等しい
    
length=len(lst)

#全色のリストL、初期値０にしておく
#DPをDP[0]を１に、残りlength-1個を０にしたリストとする
L=[0]*(2*10**5+1)
DP=[0]*(length-1)
DP.insert(0,1)
for i in range(1,length):
  if L[lst[i]]==0:#色がまだ出ていないとき
    DP[i]=DP[i-1]%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
  else:#同じ色が出ているとき
    j=L[lst[i]]#直前の色のindexはj
    DP[i]=(DP[i-1]+DP[j])%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
print(DP[-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
lst=[0]
mod=10**9+7

for i in range(N):
  a=int(input())
  if lst[-1]==a:#直前と同じ色はlstに入れない（圧縮）
    continue　
  else:
    lst.append(a)
#今lstのindexと石の個数は等しい
    
length=len(lst)

#全色のリストL、初期値０にしておく
#DPをDP[0]を１に、残りlength-1個を０にしたリストとする
L=[0]*(2*10**5+1)
DP=[0]*(length-1)
DP.insert(0,1)
for i in range(1,length):
  if L[lst[i]]==0:#色がまだ出ていないとき
    DP[i]=DP[i-1]%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
  else:#同じ色が出ているとき
    j=L[lst[i]]#直前の色のindexはj
    DP[i]=(DP[i-1]+DP[j])%mod
    L[lst[i]]=i#色のリストLに今のindexを記録
print(DP[-1])
Problem p03106 (python)

Fixed submission:
A,B,K=(int(i) for i in input().split()) 
L=[]
 
for i in range(1,min(A,B)+1):
  if A%i==0 and B%i==0:
    L.append(i)
L=L[::-1]
print(L[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K=(int(i) for i in input().split()) 
j=1
L=[]

for i in range(1,min(A,B)):
  if A%i==0 and B%i==0:
    L.append(i)
   
     
print(L[K-1])
Problem p03126 (python)

Fixed submission:
N,M=(int(i) for i in input().split())
S=set(int(i+1) for i in range(M))

for i in range(N):
    L=[int(i) for i in input().split()]
    S=S&set(L[1:])
print(len(list(S)))

Buggy submission (verdict: Runtime Error):
N,M=(int(i) for i in input().split())
L=[]
for i in range(N):
  L.append([int(i) for i in input().split()])
s=set(L[0][1:L[0][0]])
for i in range(N):
  s=s&set(L[i][1:L[i][0]])
print(len(list(s))
Problem p03136 (python)

Fixed submission:
N=int(input())
L=[int(i) for i in input().split()]
M=max(L)
L.remove(M)
if M>=sum(L):
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N=int(input())
L=[int(i) for i in input().split()]
M=max(L)
del L[M]
if M>=sum(L):
  print('No')
else:
  print('Yes')