Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
imput_list = list(map(int,input().split()))
a = imput_list[1]/imput_list[0]
print(math.floor(math.log2(a)) + 1)

Fixed submission:
input_list = list(map(int,input().split()))
for i in range(61):
    if (input_list[0]*(2**i )<=input_list[1])&(input_list[0]*(2**(i +1))>input_list[1]):
        print(i+1)

Buggy python submission (verdict: Runtime Error):
imput_list = list(map(int,input().split()))
print(math.floor(math.log(imput_list[1]/imput_list[0], 2)) + 1)

Fixed submission:
input_list = list(map(int,input().split()))
for i in range(61):
    if (input_list[0]*(2**i )<=input_list[1])&(input_list[0]*(2**(i +1))>input_list[1]):
        print(i+1)
Buggy python submission (verdict: Runtime Error):
s_input_sort = sorted(list(str(input())))
t_input_sort = sorted(list(str(input())), reverse=True)

s_str = "".join(s_input_sort)
t_str = "".join(t_input_sort)

if t_str >= s_str:
        print("Yes")
    else:
        print("No")

Fixed submission:
s_input_sort = sorted(list(str(input())))
t_input_sort = sorted(list(str(input())), reverse=True)

s_str = "".join(s_input_sort)
t_str = "".join(t_input_sort)

if s_str == t_str:
    print("No")
else:    
    if t_str < s_str:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
a_list = list(map(int, input().split()))

sort_dict = collections.Counter(a_list)

remove_counter = 0

for key, value in sort_dict.items():
    if value < key:
        remove_counter += value
    elif value == key:
        pass
    else:
        remove_counter += (value - key)
        
print(remove_counter)

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

sort_dict = {}
for i in sort_a_list:
    if i not in sort_dict.keys():
        sort_dict[i] = [i]
    else:
        sort_dict[i].append(i)
        
remove_counter = 0
for key, value in sort_dict.items():
    if len(value) < key:
        remove_counter += len(value)
    elif len(value) == key:
        pass
    else:
        remove_counter +=(len(value) - key)
        
print(remove_counter)
Buggy python submission (verdict: Runtime Error):
X = input()
Y = input()

alphabet_list = sorted([X, Y])
if alphabet_list[0] == alphabet_list[1]:
    print("=")
    #pass
elif X == alphabet_list[0]:
    print("<")
else:
    print(">")

Fixed submission:
a, b =  list(input().split())

alphabet_list = sorted([a, b])
if alphabet_list[0] == alphabet_list[1]:
    print("=")
    #pass
elif a == alphabet_list[0]:
    print("<")
else:
    print(">")
