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

Fixed submission:
N = int(input())

l_0 = list(map(int , input().split()))

L = [l_0]

m = None

count = 0

while L != []:
	for l in L:
		lis = l
		m   = min(l)
		for i in range(len(l)):
			lis[i] = lis[i] - m
		count += m
		lis = "_".join( list(map(str , lis)) )
		if lis[0:1] == "0":
			lis = lis[2:]
		lis = lis.split("_0")
		while "" in lis:
			lis.remove("")
		for a in lis:
			if a[0:1] == "_":
				a = a[1:]
			a = list(map(int, a.split("_")))
			L.append(a)
		L.remove(l)
		while [] in L:
			L.remove([])
print(count)

Buggy submission (verdict: Runtime Error):
L = [l_0]

m = None

count = 0

while L != []:
	for l in L:
		m = min(l)
		L.remove(l)
		for i in range(len(l)):
			l[i] = l[i] - m
		count += m
		l = list(map(str , l))
		l = " ".join(l)
		l = (l.split("0 "))
		for a in l:
			L.append(list(map( int, (a.split()))))
		while [] in L:
			L.remove([])

print(count)
Problem p03150 (python)

Fixed submission:
S = input()
L = len(S)
Truth = 0

for j in range(0, 8):
	if S[0:j] + S[L- 7 +j:] == "keyence":
		Truth = 1

if Truth ==1:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
L = len(S)
Truth = 0

for j in range(0, 8):
	if S[0:j] + S[L- 7 +j:] = "keyence":
		Truth = 1

if Truth =1:
	print(YES)
else:
	print(NO)
Problem p03210 (python)

Fixed submission:
X = int(input())

if X == 7 or X == 5 or X == 3:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
X = int(input())

if X = 7 or X = 5 or X = 3:
	print("YES")
else:
	print("NO")
Problem p03220 (python)

Fixed submission:
N = int(input())

T, A = list(map(int , input().split()))

H = list(map(int , input().split()))

Tlist =[]

for n in range(N):
	Tlist.append(T - H[n]*0.006)

t = Tlist[0]
m = 0

for n in range(N):
	if abs(t-A) > abs(Tlist[n]-A):
		t = Tlist[n]
		m = n

M = m + 1
print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())

T, A = list(map(int , input().split()))

H = list(map(int , input().split()))

Tlist =[]

for n in range(N):
	Tlist.append(T - H[n]*0.006)


t = Tlist[0]
m = None

for n in range(N):
	if abs(t-A) > abs(Tlist[n]-A):
		t = Tlist[n]
		m = n

M = m + 1
print(M)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
L_A = [0] * (N+1)
R_A = [0] * (N+1)
for i in range(N):
    L_A[1+i] = gcd(L_A[i], A[i])
for i in reversed(range(N)):
    R_A[i] = gcd(R_A[i+1], A[i])
print(max(gcd(L_A[i], R_A[i+1]) for i in range(N)))

Buggy submission (verdict: Runtime Error):
import fractions as fr
import copy
from functools import reduce
 
N = int(input())
yaku = [0]*N
X = input().split()
X = list(set(X))
if len(X) == 1:
    print(X[0])
    exit()
X = list(map(int, X))
 
 
def gcd_list(numbers):
    return reduce(fr.gcd, numbers)
 
 
for i in range(N):
    Xwork = copy.copy(X)
    del(Xwork[i])
    yaku[i] = gcd_list(Xwork)
 
print(max(yaku))

Buggy submission (verdict: Runtime Error):
import fractions as fr
import copy
from functools import reduce
 
N = int(input())
yaku = [0]*N
X = input().split()
X = list(set(X))
X = list(map(int, X))
 
 
def gcd_list(numbers):
    return reduce(fr.gcd, numbers)
 
 
for i in range(N):
    Xwork = copy.copy(X)
    del(Xwork[i])
    yaku[i] = gcd_list(Xwork)
 
print(max(yaku))

Buggy submission (verdict: Runtime Error):
import math
import copy
from functools import reduce

N = int(input())
yaku = [0]*N
X = input().split()
X = list(map(int, X))


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


for i in range(N):
    Xwork = copy.copy(X)
    del(Xwork[i])
    yaku[i] = gcd_list(Xwork)

print(max(yaku))

