Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np

input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N, W = map(int, input().split())
weight = []
value = []
for _ in range(N):
    x, y = map(int, input().split())
    weight.append(x)
    value.append(y)

dp = np.zeros((N + 1, W + 1))
for i in range(N):
    for j in range(W + 1):
        if weight[i] <= j:
            dp[i + 1, j] = max(dp[i, j - weight[i]] + value[i], dp[i, j])
        else:
            dp[i + 1, j] = dp[i, j]

print(int(dp[N, W]))


Fixed submission:
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7

n, w = map(int, input().split())
weight = []
value = []
for _ in range(n):
    x, y = map(int, input().split())
    weight.append(x)
    value.append(y)


dp = [[0] * (w + 1) for j in range(n + 1)]
for i in range(n):
    for j in range(w + 1):
        if j < weight[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j - weight[i]] + value[i], dp[i][j])
print(dp[n][w])
Buggy python submission (verdict: Runtime Error):
bun=[]
bun.append([0,0]+[1]*(s-2))
for j in range(1,s//3):
    bun.append([0]*(3*(j+1)-1)+[1])
    for i in range(3*(j+1),s):
        bun[j].append((bun[j][i-1]+bun[j-1][i-3])%(10**9+7))

ans=0
for i in range(s//3):
    ans = (ans+bun[i][s-1])%(10**9+7)

print(ans)

Fixed submission:
s=int(input())

bun=[]
bun.append([0,0]+[1]*(s-2))
for j in range(1,s//3):
    bun.append([0]*(3*(j+1)-1)+[1])
    for i in range(3*(j+1),s):
        bun[j].append((bun[j][i-1]+bun[j-1][i-3])%(10**9+7))

ans=0
for i in range(s//3):
    ans = (ans+bun[i][s-1])%(10**9+7)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))


ans=0
for i in range(n-1):
    a2=0
    ans = ( ans + (a[i]*sum(a[i+1:n])) )%(10**9+7)
print(ans)


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

a2=[a[n-1]]
for i in range(n-1,0,-1):
    a2.append(a2[-1]+a[i-1])
ans=0
for i in range(n-1):
    ans = ( ans + (a[i]*a2[-i-2]) )%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))


ans=0
for i in range(n-1):
    a2=0
    for j in range(i+1,n):
        a2 = (a2+a[j]) % (10**9+7)
    ans = ( ans + (a[i]*a2) )%(10**9+7)
print(ans)


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

a2=[a[n-1]]
for i in range(n-1,0,-1):
    a2.append(a2[-1]+a[i-1])
ans=0
for i in range(n-1):
    ans = ( ans + (a[i]*a2[-i-2]) )%(10**9+7)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = np.array(list(map(int,input().split())))

A = a.reshape(1, -1)
Asq = np.transpose(A) @ A
Asq = np.triu(Asq) - np.diag(np.ndarray.diagonal(Asq))
Asq = Asq % (10**9+7)

print(np.sum(Asq) % (10**9+7))


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

a2=[a[n-1]]
for i in range(n-1,0,-1):
    a2.append(a2[-1]+a[i-1])
ans=0
for i in range(n-1):
    ans = ( ans + (a[i]*a2[-i-2]) )%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))


ans=0
for i in range(n-1):
    for j in range(i+1,n):
        ans = ( ans + (a[i]*a[j]) )%(10**9+7)
print(ans)

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

a2=[a[n-1]]
for i in range(n-1,0,-1):
    a2.append(a2[-1]+a[i-1])
ans=0
for i in range(n-1):
    ans = ( ans + (a[i]*a2[-i-2]) )%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

ans=0
for i in range(n):
    for j in range(i+1,n):
        ans = ans%(10**9+7) + (a[i]*a[j])%(10**9+7)
print(ans%(10**9+7))


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

a2=[a[n-1]]
for i in range(n-1,0,-1):
    a2.append(a2[-1]+a[i-1])
ans=0
for i in range(n-1):
    ans = ( ans + (a[i]*a2[-i-2]) )%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
