Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
import itertools

S = input()

nums = [s for s in S]
idxs = np.arange(1, len(nums))
masks = list(itertools.product([False, True], repeat=len(idxs)))

ret = 0 
for mask in masks:
    selected_idxs = [0] +list( idxs[ np.array(mask)]) + [len(nums)]
    for i in range(len(selected_idxs) - 1):
        ret += (int(''.join(nums[selected_idxs[i]: selected_idxs[i+1]])))

print(ret)

Fixed submission:
import numpy as np
import itertools

def calc_sum(nums):
    if len(nums) == 1: return nums[0]
    idxs = np.arange(1, len(nums))
    masks = list(itertools.product([False, True], repeat=len(idxs)))

    ret = 0 
    for mask in masks:
        selected_idxs = [0] +list( idxs[ np.array(mask)]) + [len(nums)]
        for i in range(len(selected_idxs) - 1):
            ret += (int(''.join(nums[selected_idxs[i]: selected_idxs[i+1]])))
    return ret


S = input()
nums = [s for s in S]

print(calc_sum(nums))
Buggy python submission (verdict: Runtime Error):
 _, X = map(int, input().split())
A = sorted(list(map(int, input().split())))

count = 0
for a in A:
    if X - a >= 0:
        X -= a
        count += 1
else:
    if count > 1 and X > 0:
        count -= 1

print(count)

Fixed submission:
_, X = map(int, input().split())
A = sorted(list(map(int, input().split())))

count = 0
for a in A:
    if X - a >= 0:
        X -= a
        count += 1

if count == len(A) and X > 0:
    count -= 1

print(count)

Buggy python submission (verdict: Runtime Error):
 _, X = map(int, input().split())
A = sorted(list(map(int, input().split())))

count = 0
for a in A:
    if a > X:
        break
    X -= a
    count += 1

if X > 0:
    count -= 1

print(count)

Fixed submission:
_, X = map(int, input().split())
A = sorted(list(map(int, input().split())))

count = 0
for a in A:
    if X - a >= 0:
        X -= a
        count += 1

if count == len(A) and X > 0:
    count -= 1

print(count)
Buggy python submission (verdict: Runtime Error):
N, A = input(), input()

if N % 500 < A:
  print("Yes")
else:
  print("No")

Fixed submission:
N, A = int(input()), int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
 S = input().split("/")
S[0] = "2018"

print("/".join(S))


Fixed submission:
S = input().split("/")
S[0] = "2018"

print("/".join(S))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = map(int, input().split())

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

tmp = []
for k, v in count:
    tmp.appned(v)

tmp = sorted(tmp)

total = 0
for i in range(len(sorted_) - K):
    total += tmp[i]

print(total)

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

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

tmp = []
for k, v in count.items():
    tmp.append(v)

tmp = sorted(tmp)

total = 0
for i in range(len(tmp) - K):
    total += tmp[i]

print(total)

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

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

tmp = []
for k, v in count:
    tmp.appned(v)

tmp = sorted(tmp)

total = 0
while K < len(sorted_):
    k, v = sorted_[0]
    sorted_ = sorted_[1:]
    total += v

print(total)


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

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

tmp = []
for k, v in count.items():
    tmp.append(v)

tmp = sorted(tmp)

total = 0
for i in range(len(tmp) - K):
    total += tmp[i]

print(total)

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

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

sorted_ = sorted(count.items(), key=lambda x: x[1])

total = 0
while K < len(sorted_):
    k, v = sorted_[0]
    sorted_ = sorted_[1:]
    total += v

print(total)

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

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

tmp = []
for k, v in count.items():
    tmp.append(v)

tmp = sorted(tmp)

total = 0
for i in range(len(tmp) - K):
    total += tmp[i]

print(total)

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

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

sorted_ = sorted(count.items(), key=lambda x: x[1])

total = 0
while K < len(sorted_):
    k, v = sorted_[0]
    sorted_ = sorted_[1:]
    total += v

if len(sorted_) == 0:
    total = 0

print(total)

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

count = {}

for a in A:
    count[a] = count.get(a, 0) + 1