Buggy submission (verdict: Runtime Error):
import math
import copy
from functools import reduce

N = int(input())
yaku = [0]*N
X = input().split()
X = list(map(int, X))


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


for i in range(N):
    Xwork = copy.copy(X)
    del(Xwork[i])
    yaku[i] = gcd_list(Xwork)

print(max(yaku))
Problem p03455 (python)

Fixed submission:
a,b=(int(x) for x in input().split())
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=input().split()
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")
Problem p03206 (python)

Fixed submission:
D = int(input())

if D==22:
    print ("Christmas Eve Eve Eve")

if D==23:
    print ("Christmas Eve Eve")

if D==24:
    print ("Christmas Eve")

if D==25:
    print ("Christmas ")

Buggy submission (verdict: Runtime Error):
D = int(input())

if D==22:
    (print) "Christmas Eve Eve Eve Eve"

if D==23:
    (print) "Christmas Eve Eve"

if D==24:
    (print) "Christmas Eve"

if D==25:
    (print) "Christmas "

Buggy submission (verdict: Runtime Error):
D = int(input())

if D==22:
    print "Christmas Eve Eve Eve Eve"

if D==23:
    print "Christmas Eve Eve"

if D==24:
    print "Christmas Eve"

if D==25:
    print "Christmas "

Buggy submission (verdict: Runtime Error):
D = int(input())

if D==23:
    print "Christmas Eve Eve"

if D==24:
    print "Christmas Eve"

if D==23:
    print "Christmas "

Buggy submission (verdict: Runtime Error):

if D==23:
    print "Christmas Eve Eve"

if D==24:
    print "Christmas Eve"

if D==23:
    print "Christmas "

Buggy submission (verdict: Runtime Error):

if D==23:
    print('Christmas Eve Eve')

if D==24:
    print('Christmas Eve')

if D==23:
    print('Christmas ')

Buggy submission (verdict: Runtime Error):
if D=23:
    print('Christmas Eve Eve')

if D=24:
    print('Christmas Eve')

if D=23:
    print('Christmas ')
Problem p03147 (python)

Fixed submission:

def grand_garden(hlist):
    all_zero = False
    count = 0
    while(not all_zero):
        nonzero = False
        for i, h_i in enumerate(hlist):
            if h_i != 0:
                nonzero = True
                hlist[i] = hlist[i] -1
            elif nonzero:
                break


        if nonzero:
            count = count + 1
        else:
            all_zero = True


    return count




n = int( input())
hlist = input().split()
for i, h_i in enumerate(hlist):
    hlist[i] = int(hlist[i])

count = grand_garden(hlist)

print(count)

Buggy submission (verdict: Runtime Error):

def grand_garden(count, hlist):
    nonzero = False
    for i, h_i in enumerate(hlist):
        if h_i != 0:
            nonzero = True
            hlist[i] = hlist[i] -1
        elif nonzero:
            break


    if nonzero:
        return grand_garden(count + 1, hlist)
    else:
        return count






n = int( input())
hlist = input().split()
for i, h_i in enumerate(hlist):
    hlist[i] = int(hlist[i])

count = grand_garden(0, hlist)

print(count)
Problem p03068 (python)

Fixed submission:


N = int(input())
S = input()
K =  int(input())

moji = S[K-1]

result = ''
for s in S:
    if s == moji:
        result+=s
    else:
        result+='*'
print(result)

Buggy submission (verdict: Runtime Error):


N = int(input())
S = input()
K =  int(input())

moji = S[K]

result = ''
for s in S:
    if s == moji:
        result+=s
    else:
        result+='*'
print(result)
Problem p03086 (python)

Fixed submission:

S = input()
ARR = ['A', 'C', 'G', 'T']

results = []
count = 0
for i in range(len(S)):
    if S[i] in ARR:
        count+=1
        results.append(count)
    else:
        results.append(count)
        count = 0

print(max(results))

Buggy submission (verdict: Runtime Error):

S = input()
ARR = ['A', 'C', 'G', 'T']

results = []
count = 0
for i in range(len(S)):
    if S[i] in ARR:
        count+=1
    else:
        results.append(count)
        count = 0
print(max(results))
Problem p03060 (python)

