Harryxun/stf_run huggingface dataset:
""" Euclidean algorithm"""
    if a < b: (a, b) = (b, a)
    if b == 0: return a
    m = a % b
    while m != 0:
        a = b
        b = m
        m = a % b
    return b

N = int(input())
A = [ int(v) for v in input().split() ]

if N < 2 and 1e5 < N: raise()
for v in A:
    if v < 1 and v < 1e9: raise()

result = []
for skip in range(N):
    l = 0
    r = 0
    for v in range(0, skip):
        l = GCD(l, A[v])
    for v in range(N-1, skip, -1):
        r = GCD(r, A[v])
    result.append(GCD(l, r))

print(max(result))

### FIXED CODE ###

def GCD(a, b):
    """ Euclidean algorithm"""
    if a < b: (a, b) = (b, a)
    if b == 0: return a
    m = a % b
    while m != 0:
        a = b
        b = m
        m = a % b
    return b

N = int(input())
A = [ int(v) for v in input().split() ]

if N < 2 and 1e5 < N: raise()
for v in A:
    if v < 1 and v < 1e9: raise()


l_list = []
l = 0
for i in range(0, N):
    l = GCD(l, A[i])
    l_list.append( l )

r_list = []
r = 0
for i in range(-1, -(N+1), -1):
    r = GCD(r, A[i])
    r_list.append( r )

n = []    
for i in range(0, N):
    if i-1 < 0:
        l = 0
    else:
        l = l_list[i-1]
    if N-i-2 < 0:
        r = 0
    else:
        r = r_list[N-i-2]
    n.append(GCD(l, r))
print(max(n))
n = int(input())
li = list(map(int,input().split()))
 
ans = 1
ans_li = [0 for i in range(max(li))]
count = 0
 
for i in range(n):
    ans_li[li[i]] += 1
 
if not ans_li[0] == 1:
    print(0)
    exit()

for i in range(1,n-1):
    ans *= ans_li[i] ** ans_li[i+1]
 
for i in range(n-1):
    if ans_li[i] == 0 and (not ans_li[i+1] == 0):
        print(0)
        exit()
 
print(ans % 998244353)

### FIXED CODE ###

import collections

n = int(input())
li = list(map(int,input().split()))
 
ans = 1
ans_li = collections.Counter(li)

if not li[0] == 0:
    print(0)
    exit()

if not ans_li[0] == 1:
    print(0)
    exit()

for i in range(max(ans_li)+1):
    ans *= ans_li[i] ** ans_li[i+1]
    if ans_li[i] == 0:
        print(0)
        exit()
 
print(ans % 998244353)
import math
def charToNum(char):
    return ord(char) - 96

def check(string,subLen):
    if subLen == 0: return True
    #長さsubLenの部分文字列すべてについてローリングハッシュを計算して、
    #一致するものがあるかどうかを計算する。
    # setOfRollingHash = set()
    dictOfRollingHash = {}
    totalLen = len(string)
    h = 0
    b = 1
    for i in range(subLen):
        c = string[subLen - 1 - i]
        h += charToNum(c) * b
        b *= 27
    dictOfRollingHash[h] = 0
    maxBase = math.pow(27,subLen - 1)
    for i in range(1,totalLen - subLen + 1):
        h -= maxBase * charToNum(string[i - 1])
        h *= 27
        h += charToNum(string[i + subLen - 1])
        if h in dictOfRollingHash:
            if i - dictOfRollingHash[h] >= subLen:
                return True
        else:
            dictOfRollingHash[h] = i
    return False

N = int(input())
S = input()
ok = 0
ng = N + 1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if check(S,mid):
        ok = mid
    else:
        ng = mid
print(ok)

### FIXED CODE ###

import math
MOD = pow(2,61) - 1
def charToNum(char):
    return ord(char) - 96

