Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import functools
A,B=[int(_) for _ in input().split()]
def fxor(a,b):
    return a^b
def fxorA2B(a,b):
    if a < b:
        return functools.reduce(fxor,range(a,b+1))
    else:
        return a
def lenbin(X):
    return len(bin(X)) - 3
iA = lenbin(A)
iB = lenbin(B)
if iA == iB:
    print(fxorA2B(A,B))
else:
    print(fxorA2B(A,(2**(iA+1) - 1))^fxorA2B(2**iB,B))


Fixed submission:
A,B=[int(_) for _ in input().split()]
def fxor(a,b):
    return a^b

def fxorA2B(a,b,iD):
    def calcFD(g,b):
        return (g -1) //2 % 2 if b else g//2 % 2
    if a < b:
        if a == 2**iD :
            sB = bin(b)[2:][::-1]
            i2 = 2**iD -1
            bB = (b - i2)%2
            iC = 0
            for i in range(iD+1):
                iB = int(sB[i])
                if i == 0 and calcFD(b-i2,bB):
                    iC += 1
                elif iB and bB:
                    iC += 2**i
        else:
            a -= 1
            sA = bin(a)[2:][::-1]
            sB = bin(b)[2:][::-1]
            i2 = 2**iD -1
            bA = (a - i2)%2
            bB = (b - i2)%2
            iC = 0
            for i in range(iD+1):
                iA = int(sA[i])
                iB = int(sB[i])
                if i == 0 and calcFD(a-i2,bA) ^ calcFD(b-i2,bB):
                    iC += 1
                elif (iA and bA) ^ (iB and bB):
                    iC += 2**i
        return iC
    else:
        return a
def lenbin(X):
    return len(bin(X)) - 3
iA = lenbin(A)
iB = lenbin(B)
if iA == iB:
    print(fxorA2B(A,B,iA))
else:
    if iA == 0 :
        print(fxorA2B(2**iB,B,iB))
    else:
        print(fxorA2B(A,(2**(iA+1) - 1),iA)^fxorA2B(2**iB,B,iB))

Buggy python submission (verdict: Time Limit Exceeded):
A,B=[int(_) for _ in input().split()]
def fxor(a,b):
    return a^b
import functools
print(functools.reduce(fxor,range(A,B+1)))


Fixed submission:
A,B=[int(_) for _ in input().split()]
def fxor(a,b):
    return a^b

def fxorA2B(a,b,iD):
    def calcFD(g,b):
        return (g -1) //2 % 2 if b else g//2 % 2
    if a < b:
        if a == 2**iD :
            sB = bin(b)[2:][::-1]
            i2 = 2**iD -1
            bB = (b - i2)%2
            iC = 0
            for i in range(iD+1):
                iB = int(sB[i])
                if i == 0 and calcFD(b-i2,bB):
                    iC += 1
                elif iB and bB:
                    iC += 2**i
        else:
            a -= 1
            sA = bin(a)[2:][::-1]
            sB = bin(b)[2:][::-1]
            i2 = 2**iD -1
            bA = (a - i2)%2
            bB = (b - i2)%2
            iC = 0
            for i in range(iD+1):
                iA = int(sA[i])
                iB = int(sB[i])
                if i == 0 and calcFD(a-i2,bA) ^ calcFD(b-i2,bB):
                    iC += 1
                elif (iA and bA) ^ (iB and bB):
                    iC += 2**i
        return iC
    else:
        return a
def lenbin(X):
    return len(bin(X)) - 3
iA = lenbin(A)
iB = lenbin(B)
if iA == iB:
    print(fxorA2B(A,B,iA))
else:
    if iA == 0 :
        print(fxorA2B(2**iB,B,iB))
    else:
        print(fxorA2B(A,(2**(iA+1) - 1),iA)^fxorA2B(2**iB,B,iB))
Buggy python submission (verdict: Runtime Error):
A,B,K =[int(_) for _ in input().split()]

def fgcd(a,b):
    while b:
        a,b = b,a%b
    return a