Fixed submission:
N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.append(int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.append(int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(c)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.insert(0,int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.insert(0,int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(c)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.insert(0,int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.insert(0,int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(0)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)
Problem p03068 (python)

Fixed submission:
N=input()
S=str(input())
K=int(input())
Ans=""
for i in range(0,len(S),1):
  if S[i]==S[K-1]:
    Ans+=str(S[i])
  elif S[i]!=S[K-1]:
    Ans+="*"

print(Ans)

Buggy submission (verdict: Runtime Error):
N=input()
S=str(input())
K=int(input())
Target=S[K]
Ans=""
for i in range(0,len(S),1):
  if S[i]==S[K]:
    Ans+=str(S[i])
  elif S[i]!=S[K]:
    Ans+="*"

print(Ans)
Problem p03076 (python)

Fixed submission:
#下1桁が小さい(しかし0でない)物を最後に残す
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
S=a+b+c+d+e
A=a%10
B=b%10
C=c%10
D=d%10
E=e%10
ListN=[]
if A!=0:
  ListN.append(A)
if B!=0:
  ListN.append(B)
if C!=0:
  ListN.append(C)
if D!=0:
  ListN.append(D)
if E!=0:
  ListN.append(E)

if len(ListN)==0:
  print(S)
else:
  Listn=[]
  ListN.sort()
  for i in range(1,len(ListN),1):
    q=10-int(ListN[i])
    S+=q
  print(S)

Buggy submission (verdict: Runtime Error):
#下1桁が小さい(しかし0でない)物を最後に残す
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
S=a+b+c+d+e
A=a%10
B=b%10
C=c%10
D=d%10
E=e%10
ListN=[]
if A!=0:
  ListN.append(A)
if B!=0:
  ListN.append(B)
if C!=0:
  ListN.append(C)
if D!=0:
  ListN.append(D)
if E!=0:
  ListN.append(E)
ListN.sort()
if len(N)==0:
  print(S)
else:
  Listn=[]
  for i in range(0,len(N),1):
    q=10-int(ListN[i])
    S+=q
  print(S)

Buggy submission (verdict: Runtime Error):
#下1桁が小さい(しかし0でない)物を最後に残す
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
S=a+b+c+d+e
A=a%10
B=b%10
C=c%10
D=d%10
E=e%10
ListN=[]
ListN.append(A)
ListN.append(B)
ListN.append(C)
ListN.append(D)
ListN.append(E)
ListN.sort()
while ListN[0]==0:
  ListN.pop(0)
  ListN.append(0)
Listn=[]
for i in range(1,5,1):
  if ListN[i]!=0
    Listn.append(10-int(ListN[i]))

s=0
for i in range(1,5,1):
  s+=Listn[i]

S+=s
print(S)
Problem p03086 (python)

Fixed submission:
S=str(input())  #文字列の入力
S=S.replace("A","x")
S=S.replace("T","x")
S=S.replace("G","x")
S=S.replace("C","x")
for i in range(0,2,1):
  if S.count("xxxxxxxxxx")!=0:
    print(10)
    break
  elif S.count("xxxxxxxxx")!=0:
    print(9)
    break
  elif S.count("xxxxxxxx")!=0:
    print(8)
    break
  elif S.count("xxxxxxx")!=0:
    print(7)
    break
  elif S.count("xxxxxx")!=0:
    print(6)
    break
  elif S.count("xxxxx")!=0:
    print(5)
    break
  elif S.count("xxxx")!=0:
    print(4)
    break
  elif S.count("xxx")!=0:
    print(3)
    break
  elif S.count("xx")!=0:
    print(2)
    break
  elif S.count("x")!=0:
    print(1)
    break
  else:
    print(0)
    break

Buggy submission (verdict: Runtime Error):
moji=str(input()) #文字列の入力
ListNum=[] #suuの各値を入れる
suu=0
for i in range(0,len(moji),1):
  if moji[i]=="A":
    suu+=1
  elif moji[i]=="T":
    suu+=1
  elif moji[i]=="G":
    suu+=1
  elif moji[i]=="C":
    suu+=1
  else:
    ListNum.append(suu)
    suu=0
print(max(ListNum))

Buggy submission (verdict: Runtime Error):
moji=str(input()) #文字列の入力
ListNum=[] #suuの各値を入れる
suu=0
for i in range(0,len(moji),1):
  if moji[i]=="A":
    suu+=1
  elif moji[i]=="T":
    suu+=1
  elif moji[i]=="G":
    suu+=1
  elif moji[i]=="C":
    suu+=1
  else:
    ListNum.append(suu)
    suu=0
print(max(ListNum))
Problem p03211 (python)

Fixed submission:
S=str(input())
ListNum=[]
ListNUm=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<len(S)-2:
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    NUm=Num-753
    NUM=NUm**2
    ListNum.append(Num)
    ListNUm.append(NUm)
    ListNUM.append(NUM)
posi=ListNUM.index(min(ListNUM))

if ListNUm[posi]<0:
  ListNUm[posi]=ListNUm[posi]*(-1)
print(ListNUm[posi])

Buggy submission (verdict: Runtime Error):
S=str(input())
ListNum=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<len(S)-2:
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    NUm=Num-753
    NUM=NUm**2
    ListNum.append(Num)
    ListNUm.append(NUm)
    ListNUM.append(NUM)
posi=ListNUM.index(min(ListNUM))
print(int(NUm[posi]))

Buggy submission (verdict: Runtime Error):
S=str(input())
ListNum=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<len(S)-2:
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    NUM=(Num-753)**2
    ListNum.append(Num)
    ListNUM.append(NUM)
posi=ListNUM.index(min(ListNUM))
print(int(int(NUM[posi])**(1/2)))

Buggy submission (verdict: Runtime Error):
S=str(input())
ListNum=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<len(S)-2:
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    NUM=(Num-753)**2
    ListNum.append(Num)
    ListNUM.append(NUM)
posi=ListNUM.index(min(ListNUM))
print(int(NUM[posi]**(1/2)))

Buggy submission (verdict: Runtime Error):
S=str(input())
ListNum=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<len(S)-2:
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    NUM=(Num-753)**2
    ListNum.append(Num)
    ListNUM.append(NUM)
posi=ListNUM.index(mini(ListNUM))
print(NUM**(1/2))

Buggy submission (verdict: Runtime Error):
S=str(input())
ListNum=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<(len(S)-2):
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    ListNum.append(Num)

for j in range(0,len(ListNum),1):
  NUm=int(ListNum[i])-753
  NUM=int(NUm**2)
  ListNUM.append(NUM)

mini=min(ListNUM)
ans=ListNUM.index(mini)
print(ListNum[ans])

Buggy submission (verdict: Runtime Error):
S=str(input())
ListNum=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<(len(S)-2):
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    ListNum.append(Num)

for j in range(0,len(ListNum)-1,1):
  NUm=int(ListNum[i])-753
  NUM=int(NUm**2)
  ListNUM.append(NUM)

mini=min(ListNUM)
ans=ListNUM.index(mini)
print(ListNum[ans])

Buggy submission (verdict: Runtime Error):
S=str(input())
ListNum=[]
ListNUM=[]
for i in range(0,len(S),1):
  if i<(len(S)-2):
    Num=100*int(S[i])+10*int(S[i+1])+int(S[i+2])
    ListNum.append(Num)

for j in range(0,len(ListNum),1):
  NUm=int(ListNum[i])-753
  NUM=int(NUm**2)
  ListNUM.append(NUM)

mini=min(ListNUM)
ans=ListNUM.index(mini)
print(ListNum[ans])
Problem p03323 (python)

Fixed submission:
A,B=map(int,input().split())
if A<=8 and B<=8:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split()) #Nは種類、Mは食べる個数
ListPPP=[]
ListPPM=[]
ListPMP=[]
ListMPP=[]
ListPMM=[]
ListMPM=[]
ListMMP=[]
ListMMM=[]
for i in range(0,N,1):
  x,y,z=map(int,input().split())
  ListPPP.append(x+y+z)
  ListPPM.append(x+y-z)
  ListPMP.append(x-y+z)
  ListMPP.append(-x+y+z)
  ListPMM.append(x-y-z)
  ListMPM.append(-x+y-z)
  ListMMP.append(-x-y+z)
  ListMMM.append(-x-y-z)

MAXList=[]
a=0;b=0;c=0;d=0;e=0;f=0;g=0;h=0


ListPPP.sort()
for i in range(0,M,1):
  a+=int(ListPPP[-1-i])
  
ListPPM.sort()
for i in range(0,M,1):
  b+=int(ListPPM[-1-i])

ListPMP.sort()
for i in range(0,M,1):
  c+=int(ListPMP[-1-i])

ListMPP.sort()
for i in range(0,M,1):
  d+=int(ListMPP[-1-i])

ListPMM.sort()
for i in range(0,M,1):
  e+=int(ListPMM[-1-i])


ListMPM.sort()
for i in range(0,M,1):
  f+=int(ListMPM[-1-i])


ListMMP.sort()
for i in range(0,M,1):
  g+=int(ListMMP[-1-i])

ListMMM.sort()
for i in range(0,M,1):
  h+=int(ListMMM[-1-i])
  
MAXList.append(a)
MAXList.append(b)
MAXList.append(c)
MAXList.append(d)
MAXList.append(e)
MAXList.append(f)
MAXList.append(g)
MAXList.append(h)
print(max(MAXList))
Problem p03059 (python)

Fixed submission:
in_str = input()
str_num = in_str.split()
num = []
for i in range(3):
    num.append(int(str_num[i]))

bis = 0
i = 1

while True:
    if num[0] * i > num[2] + 0.5:
        break
    bis += num[1]
    i += 1

print(bis)

Buggy submission (verdict: Runtime Error):
import fractions

n_str = input()
n = int(n_str)
a_str = input().split()
a = []
for i in range(n):
    a.append(int(a_str[i]))
tmp1 = [0] * (n + 1)
tmp2 = [0] * (n + 1)
tmp = []
for i in range(n + 1):
    for j in range(i):
        if j == 0:
            tmp1[j + 1] = fractions.gcd(0, a[j])
        else:
            tmp1[j + 1] = fractions.gcd(tmp1[j], a[j])
    for j in range(n - 1, i, -1):
        if j == n - 1:
            tmp2[j] = fractions.gcd(0, a[j])
        else:
            tmp2[j] = fractions.gcd(tmp2[j + 1], a[j])
    if i == 0:
        tmp.append(fractions.gcd(0, tmp2[i + 1]))
    elif i == n:
        tmp.append(fractions.gcd(tmp1[i], 0))
    else:
        tmp.append(fractions.gcd(tmp1[i], tmp2[i + 1]))
print(max(tmp))
Problem p03826 (python)

Fixed submission:
A, B, C, D = map(int,input().split())
print(max(A*B, C*D))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = eval("*".join(map(str, list(range(1, N+1)))))
ans = 1
for i in range (2, N + 1):
    num = 0
    while K % i == 0:
        num += 1
        K //= i
    ans *= (num + 1)
print(ans % (10**9 + 7))
Problem p03828 (python)

Fixed submission:
N = int(input())
K = eval("*".join(map(str, list(range(1, N+1)))))
ans = 1
for i in range (2, N + 1):
    num = 0
    while K % i == 0:
        num += 1
        K //= i
    ans *= (num + 1)
print(ans % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = eval("*".join(map(str,[*range(1, N+1)])))
ans = 1
for i in range (2, N + 1):
    num = 0
    while K % i == 0:
        num += 1
        K //= i
    ans *= (num + 1)

print(ans % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
N = int(input())
f = lambda n: n*f(n-1) if n > 1 else 1
K = f(N)
ans = 1
for i in range (2, N + 1):
    num = 0
    while K % i == 0:
        num += 1
        K //= i
    ans *= (num + 1)

print(ans % (10**9 + 7))
Problem p04043 (python)

Fixed submission:
l = list(map(int, input().split()))
if (l.count(5) == 2) and (l.count(7) == 1):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
N, _ = map(int, input().strip().split())
D = input().strip().split()
for ans in range(N, 100000):
    if len(set(str(ans)) & set(D)) == 0:
        print(ans)
        break

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = input().split()
ans = N
for i in range(N, 10000):
    for x in str(ans):
        if x in D:
            ans += 1
            break;
    if ans == i:
        print(ans)
        break

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = input().split()
ans = N
for i in range(N, 10000):
    for x in str(ans):
        if x in D:
            ans += 1
            break;
    else:
        print(ans)
        exit()
Problem p03231 (python)

Fixed submission:
import fractions
n, m = map(int, input().split())
s = list(input())
t = list(input())
u = fractions.gcd(n, m)
l = n * m // u
n = n//u
m = m // u
for i in range(u):
    if s[i * n] != t[i * m]:
        l = -1
        break
print(l)

Buggy submission (verdict: Runtime Error):
import fractions
n, m = map(int, input().split())
s = list(input())
t = list(input())
l = n * m // fractions.gcd(n, m)
k = [""] * l
n = l // n
m = l//m
for i in range(l):
    if i % n == 0 and i % m == 0:
        if s[i//n] != t[i//m]:
            ans = -1
            break
else:
    ans = l
print(ans)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
N, X = map(int, input().split())
kotae = list(map(int, input().split()))
kotae.append(X)
kotae.sort()
t = kotae[1]-kotae[0]
for i in range(len(kotae)-1):
    t = gcd(t, abs(kotae[i + 1] - kotae[i]))
print(t)

Buggy submission (verdict: Runtime Error):
from math import gcd
N, X = map(int, input().split())
kotae = list(map(int, input().split()))
kotae.append(X)
kotae.sort()
t = kotae[1]-kotae[0]
for i in range(len(kotae)-1):
    t = gcd(t, abs(kotae[i + 1] - kotae[i]))
print(t)

Buggy submission (verdict: Runtime Error):
import math
n, x = map(int, input().split())
kotae = list(map(int, input().split()))
kotae.append(x)
kotae = sorted(kotae)
t = kotae[1]-kotae[0]
for i in range(len(kotae)-1):
    t = math.gcd(t, kotae[i + 1] - kotae[i])
print(t)

Buggy submission (verdict: Runtime Error):
import math
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a = sorted(a)
t = 0
for i in range(n-1):
    if i == 0:
        t = a[1] - a[0]
    else:
        t = math.gcd(t, a[i + 1] - a[i])
print(t)

Buggy submission (verdict: Runtime Error):
import math
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a.sort()
t = 0
for i in range(n):
    if i == 0:
        t = a[1] - a[0]
    else:
        t = math.gcd(t, a[i + 1] - a[i])
print(t)

Buggy submission (verdict: Runtime Error):
import math
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a.sort()
for i in range(n):
    if i == 0:
        t = a[1] - a[0]
    else:
        t = math.gcd(t, a[i + 1] - a[i])
print(t)
Problem p03283 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000)

def memoize(f):
    table = {}

    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func


@memoize
def memo(a, b):
    if a == b:
        return e[a].count(a)
    elif b - a == 1:
        return memo(b, b) + memo(a, a) + e[a].count(b)
    else:
        return memo(a+1, b)+memo(a, b-1) + e[a].count(b) - memo(a+1, b-1)


n, m, q = map(int, input().split())
e = []
for i in range(n+1):
    e.append([])
for i in range(m):
    x, y = map(int, input().split())
    e[x].append(y)
for i in range(q):
    x, y = map(int, input().split())
    print(memo(x, y))

Buggy submission (verdict: Runtime Error):
def memoize(f):
    table = {}

    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func


@memoize
def memo(a, b):
    if a == b:
        return e[a].count(a)
    elif b - a == 1:
        return memo(b, b) + memo(a, a) + e[a].count(b)
    else:
        return memo(a+1, b)+memo(a, b-1) + e[a].count(b) - memo(a+1, b-1)


n, m, q = map(int, input().split())
e = []
for i in range(n+1):
    e.append([])
for i in range(m):
    x, y = map(int, input().split())
    e[x].append(y)
for i in range(q):
    x, y = map(int, input().split())
    print(memo(x, y))
Problem p03352 (python)

Fixed submission:
lis=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,216,36,343,49,100,1000]
for i in range(11,32):
    t=i*i
    lis.append(t)
listt=list(set(lis))
listt=sorted(listt)
a=int(input())
for i in range(300):
    if a < listt[i]:
        print (listt[i-1])
        break
    elif a == listt[i]:
        print(listt[i])
        break

Buggy submission (verdict: Runtime Error):
lis=[1,2,4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,216,36,343,49,100,1000]
for i in range(11,32):
    t=i*i
    lis.append(t)
listt=list(set(lis))
listt=sorted(listt)
a=int(input())
for i in range(300):
    if a < listt[i]:
        print (listt[i-1])
        break
    elif a = listt[i]:
        print(listt[i])
        break