tmp = []
for k, v in count.items():
    tmp.append(v)

tmp = sorted(tmp)

total = 0
for i in range(len(tmp) - K):
    total += tmp[i]

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

count = [1 for x in range(K + 1) for y in range(K + 1)
         for z in range(K + 1) if x + y + z == S]

print(len(count))


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

count = 0
for x in range(K + 1):
    for y in range(K + 1):
        if 0 <= S - x - y <= K:
            count += 1

print(count)

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

count = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if x + y + z == S:
                count += 1

print(count)

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

count = 0
for x in range(K + 1):
    for y in range(K + 1):
        if 0 <= S - x - y <= K:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
k=int(input())
for i in s:
      if i != s[k-1]:
          s_replace=s.replace(i,'*')
print(s_replace)

Fixed submission:
n=int(input())
s=input()
k=int(input())

for a in s:
    if a==s[k-1]:
          print(a,end='')
    else:
          print('*',end='')
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,k=map(int,input())
if b-a<=k and c-b<=k and d-c<=k and e-d<=k:
    print('Yay!')
else:
    print(':(')

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if b-a<=k and c-a<=k and d-a<=k and e-a<=k and c-b<=k and d-b<=k and e-b<=k and d-c<=k and e-c<=k and e-d<=k:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
l=[int(input()) for i in range(5)]
print(math.ceil(n/min(l)+4)


Fixed submission:
import math
n=int(input())
l=[int(input()) for i in range(5)]
print(math.ceil(n/min(l))+4)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
l=[int(input()) for i in range(6)]
print(math.ceil(n/min(l)+4)


Fixed submission:
import math
n=int(input())
l=[int(input()) for i in range(5)]
print(math.ceil(n/min(l))+4)
Buggy python submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
sum=0
count=0
for i in range(m):
    b=list(map(int,input().split()))
    a=list(map(int,input().split()))
    sum+=b[i]*a[i]
for j in range(n):
    if sum>-c:
        count+=1
print(count)

Fixed submission:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
count=0
for i in range(n):
    p=c
    a=list(map(int,input().split()))
    for j in range(m):
        p+=a[j]*b[j]
    if p>0:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
count=0
for i in range(m):
    b=list(map(int,input().split()))
for j in range(n):
    a=list(map(int,input().split()))
    combined=[x*y for (x,y) in zip(a,b)]
    if sum(combined)>c:
        count+=1
print(count)
    


Fixed submission:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
count=0
for i in range(n):
    p=c
    a=list(map(int,input().split()))
    for j in range(m):
        p+=a[j]*b[j]
    if p>0:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
count=0
for i in range(m):
    b=list(map(int,input().split()))
    for j in range(n):
        a=list(map(int,input().split()))
        combined=[x*y for (x,y) in zip(a,b)]
        if sum(combined)>c:
            count+=1
print(count)
    


Fixed submission:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
count=0
for i in range(n):
    p=c
    a=list(map(int,input().split()))
    for j in range(m):
        p+=a[j]*b[j]
    if p>0:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n,m,c=map(int,input().split())
count=0
for i in range(m):
    b=list(map(int,input().split()))
    for j in range(1,n):
        a=list(map(int,input().split()))
        combined=[x*y for (x,y) in zip(a,b)]
        if sum(combined)>c:
            count+=1
print(count)
    

Fixed submission:
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
count=0
for i in range(n):
    p=c
    a=list(map(int,input().split()))
    for j in range(m):
        p+=a[j]*b[j]
    if p>0:
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
    k,*a=map(int,input().split())
    s&=set(a)
print(les(s))


Fixed submission:
n,m=map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
    k,*a=list(map(int,input().split()))
    s&=set(a)
print(len(s))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
    k,*a=list(map(int,input().split()))
    s&=set(a)
print(les(s))

Fixed submission:
n,m=map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
    k,*a=list(map(int,input().split()))
    s&=set(a)
print(len(s))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
for i in range(n):
    k,*a=list(map(int,input().split()))
    b=set(a[0])
    for j in range(k):
        b=b-set(a[j])
        print(len(list(b)))
    
    


Fixed submission:
n,m=map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
    k,*a=list(map(int,input().split()))
    s&=set(a)
print(len(s))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
for i in range(n):
    k,*a=list(map(int,input().split()))
    b=a[0]
    for j in range(k):
        b=b-a[j]
        print(len(b))
    
    


Fixed submission:
n,m=map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
    k,*a=list(map(int,input().split()))
    s&=set(a)
print(len(s))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
for i in range(n):
    k,*a=list(map(int,input().split()))
    b=a[0]
    for j in range k:
        b=b-a[j]
        print(len(b))
    
    

Fixed submission:
n,m=map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
    k,*a=list(map(int,input().split()))
    s&=set(a)
print(len(s))
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
dp=[10**6]*n
dp[0]=0
dp[1]=dp[0]+abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min((dp[i-1]+abs(h[i]-h[i-1])),(dp[i-2]+abs(h[i]-h[i-2])))
print(dp(n-1))


Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[10**6]*n
dp[0]=0
dp[1]=dp[0]+abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min((dp[i-1]+abs(h[i]-h[i-1])),(dp[i-2]+abs(h[i]-h[i-2])))
print(dp[n-1])

Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
dp=[10**6]*n
dp[0]=0
dp[1]=dp[0]+abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min((dp[i-1]+abs(h[i]-h[i-1]),(dp[i-2]+abs(h[i]-h[i-2])))
print(dp(n-1))

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[10**6]*n
dp[0]=0
dp[1]=dp[0]+abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min((dp[i-1]+abs(h[i]-h[i-1])),(dp[i-2]+abs(h[i]-h[i-2])))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
    
dp=[[-1]*(W+1) for i in range(N+1)]
for i in range(W+1):
    dp[0][i]=0
for i in range(N):
    for j in range(W+1):
        if j-w[i]<0:
            dp[i+1][j]=dp[i][j]
        else:
            dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])
print(dp[N][W])

Fixed submission:
import numpy as np

N,W = map(int, input().split())

dp = np.zeros(W+1, dtype=np.int64)

for _ in range(N):
  w,v = map(int,input().split())
  np.maximum(dp[:-w]+v,dp[w:], out=dp[w:])

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j>w[j-1]:
            dp[i][j]=max(dp[i-1][j-w[j-1]]+v[i],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
print(dp[N][W])
       


Fixed submission:
import numpy as np

N,W = map(int, input().split())

dp = np.zeros(W+1, dtype=np.int64)

for _ in range(N):
  w,v = map(int,input().split())
  np.maximum(dp[:-w]+v,dp[w:], out=dp[w:])

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j>w[j-1]:
            dp[i+1][j]=max(dp[i][j-w[j-1]]+v[i],dp[i][j])
        else:
            dp[i+1][j]=dp[i][j]
print(dp[N][W])
       

Fixed submission:
import numpy as np

N,W = map(int, input().split())

dp = np.zeros(W+1, dtype=np.int64)

for _ in range(N):
  w,v = map(int,input().split())
  np.maximum(dp[:-w]+v,dp[w:], out=dp[w:])

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
N,W=map(int,input().split())
weight=[]
value=[]
for i in range(N):
    w,v=map(int,input().split())
    weight.append(w)
    value.append(v)
inf=float('inf')
dp=[[-inf for i in range(W+1)] for j in range(N+1)]
for i in range(W+1):
    dp[0][i]=0
for i in range(N):
    for j in range(W+1):
        if j>=weight[i]:
            dp[i+1][j]=max(dp[i][j],dp[i][j-weight[i]]+value[i])
        else:
            dp[i+1][j]=dp[i][j]
print(dp[W])

Fixed submission:
import numpy as np

N,W = map(int, input().split())

dp = np.zeros(W+1, dtype=np.int64)

for _ in range(N):
  w,v = map(int,input().split())
  np.maximum(dp[:-w]+v,dp[w:], out=dp[w:])

print(dp[-1])

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

N,W = map(int, input().split())

dp = np.zeros(W+1, dtype=int64)

for i in range(N):
  w,v = map(int,input().split())
  np.maximum(dp[:-w]+v,dp[w:], out=dp[w:])

print(dp[-1])


Fixed submission:
import numpy as np

N,W = map(int, input().split())

dp = np.zeros(W+1, dtype=np.int64)

for _ in range(N):
  w,v = map(int,input().split())
  np.maximum(dp[:-w]+v,dp[w:], out=dp[w:])

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[map(int,input() for i in range(n))]
q=max(p)
print(sum(p)-q/2)


Fixed submission:
n=int(input())
p=[int(input()) for i in range(n)]
q=max(p)
print(int(sum(p))-int(max(p)/2))
Buggy python submission (verdict: Runtime Error):
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
li=[]
for h in H:
    li.append(abs(A-(T-0.006*h)))
print(li.index(min(li))+1)


Fixed submission:
x,y=map(int,input().split())
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
T,A=int(input())
H=list(map(int,input().split()))
li=[]

s=li.append(abs(A-(T-0.006*H)))

print(s.index(min(s))+1)

Fixed submission:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
li=[]
for h in H:
    li.append(abs(A-(T-0.006*h)))
print(li.index(min(li))+1)
Buggy python submission (verdict: Runtime Error):
n,T=map(int,input().split())
li_c=[]
li_t=[]
for i in range(n):
    c,t=map(int,input().split())
    li_c.append(c)
    li_t.append(t)
k=[]
if all(li_t)>T:
    print('TLE')
else:
    for i in range(n):
        if li_t[i]<=T:
            k.append(li_c[i])
    print(min(k))


Fixed submission:
n,T=map(int,input().split())
m=1001
for i in range(n):
    c,t=map(int,input().split())
    if t<=T:
        m=min(m,c)
if m==1001:
    print('TLE')
else:
    print(m)

Buggy python submission (verdict: Runtime Error):
n,T=map(int,input().split())
c,t=[map(int,input().split() for i in range(n))]
k=[]
if all(t)>T:
    print('TLE')
else:
    for i in range(n):
        if t[i]<=T:
            k.append(c[j])
    print(min(k))


Fixed submission:
n,T=map(int,input().split())
m=1001
for i in range(n):
    c,t=map(int,input().split())
    if t<=T:
        m=min(m,c)
if m==1001:
    print('TLE')
else:
    print(m)

Buggy python submission (verdict: Runtime Error):
n,T=map(int,input().split())
c,t=[int(input().split()) for i in range(n)]
k=[]
if all(t)>T:
    print('TLE')
else:
    for i in range(n):
        if t[i]<=T:
            k.append(c[j])
    print(min(k))

Fixed submission:
n,T=map(int,input().split())
m=1001
for i in range(n):
    c,t=map(int,input().split())
    if t<=T:
        m=min(m,c)
if m==1001:
    print('TLE')
else:
    print(m)
Buggy python submission (verdict: Runtime Error):
n=int(input())
m==111
for i in range(1,10):
    if 111*i>=n:
        m=min(m,111*i)
print(m)
    

Fixed submission:
n=int(input())
m=999
for i in range(1,10):
    if 111*i>=n:
        m=min(m,111*i)
print(m)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(int(str(a)+str(b))+c,int(str(a)+str(c))+b,int(str(b)+str(c))+a,int(str(b)+str(a)+c,int(str(c)+str(a)+b,int(str(c)+str(b)+a))


Fixed submission:
a=list(map(int,input().split()))
a_=sorted(a,reverse=True)
print(int(str(a_[0])+str(a_[1]))+a_[2])
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split() for i in range(n)))
a_sort=sorted(a)
count=0
sum=0
for i in a_sort:
    while sum+i<=x:
        sum=sum+i
        count+=1
    else:
        break
print(count)


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

count=0
if x==sum(a):
    print(n)
elif x>sum(a):
    print(n-1)
else:
    for i in range(n):
        if x>=a[i]:
            count+=1
            x-=a[i]
        else:
            break
    print(count)

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split() for i in range(n)))
a_sort=sorted(a)
count=0
sum=0
for i in a_sort:
    if sum+i<=x:
        sum=sum+i
        count+=1
    else:
        break