c = list(map(int,input().split()))
lr= [input().split() for _ in range(q)]
for i in range(q):
    print(len(set(c[int(lr[i][0])-1:int(lr[i][1])])))


Fixed submission:
print("Yes" if int(input())>=30 else "No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
rw = list(input())

rw_after=sorted(rw)

count=0
for i in range(N):
    if rw[i] != rw_after[i]:
        count+=1
print(int(count/2))


Fixed submission:
K = int(input())
rest = 7%K
count=1
while (count<=K):
    if rest == 0:
        print(count)
        exit()
    count +=1
    rest = (rest%K*10%K + 7%K)%K
print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
2 s = [input() for i in range(N)]
3 for v in ['AC', 'WA', 'TLE', 'RE']:
4 print('{0} x {1}'.format(v, s.count(v)))


Fixed submission:
N = int(input())

a = [0]*N
for i in range(N):
    a[i]=input()

result=[0]*4
for i in range(len(a)):
    if a[i] == "AC":
        result[0]+=1

    if a[i] == "WA":
        result[1]+=1

    if a[i] == "TLE":
        result[2]+=1

    if a[i] == "RE":
        result[3]+=1

print("AC x ",result[0])
print("WA x ",result[1])
print("TLE x ",result[2])
print("RE x ",result[3])
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()

count=0

for i in range(len(S)+1):
    if S[i]!=T[i]:
        count +=1
    print(T[i])
print(count)

Fixed submission:
S=input()
T=input()

count=0

for i in range(len(S)):
    if S[i]!=T[i]:
        count +=1
print(count)
Buggy python submission (verdict: Runtime Error):
import math

# one = 1000000000000001
dict={1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",
        11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",
        21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}

n=int(input())

if n==1:
    print("a")
    exit()

keta= math.floor(math.log(n-1,26))

ans=[]
for i in range(keta+1):

    if i==0:
        ans.append(dict[((n-1)//26**i)%26+1])
    else:
        ans.append(dict[((n-1)//26**i)%26])

for str in ans[::-1]:
    print(str,end="")


Fixed submission:
import math

# one = 1000000000000001
dict={1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",
        11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",
        21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}

n=int(input())

ans = str(dict[(n-1)%26+1])

n=(n-1)//26
while n:
    ans = str(dict[(n-1)%26+1]) + ans
    n=(n-1)//26

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans=1
for i in range(N):
    ans = ans * A[i]
if ans > 10**18:
    ans = -1
print(ans)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))

ans=1
if 0 in A:
    ans=0
else:
    for i in range(N):
        ans = ans * A[i]
        if ans > 10**18:
            ans = -1
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M,X = list(map(int,input().split()))
skill = [list(map(int,input().split())) for i in range(N)]
cost = []

for i in range(2**N):
    total_skill=[0,0,0,0]
    for j in range(N):
        if ((i>>j) & 1):
            total_skill = [x+y for (x,y) in zip(total_skill,skill[j])]
    count=0
    for k in total_skill[1:]:
        if k<X:
            count +=1
    if count==0:
        cost.append(total_skill[0])

cost.sort()
print(-1 if cost==[] else cost[0])


Fixed submission:
S=input()
T=input()
print("Yes" if S==T[:-1] else "No")
Buggy python submission (verdict: Runtime Error):
S,W = list(map(int,input()split()))
print("safe" if S>W else "unsafe")

Fixed submission:
S,W = list(map(int,input().split()))
print("safe" if S>W else "unsafe")
Buggy python submission (verdict: Runtime Error):
print(C/B)
print(A/D)
if (math.ceil(C/B)-math.ceil(A/D))<1:
    print("Yes")
else:
    print("No")

Fixed submission:
import math
A,B,C,D = list(map(int,input().split()))

if (math.ceil(C/B)-math.ceil(A/D))<1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = set()
for _ in range(n):
    a.append(input())
print(len(a))


Fixed submission:
N = int(input())
print(len(set([input() for _ in range(N)])))
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())

ans=0
for i in range(k):
  for j in range(k):
    for l in range(k):
      ans+=math.gcd(math.gcd(i+1,j+1),l+1)
print(ans)

Fixed submission:
import math
k=int(input())

ans=0
for i in range(k):
  for j in range(k):
    q=math.gcd(i+1,j+1)
    for l in range(k):
      ans+=math.gcd(q,l+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools

n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
ls = list(itertools.parmutations(range(1,n+1)))
print(abs(ls.index(p)-ls.index(q)))

Fixed submission:
import itertools

n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
ls = list(itertools.permutations(range(1,n+1)))
print(abs(ls.index(p)-ls.index(q)))
Buggy python submission (verdict: Runtime Error):
print("win" if sun(map(int,input().split()))<=21 else "bust")

Fixed submission:
print("win" if sum(map(int,input().split()))<=21 else "bust")
Buggy python submission (verdict: Runtime Error):
md1=map(int,input().split())
md2=map(int,input().split())

print(1 if md1[0]!=md2[0] else 0)

Fixed submission:
md1=list(map(int,input().split()))
md2=list(map(int,input().split()))

print(1 if md1[0]!=md2[0] else 0)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()

pin=set()
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            pin.add(s[i]+s[j]+s[k])
print(len(pin))


Fixed submission:
N=int(input())
s=input()

count=0

for i in range(0,10):
    if str(i) in s[:-2]:
        index_1=s.index(str(i))

        for j in range(0,10):
            if str(j) in s[index_1+1:-1]:
                index_2=s[index_1+1:-1].index(str(j))+index_1+1

                for k in range(0,10):
                    if str(k) in s[index_2+1:]:
                        count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
ans_set=set()
N=int(input())
s=input()

for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            ans_set.add(s[i]+s[j]+s[k])

print(len(ans_set))


Fixed submission:
N=int(input())
s=input()

count=0

for i in range(0,10):
    if str(i) in s[:-2]:
        index_1=s.index(str(i))

        for j in range(0,10):
            if str(j) in s[index_1+1:-1]:
                index_2=s[index_1+1:-1].index(str(j))+index_1+1

                for k in range(0,10):
                    if str(k) in s[index_2+1:]:
                        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
pritn(int(input())**2)

Fixed submission:
print(int(input())**2)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,k,q=map(int,input().split())
p=np.array([0]+[k]*n)

for _ in range(q):
    p=p-1
    p[int(input())]+=1

for i in range(1,n+1):
    print("Yes" if p[i]>0 else "No")


Fixed submission:
import numpy as np

n,k,q=map(int,input().split())
p=[0]*(n+1)

for _ in range(q):
    p[int(input())]+=1

for i in range(1,n+1):
    print("Yes" if k-(q-p[i])>0 else "No")
Buggy python submission (verdict: Runtime Error):
prnt(int(input())**3)

Fixed submission:
print(int(input())**3)
Buggy python submission (verdict: Runtime Error):
K,X = map(int,input().split())

for i in range(max(-1000000,X-K+1), min(X+K,1000000):
    print(i, end=' ')


Fixed submission:
K,X = map(int,input().split())

for i in range(X-K+1, X+K):
    if -1000000<=i<=1000000:
        print(i, end=' ')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = ["".join(sorted(list(input()))) for _ in range(n)]
s.sort()
cnt=0
for i in range(n-1):
    if s[i]==s[i+1]:
    cnt +=1
print(cnt)

Fixed submission:
n = int(input())
s = ["".join(sorted(list(input()))) for _ in range(n)]
s.sort()
ans=0
pairs=1
for i in range(n-1):

    if s[i]==s[i+1]:
        pairs += 1
    else:      
        ans += pairs*(pairs-1)/2
        pairs =1
if pairs != 1:
    ans += pairs*(pairs-1)/2
    pairs =1
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = ["".join(sorted(list(input()))) for _ in range(n)]
s.sort()
print(s)
cnt=0
for i in range(n-1):
    if s[i]==s[i+1]
    cnt +=1
print(cnt-n)


Fixed submission:
n = int(input())
s = ["".join(sorted(list(input()))) for _ in range(n)]
s.sort()
ans=0
pairs=1
for i in range(n-1):

    if s[i]==s[i+1]:
        pairs += 1
    else:      
        ans += pairs*(pairs-1)/2
        pairs =1
if pairs != 1:
    ans += pairs*(pairs-1)/2
    pairs =1
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = ["".join(sorted(list(input()))) for _ in range(n)]

cnt=0
for i in range(n):
    if s.count(s[i])!=1
        cnt += s.count(s[i])/s.count(s[i])
print(cnt-n)


Fixed submission:
n = int(input())
s = ["".join(sorted(list(input()))) for _ in range(n)]
s.sort()
ans=0
pairs=1
for i in range(n-1):

    if s[i]==s[i+1]:
        pairs += 1
    else:      
        ans += pairs*(pairs-1)/2
        pairs =1
if pairs != 1:
    ans += pairs*(pairs-1)/2
    pairs =1
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N=int(input())

sum=0
if len(str(N))%2==0:
    for i in range(int(len(str(N))/2)):
        sum += 9*10**(i*2)
else:
    for i in range(len(str(N))//2):
        sum += 9*10**i
    sum += N-int("9"*(len(str(N))-1))

print(sum)


Fixed submission:
N=int(input())

step = sum([90*100**i for i in range(len(str(N))//2)])
dance_floor = sum([9*100**i for i in range(len(str(N))//2)])

ans = len(str(N))%2 * (N-step)  +  -1*(len(str(N))%2-1) * dance_floor
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()

p=[0]*len(s)

for i in range(len(s)):
    if s[i]=="R":
        index = s[i:].index("L")
        index = i + index - (index)%2
        p[index] +=1


    if s[i]=="L":
        index = s[i::-1].index("R")
        index = i - index + (index)%2
        p[index] +=1

for i in p:
    print(i,end=" ")


Fixed submission:
s=input()+"R"


p=[0]*(len(s)-1)
key=s[0]
strt=0
for i in range(len(s)):

    if key!=s[i]:
        if key=="R":
            p[i]  += (i-strt)//2
            p[i-1] += (i-strt)//2 + (i-strt)%2
            key="L"
        else:
            p[strt] += (i-strt)//2 + (i-strt)%2
            p[strt-1] += (i-strt)//2
            key="R"
        strt=i

for i in p:
    print(i,end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
s=input()

p=[0]*len(s)

for i in range(len(s)):
    if s[i]=="R":
        index = i + s[i:].index("L") - (s[i:].index("L"))%2
        p[index] +=1


    if s[i]=="L":
        index = i - s[i::-1].index("R") + (s[i::-1].index("R"))%2
        p[index] +=1

for i in p:
    print(i,end=" ")


Fixed submission:
s=input()+"R"


p=[0]*(len(s)-1)
key=s[0]
strt=0
for i in range(len(s)):

    if key!=s[i]:
        if key=="R":
            p[i]  += (i-strt)//2
            p[i-1] += (i-strt)//2 + (i-strt)%2
            key="L"
        else:
            p[strt] += (i-strt)//2 + (i-strt)%2
            p[strt-1] += (i-strt)//2
            key="R"
        strt=i

for i in p:
    print(i,end=" ")
Buggy python submission (verdict: Runtime Error):
N=int(input())

step = sum([90*100**i for i in range(len(str(N))//2)])
dance_floor = sum([9*100**i for i in range(len(str(N))//2)])

ans = len(str(N))%2 * (N-step)  +  -1*(len(str(N))%2-1) * dance_floor
print(ans)


Fixed submission:
A,B = map(int,input().split())
print("IMPOSSIBLE" if (A+B)%2!=0 else int((A+B)/2))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

a=[]
for i in range(n):
    a.append(int(input()))

for i in range(n):
    print(max(a[:i]+a[i+1:]))

Fixed submission:
n=int(input())

a=[]
for i in range(n):
    a.append(int(input()))

a_max=max(a)
a_max_cnt=a.count(a_max)

for i in range(n):
    if (a[i]!=a_max or a_max_cnt>1):
        print(a_max)
    else:
        print(max(a[:i]+a[i+1:]))
Buggy python submission (verdict: Runtime Error):
s=input()
print("Yes" if (sorted(s[:2])==sorted(s[2:]) and len(sorted(s[:2))==2) else "No")


Fixed submission:
s=input()
if len(set(s))==2 and s.count(s[0])==2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[int(i) for i in input().split()]
l.sort()
print(max(0,l[int(N/2)] - l[int(N/2)-1])


Fixed submission:
N=int(input())
l=[int(i) for i in input().split()]
l.sort()
print(max(0,l[int(N/2)] - l[int(N/2)-1]))
Buggy python submission (verdict: Runtime Error):
s=input()
print("Good" if len(s)=len(set(s)) else "Bad")

Fixed submission:
s=input()

flag=True
for i in range(len(s)-1):
    if s[i+1]==s[i]:
        flag=False
print("Good" if flag else "Bad")
Buggy python submission (verdict: Runtime Error):
a,x=map(int,input().split())
print(10 if A>=X else 10)

Fixed submission:
A,X=map(int,input().split())
print(10 if A>=X else 0)
Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
l=[0]
l.append(list(map(int,input().split())))

sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)

Fixed submission:
N,X = map(int,input().split())
l=[0]
l += list(map(int,input().split()))
sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
l = list(map(int,input().split()))

sum=0
for i in range(N-1):
    sum += l[i]
    if sum>X:
        ans = i+1
print(ans)


Fixed submission:
N,X = map(int,input().split())
l=[0]
l += list(map(int,input().split()))
sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
l = list(map(int,input().split()))

sum=0
for i in range(N):
    sum += l[i]
    if sum>X:
        ans = i+1
print(ans)


Fixed submission:
N,X = map(int,input().split())
l=[0]
l += list(map(int,input().split()))
sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
l = list(map(int,input().split()))

sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        ans = i+1
print(ans)


Fixed submission:
N,X = map(int,input().split())
l=[0]
l += list(map(int,input().split()))
sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)

Buggy python submission (verdict: Runtime Error):
N,X = map(int,input().split())
l = list(map(int,input().split()))

sum=0
for i in range(N+1):
    if sum>X:
        print(i)
        exit()
    sum += l[i]


Fixed submission:
N,X = map(int,input().split())
l=[0]
l += list(map(int,input().split()))
sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if 13<=A:
    ans=B
elif 6<=A:
    ans=B/2S
else:
    ans = 0

print(ans)


Fixed submission:
A,B = map(int,input().split())
if 13<=A:
    ans=B
elif 6<=A:
    ans=B/2
else:
    ans = 0

print(int(ans))
Buggy python submission (verdict: Runtime Error):
A,B,T = map(input().split())
print(T//A*B)


Fixed submission:
A,B,T = map(int,input().split())
print(T//A*B)
Buggy python submission (verdict: Runtime Error):
dict={"A":"T","T":"A","G":"C","C":"G"}
print(dict(input()))


Fixed submission:
dict={"A":"T","T":"A","G":"C","C":"G"}
print(dict[input()])

Buggy python submission (verdict: Runtime Error):
dict={"A":"T","T":"A","G":"C","C":"G"}
print(dict(input))

Fixed submission:
dict={"A":"T","T":"A","G":"C","C":"G"}
print(dict[input()])
Buggy python submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
i=1
count=max(A,B)
while 1:
    if A%i+B%i==0:
        count +=1
    if count=K:
        print(i)
    i-=1
    


Fixed submission:
A,B,K = map(int,input().split())
ans_list=[0]
for i in range(1,min(A,B)+1):
    if A%i==B%i==0:
        ans_list.append(i)
print(ans_list[-K])
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans=0
for _ in range(N):
    xu=input().split()
    if xu[1]=="JPY":
        ans+=xu[0]
    else:
        ans+=xu[0]*380000
print(ans)


Fixed submission:
N = int(input())
ans=0
for _ in range(N):
    xu=input().split()
    if xu[1]=="JPY":
        ans+=int(xu[0])
    else:
        ans+=float(xu[0])*380000
print(ans+0.000001)
Buggy python submission (verdict: Runtime Error):
T,X=map(int,input())
print(float(T/X))


Fixed submission:
T,X=map(int,input().split())
print(float(T/X))
Buggy python submission (verdict: Runtime Error):
def cmin(a,b):
    if a>b:
        return b
    else:
        return a

N = int(input())
h = list(map(int,input().split()))

dp[] = [0] + [float("inf")]*(N-1)
for i in range(N-2):
    dp[i] = cmin(dp[i],dp[i-1]+abs(h[i-1]-h[i]))
print(dp[-1])

Fixed submission:
N = int(input())
h = list(map(int,input().split()))

cost = [0,abs(h[1]-h[0])]
for i in range(1,N-1):
    cost.append( min(cost[i]+abs(h[i+1]-h[i]), cost[i-1]+abs(h[i+1]-h[i-1])) )
print(cost[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
h = list(map(int,input().split()))

# Kステップ手前までの座標からの所要コストをリスト化、最小値を計算
# 構造がかなり複雑

# i番目のcostと0番目のcost,i番目のcostと1番目のcost…と一個ずつ比較していく手法
# 構造的にはかなりすっきりしてて分かりやすい

# N,K = map(int,input().split())
# h = list(map(int,input().split()))

dp = [0] + [10**9]*(N-1)
for i in range(1,N):
    for j in range(1, min(i+1,K+1)):
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])


Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))

cost = [0]
for i in range(2,N+1):
    cost.append( min([cost[j] + abs(h[i-1]-h[j]) for j in range(max(0,i-K-1), i-1)]) )
print(cost[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
h = list(map(int,input().split()))

# i番目のcostと0番目のcost,i番目のcostと1番目のcost…と比較していく手法
# 構造的にはかなりすっきりしてて分かりやすい

# N,K = map(int,input().split())
# h = list(map(int,input().split()))

dp = [0] + [float("inf")]*(N-1)
for i in range(1,N):
    for j in range(1, min(i+1,K+1)):
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])


Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))

cost = [0]
for i in range(2,N+1):
    cost.append( min([cost[j] + abs(h[i-1]-h[j]) for j in range(max(0,i-K-1), i-1)]) )
print(cost[-1])

Buggy python submission (verdict: Time Limit Exceeded):
def cmin(a,b):
    if a>b:
        return b
    else:
        return a

N,K = map(int,input().split())
h = list(map(int,input().split()))

dp = [0] + [float("inf")]*(N-1)
for i in range(1,N):
    for j in range(1, min(i+1,K+1)):
        dp[i] = cmin(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])


Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))

cost = [0]
for i in range(2,N+1):
    cost.append( min([cost[j] + abs(h[i-1]-h[j]) for j in range(max(0,i-K-1), i-1)]) )
print(cost[-1])

Buggy python submission (verdict: Runtime Error):
def cmin(a,b):
    if a>b:
        return b
    else:
        return a

# N,K = map(int,input().split())
# h = list(map(int,input().split()))

dp = [0] + [float("inf")]*(N-1)
for i in range(1,N):
    for j in range(1, min(i+1,K+1)):
        dp[i] = cmin(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp)


Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))

cost = [0]
for i in range(2,N+1):
    cost.append( min([cost[j] + abs(h[i-1]-h[j]) for j in range(max(0,i-K-1), i-1)]) )
print(cost[-1])
Buggy python submission (verdict: Runtime Error):
s=input()
ans=[]
for i in range(len(s)-2):
    ans = min(ans , abs(753-int(s[i:i+3])))
print(min(ans))

Fixed submission:
s=input()
ans=999
for i in range(len(s)-2):
    ans = min(ans , abs(753-int(s[i:i+3])))
print(ans)