def check(string,subLen):
    if subLen == 0: return True
    #長さsubLenの部分文字列すべてについてローリングハッシュを計算して、
    #一致するものがあるかどうかを計算する。
    # setOfRollingHash = set()
    dictOfRollingHash = {}
    totalLen = len(string)
    h = 0
    b = 1
    for i in range(subLen):
        c = string[subLen - 1 - i]
        h += charToNum(c) * b
        b *= 27
        b %= MOD
    h %= MOD
    dictOfRollingHash[h] = 0
    maxBase = pow(27,subLen - 1,MOD) 
    for i in range(1,totalLen - subLen + 1):
        h -= maxBase * charToNum(string[i - 1])
        h *= 27
        h += charToNum(string[i + subLen - 1])
        h %= MOD
        if h in dictOfRollingHash:
            if i - dictOfRollingHash[h] >= subLen:
                return True
        else:
            dictOfRollingHash[h] = i
    return False

N = int(input())
S = input()
ok = 0
ng = N + 1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if check(S,mid):
        ok = mid
    else:
        ng = mid
print(ok)
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

s = rs()
t = rs()


import collections
pos = collections.defaultdict(list)
for i, c in enumerate(s):
	pos[c].append(i)

import bisect

def bisect_right(arr, x):
    # a_i <= x < a_{i+1}
    l, r = 0, len(arr)
    while r - l > 1:
        c = (r + l) // 2
        if x >= arr[c]:
            l = c
        else:
            r = c
    return r

num = 0
cur = -1

for c in t:
	if c not in pos:
		print(-1)
		exit()
	#i = bisect.bisect_right(pos[c], cur)
	i = search(pos[c], cur)
	if i == len(pos[c]):
		i = 0
		num += 1
	cur = pos[c][i]
print(num*len(s)+cur+1)



### FIXED CODE ###

import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

s = rs()
t = rs()


import collections
pos = collections.defaultdict(list)
for i, c in enumerate(s):
	pos[c].append(i)

import bisect

num = 0
cur = -1

for c in t:
	if c not in pos:
		print(-1)
		exit()
	i = bisect.bisect_right(pos[c], cur)
	if i == len(pos[c]):
		i = 0
		num += 1
	cur = pos[c][i]
print(num*len(s)+cur+1)
while true:
    n =input()
    if n == 0: break
    print sum(input() for i in xrange(n/4))

### FIXED CODE ###

while True:
    n = input()
    if n == 0: break
    print sum(input() for i in range(n/4))