print(count)


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

count=0
if x==sum(a):
    print(n)
elif x>sum(a):
    print(n-1)
else:
    for i in range(n):
        if x>=a[i]:
            count+=1
            x-=a[i]
        else:
            break
    print(count)

Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(int(input() for i in range(n)))
a_sort=sorted(a)
count=0
sum=0
for i in a_sort:
    if sum+i<=x:
        sum=sum+i
        count+=1
    else:
        break
print(count)

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

count=0
if x==sum(a):
    print(n)
elif x>sum(a):
    print(n-1)
else:
    for i in range(n):
        if x>=a[i]:
            count+=1
            x-=a[i]
        else:
            break
    print(count)
Buggy python submission (verdict: Runtime Error):
k=int(input())
if k%2=0:
    print(k/2*k/2)
else:
    print(k//2*(k//2+1))


Fixed submission:
k=int(input())
if k%2==0:
    print(int((k/2)*(k/2)))
else:
    print(int((k//2)*(k//2+1)))
Buggy python submission (verdict: Runtime Error):
N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print(Yes)
        else:
            print(No)


Fixed submission:
N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print('Yes')
            exit()
  
print('No')

Buggy python submission (verdict: Runtime Error):
N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print(Yes)
        exit()
        else:
            print(No)


Fixed submission:
N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print('Yes')
            exit()
  
print('No')

Buggy python submission (verdict: Runtime Error):
N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print(Yes)
            exit()
        else:
            print(No)

Fixed submission:
N=int(input())
for a in range(N//4+1):
    for b in range(N//7+1):
        if 4*a+7*b==N:
            print('Yes')
            exit()
  
print('No')
Buggy python submission (verdict: Runtime Error):
a=[]
b=[]
for i in range(m):
    a_,b_=map(int,input().split())
    a.append(a_)
    b.append(b_)
ab=sorted([(a[i],b[i]) for i in range(m)],  key=itemgetter(1))  

ans=0
last=0
for i in range(m):
    if last<ab[i][0]:
        last=ab[i][1]
        ans+=1
    else:
        last=ab[i][1]
print(ans)

Fixed submission:
from operator import itemgetter
n,m=map(int,input().split())
a=[]
b=[]
for i in range(m):
    a_,b_=map(int,input().split())
    a.append(a_)
    b.append(b_)
ab=sorted([(a[i],b[i]) for i in range(m)],  key=itemgetter(1))  
removed=-1
ans=0

for i,j in ab:
    if i>removed:
        ans+=1
        removed=j-1
print(ans)

Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
n,m=map(int,input().split())
a=[]
b=[]
for i in range(m):
    a_,b_=map(int,input().split())
    a.append(a_)
    b.append(b_)
ab=sorted([(a[i],b[i]) for i in range(m)],  key=itemgetter(1))  

ans=0
last=0
for i in range(m):
    if last<a[i][0]:
        last=a[i][1]
        ans+=1
print(ans)
        

Fixed submission:
from operator import itemgetter
n,m=map(int,input().split())
a=[]
b=[]
for i in range(m):
    a_,b_=map(int,input().split())
    a.append(a_)
    b.append(b_)
ab=sorted([(a[i],b[i]) for i in range(m)],  key=itemgetter(1))  
removed=-1
ans=0

for i,j in ab:
    if i>removed:
        ans+=1
        removed=j-1
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
dp=[10**5]*n
dp[0]=0
for i in range(n+1):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n])


Fixed submission:
n=int(input())
dp=[10**5]*(n+1)
dp[0]=0
for i in range(n+1):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n])

Buggy python submission (verdict: Runtime Error):
n=int(input())
dp=[10**5]*n
dp[0]=0
for i in range(n+1):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n+1])


Fixed submission:
n=int(input())
dp=[10**5]*(n+1)
dp[0]=0
for i in range(n+1):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n])

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[10**5]*n
dp[0]=0
for i in range(n):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n-1])

Fixed submission:
n=int(input())
dp=[10**5]*(n+1)
dp[0]=0
for i in range(n+1):
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=6
    pow=1
    while pow<=n:
        dp[i]=min(dp[i],dp[i-pow]+1)
        pow*=9
print(dp[n])