Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
if (a+b)%2==0:
    print(int((A+B)/2))
else:
    print('IMPOSSIBLE')

Fixed submission:
A,B = map(int, input().split())
if (A+B)%2==0:
    print(int((A+B)/2))
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
if (a+b)%2==0:
    print(int((a+b)/2))
else:
    print('IMPOSSIBLE')

Fixed submission:
A,B = map(int, input().split())
if (A+B)%2==0:
    print(int((A+B)/2))
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
r = map(int, input())
b = 3*r**2
print(b)

Fixed submission:
r = int(input())
b = 3*r**2
print(b)

Buggy python submission (verdict: Runtime Error):
r = map(int, input().split())
b = 3*r*r
print(b)

Fixed submission:
r = int(input())
b = 3*r**2
print(b)
Buggy python submission (verdict: Runtime Error):
A, P = map(int, input().split())
D = 3*A + P
if D % 2 == 0:
    print(int(D/2))
else:
    print(round(int((D/2))

Fixed submission:
A, P = map(int, input().split())
D = 3*A + P
print(D//2)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A>= 13:
    print(B)
elif 6 =< A =< 12:
    print(B/2)
else:
    print(0)

Fixed submission:
A, B = map(int, input().split())
if A>= 13:
    print(B)
elif A <= 5:
    print(0)
else:
    print(B//2)
Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int, input().split())
f = int(e-a)
if f > k:
    print(':(')
else:
    print('Yay!')

Fixed submission:
a = [int(input()) for i in range(6)] 
f = a[4] - a[0]
if f > a[5]:
    print(':(')
else:
    print('Yay!')

Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int, input().split())
f = e-a
if f > k:
    print(':(')
else:
    print('Yay!')

Fixed submission:
a = [int(input()) for i in range(6)] 
f = a[4] - a[0]
if f > a[5]:
    print(':(')
else:
    print('Yay!')
Buggy python submission (verdict: Runtime Error):
b = input()
if b = "A": 
    print("T")
elif b = "T":
    print("A")
elif b = "C":
    print("G")
elif b = "G":
    print("C")

Fixed submission:
b = input()
if b == "A": 
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
elif b =="G":
    print("C")

Buggy python submission (verdict: Runtime Error):
b = input()
if b = A: 
    print(T)
elif b = T:
    print(A)
elif b = C:
    print(G)
elif b = G:
    print(C)

Fixed submission:
b = input()
if b == "A": 
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
elif b =="G":
    print("C")
Buggy python submission (verdict: Runtime Error):
import math
import functools


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

def lcm_list(*numbers):
    return functools.reduce(lcm_base, numbers, 1)

def main() :
    n = int(input())
    a = list(map(int, input().split()))
    lcm = lcm_list(*a)

    ans = 0
    for aa in a :
        ans += (lcm-1) % aa

    print(ans)

main()

Fixed submission:
a = list(map(int, input().split()))
a = sorted(a)
ans = 0
L = len(a)
for i in range(1,L) :
    ans += abs(a[i]-a[i-1])

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = map(int, input().split())
H = list(H)
res = 'Yes'
for i in range(len(H) - 1):
  for j in range(i + 1, len(H)):
    if H[i] - H[j] >= 2:
      res = 'No'
      break
  if res == 'No':
    break
print(res)


Fixed submission:
A, B, C = map(int, input().split())
if A - B >= C:
  r = 0
else:
  r = C - (A - B)
print(r)
Buggy python submission (verdict: Runtime Error):
S = input()
k = len(S)
win = 0
for i in range(k):
  if S[i] == 'o':
    win = win + 1
if win + 15 - k >= 8:
  print('YES')
else:
  print('NO)

Fixed submission:
S = input()
k = len(S)
win = 0
for i in range(k):
    if S[i] == 'o':
        win = win + 1
if win + 15 - k >= 8:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
X_list = list(map(int, input().split()))
def get_median(a_list, i):
    b_list = a_list[:]
    del b_list[i]
    data = np.array(b_list)
    print(np.median(data))
for j in range(N):
    get_median(X_list, j)


Fixed submission:
a, b, x = map(int, input().split())
if a <= x <= a + b:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
# input
for i in range(N):
  A.append(int(input()))
  
max_A = max(A)
# output
for i in range(N):
  if A[i] < max_A:
    print(max_A)
  else:
    tmp = A.copy();
    tmp.remove(A[i]);
    print(max(tmp))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

tmp = A.copy();
tmp.sort()
max1_A = tmp[-1];
max2_A = tmp[-2];
max_count = A.count(max1_A);

# 最大値が複数ある場合
if max_count > 1:
  for i in range(N):
    print(max1_A)
# 最大値が1つある場合
else:
  for i in range(N):
    if A[i] < max1_A:
      print(max1_A)
    else:
      print(max2_A)
      break
  for j in range(i+1,N):
    print(max1_A)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
# input
for i in range(N):
  A.append(int(input()))

# output
for i in range(N):
  tmp = A.copy();
  tmp.remove(A[i]);
  print(max(tmp))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

tmp = A.copy();
tmp.sort()
max1_A = tmp[-1];
max2_A = tmp[-2];
max_count = A.count(max1_A);

# 最大値が複数ある場合
if max_count > 1:
  for i in range(N):
    print(max1_A)
# 最大値が1つある場合
else:
  for i in range(N):
    if A[i] < max1_A:
      print(max1_A)
    else:
      print(max2_A)
      break
  for j in range(i+1,N):
    print(max1_A)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
# input
for i in range(N):
  A.append(int(input()))

# output
for i in range(N):
  tmp = A.copy();
  tmp.remove(A[i]);
  print(max(tmp))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

tmp = A.copy();
tmp.sort()
max1_A = tmp[-1];
max2_A = tmp[-2];
max_count = A.count(max1_A);

# 最大値が複数ある場合
if max_count > 1:
  for i in range(N):
    print(max1_A)
# 最大値が1つある場合
else:
  for i in range(N):
    if A[i] < max1_A:
      print(max1_A)
    else:
      print(max2_A)
      break
  for j in range(i+1,N):
    print(max1_A)
Buggy python submission (verdict: Time Limit Exceeded):
# input
N, K = map(int, input().split())
A = list(map(int,input().split()))

import numpy as np
dp = [np.Inf for i in range(N)]

# 初期化
dp[0] = 0; 
# dp[1] = np.abs(A[1] - A[0]);

for i in range(1,N):
  lim = min(i,K);
  for k in range(lim,0,-1):
    dp[i] = min(dp[i], dp[i-k] + np.abs(A[i]-A[i-k]))  
print(dp[-1])

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

dp = [float('inf') for i in range(N)]

# 初期化
dp[0] = 0; 

for i in range(1,N):
  lim = min(i,K);
  for k in range(lim,0,-1):
    dp[i] = min(dp[i], dp[i-k] + abs(A[i]-A[i-k]))  
print(dp[-1])

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

import numpy as np
dp = [0 for i in range(N)]

# 初期化
dp[0] = 0; 
# dp[1] = np.abs(A[1] - A[0]);

for i in range(1,N):
  lim = min(i,K)
  tmp = [dp[i-k] + np.abs(A[i] - A[i-k]) 
         for k in range(lim,0,-1)]
  dp[i] = min(tmp)
  
print(dp[-1])

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

dp = [float('inf') for i in range(N)]

# 初期化
dp[0] = 0; 

for i in range(1,N):
  lim = min(i,K);
  for k in range(lim,0,-1):
    dp[i] = min(dp[i], dp[i-k] + abs(A[i]-A[i-k]))  
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
a = input()
s = input()
d = input()
f = input()
g = input()
h = input()
j = min(int(s), int(d), int(f), int(g), int(h))

if int(a)%j == 0:
    k = int(a)//j + 4
else:
    k = int(a)//j + 5
print(i)



Fixed submission:
a = input()
s = input()
d = input()
f = input()
g = input()
h = input()
j = min(int(s), int(d), int(f), int(g), int(h))

if int(a)%j == 0:
    k = int(a)//j + 4
else:
    k = int(a)//j + 5
print(k)

Buggy python submission (verdict: Runtime Error):
a = input()
s = input()
d = input()
f = input()
g = input()
h = input()
j = min(int(s), int(d), int(f), int(g), int(h))

if int(a)%j = 0:
    k = int(a)//j + 4
else:
    k = int(a)//j + 5
print(i)



Fixed submission:
a = input()
s = input()
d = input()
f = input()
g = input()
h = input()
j = min(int(s), int(d), int(f), int(g), int(h))

if int(a)%j == 0:
    k = int(a)//j + 4
else:
    k = int(a)//j + 5
print(k)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
a = int(input())
b = list(map(int, input().split()))

d = 0


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


print(gcd_list(b))


Fixed submission:
import math
from functools import reduce
aaa = int(input())
baa = list(map(int, input().split()))


def gcd (a,b):
    if (b == 0):
        return a
    else:
        return gcd(b, a % b)
res = baa[0]
for c in baa[1::]:
    res = gcd(res , c)
print(res)
Buggy python submission (verdict: Runtime Error):
n = input()
h2 = list(map(int, input().split()))
j2 = -2
count2 = 0


def maax(count, j, h):
    if max(h) == 0:
        print(count)
        return
    k = max(h)
    
    for i in range(len(h)):
        if h[i] == k:
            if j+1 != i:
                count = count+1
    
            j = i
            h[i] = k-1
            maax(count, j, h)
    


maax(count2, j2, h2)


Fixed submission:
import sys
sys.setrecursionlimit(10000000)


n = input()
h2 = list(map(int, input().split()))
j2 = -2
count2 = 0


def maax(count, j, h):
    if max(h) == 0:
        print(count)
        return
    k = max(h)
    
    for i in range(len(h)):
        if h[i] == k:
            if j+1 != i:
                count = count+1
    
            j = i
            h[i] = k-1
            maax(count, j, h)
    

maax(count2, j2, h2)
Buggy python submission (verdict: Runtime Error):
import sys 
a = sys.argv[1]
if a == '25':
    print('Christmas')
if a == '24':
    print('Christmas Eve')
if a == '23':
    print('Christmas Eve Eve')
if a == '22':
    print('Christmas Eve Eve Eve')


Fixed submission:
a = input()
if a == '25':
    print('Christmas')
if a == '24':
    print('Christmas Eve')
if a == '23':
    print('Christmas Eve Eve')
if a == '22':
    print('Christmas Eve Eve Eve')
Buggy python submission (verdict: Runtime Error):
import numpy as npo
a=input()
a=(map(int,input().split()))
a=npo.array(a)
a=npo.sort()
print(a[-1]-a[0])

print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")


Fixed submission:
a=input()
a=sorted(map(int,input().split()))
print(a[-1]-a[0])

Buggy python submission (verdict: Runtime Error):
import numpy as npo
a=input()
a=(map(int,input().split()))
a=npo.array(a)
a=npo.sort.()
print(a[-1]-a[0])

print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")
print("")

Fixed submission:
a=input()
a=sorted(map(int,input().split()))
print(a[-1]-a[0])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if ((a+b)%2) == 1:
    print (IMPOSSIBLE )
else:
    print ((a+b)/2)

Fixed submission:
a, b = map(int, input().split())
if ((a+b)%2) == 1:
    print ('IMPOSSIBLE')
else:
    print ((a+b)//2)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a+b)%2 == 1:
    print (IMPOSSIBLE )
else:
    print ((a+b)/2)

Fixed submission:
a, b = map(int, input().split())
if ((a+b)%2) == 1:
    print ('IMPOSSIBLE')
else:
    print ((a+b)//2)

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



if (a+b)%2 == 1:
    print (IMPOSSIBLE )

print ((a+b)/2)



Fixed submission:
a, b = map(int, input().split())
if ((a+b)%2) == 1:
    print ('IMPOSSIBLE')
else:
    print ((a+b)//2)

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



if (a+b)%2 == 1:
    print (IMPOSSIBLE )

print ((a+b)%2)



Fixed submission:
a, b = map(int, input().split())
if ((a+b)%2) == 1:
    print ('IMPOSSIBLE')
else:
    print ((a+b)//2)
Buggy python submission (verdict: Runtime Error):
S = input()
if len(set(s)) == 2:
    for i in list(set(s)):
        if not S.count(i) == 2:
            print('No')
        else:
            print('Yes')
else:
    print('No')

Fixed submission:
S = input()
if len(set(S)) == 2 and S.count(list(set(S))[0]) == 2 and S.count(list(set(S))[1]) == 2:
    print ('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
s = int(input())
for i in range(1, s):
    if s[i] == s[i-1]:
        print ('Bad')
        exit()

print ('Good')


Fixed submission:
s = input()
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        print ('Bad')
        exit()

print ('Good')
Buggy python submission (verdict: Runtime Error):
n,x = map(int, input().split())
l = map(int, input().split())
#ボールの弾む座標
cnt=1
length=0
for i in range(n):
    length +=l[i]
    if length <=x:
        cnt+=1

print (cnt)

Fixed submission:
n,x = map(int, input().split())
l = list(map(int, input().split()))
#ボールの弾む座標
cnt=1
length=0
for i in range(n):
    length +=l[i]
    if length <=x:
        cnt+=1

print (cnt)

Buggy python submission (verdict: Runtime Error):
n,x = map(int, input().split())
l = map(int, input().split())
#ボールの弾む座標
cnt=1
length=0
for i in range(n):
    length +=l[i]
    if length <=x:
        cnt+=1

print (cnt)

Fixed submission:
n,x = map(int, input().split())
l = list(map(int, input().split()))
#ボールの弾む座標
cnt=1
length=0
for i in range(n):
    length +=l[i]
    if length <=x:
        cnt+=1

print (cnt)

Buggy python submission (verdict: Runtime Error):
n,x = map(int, input().split())
l = map(int, input()/split())
#ボールの弾む座標
cnt=1
length=0
for i in range(n):
    length +=l[i]
    if length <=x:
        cnt+=1

print (cnt)

Fixed submission:
n,x = map(int, input().split())
l = list(map(int, input().split()))
#ボールの弾む座標
cnt=1
length=0
for i in range(n):
    length +=l[i]
    if length <=x:
        cnt+=1

print (cnt)
Buggy python submission (verdict: Runtime Error):
times=list(map(int, input().split()))
time=[]
for i in range(len(times)):
    for j in range(len(times)):
        if times.index(times[i]) == times.index(times[j]):
            continue
        
        time.append(times[i]+times[j])

print (min(time))


Fixed submission:
p,q,r = map(int, input().split())
print(min(p+q, q+r, r+p))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, inptu().split())
if a == b:
    print (a*2)
else:
    print (max(a,b)*2-1)

Fixed submission:
a,b = map(int, input().split())
if a == b:
    print (a*2)
else:
    print (max(a,b)*2-1)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(max(0, c - (a - b))

Fixed submission:
a, b, c = map(int, input().split())
print(max(0, c - (a - b)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = map(int, input().split())

H_diff = []
for i in range(N-1):
  	H_diff = H[i] - H[i+1]
if max(H_diff) <= 1:
  	print('Yes')
else:
  	print('No')

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

Hmax = H[0]
flag = 0
for i in range(N):
	if H[i] < Hmax - 1:
		flag = 1
		break
	if H[i] > Hmax:
		Hmax = H[i]

if flag == 1:
  	print('No')
else:
  	print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(x) for x in input().split()]
S = []
from1 = []
fromN = []
ans = "IMPOSSIBLE"
for i in range(M):
	S.append([int(x) for x in input().split()])
	if S[i][0] == 1:
		from1.append(S[i][1])
	if S[i][1] == N:
		fromN.append(S[i][0])

for x in from1:
	if x in fromN:
		ans = "POSSIBLE"

print(ans)

Fixed submission:
N, M = [int(x) for x in input().split()]
S1 = []
S2 = []
for i in range(M):
	S1 = [int(x) for x in input().split()]
	if S1[0] == 1:
		S2.append(S1[1])
	if S1[1] == N:
		S2.append(S1[0])
		
if len(S2) == len(set(S2)):
	print("IMPOSSIBLE")
else:
	print("POSSIBLE")
Buggy python submission (verdict: Runtime Error):
x, y = [int(x) for x in input().split()]

list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]

if x in list1:
	if y in list1:
		print("Yes")
	else:
		pirnt("No")
elif x in list2:
	if y in list2:
		print("Yes")
	else:
		print("No")
else:
	if y in list3:
		print("Yes")
	else:
		print("No")


Fixed submission:
x, y = [int(x) for x in input().split()]

list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]

if x in list1:
	if y in list1:
		print("Yes")
	else:
		print("No")
elif x in list2:
	if y in list2:
		print("Yes")
	else:
		print("No")
else:
	if y in list3:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
N, K = [int(x) for x in input().split()]
Array = list()
A = list()
count = 0
ans = 0
for i in range(N):
	A.append[int(x) for x in input().split()]

A.sort(key=itemgetter(0), reverse=True)
for i in range(N):
	count += A[1, i]
	if count >= K:
		ans = A[0, i]
		break
		
print(ans)

Fixed submission:
from operator import itemgetter

N, K = [int(x) for x in input().split()]
Array = list()
A = list()
count = 0
ans = 0
for i in range(N):
	A.append([int(x) for x in input().split()])

A.sort(key=itemgetter(0))
for i in range(N):
	count += A[i][1]
	if count >= K:
		ans = A[i][0]
		break
		
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(x) for x in input().split()]
Array = list()
a = 0
b = 0
for i in range(N):
	a, b = [int(x) for x in input().split()]
	Array.extend([a]*b)
	if len(Array) > K:
		Array.sort()
		Array = Array[:K]
	
print(Array[K - 1])

Fixed submission:
from operator import itemgetter

N, K = [int(x) for x in input().split()]
Array = list()
A = list()
count = 0
ans = 0
for i in range(N):
	A.append([int(x) for x in input().split()])

A.sort(key=itemgetter(0))
for i in range(N):
	count += A[i][1]
	if count >= K:
		ans = A[i][0]
		break
		
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(x) for x in input().split()]
Array = list()
a = 0
b = 0
for i in range(N):
	a, b = [int(x) for x in input().split()]
	Array.extend([a]*b)

Array.sort()
print(Array[K - 1])

Fixed submission:
from operator import itemgetter

N, K = [int(x) for x in input().split()]
Array = list()
A = list()
count = 0
ans = 0
for i in range(N):
	A.append([int(x) for x in input().split()])

A.sort(key=itemgetter(0))
for i in range(N):
	count += A[i][1]
	if count >= K:
		ans = A[i][0]
		break
		
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]
B = list()
cut = 0
trend = ""

for i in range(N):
	B.append(A[i])
	if len(B) == 2 or trend == "neutral":
		if min(B) == max(B):
			trend = "neutral"
		elif A[i] == max(B):
			trend = "up"
		elif A[i] == min(B):
			trend = "down"
	elif len(B) > 2:
		if trend == "up" and A[i] != max(B):
			cut += 1
			B = [A[i]]
		elif trend == "down" and A[i] != min(B):
			cut += 1
			B = [A[i]]
print(cut + 1)


Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
B = list()
cut = 0
trend = ""

for i in range(N):
	B.append(A[i])
	if len(B) == 2 or trend == "neutral":
		if min(B) == max(B):
			trend = "neutral"
		elif A[i] == max(B):
			trend = "up"
		elif A[i] == min(B):
			trend = "down"
	elif len(B) > 2:
		if trend == "up" and A[i] < B[-2]:
			cut += 1
			B = [A[i]]
		elif trend == "down" and A[i] > B[-2]:
			cut += 1
			B = [A[i]]
print(cut + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]
B = list()
cut = 0
trend = ""

for i in range(N):
	B.append(A[i])
	if len(B) == 2 or trend == "neutral":
		if min(B) == max(B):
			trend = "neutral"
		elif B == sorted(B):
			trend = "up"
		elif B == sorted(B, reverse = True):
			trend = "down"
	elif len(B) > 2:
		if trend == "up" and A[i] != max(B):
			cut += 1
			B = [A[i]]
		elif trend == "down" and A[i] != min(B):
			cut += 1
			B = [A[i]]
print(cut + 1)


Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
B = list()
cut = 0
trend = ""

for i in range(N):
	B.append(A[i])
	if len(B) == 2 or trend == "neutral":
		if min(B) == max(B):
			trend = "neutral"
		elif A[i] == max(B):
			trend = "up"
		elif A[i] == min(B):
			trend = "down"
	elif len(B) > 2:
		if trend == "up" and A[i] < B[-2]:
			cut += 1
			B = [A[i]]
		elif trend == "down" and A[i] > B[-2]:
			cut += 1
			B = [A[i]]
print(cut + 1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]
B = list()
cut = 0

for i in range(N):
	B.append(A[i])
	if B != sorted(B) and B != sorted(B, reverse = True):
		B = [A[i]]
		cut += 1
		
print(cut + 1)


Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
B = list()
cut = 0
trend = ""

for i in range(N):
	B.append(A[i])
	if len(B) == 2 or trend == "neutral":
		if min(B) == max(B):
			trend = "neutral"
		elif A[i] == max(B):
			trend = "up"
		elif A[i] == min(B):
			trend = "down"
	elif len(B) > 2:
		if trend == "up" and A[i] < B[-2]:
			cut += 1
			B = [A[i]]
		elif trend == "down" and A[i] > B[-2]:
			cut += 1
			B = [A[i]]
print(cut + 1)
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
students = list()
checkpoints = list()

for i in range(N):
	students.append(list(map(int, input().split())))

for i in range(M):
	checkpoints.append(list(map(int, input().split())))

ans = [0] * N

for i in range(N):
	mindif = 4 * 10**8 + 1
	for j in range(M):
		dif = abs(students[i][0] - checkpoints[j][0]) + abs(students[i][1] - checkpoints[j][1])
		if dif < mindif:
			mindif = dif
			ans[i] = j

for i in range(M):
	print(ans[i])


Fixed submission:
N, M = list(map(int, input().split()))
students = list()
checkpoints = list()

for i in range(N):
	students.append(list(map(int, input().split())))

for i in range(M):
	checkpoints.append(list(map(int, input().split())))

ans = [0] * N

for i in range(N):
	mindif = 4 * 10**8 + 1
	for j in range(M):
		dif = abs(students[i][0] - checkpoints[j][0]) + abs(students[i][1] - checkpoints[j][1])
		if dif < mindif:
			mindif = dif
			ans[i] = j + 1

for i in range(N):
	print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1

for i in range(N):
	power = power * (i + 1)

print(power % (10**9 + 7))

Fixed submission:
N = int(input())
power = 1

for i in range(N):
	power = power * (i + 1) % (10**9 + 7)

print(power)
Buggy python submission (verdict: Runtime Error):
N = int (input())
H = list(map(int,input().split()))
ans = 'Yes'
for  i in range(N-1):
    diff = H[i+1] - H[i]
    if diff >= 1:
        H[i+1] -= 1
    elif diff < 0:
        ans ='No'
print(ans)


Fixed submission:
a,b,c = map(int,(input().split()))
ans = c-(a-b)
if ans <= 0:
    ans = 0
else:
    pass
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))

for x in range(n-1):
    if h[x] <= h[x+1]:
        pass
    else:
        h[x] = h[x]-1

if n == 1:
    ans ='Yes'
for x in range(n-1):
    if h[x] <= h[x+1]:
        ans = 'Yes'
    else:
        ans = 'No'
        break
print(ans)

Fixed submission:
a,b,c = map(int,(input().split()))
ans = c-(a-b)
if ans <= 0:
    ans = 0
else:
    pass
print(ans)