h1,m1,h2,m2,k = map(int, input().split())
h1 += m1/60
h2 += m2/60
val = h2-h1
val *= 60
val -= k
print(max(0,int(val))


### FIXED CODE ###

h1,m1,h2,m2,k = map(int, input().split())
m1 += h1*60
m2 += h2 * 60
val = m2 - m1
val -= k
print(max(0,int(val)))
import numpy as np
N = int(input())

xyh = []
for _ in range(N):
    xyh.append(list(map(int, input().split())))
xyh = np.array(xyh)
xyh = xyh[np.argsort(xyh[:, 2])[::-1]]

cxylist = [[i, j] for i in range(101) for j in range(101)]

Hdict = [[] for i in range(101)]
for i in range(len(cxylist)):
    x, y, h =xyh[0]
    H = h + abs(x-cxylist[i][0]) + abs(y-cxylist[i][1])
    Hdict[cxylist[i][0]].append(H)

def calh(cxylist, x, y, h):
    newcxylist = []
    for i in range(len(cxylist)):
        cx, cy = cxylist[i]
        H = h + abs(x-cx) + abs(y-cy)
        if Hdict[cx][cy] == H:
            newcxylist.append([cx, cy])
    return newcxylist

def checkh(cxylist, x, y):
    newcxylist = []
    for i in range(len(cxylist)):
        cx, cy = cxylist[i]
        if Hdict[cx][cy] - abs(x-cx) - abs(y-cy) <= 0:
            newcxylist.append(cx)
    return newcxylist

for n in range(N-1):
    if xyh[n][2] != 0:
        cxylist = calh(cxylist, xyh[n+1][0], xyh[n+1][1], xyh[n+1][2])
    else:
        cxylist = checkh(cxylist, xyh[n+1][0], xyh[n+1][1])

print(cxylist[0][0], cxylist[0][1], Hdict[cxylist[0][0]][cxylist[0][1]])


### FIXED CODE ###

import numpy as np
N = int(input())

xyh = []
for _ in range(N):
    xyh.append(list(map(int, input().split())))
xyh = np.array(xyh)
xyh = xyh[np.argsort(xyh[:, 2])[::-1]]

cxylist = [[i, j] for i in range(101) for j in range(101)]

Hdict = [[] for i in range(101)]
for i in range(len(cxylist)):
    x, y, h =xyh[0]
    H = h + abs(x-cxylist[i][0]) + abs(y-cxylist[i][1])
    Hdict[cxylist[i][0]].append(H)

def calh(cxylist, x, y, h):
    newcxylist = []
    for i in range(len(cxylist)):
        cx, cy = cxylist[i]
        H = h + abs(x-cx) + abs(y-cy)
        if Hdict[cx][cy] == H:
            newcxylist.append([cx, cy])
    return newcxylist

def checkh(cxylist, x, y):
    newcxylist = []
    for i in range(len(cxylist)):
        cx, cy = cxylist[i]
        if Hdict[cx][cy] - abs(x-cx) - abs(y-cy) <= 0:
            newcxylist.append([cx, cy])
    return newcxylist

for n in range(N-1):
    if xyh[n+1][2] != 0:
        cxylist = calh(cxylist, xyh[n+1][0], xyh[n+1][1], xyh[n+1][2])
    else:
        cxylist = checkh(cxylist, xyh[n+1][0], xyh[n+1][1])

print(cxylist[0][0], cxylist[0][1], Hdict[cxylist[0][0]][cxylist[0][1]])
# -*- coding: utf-8 -*-


lst = list(map(int, input().split()))
if lst[0] == 1:
    print("Hello World")
else:
    print(lst[1] + lst[2])

### FIXED CODE ###

# -*- coding: utf-8 -*-

n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
n=int(input())
math inport ceil
a=[]
for i in range(5):
  a.append(int(input()))
print(ceil(n/min(a))+4)


### FIXED CODE ###

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(':(')
input_list = input().split()
test = input_list[0]*input_list[1]%2
if test == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

#入力がs_1 s_2
#input_list = input().split() str型ならこれでもいいかも
input_list = list(map(int, input().split()))
test = input_list[0]*input_list[1]%2
if test == 0:
    print("Even")
else:
    print("Odd")
from collections import deque

N = int( input() ) + 1 # empty counts

hi = 0
while 1 << hi + 1 <= N:
  hi += 1
hi -= 1

ans_A = deque()
ans_B = deque()
ptr = 1
for i in range( hi, -1, -1 ):
  ans_A.append( ptr )
  ans_B.append( ptr )
  ptr += 1
  if N >> i & 1:
    ans_A.append( ptr )
    ans_B.appendleft( ptr )
    ptr += 1

print( len( ans_A ) * 2 )
print( * ( ans_A + ans_B ) )


### FIXED CODE ###

from collections import deque

N = int( input() ) + 1 # empty counts

hi = 0
while 1 << hi + 2 <= N:
  hi += 1

ans_A = deque()
ans_B = deque()
ptr = 1
for i in range( hi, -1, -1 ):
  ans_A.append( ptr )
  ans_B.append( ptr )
  ptr += 1
  if N >> i & 1:
    ans_A.append( ptr )
    ans_B.appendleft( ptr )
    ptr += 1

print( len( ans_A ) * 2 )
for i in range( len( ans_A ) ):
  print( ans_A[ i ], end = ' ' )
for i in range( len( ans_B ) ):
  print( ans_B[ i ], end = ' \n'[ i + 1 == len( ans_B ) ] )
# encoding:utf-8

import copy
import numpy as np
import random

a = []
b = []

for i in range(3):
    a_now,b_now = map(int, input().split())
    a.append(a_now)
    b.append(b_now)

town_dic = {1:0,2:0,3:0,4:0}

for i in range(3):
    town_dic[a[i]] += 1
    town_dic[b[i]] += 1

answer = "YES"
for i in range(4):
    if town_dic[i+1] == 3:
        answer = "NO"


print(answer)


### FIXED CODE ###

# encoding:utf-8

import copy
import numpy as np
import random

k,a,b = map(int,input().split())

cookie = 1

if b-a < 2:
    cookie += k

else:
    k -= (a-cookie)
    cookie = a

    cookie += (k//2)*(b-a)

    if k % 2 == 1:
        cookie += 1
    else:
        pass

print(cookie)
def Ics(X, Y):
    m = len(X)
    n = len(Y)
    c1 = [0] * (n + 1)
    c2 = [0] * (n + 1)
    for i in range(m):
        d = X[i]
    for j in range(n):
        if (d == Y[j]):
            c1[j + 1] = c2[j] + 1
        elif (c1[j + 1] < c1[j]):
            c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
t = []
for i in range(n):
    s1 = input().rstrip()
    s2 = input().rstrip()
    t.append(Ics(s1, s2))
print(*t, sep="\n")

### FIXED CODE ###

def Ics(X, Y):
    m = len(X)
    n = len(Y)
    c1 = [0] * (n + 1)
    for i in range(m):
        d = X[i]
        c2 = c1[:]
        for j in range(n):
            if (d == Y[j]):
                c1[j + 1] = c2[j] + 1
            elif (c1[j + 1] < c1[j]):
                c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
t = []
for i in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    t.append(Ics(s1, s2))
print(*t, sep = "\n")
N =int(input())
A = list(map(int, input().split()))
ans = 1
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
print("ACL"*int(inout()))

### FIXED CODE ###

print("ACL"*int(input()))
def main() -> None:
    H, W = map(int, input().split())
    s = ['0' + input() + '0' for _ in range(H)]
    s.insert(0, '0' * (W + 2))
    s.append('0' * (W + 2))
    print(s)
    for v in s:
        print(v)
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if s[j][i] == "#":
                if s[j+1][i] == "#" or s[j-1][i] == "#" or s[j][i+1] == "#" or s[j][i-1] == "#":
                    continue
                else:
                    print("No")
                    exit()
    print("Yes")


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main() -> None:
    H, W = map(int, input().split())
    s = ['0' + input() + '0' for _ in range(H)]
    s.insert(0, '0' * (W + 2))
    s.append('0' * (W + 2))
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            # print(s[i][j])
            if s[i][j] == "#":
                if s[i+1][j] == "#" or s[i-1][j] == "#" or s[i][j+1] == "#" or s[i][j-1] == "#":
                    continue
                else:
                    print("No")
                    exit()
    print("Yes")


if __name__ == '__main__':
    main()
n = int(input())
count = 0
for i in range(n+1):
  if len(i)%2 == 1:
    count += 1
    
print(count)

### FIXED CODE ###

n = int(input())
count = 0
for i in range(1,n+1):
  if len(str(i))%2 == 1:
    count += 1
    
print(count)
r = int(input())
 
s = r * r * 3.14159265358979
l = 2 * r * 3.14159265358979

### FIXED CODE ###

r = float(input())

s = r * r * 3.14159265358979
l = 2 * r * 3.14159265358979
 
print(s, end = " ")
print(l)
grid = []
for _ in range(3):
    grid.append((list)(map(int, input().split())))

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[i][0] - grid[j][0]
    diff2 = grid[i][1] - grid[j][1]

    if diff1 != diff2 or diff2 != diff3:
        print("No")
        exit()

print("Yes")


### FIXED CODE ###

grid = []
for _ in range(3):
    grid.append((list)(map(int, input().split())))

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[i][0] - grid[j][0]
    diff2 = grid[i][1] - grid[j][1]
    diff3 = grid[i][2] - grid[j][2]

    if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
        print("No")
        exit()

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[0][i] - grid[0][j]
    diff2 = grid[1][i] - grid[1][j]
    diff3 = grid[2][i] - grid[2][j]

    if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
        print("No")
        exit()

print("Yes")
S = list(input())
K = int(input())
n = len(S)

#(方針)Sの「先頭(の連続)」と「末尾(の連続)」が同じ文字ならそこも連続に
#2連続→1回で置換できる,3連続→1回で置換できる,　「N連続→N//2回で置換できる」

A = [] #連続でちぎるようのリスト
count = 1
for i in range(n): 
 if(i != 0):
  if(S[i]== tmp): count += 1
  if((S[i] != tmp)or(i == n-1)):
    A.append([tmp,count])
    count = 1
 tmp = S[i]

ans = 0
for i in range(len(A)):
  if((i != 0)and(i != len(A)-1)):
   ans += (A[i][1]//2)*K
     
if(len(A) == 1):
   ans += (A[0][1]*K)//2  
elif(A[0][0] == A[-1][0]):
   ans += (A[0][1]//2) + (A[-1][1]//2) + ((A[0][1]+A[-1][1])//2)*(K-1) #最初の二項 : 結合後の先頭と末尾分 
elif(A[0][0] != A[-1][0]):
   ans += (A[0][1]//2)*K  
   ans += (A[-1][1]//2)*K
print(ans)     

### FIXED CODE ###

S = list(input())
K = int(input())
n = len(S)

#(方針)Sの「先頭(の連続)」と「末尾(の連続)」が同じ文字ならそこも連続に
#2連続→1回で置換できる,3連続→1回で置換できる,　「N連続→N//2回で置換できる」

A = [] #連続でちぎるようのリスト
count = 1
for i in range(n): 
 if(i != 0):
  if(S[i]== tmp): count += 1
  if((S[i] != tmp)or(i == n-1)):
    A.append([tmp,count])
    count = 1
 tmp = S[i]
if(n == 1): A.append([S[0],1])

ans = 0
for i in range(len(A)):
  if((i != 0)and(i != len(A)-1)):
   ans += (A[i][1]//2)*K
     
if(len(A) == 1):
   ans += (A[0][1]*K)//2  
elif(A[0][0] == A[-1][0]):
   ans += (A[0][1]//2) + (A[-1][1]//2) + ((A[0][1]+A[-1][1])//2)*(K-1) #最初の二項 : 結合後の先頭と末尾分 
elif(A[0][0] != A[-1][0]):
   ans += (A[0][1]//2)*K  
   ans += (A[-1][1]//2)*K
print(ans)
ソースコード 拡げる

Copy
Copy
n=input()
S=list(input().split())
count=0
for i in range(1,len(S)-1):
    if (S[i-1]<S[i] and S[i+1]>S[i]) or (S[i-1]>S[i] and S[i+1]<S[i]):
        count+=1
print(count)

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))
cnt =0
for i in range(1,n-1):
    if p[i-1]<=p[i]<=p[i+1] or p[i+1]<=p[i]<=p[i-1]:
        cnt +=1
print(cnt)
lst = list(map(int, input().split()))
n = 0

while True:
    if lst[0] == lst[1] and lst[1] == lst[2]:
        break
    
    minimum = min(lst)
    maximum = max(lst)

    if maximum-minimum >= 2:
        idx = lst.index(minimum)
        lst[idx] += 2
        
    else:
        idx = lst.index(minimum)
        lst[idx] += 1
        idx = lst.index(minimum)
        lst[idx] += 1
    n += 1
print(n)

### FIXED CODE ###

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

m = max(a, b, c)
if 3*m%2 == (a+b+c)%2:
    print((3*m-(a+b+c))//2)
else:
    print((3*(m+1)-(a+b+c))//2)
import sys
sys.setrecursionlimit(10000)
n = int(input())
a = [int(input()) for i in range(n)]

switch = [False] * (n + 1)
def button(x,cnt):
    if switch[x]:
        print(-1)
        return -1
    if x == 2:
        print(cnt)
        return
    switch[x] = True
    button(a[x - 1], cnt + 1)
    return cnt

ans = button(1, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
n = int(input())
a = [int(input()) for i in range(n)]

switch = [False] * (n + 1)
def button(x,cnt):
    if switch[x]:
        print(-1)
        return -1
    if x == 2:
        print(cnt)
        return
    switch[x] = True
    button(a[x - 1], cnt + 1)
    return cnt

ans = button(1, 0)
from math import gcd

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = LCM*A[i+1]//gcd(A[i+1],LCM)
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]=(LCM*pow(A[i],MOD-2,MOD))%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i]%MOD + ans%MOD)%MOD

print(ans)

### FIXED CODE ###

def lcm(X,Y):
    x=X
    y=Y
    if y>x:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return X*Y//y

MOD = 1000000007
N = int(input())
A = list(map(int,input().split()))

LCM = A[0]
for i in range(0,N-1,1):
    LCM = lcm(LCM,A[i+1])
B = [0 for i in range(0,N,1)]
for i in range(0,N,1):
    B[i]= (LCM%MOD)*pow(A[i],MOD-2,MOD)%MOD

ans = 0
for i in range(0,N,1):
    ans = (B[i] + ans)%MOD

print(ans)
N,M,V,P = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
def possible(i):
    A_ = A.copy()
    rest = M*(V-1)
    A_[i] += M
    for j in range(i+1,N):
        if A_[j] <= A_[i]:
            d = min(rest,A_[i]-A_[j])
            A_[j] += d
            rest -= d
        else:
            d = min(rest,M)
            A_[j] += d
            rest -= d
        if rest == 0:
            break
    for j in range(i):
        d = min(rest,M)
        A_[j] += d
        rest -= d
        if rest == 0:
            break
    for j in range(N-1,i,-1):
        if A_[j] == A_[i]:
            d = min(rest,A[j]+M-A_[j])
            A_[j] += d
            rest -= d
        if rest == 0:
            break
    c = A_[i]
    A_.sort(reverse=True)
    return A_[P-1] <= c

l = 0
r = N-1
m = (l+r)//2
for i in range(20):
    if possible(m):
        r = m
    else:
        l = m
    m = (l+r)//2
if possible(m):
    ans = N-m
else:
    ans = N-m-1
print(ans)

### FIXED CODE ###

N,M,V,P = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
def possible(i):
    A_ = [A[i] for i in range(N)]
    rest = M*(V-1)
    A_[i] += M
    for j in range(i+1,N):
        if A_[j] <= A_[i]:
            d = min(rest,A_[i]-A_[j])
            A_[j] += d
            rest -= d
        else:
            d = min(rest,M)
            A_[j] += d
            rest -= d
        if rest == 0:
            break
    for j in range(i):
        d = min(rest,M)
        A_[j] += d
        rest -= d
        if rest == 0:
            break
    for j in range(N-1,i,-1):
        if A_[j] == A_[i]:
            d = min(rest,A[j]+M-A_[j])
            A_[j] += d
            rest -= d
        if rest == 0:
            break
    c = A_[i]
    A_.sort(reverse=True)
    return A_[P-1] <= c

l = 0
r = N-1
m = (l+r)//2
for i in range(20):
    if possible(m):
        r = m
    else:
        l = m
    m = (l+r)//2
if possible(m):
    ans = N-m
else:
    ans = N-m-1
print(ans)
n = int(input())
A = list(map(int, input().split()))

from collections import deque
b = deque([])
for i, a in enumerate(A):
    if i % 2 == 0:
        b.append(a)
    else:
        b.appendleft(a)

if n % 2 == 0:
    print(*b)
else:
    print(*b[::-1])

### FIXED CODE ###

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

from collections import deque
b = deque([])
for i, a in enumerate(A):
    if i % 2 == 0:
        b.append(a)
    else:
        b.appendleft(a)

if n % 2 == 0:
    print(*b)
else:
    print(*reversed(b))
S, W = map(int, input().split())
    if S >= W:
        print('safe')
    else S < W:
      print('unsafe')

### FIXED CODE ###

s,w=map(int,input().split())
if s>w:
    print('safe')
else :
    print('unsafe')
print(eval(input().replace(" ","//")))

### FIXED CODE ###

a,p=map(int,input().split())
print((a*3+p)//2)
N,T=map(int,input().split())
ls=[int(input()) for _ in range(N)]
ans=10**18
for c,t in ls:
  if t <= T:
    ans = min(ans,c)
if ans < 10**18:
  print(ans)
else:
  print('TLE')

### FIXED CODE ###

N,T=map(int,input().split())
ls=[list(map(int,input().split())) for _ in range(N)]
ans=10**18
for i in ls:
  if i[1] <= T:
    ans = min(ans,i[0])
if ans < 10**18:
  print(ans)
else:
  print('TLE')
n = int(input())
h = list(map(int, input().split()))
cnt = 0
ans = 0
for i in range(n-1):
   if h[i] >= h[i+1]:
      cnt += 1
      move_cnt.append(cnt)
   else:
      move_cnt.append(cnt) 
      cnt = 0
      
print(max(move_cnt))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
cnt = 0
ans = 0
for i in range(n-1):
   if h[i] >= h[i+1]:
      cnt += 1
      ans = max(ans, cnt)
   else:
      cnt = 0
print(ans)
#! env/bin/local python3
# -*- coding: utf-8 -*-

conditions = []

n, m = map(int, input().split())
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

number: list = [0] * n

is_ok = True
for c in conditions:
    if number[c[0]-1] == 0 or number[c[0]-1] == c[1]:
        number[c[0]-1] = c[1]
    else:
        is_ok = False

if number[0] == 0:
    is_ok = False

if is_ok:
    print(*number)
else:
    print(-1)






### FIXED CODE ###

#! env/bin/local python3
# -*- coding: utf-8 -*-

n, m = map(int, input().split())
conditions = []
while True:
    try:
        conditions.append(list(map(int, input().split())))
    except EOFError:
        break

for i in range(0, 10**n):
    if len(str(i)) != n:
        continue
    flag = True
    for c in conditions:
        if str(i)[c[0]-1] != str(c[1]):
            flag = False

    if flag:
        print(i)
        break
else:
    print(-1)
do run python3
n=int(input())
stones=list(map(int, input().split()))
infini=(10**4)*(10**5)
dp = [infini for _ in range(n)]
dp[0]=0

for pos in range(0, n-1):
   dp[pos+1] = min(dp[pos+1], dp[pos] + abs(stones[pos] - stones[pos+1]))
   if pos <= n-3:
      dp[pos+2] = min(dp[pos+2], dp[pos] + abs(stones[pos] - stones[pos+2]))
print(dp[-1])


### FIXED CODE ###


n=int(input())
stones=list(map(int, input().split()))
infini=(10**4)*(10**5)
dp = [infini for _ in range(n)]
dp[0]=0

for pos in range(0, n-1):
   dp[pos+1] = min(dp[pos+1], dp[pos] + abs(stones[pos] - stones[pos+1]))
   if pos <= n-3:
      dp[pos+2] = min(dp[pos+2], dp[pos] + abs(stones[pos] - stones[pos+2]))
print(dp[-1])
a = ['Sunny', 'Cloudy', 'Rainy']
s = input()

i = a.index(s)
print(a[i + 1 % 3])

### FIXED CODE ###

a = ['Sunny', 'Cloudy', 'Rainy']
s = input()

i = a.index(s)
print(a[(i + 1) % 3])