Buggy python submission (verdict: Runtime Error):
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)



Fixed submission:
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape[0]):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0
in_task = np.zeros(m).astype(np.bool)

for i in range(n-1):
    a_bool = (a == i).astype(np.bool)
    if(a_bool.any()):
        in_task += a_bool
    if(np.any(b == i+1)):
        cnt += 1
        tmp = np.logical_not(in_task)
        a = a[tmp]
        b = b[tmp]
        in_task = np.zeros(a.shape).astype(np.bool)

print(cnt)



Fixed submission:
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape[0]):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
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_)

a = np.array(a) - 1
b = np.array(b) - 1 
cnt = 0
in_task = np.zeros(m).astype(np.bool)

for i in range(n-1):
    if(np.any(a == i)):
        in_task += (a == i).astype(np.bool)
    if(np.any(b == i+1)):
        cnt += 1
        tmp = np.logical_not(in_task)
        a = a[tmp]
        b = b[tmp]
        in_task = np.zeros(a.shape).astype(np.bool)
print(cnt)

Fixed submission:
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape[0]):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
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_)

broken_bridge = [0 for i in range(n-1)]
comp_task = [0 for i in range(m)]

a = np.array(a) - 1
b = np.array(b) - 1 
cnt = 0
comp_task = np.zeros(m).astype(np.bool)
in_task = np.zeros(m).astype(np.bool)

for i in range(n-1):
    if(np.any(a == i)):
        in_task += (a == i).astype(np.bool)
    if(np.any(b*in_task == i+1)):
        cnt += 1
        comp_task += in_task
        a[comp_task] = -1
        b[comp_task] = -1
        in_task = np.zeros(m).astype(np.bool)

print(cnt)

Fixed submission:
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape[0]):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
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_)

broken_bridge = [0 for i in range(n-1)]
comp_task = [0 for i in range(m)]

a = np.array(a) - 1
b = np.array(b) - 1 
cnt = 0
conp_task = np.zeros(m)
in_task = np.zeros(m)

for i in range(n-1):
    if(np.any(a*np.logical_not(comp_task) == i )):
        in_task = (in_task+(a*np.logical_not(comp_task)==i)).astype(np.bool)
    if(np.any(b*np.logical_not(comp_task)*in_task == i+1)):
        cnt += 1
        comp_task = (comp_task + in_task).astype(np.bool)
        in_task = np.zeros(m)

print(cnt)



Fixed submission:
import numpy as np
n,m = map(int,input().split())
a = np.zeros(m)
b = np.zeros(m)
for i in range(m):
    a[i] , b[i] = map(int ,input().split())

a -= 1
b -= 1 
cnt = 0

while(a.shape[0]):
    min_b = np.min(b)
    in_task = (a < min_b).astype(np.bool)
    cnt += 1
    tmp = np.logical_not(in_task)
    a = a[tmp]
    b = b[tmp]
    
print(cnt)