Buggy python submission (verdict: Runtime Error):
X, Y, Z =  list(map(int, input().split()))
pritn((X-Z)//(Y+Z))

Fixed submission:
X, Y, Z =  list(map(int, input().split()))
print((X-Z)//(Y+Z))
Buggy python submission (verdict: Runtime Error):
str_list = list(input())
import string
dif_list = sorted(list(set(string.ascii_lowercase) - set(sorted(str_list))))
print(dif_list[0])

Fixed submission:
str_list = list(input())
import string
if set(str_list) == set(string.ascii_lowercase):
    print("None")
else:
    dif_list = sorted(list(set(string.ascii_lowercase) - set(str_list)))
    print(dif_list[0])
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
input_list = [int(input())for _ in range(N)]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
  
initial_num = 1
for i in input_list:
    t = lcm(initial_num, i)
    if  t > initial_num:
        initial_num = t
        
print(initial_num)

Fixed submission:
N = int(input())
input_list = [int(input())for _ in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
  
def lcm(x, y):
    return (x * y) // gcd(x, y)
  
initial_num = 1
for i in input_list:
    t = lcm(initial_num, i)
    if  t > initial_num:
        initial_num = t
        
print(initial_num)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
input_list = [int(input())for _ in range(N)]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
  
initial_num = 1
for i in input_list:
    if lcm(initial_num, i) > initial_num:
        initial_num = lcm(initial_num, i)
        
print(initial_num)

Fixed submission:
N = int(input())
input_list = [int(input())for _ in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
  
def lcm(x, y):
    return (x * y) // gcd(x, y)
  
initial_num = 1
for i in input_list:
    t = lcm(initial_num, i)
    if  t > initial_num:
        initial_num = t
        
print(initial_num)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
int_list = sorted(list(map(int, input().split())), reverse=True)

print(sum(int_list[:K])

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

print(sum(int_list[-K:]))
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
C_list = []
for _ in range(W):
    i = input()
    print(i + "\n" + i)

Fixed submission:
H, W = map(int, input().split())
c=[input() for _ in range(H)]
for _ in c:
    print(_ + "\n" + _)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
C_list = []
for _ in range(W):
    C_list.append(input())
    
for i in C_list:
    print(i + "\n" + i)

Fixed submission:
H, W = map(int, input().split())
c=[input() for _ in range(H)]
for _ in c:
    print(_ + "\n" + _)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
C_list = []
for _ in range(W):
    C_list.append(input())
    
for i in C_list:
    print(i)
    print(i)

Fixed submission:
H, W = map(int, input().split())
c=[input() for _ in range(H)]
for _ in c:
    print(_ + "\n" + _)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
C_list = []
for _ in range(W):
    temp_list = input()
    print(temp_list)
    print(temp_list)

Fixed submission:
H, W = map(int, input().split())
c=[input() for _ in range(H)]
for _ in c:
    print(_ + "\n" + _)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N, L = map(int, input().split())
str_list = [input() for _ in range(N)]

tmp_str=''.join(['z' for _ in range(N*L)])
for ii in itertools.permutations(str_list):
    if tmp_str > ''.join(ii):
        tmp_str=''.join(ii)
        
print(tmp_str)

Fixed submission:
N, L = map(int, input().split())
str_list = sorted([input() for _ in range(N)])
print(''.join(str_list))
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
c = []
t = []

for i in range(N):
    box = [0,0]
    box[0], box[1] = map(int, input().split())
    c.append(box[0])
    t.append(box[1])

cost = 1000
check = -1

for i in range(N):
    if t[i] <=T and c[i] <= cost:
        check = i
        cost = c[i]
        #print(i)
        #print(cost)

if index == -1:
    print('TLE')
else:
    print(cost)

Fixed submission:
N, T = map(int, input().split())
c = []
t = []

for i in range(N):
    box = [0,0]
    box[0], box[1] = map(int, input().split())
    c.append(box[0])
    t.append(box[1])

cost = 1000
check = -1
for i in range(N):
    if t[i] <=T and c[i] <= cost:
        check = i
        cost = c[i]
        #print(i)
        #print(cost)

if check == -1:
    print('TLE')
else:
    print(cost)
Buggy python submission (verdict: Runtime Error):

Copy
S = input()
T = input()
 
S_list = []
T_list = []
alpha = "abcdefghijklmnopqrstuvwxyz"
 
for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS and TT> 0:
        S_list.append(SS)
        T_list.append(TT)
 
if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

Fixed submission:
a,b,c = map(int, input().split())

max = max([a, b, c])
print(max * 10 + a + b + c - max)
Buggy python submission (verdict: Runtime Error):

----:---F1  *scratch*      All L1     (Fundamental)-----------------------------
Loading subst-jis...done
S = input()
T = input()

S_list = []
T_list = []
print(S_list)
print(T_list)
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS and TT > 0:
        S_list.append(SS)
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')

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

S_list = []
T_list = []
alpha = "abcdefghijklmnopqrstuvwxyz"

for i in alpha:
    SS = S.count(i)
    TT = T.count(i)
    if SS > 0:
        S_list.append(SS)
    if TT > 0:
        T_list.append(TT)

if sorted(S_list) != sorted(T_list):
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
for i in range(m//n,0,-1):
    if m % i == 0:
        break
print(i) 

Fixed submission:
def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if M%i==0: break
print(i)

Fixed submission:
def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if M%i==0:
        print(i)
        break

Fixed submission:
def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if M%i==0:
        print(i)
        break

Fixed submission:
def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
for i in range(M//N,0,-1):
    if m%i==0:
        print(i)
        break
    else: break

Fixed submission:
def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()

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

for i in range(M//N,0,-1):
    if m%i!=0: break
    else (M-N*i)%i==0:
        ret = i
        print(ret)
        break

Fixed submission:
def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()

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

for i in range(M//N+1,0,-1):
    if (M-(N-1)*i)%i==0 and M-(N-1)*i>0:
        ret = i
        print(ret)
        break

Fixed submission:
def solve():
    n,m = map(int,input().split())
    for i in range(m//n,0,-1):
        if m%i==0: break
    print(i)
solve()
Buggy python submission (verdict: Runtime Error):
# abc109c

import math

N,X = map(int,input().split())
x = list(map(int,input().split()))

x.append(X)
x.sort()
diff = [x[1]-x[0]]
for i in range(N):
    diff.append(x[i+1]-x[i])
#print(x)
#print(diff)
D = math.gcd(diff[0],diff[1])
for i in range(2,N+1):
    D = math.gcd(D,diff[i])
    #print(diff[i],D)
print(D)

Fixed submission:
# abc109c

def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcd(r, b)

N,X = map(int,input().split())
x = list(map(int,input().split()))

x.append(X)
x.sort()
diff = [x[1]-x[0]]
for i in range(N):
    diff.append(x[i+1]-x[i])

D = gcd(diff[0],diff[1])
for i in range(2,N+1):
    D = gcd(D,diff[i])
print(D)
Buggy python submission (verdict: Runtime Error):
#c

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

for i in range(1,n+1):
    a[i-1] -= i
num1 = a[int(n/2)]
num2 = a[int(n/2)+1]

ans1 = 0
for i in range(n):
    ans1 += abs(a[i]-num1)
ans2 = 0
for i in range(n):
    ans2 += abs(a[i]-num2)

ans = min(ans1,ans2)
print(ans)

Fixed submission:
#c

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

for i in range(1,n+1):
    a[i-1] -= i
a.sort()
num0 = 0
num1 = a[int(n/2)-1]
num2 = a[int(n/2)]
num3 = int((num1 + num2)/2)
num4 = num3 - 1
num5 = num3 + 1
num6 = num1 + 1
num7 = num1 - 1
num8 = num2 + 1
num9 = num2 - 1

ans0 = 0
for i in range(n):
    ans0 += abs(a[i]-num0)
ans1 = 0
for i in range(n):
    ans1 += abs(a[i]-num1)
ans2 = 0
for i in range(n):
    ans2 += abs(a[i]-num2)
ans3 = 0
for i in range(n):
    ans3 += abs(a[i]-num3)
ans4 = 0
for i in range(n):
    ans4 += abs(a[i]-num4)
ans5 = 0
for i in range(n):
    ans5 += abs(a[i]-num5)
ans6 = 0
for i in range(n):
    ans6 += abs(a[i]-num6)
ans7 = 0
for i in range(n):
    ans7 += abs(a[i]-num7)
ans8 = 0
for i in range(n):
    ans8 += abs(a[i]-num8)
ans9 = 0
for i in range(n):
    ans9 += abs(a[i]-num9)

ans = min(ans0,ans1)
ans = min(ans,ans2)
ans = min(ans,ans3)
ans = min(ans,ans4)
ans = min(ans,ans5)
ans = min(ans,ans6)
ans = min(ans,ans7)
ans = min(ans,ans8)
ans = min(ans,ans9)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
ans = A - B
if abs(ans) > 10**18: ans = "Unfair"
print(ans)

Fixed submission:
A,B,C,K=map(int,input().split());print((A-B)*(-1)**K)
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
arr = set()
for i in range(len(s)):
    for j in range(i+1,min(i+1+K,len(s))):
        arr.add(s[i:j])
print(list(sorted(arr))[K-1])

Fixed submission:
s = input()
K = int(input())
arr = set()
for i in range(len(s)):
    for j in range(i+1,min(i+1+K,len(s)+1)):
        arr.add(s[i:j])
print(sorted(arr)[K-1])
Buggy python submission (verdict: Runtime Error):
H,W=list(map(int,input().split())) # R行 C列 の迷路を受け取る

canv=[]
for i in range(H):
    canv.append([])
    line_input=input() # 迷路を1行取得
    for j in range(W):
        canv[i].append(line_input[j:j+1]) # slice による部分文字列取得

dx=[1,0,-1,0]
dy=[0,1,0,-1]

def dfs(x,y):
    for i in range(4):
        canv[x][y]="."
        nx = x + dx[i]
        ny = y + dy[i]
        if 0<=nx and nx<H and 0<=ny and ny<W:
            if canv[nx][ny]=="#":
                dfs(nx,ny)

for i in range(H):
    for j in range(W):
        for k in range(4):
            nx1 = i + dx[k]
            ny1 = j + dy[k]
            if 0<=nx1 and nx1<H and 0<=ny1 and ny1<W:
                if canv[i][j]=="#" and canv[nx1][ny1]=="#":
                    dfs(i,j)
flg = True
for i in range(H):
    for j in range(W):
        if canv[i][j]=="#":
            flg = False
if flg: print("Yes")
else: print("No")

Fixed submission:
import sys
sys.setrecursionlimit(100000)

H,W=list(map(int,input().split())) # R行 C列 の迷路を受け取る

canv=[]
for i in range(H):
    canv.append([])
    line_input=input() # 迷路を1行取得
    for j in range(W):
        canv[i].append(line_input[j:j+1]) # slice による部分文字列取得

dx=[1,0,-1,0]
dy=[0,1,0,-1]

def dfs(x,y):
    for i in range(4):
        canv[x][y]="."
        nx = x + dx[i]
        ny = y + dy[i]
        if 0<=nx and nx<H and 0<=ny and ny<W:
            if canv[nx][ny]=="#":
                dfs(nx,ny)

for i in range(H):
    for j in range(W):
        for k in range(4):
            nx1 = i + dx[k]
            ny1 = j + dy[k]
            if 0<=nx1 and nx1<H and 0<=ny1 and ny1<W:
                if canv[i][j]=="#" and canv[nx1][ny1]=="#":
                    dfs(i,j)
flg = True
for i in range(H):
    for j in range(W):
        if canv[i][j]=="#":
            flg = False
if flg: print("Yes")
else: print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy as cp

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

def nck(n,k):
    if 0 <= k <= n:
        ret = 1
        for i in range(k):
            ret = ret*(n-i)/(i+1)
        return ret
    return 0

def numzero(a):
    if a <= 1:
        return 0
    elif a == 2:
        return 1
    else: return nck(a,2)

cumsum = [0]
s = 0
for i in range(len(a)):
    s += a[i]
    cumsum.append(s)
#print(cumsum)

v = cp.deepcopy(cumsum)
v.sort()
cnt = np.zeros(v[-1]-v[0]+1)

for i in range(len(cumsum)):
    #print(i,cumsum[i])
    cnt[cumsum[i]-v[0]] += 1
    #print(cnt)
#print(cnt)

ans = 0
for i in range(len(cnt)):
    ans += numzero(cnt[i])
print(int(ans))

Fixed submission:
#import numpy as np
import copy as cp

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

def nck(n,k):
    if 0 <= k <= n:
        ret = 1
        for i in range(k):
            ret = ret*(n-i)/(i+1)
        return ret
    return 0

def numzero(a):
    if a <= 1:
        return 0
    elif a == 2:
        return 1
    else: return nck(a,2)

cumsum = [0]
s = 0
for i in range(len(a)):
    s += a[i]
    cumsum.append(s)
#print(cumsum)

v = cp.deepcopy(cumsum)
v.sort()
#print(v)

cnt = [1]
c = 0
for i in range(1,len(v)):
    if v[i] == v[i-1]:
        cnt[c] += 1
    else:
        cnt.append(1)
        c += 1
#print(cnt)    

ans = 0
for i in range(len(cnt)):
    ans += numzero(cnt[i])
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import copy

def funcabs(a,b):
    if a>=b: ret = a-b
    else: ret = b-a
    return ret

N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.append(0)

for i in range(1,N+1):
    ans = 0
    B = copy.deepcopy(A)
    del B[i]
    for j in range(1,N+1):
        ans += funcabs(B[j],B[j-1])
    print(ans)

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

S = 0
for i in range(len(A)-1):
    S+=abs(A[i+1]-A[i])
    
for i in range(1,N+1):
    ans = S + abs(A[i+1]-A[i-1]) - abs(A[i+1]-A[i]) - abs(A[i]-A[i-1])
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
for i in range(int(np.sqrt(n)),n+1):
    if np.sqrt(i)==int(np.sqrt(i)): a=i
print(a)

Fixed submission:
import numpy as np
n=int(input())
for i in range(n,0,-1):
    if np.sqrt(i)==int(np.sqrt(i)):
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
for i in range(int(np.sqrt(n)),n+1):
    if np.sqrt(i)==int(np.sqrt(i)): a=i
print(a)

Fixed submission:
import numpy as np
n=int(input())
for i in range(n,0,-1):
    if np.sqrt(i)==int(np.sqrt(i)):
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n=int(input())
for i in range(1,n+1):
    if np.sqrt(i)==int(np.sqrt(i)): a=i
print(a)

Fixed submission:
import numpy as np
n=int(input())
for i in range(n,0,-1):
    if np.sqrt(i)==int(np.sqrt(i)):
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())

x = map(int, input().split())

ans = 0
for i in range(N):
    ans += 2*min(x, K-x)
    
print(ans)

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

x = input().split()

ans = 0
for i in range(N):
    ans += 2*min(int(x[i]), K-int(x[i]))
    
print(ans)

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

x = map(int, input().split())

ans = 0
for i in range(N);
    ans += 2*min(x, K-x)
    
print(ans)

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

x = input().split()

ans = 0
for i in range(N):
    ans += 2*min(int(x[i]), K-int(x[i]))
    
print(ans)

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

ans = 0
for i in range(N):
    x = int(input())
    ans += 2*min(x,K-x)
print(ans)

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

x = input().split()

ans = 0
for i in range(N):
    ans += 2*min(int(x[i]), K-int(x[i]))
    
print(ans)

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

ans = 0
for i in range(N):
    x = int(input)
    ans += 2*min(x,K-x)
print(ans)


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

x = input().split()

ans = 0
for i in range(N):
    ans += 2*min(int(x[i]), K-int(x[i]))
    
print(ans)

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

ans = 0
for i in range(N):
    x = int(input)
    ans += 2*min(x,K-x)
print(ans)


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

x = input().split()

ans = 0
for i in range(N):
    ans += 2*min(int(x[i]), K-int(x[i]))
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())

a = np.zeros([100000])
for i in range(N):
    idx = int(input())
    a[idx] += 1
    a[idx] = a[idx]%2
ans = int(np.sum(a))
print(ans)

Fixed submission:
N = int(input())

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

a.sort() 

cnt2 = 0
cnt = 1
ans = 0
for i in range(len(a)-1):
    if a[i] == a[i+1]:
        cnt += 1
    else:
        ans += cnt%2
        cnt = 1
        flg = False

ans += cnt%2
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input()split())
d = []
for _ in range(n):
    d.append(list(map(int,input().split())))
d.sort(key=lambda x: x[0])
count = 0
for x,y in d:
    count += y
    if count >= k:
        break
print(x)

Fixed submission:
n,k = map(int,input().split())
d = []
for _ in range(n):
    d.append(list(map(int,input().split())))
d.sort(key=lambda x: x[0])
count = 0
for x,y in d:
    count += y
    if count >= k:
        break
print(x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

flg = int(a[1]>a[0])
skp = 1
cnt = 1
temp = a[0]
for i in range(1,n):
    dif = a[i] - temp
    direct = int(dif>0)
    if dif != 0:
        if skp:
            flg = direct
            skp = 0
            
        elif direct != flg and skp==0:
            flg = direct
            cnt+=1
            skp = 1
    temp = a[i]
print(cnt)

Fixed submission:
import numpy as np

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

cnt = 1
direct = 0
temp = a[0]
for i in range(1,n):
    dif = a[i] - temp
    if dif != 0:
        if direct == 0:
            direct = np.sign(dif)
            
        elif np.sign(a[i] - temp) != direct:
            cnt+=1
            direct = 0
    temp = a[i]
print(cnt)

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

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

flg = np.sign(a[1] - a[0])
skp = 1
cnt = 1
temp = a[0]
for i in range(1,n):
    dif = a[i] - temp
    direct = np.sign(dif)
    if dif != 0:
        if skp:
            flg = direct
            skp = 0
            continue
            
        elif direct != flg:
            flg = direct
            cnt+=1
            skp = 1
    temp = a[i]
print(cnt)

Fixed submission:
import numpy as np

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

cnt = 1
direct = 0
temp = a[0]
for i in range(1,n):
    dif = a[i] - temp
    if dif != 0:
        if direct == 0:
            direct = np.sign(dif)
            
        elif np.sign(a[i] - temp) != direct:
            cnt+=1
            direct = 0
    temp = a[i]
print(cnt)

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

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

flg = np.sign(a[1] - a[0])
skp = 1
cnt = 1
temp = a[0]
for i in range(1,n):
    dif = a[i] - temp
    direct = np.sign(dif)
    if dif != 0:
        if skp:
            flg = direct
            skp = 0
            
        elif direct != flg:
            flg = direct
            cnt+=1
            skp = 1
    temp = a[i]
print(cnt)

Fixed submission:
import numpy as np

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

cnt = 1
direct = 0
temp = a[0]
for i in range(1,n):
    dif = a[i] - temp
    if dif != 0:
        if direct == 0:
            direct = np.sign(dif)
            
        elif np.sign(a[i] - temp) != direct:
            cnt+=1
            direct = 0
    temp = a[i]
print(cnt)