igcd = fgcd(A,B)
if igcd == 1:
    print(1)
else:
    aP = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97)
    aD =[igcd,1]
    for eP in aP:
        if igcd < eP:
            break
        if igcd % eP == 0:
            i = 1
            while igcd % (eP**i) == 0 :
                aD.append(eP**i)
                aD.append(igcd // (eP ** i))
                i += 1
    aD = sorted(list(set(aD)),reverse=True)
    print(aD[K-1])


Fixed submission:
A,B,K =[int(_) for _ in input().split()]

iC = 0
for i in range(100,0,-1):
    if A % i == 0 and B % i ==0:
        iC += 1
        if K == iC:
            print(i)
            exit()

Buggy python submission (verdict: Runtime Error):
A,B,K =[int(_) for _ in input().split()]

def fgcd(a,b):
    while b:
        a,b = b,a%b
    return a

igcd = fgcd(A,B)
if igcd == 1:
    print(1)
else:
    aP = (2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97)
    aD =[igcd,1]
    for eP in aP:
        if igcd % eP == 0:
            aD.append(eP)
            i = 1
            while igcd % (eP**i) == 0 :
                aD.append(igcd // (eP ** i))
                i += 1
    aD = sorted(list(set(aD)),reverse=True)
    print(aD[K-1])


Fixed submission:
A,B,K =[int(_) for _ in input().split()]

iC = 0
for i in range(100,0,-1):
    if A % i == 0 and B % i ==0:
        iC += 1
        if K == iC:
            print(i)
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def 解():
    input = sys.stdin.readline
    H,W = [int(_) for _ in input().split()]
    aM = [""]*H
    for i in range(H):
        aM[i] = input().rstrip()

    adxy=[(0,1),(1,0),(-1,0),(0,-1)]

    def bfsM(i,j):
        aS = [(i,j)]
        dsV = set()
        iC = 0
        while aS:
            th,tw = aS[0]
            del aS[0]
            if aM[th][tw] == ".":
                iC += 1
                for dh,dw in adxy:
                    nh,nw=dh+th,dw+tw
                    nP = (nh,nw)
                    if 0 <= nh < H and 0 <= nw < W:
                        if aM[nh][nw] == "#" and nP not in dsV:
                            aS.append(nP)
                            dsV.add(nP)
            else:
                for dh,dw in adxy:
                    nh,nw=dh+th,dw+tw
                    nP = (nh,nw)
                    if 0 <= nh < H and 0 <= nw < W:
                        if aM[nh][nw] == "." and nP not in dsV:
                            aS.append(nP)
                            dsV.add(nP)
        return iC

    iAns = 0
    for i in range(H):
        for j in range(W):
            if aM[i][j] == "#":
                iAns += bfsM(i,j)
    print(iAns)
解()



Fixed submission:
import sys

def 解():
    input = sys.stdin.readline
    H,W = [int(_) for _ in input().split()]
    aM = [""]*H
    for i in range(H):
        aM[i] = input().rstrip()

    adxy=[(0,1),(1,0),(-1,0),(0,-1)]
    dsVBs=set()

    def bfsM(i,j):
        aS = [(i,j)]
        dsV = set()
        dsVB = set()
        iC = 0
        while aS:
            th,tw = aS[0]
            del aS[0]
            if aM[th][tw] == ".":
                iC += 1
                for dh,dw in adxy:
                    nh,nw=dh+th,dw+tw
                    nP = (nh,nw)
                    if 0 <= nh < H and 0 <= nw < W:
                        if aM[nh][nw] == "#" and nP not in dsV:
                            aS.append(nP)
                            dsV.add(nP)
                            dsVB.add(nP)
            else:
                for dh,dw in adxy:
                    nh,nw=dh+th,dw+tw
                    nP = (nh,nw)
                    if 0 <= nh < H and 0 <= nw < W:
                        if aM[nh][nw] == "." and nP not in dsV:
                            aS.append(nP)
                            dsV.add(nP)
        iB = len(dsVB)
        for nP in dsVB:
            dsVBs.add(nP)
        return iC*iB

    iAns = 0
    for i in range(H):
        for j in range(W):
            if aM[i][j] == "#" and (i,j) not in dsVBs:
                iAns += bfsM(i,j)
    print(iAns)
解()
Buggy python submission (verdict: Time Limit Exceeded):
def 解():
    N,K = [int(_) for _ in input().split()]
    aH = [int(_) for _ in input().split()]
    INF=float("inf")
    dp=[INF]*N
    dp[0]=0
    for i in range(N):
        dp[i] = min(dp[i-j] + abs(aH[i-j]-aH[i]) for j  in  range(min(K+1,i+1)))
    print(dp[-1])
解()


Fixed submission:
def 解():
    N,K = [int(_) for _ in input().split()]
    aH = [int(_) for _ in input().split()]
    INF=float("inf")
    dp=[INF]*N
    dp[0]=0
    for i in range(N):
        dp[i] = min(dp[i-j] + abs(aH[i-j]-aH[i]) for j  in  range(min(K+1,i+1)))
    print(dp[-1])
解()
Buggy python submission (verdict: Runtime Error):
mport sys
def 解():
    input = sys.stdin.readline
    N = int(input())
    dp = [int(_) for  _ in input().split()]
    for _ in range(N-1):
        a,b,c = [int(_) for  _ in input().split()]
        dp = [max(dp[1]+a,dp[2]+a),max(dp[0]+b,dp[2]+b),max(dp[0]+c,dp[1]+c)]
    print(max(dp))
解()


Fixed submission:
import sys
def 解():
    input = sys.stdin.readline
    N = int(input())
    dp = [int(_) for  _ in input().split()]
    for _ in range(N-1):
        a,b,c = [int(_) for  _ in input().split()]
        dp = [max(dp[1]+a,dp[2]+a),max(dp[0]+b,dp[2]+b),max(dp[0]+c,dp[1]+c)]
    print(max(dp))
解()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def 解():
    input = sys.stdin.readline

    N,W=[int(_) for _ in input().split()]
    dp={0:0}
    for i in range(N):
        w,v=[int(_) for _ in input().split()]
        for j in dp.copy():
            if dp[j]+w <= W:
                if j+v in dp:
                    dp[j+v] = min(dp[j+v],dp[j]+w)
                else:
                    dp[j+v] = dp[j]+w

    print(max(dp.keys()))
解()


Fixed submission:
import sys
def 解():
    input = sys.stdin.readline

    N,W=[int(_) for _ in input().split()]
    dp = [0]*(W+1)
    for i in range(N):
        w,v=[int(_) for _ in input().split()]
        for j in range(W,w-1,-1):
            dp[j] = max(dp[j] ,dp[j-w]+v)
    print(dp[W])
解()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def 解():
    input = sys.stdin.readline

    N,W=[int(_) for _ in input().split()]
    #dp = [[0]*(W+1) for _  in range(N+1)]
    dp = [0]*(W+1)

    for i in range(N):
        w,v=[int(_) for _ in input().split()]
        for j in range(W,w-1,-1):
            dp[j] = max(dp[j] ,dp[j-w]+v)
    print(dp[W])
解()


Fixed submission:
import sys
def 解():
    input = sys.stdin.readline

    N,W=[int(_) for _ in input().split()]
    dp = [0]*(W+1)
    for i in range(N):
        w,v=[int(_) for _ in input().split()]
        for j in range(W,w-1,-1):
            dp[j] = max(dp[j] ,dp[j-w]+v)
    print(dp[W])
解()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def 解():
    L,N=[int(_) for _ in input().split()]
    aX=[int(_) for _ in sys.stdin.readlines()]
    iMax = max(aX[0],L-aX[0],aX[-1],L-aX[-1])
    if 1 < N:
        for i in range(N-1):

            lN = min(i,N-i-1)
            rN = min(i+1,N-i-1)
            R1 = aX[i]+ 2*sum(aX[i-lN:i]) + 2*(rN*L-(sum(aX[i+1:i+rN+1])))

            i += 1
            lN = min(i,N-i)
            rN = min(i,N-i-1)
            R2 = (L- aX[i])+ 2*sum(aX[i-lN:i]) + 2*(rN*L-(sum(aX[i+1:i+rN+1])))

            iMax = max(R1,R2,iMax)
    print(iMax)
解()


Fixed submission:
import sys
def 解():
    L,N=[int(_) for _ in input().split()]
    aX=[int(_) for _ in sys.stdin.readlines()]
    iMax = max(aX[0],L-aX[0],aX[-1],L-aX[-1])
    accX = [0]*(N+1)
    accX[0]=aX[0]
    for i in range(1,N):
        accX[i]=accX[i-1]+aX[i]

    if 1 < N:
        for i in range(N-1):

            lN = min(i,N-i-1)
            rN = min(i+1,N-i-1)
            #R1 = aX[i]+ 2*sum(aX[i-lN:i]) + 2*(rN*L-(sum(aX[i+1:i+rN+1])))
            R1 = aX[i]+ 2*(accX[i-1]-accX[i-lN-1]) + 2*(rN*L-(accX[i+rN]-accX[i]))

            i += 1
            lN = min(i,N-i)
            rN = min(i,N-i-1)
            #R2 = (L- aX[i])+ 2*sum(aX[i-lN:i]) + 2*(rN*L-(sum(aX[i+1:i+rN+1])))
            R2 = (L- aX[i])+ 2*(accX[i-1]-accX[i-lN-1]) + 2*(rN*L-(accX[i+rN]-accX[i]))

            iMax = max(R1,R2,iMax)
    print(iMax)
解()
Buggy python submission (verdict: Runtime Error):
iN,iM = [int(_) for _ in input().split()]
iD = iM // iN
if iM % iN == 0:
    print(iD)
else:
    aD = []
    for i in range(1,int(iM**0.5)+1):
        if iM % i == 0:
            if iD > i : aD.append(i)
            j = iM//i
            if iD > j :aD.append(j)
    print(max(aD))


Fixed submission:
iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    aRet = []
    for i in range(1,iM//iN + 1):
        if iM % i == 0:
            aRet.append(i)
    print(aRet[-1])

Buggy python submission (verdict: Time Limit Exceeded):
iN,iM = [int(_) for _ in input().split()]
iD = iM // iN
if iM % iN == 0:
    print(iD)
else:
    for i in range( iD , 0,-1):
        if iM % i == 0:
            print(i)
            exit()


Fixed submission:
iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    aRet = []
    for i in range(1,iM//iN + 1):
        if iM % i == 0:
            aRet.append(i)
    print(aRet[-1])

Buggy python submission (verdict: Runtime Error):
import itertools
iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    for i in range( 1 , min(iM // iN + 1,int(iM ** 0.5)+1) ):
        if iM % i == 0:
            aRet.append( i )
    print( aRet[-1] )


Fixed submission:
iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    aRet = []
    for i in range(1,iM//iN + 1):
        if iM % i == 0:
            aRet.append(i)
    print(aRet[-1])

Buggy python submission (verdict: Time Limit Exceeded):

iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    aRet = []
    for i in range(1,iM//iN + 1):
        if iM % i == 0:
            aRet.append(i)
    print(aRet[-1])


Fixed submission:
iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    aRet = []
    for i in range(1,iM//iN + 1):
        if iM % i == 0:
            aRet.append(i)
    print(aRet[-1])
Buggy python submission (verdict: Runtime Error):
rint(input().rstrip().replace("1","a").replace("9","1").replace("a","9"))


Fixed submission:
print(input().rstrip().replace("1","a").replace("9","1").replace("a","9"))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

iN ,iX  = [int(x) for x in input().split()]
aX = [int(x) for x in input().split()]

aCum = [0]*(iN)
aCum[0] = aX[0]
for i in range(1,iN):
    aCum[i]=aCum[i-1]+aX[i]

aCum = np.array(aCum)

def fCeil(iT,iR):
    return -1 * iT // iR * -1

def fCalcCost(iN,iX,aCum,iK):
    iCost = 5 * aCum[-1]
    for i in range(2,fCeil(iN,iK) ):
        iCost += 2 * aCum[-1 * i * iK -1]
    iCost += (iK +iN)*iX
    return iCost

iTotalCost = fCalcCost(iN,iX,aCum,1)
for iK in range(2,fCeil(iN,2) + 1):
    iTotalCost = min(iTotalCost,fCalcCost(iN,iX,aCum,iK))
print(iTotalCost)


Fixed submission:

iN ,iX  = [int(x) for x in input().split()]
aX = [int(x) for x in input().split()]

#人のをみてようやく仕組みがわかったがこれで通るんだろうか

aCum = [0]*(iN)
aCum[0] = aX[0]
for i in range(1,iN):
    aCum[i]=aCum[i-1]+aX[i]

def fCalcCost(iN,iX,aCum,iK):
    iCost = 5 * aCum[-1]
    i = 2
    while  i*iK < iN  :
        iCost += 2 * aCum[-1 * i * iK -1]
        i += 1
    iCost += (iK +iN)*iX
    return iCost

iTotalCost = fCalcCost(iN,iX,aCum,1)
for iK in range(2,iN//2 + 2):
    iTotalCost = min(iTotalCost,fCalcCost(iN,iX,aCum,iK))
print(iTotalCost)
Buggy python submission (verdict: Time Limit Exceeded):

iN , iK = [int(x) for x in input().split()]

iULimit = int( iN * 2  / iK )
iCount = 0
for i in range(1,iULimit+1):
    for j in range(1,iULimit + 1):
        for m in range(1,iULimit + 1):
            if( 0 < i + j - m and 0 < i -j + m and 0 < -i + j + m and i + j - m <= iULimit and i-j+m <= iULimit and -i+j+m <= iULimit):
                if( (i + j - m ) * iK % 2 == 0 and (i -j + m) * iK % 2 == 0 and ( -i + j + m) * iK % 2 ==0 ):
                    iCount = iCount + 1
print (iCount)


Fixed submission:

iN , iK = [int(x) for x in input().split()]

if iK % 2 == 0 :
    iFK = int(iK / 2)
    # iFK の奇数だけの組と偶数だけの組
    iULimit = int(iN /iFK)
    if iULimit % 2 == 0:
        print (int(iULimit / 2 ) ** 3 * 2 )
    else:
        print( int((iULimit + 1 )/ 2) ** 3 + int((iULimit - 1)/2) ** 3)
else:
    #iKの倍数だけの組み合わせ
    iULimit = int( iN / iK )
    print(iULimit ** 3)
Buggy python submission (verdict: Runtime Error):
sS = input().rstrip()
#iK = int(input())
if sS[0] == "1":
    if iK !=1:
        print(sS[1])
    else:
        print(sS[0])
else:
    print(sS[0])


Fixed submission:

sS = input().rstrip()
iK = int(input())

for i in range(iK):
    if sS[i] != "1" :
        print(sS[i])
        exit()
print(sS[i])
Buggy python submission (verdict: Runtime Error):
iN = int(input())
aS = map(int,input().split())

iCounter = 0
for i in range(1,iN-1):
  if aS[i] == aS[i-1]:
    if aS[i] == aS[i+1]:
      aS[i] += 1
      iCounter += 1
    else:
      iU = max(aS[i],aS[i+1])
      if iU < 10000:
        iU += 1
      else:
        while iU not in aS[i:i+2]:
          iU -= 1
      aS[i] = iU
      iCounter += 1
print(iCounter)

Fixed submission:
iN = int(input())
aS = [int(x) for x in input().rstrip().split()]

#はぁ こんなのを一発で通れるようなものも書けないのか.. つらい

#つけたしつけたしで条件追加しててやっててつらい



iCounter = 0
if iN == 2:
    if aS[0] == aS[1]:
        iCounter += 1
else:
    for i in range(1,iN-1):
        if aS[i] == aS[i-1]:
            if aS[i] == aS[i+1]:
                if aS[i] < 10000:
                    aS[i] += 1
                else:
                    aS[i] -= 1
                iCounter += 1
            else:
                iU = max(aS[i],aS[i+1])
                if iU < 10000:
                    iU += 1
                else:
                    iU -= 1
                    if iU == min(aS[1],aS[i+1]):
                        iU -= 1
                aS[i] = iU
                iCounter += 1
    if aS[iN-2] == aS[iN-1] :
        iCounter += 1
print(iCounter)
Buggy python submission (verdict: Time Limit Exceeded):
def 解():
    iN = int(input())
    aA = map(int,input().split())
    aA = sorted(map(lambda x,y:x-y,aA,range(1,iN+1)))
    iL = len(aA)
    if iL % 2 :
        iMed = aA[(iL-1)//2]
    else:
        iMed = aA[iL//2]
    iMean = sum(aA) // 2
    iBlim= min(iMed,iMean)
    iUlim= min(iMed,iMean+1)

    iD = iN*max(abs(_) for _ in aA)
    for i in range(min(iMed,iMean),max(iMed,iMean+1)+1):
        iC = 0
        for a in aA:
            iC += abs(a - i)
        if iD > iC:
            iD = iC
    print(iD)
解()


Fixed submission:
def 解():
    iN = int(input())
    aA = map(int,input().split())
    aA = sorted(map(lambda x,y:x-y,aA,range(1,iN+1)))
    iL = len(aA)
    if iL % 2 :
        iMed = aA[(iL-1)//2]
    else:
        iMed = aA[iL//2]
    iMean = sum(aA) // 2
    iBlim= min(iMed,iMean)
    iUlim= min(iMed,iMean+1)

    print(min(sum(abs(a-i) for a in aA) for i in [iMed,iMean,iMean+1]))

解()
Buggy python submission (verdict: Runtime Error):

import sys
def 解():
    input = sys.stdin.readline
    iN = int(input())
    aA = sorted([int(_) for _ in input().split()])
    aB = sorted([int(_) for _ in input().split()])
    aC = sorted([int(_) for _ in input().split()])

    #解法どおり書くとどれくらいでできるのか計測

    idxA = 0
    idxC = iN-1
    iAns = 0
    for idxB in range(iN):

        iB = aB[idxB]
        while idxA < iN and aA[idxA] < iB:
            idxA += 1
        idxA -= 1
        while 0 <= idxC  and aC[idxC] > iB:
            idxC -= 1
        idxC += 1
        if aA[idxA] >= iB or aC[idxC] <= iB:
            break
        else:
            iAns += (idxA + 1 )* (iN - idxC  )
    print(iAns)
解()


Fixed submission:
import sys
def 解():
    input = sys.stdin.readline
    iN = int(input())
    aA = sorted([int(_) for _ in input().split()])
    aB = sorted([int(_) for _ in input().split()])
    aC = sorted([int(_) for _ in input().split()])

    aBA =[0]*iN
    iIndex = iN-1
    for i in range(iN-1,-1,-1):
        iB = aB[i]
        while aA[iIndex] >= iB:
            iIndex -= 1
            if iIndex < 0:
                break
        if iIndex >= 0 :
            aBA[i] = iIndex + 1
        else:
            break
    aAcBA=[0]*iN
    aAcBA[0]=aBA[0]
    for i in range(1,iN):
        aAcBA[i]=aAcBA[i-1]+aBA[i]
    iAns = 0
    iIndex = iN-1
    for i in range(iN-1,-1,-1):
        iC = aC[i]
        while aB[iIndex] >= iC:
            iIndex -= 1
            if iIndex < 0:
                break
        if iIndex >= 0 :
            iAns += aAcBA[iIndex]
        else:
            break
    print(iAns)
解()
Buggy python submission (verdict: Runtime Error):
def 解():
    iA,iB,iC,iD,iE,iF = [int(_) for _ in input().split()]
    #とりあえず全検索
    d = {}
    iMaxA = iF // 100*iA
    for i in range(iMaxA+1):
        iMaxB = (iF - 100*iA*i) // iB
        for j in range(iMaxB + 1):
            if i==0 and j==0:
                continue
            iAB = 100*iA*i + 100*iB*j
            iUlim = iAB * iE // 100
            if iAB + iUlim > iF :
                continue
            iMaxC = iUlim //iC
            for k in range(iMaxC+1):
                l = (iUlim - iC*k ) //iD
                iCD = iC*k +iD*l
                #if iCD > iF-iAB:
                #   continue
                if iUlim -iCD == 0:
                    print(iAB +iCD,iCD)
                    exit()
                else:
                    iKey = iUlim-iCD
                    if not iKey in d:
                        d[iKey] = (iAB +iCD,iCD)
    iMin = min(d.keys())
    print(" ".join(map(str,d[iMin])))
解()


Fixed submission:

def 解():
    iA,iB,iC,iD,iE,iF = [int(_) for _ in input().split()]
    #結局全検索
    d = {}
    def searchAll(d,bF): # bF=0 Eにちかづける
        iMaxA = iF // 100*iA
        for i in range(iMaxA+1):
            iMaxB = (iF - 100*iA*i) // iB
            for j in range(iMaxB + 1):
                if i==0 and j==0:
                    continue
                iAB = 100*iA*i + 100*iB*j
                iUlim = iAB * iE //100
                if bF:
                    iUlim = min(iUlim,iF-iAB)
                else:
                    if iUlim > iF - iAB:
                        continue
                iMaxC = iUlim //iC
                for k in range(iMaxC+1):
                    l = (iUlim - iC*k ) //iD
                    iCD = iC*k +iD*l
                    if iUlim -iCD == 0:
                        print(iAB +iCD,iCD)
                        exit()
                    else:
                        iKey = iUlim-iCD
                        if not iKey in d:
                            d[iKey] = (iAB +iCD,iCD)
        return d
    d = searchAll(d,0)
    if not d:
        d = searchAll(d,1)
    iMin = min(d.keys())
    print(" ".join(map(str,d[iMin])))

解()
Buggy python submission (verdict: Runtime Error):

def 解():
    iN = int(input())
    aA = [int(_) for _ in input().split()]
    aA = reversed(sorted(aA))
    d = {}
    for a in aA:
        if a in d:
            if d[a] == 3:
                print(a*a)
                exit()
            elif iC and iC != a:
                print(iC * a)
                exit()
            else:
                iC = a
                d[a] += 1
        else:
            d[a] = 1
    print(0)
解()


Fixed submission:
def 解():
    iN = int(input())
    aA = reversed(sorted([int(_) for _ in input().split()]))
    iC = 0
    d = {}
    for a in aA:
        if a in d:
            if d[a] == 3:
                print(a*a)
                exit()
            elif iC and iC != a:
                print(iC * a)
                exit()
            else:
                iC = a
                d[a] += 1
        else:
            d[a] = 1
    print(0)
解()
Buggy python submission (verdict: Runtime Error):

import sys
def 解():
    iN = int(sys.stdin.readline())
    aT = [int(_) for _ in sys.stdin.readlines()]

    #公倍数を求めるだけ

    def fgcd(a,b):
        while b:
            a,b = b, a%b
        return a

    lcm = aT[0] * aT[1] // fgcd(aT[0],aT[1])
    for a in aT[2:]:
        lcm = lcm * a // fgcd(lcm,a)
    print(lcm)
解()


Fixed submission:
import sys
def 解():
    iN = int(sys.stdin.readline())
    aT = [int(_) for _ in sys.stdin.readlines()]
    #公倍数を求めるだけ
    def fgcd(a,b):
        while b:
            a,b = b, a%b
        return a

    lcm = aT[0]
    for a in aT[1:]:
        lcm = lcm * a // fgcd(lcm,a)
    print(lcm)
解()