Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
N = int(input())
H = list(map(int,input().split()))

sum = 0
L = []

for i in range(len(H)):
  if i == 0:
    sum = 0
  elif i == N-1:
    if H[i] <= H[i-1]:
      sum += 1
      L.append(sum)
    else:
      L.append(sum)
  else:
    if H[i] <= H[i-1]:
      sum += 1
    else:
      L.append(sum)
      sum = 0
    
print(max(L))

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
H = list(map(int,input().split()))

sum = 0
L = []

for i in range(len(H)):
  if i == 0:
    sum = 0
    L.append(sum)
  elif i == N-1:
    if H[i] <= H[i-1]:
      sum += 1
      L.append(sum)
    else:
      L.append(sum)
  else:
    if H[i] <= H[i-1]:
      sum += 1
    else:
      L.append(sum)
      sum = 0
    
print(max(L))
import math
print(2*math.pi*int(input))

### FIXED CODE ###

import math
print(2*float(input())*math.pi)
import sys
input = sys.stdin.readline
s=list(input())
x,y = map(int, input().split())
x=abs(x)
y=abs(y)
s.append('T')
x1=[]
y1=[]

count=0
u=0
for i in range(len(s)):
    if s[i]=='F':
        count+=1
    else:
        if u%2==0:
            x1.append(count)
            u+=1
            count=0
        else:
            y1.append(count)
            u+=1
            count=0

v=sum(x1)
w=sum(y1)

dpx=[[0 for i in range(v+1)] for j in range(len(x1)+1)]

dpx[0][-1]=1

for i in range(len(x1)):
    for j in range(v+1):
        if dpx[i][j]==1:
            if j-2*x1[i]>=0:
                dpx[i+1][j-2*x1[i]]=1
            dpx[i+1][j]=1

if len(y1)==0:
    y1.append(0)

dpy=[[0 for i in range(w+1)] for j in range(len(y1)+1)]
dpy[0][-1]=1

for i in range(len(y1)):
    for j in range(w+1):
        if dpy[i][j]==1:
            if j-2*y1[i]>=0:
                dpy[i+1][j-2*y1[i]]=1
            dpy[i+1][j]=1



if dpy[len(y1)][y]==1 and dpx[len(x1)][x]==1:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

import sys
input = sys.stdin.readline
s=list(input())
x,y = map(int, input().split())
y=abs(y)
s.append('T')
x1=[]
y1=[]

count=0
u=0
for i in range(len(s)):
    if s[i]=='F':
        count+=1
    else:
        if u%2==0:
            x1.append(count)
            u+=1
            count=0
        else:
            y1.append(count)
            u+=1
            count=0
v=sum(x1)
w=sum(y1)
v-=x1[0]
x-=x1[0]
x1.pop(0)
x=abs(x)
if v<x or w<y:
    print('No')
    exit()

dpx=[[0 for i in range(v+1)] for j in range(len(x1)+1)]
dpx[0][-1]=1

for i in range(len(x1)):
    for j in range(v+1):
        if dpx[i][j]==1:
            if j-2*x1[i]>=0:
                dpx[i+1][j-2*x1[i]]=1
            dpx[i+1][j]=1

if len(y1)==0:
    y1.append(0)
dpy=[[0 for i in range(w+1)] for j in range(len(y1)+1)]
dpy[0][-1]=1

for i in range(len(y1)):
    for j in range(w+1):
        if dpy[i][j]==1:
            if j-2*y1[i]>=0:
                dpy[i+1][j-2*y1[i]]=1
            dpy[i+1][j]=1

if dpy[-1][y]==1 and dpx[-1][x]==1:
    print('Yes')
else:
    print('No')
n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
L = l[0:n-K+1]
L_sum = sum(L)
print(L_sum)

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
if len(l) > k:
    print(sum(l[:n-k]))
else:
    print(0)
N, M = map(int, input().split())
    A = list(map(int, input().split()))
     
    sum_A =0
    for i in range(N):
        sum_A += A[i]
     
    ans = 1
    for i in range(M):
        if (4*M*A[i] > sum_A):
            ans= ans*1
        else:
        	ans =ans*0
     
    if (ans == 1):
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
 
sum_A =0
for i in range(N):
    sum_A += A[i]

ans = 0
for i in range(N):
    if (4*M*A[i] >= sum_A):
        ans+=1
    else:
    	ans+=0
    	
if (ans >= M):
    print('Yes')
else:
    print('No')
a = int(input())
b = int(input())
if a % 2 = 0 or b % 2 =0:
    print("even")
else:
    print("odd")


### FIXED CODE ###

a, b = map(int,input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
mport sys
sys.setrecursionlimit(10 ** 7)
from functools import lru_cache

n = int(input())
ans = []

if n == 1:
    print('a')
    exit()

@lru_cache(None)
def rec(before, depth, MAX):
    for i in range(MAX-ord('a') +2):
        tmp = before + chr(ord('a') + i)
        if len(tmp) >= n:
            ans.append(tmp)
        else:
            MAX = max(MAX, ord(tmp[-1]) )
            rec(tmp, depth+1, MAX)


rec('a',1, ord('a'))

ans.sort()

print(*ans, sep ='\n')


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
from functools import lru_cache

n = int(input())
ans = []

if n == 1:
    print('a')
    exit()

@lru_cache(None)
def rec(before, depth, MAX):
    for i in range(MAX-ord('a') +2):
        tmp = before + chr(ord('a') + i)
        if len(tmp) >= n:
            ans.append(tmp)
        else:
            MAX = max(MAX, ord(tmp[-1]) )
            rec(tmp, depth+1, MAX)


rec('a',1, ord('a'))

ans.sort()

print(*ans, sep ='\n')
from itertools import permutations

n = int(input())
nums1 = list(map(int,input(),split("")))
nums2 = list(map(int,input(),split("")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index +=  1

print(abs(a-b))

### FIXED CODE ###

from itertools import permutations

n = int(input())
nums1 = list(map(int,input().split(" ")))
nums2 = list(map(int,input().split(" ")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index += 1

print(abs(a-b))
i(j)=map(int,input().split())
if i*500>=j:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

i,j=map(int,input().split())
if i*500>=j:
    print("Yes")
else:
    print("No")
n=int(input())
print(n***3)

### FIXED CODE ###

n=int(input())
print(n**3)
from itertools import combinations_with_replacement


def euclidean(num_list: list):
    a, b = sorted(num_list)
    while b % a != 0:
        redi = b % a
        b = a
        a = redi
    return a


K = int(input())
k_range = list(range(1, K+1))

result = 0
for comb in combinations_with_replacement(k_range, 3):
    min_abc = min(comb)
    gcd = euclidean(comb[0:2])
    gcd = euclidean([gcd, comb[2]])
    if comb[0]==comb[1] and comb[1]==comb[2]:
        coef = 1
    elif (comb[0]!=comb[1] and comb[1]!=comb[2]) and comb[2]!=comb[0]:
        coef = 6
    else:
        coef = 3
    result += i * coef
print(result)

### FIXED CODE ###

from itertools import combinations_with_replacement

K = int(input())
k_range = list(range(1, K+1))

result = 0
for comb in combinations_with_replacement(k_range, 3):
    min_abc = min(comb)
    for i in range(min_abc, 0, -1):
        if (comb[0]%i == 0 and comb[1]%i == 0) and comb[2]%i == 0:
            if comb[0]==comb[1] and comb[1]==comb[2]:
                coef = 1
            elif (comb[0]!=comb[1] and comb[1]!=comb[2]) and comb[2]!=comb[0]:
                coef = 6
            else:
                coef = 3
            result += i * coef
            break
print(result)
n,m,x,y = map(int,input().split())

xis = sorted(list(map(int,input().split())),reverse=True)
yis = sorted(list(map(int,input().split())))
 
ans = 'No War' (if xis[0] < yis[0]) and x < yis[0] and xis[0] < y else 'War'

print(ans)


### FIXED CODE ###

n,m,x,y = map(int,input().split())

xis = sorted(list(map(int,input().split())),reverse=True)
yis = sorted(list(map(int,input().split())))
 
ans = 'No War' if (xis[0] < yis[0]) and (x < yis[0] and xis[0] < y) else 'War'

print(ans)
n = int(input())
s = str(input())
if (n % 2 == 1):
  print("No")
else:
  if (s[:n/2+1] = s[n/2+1:]):
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    A=list(map(int,input().split()))
    rgb=[-1,-1,-1]
    ans=1
    mod=10**9+7
    for a in A:
        ans=ans*Counter(rgb)[a-1]%mod
        rgb[rgb.index(a-1)]+=1
    print(ans)
    

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    A=list(map(int,input().split()))
    rgb=[-1,-1,-1]
    ans=1
    mod=10**9+7
    for a in A:
        ans=ans*Counter(rgb)[a-1]%mod
        if ans==0:break
        rgb[rgb.index(a-1)]+=1
    print(ans)
    

if __name__=='__main__':
    main()
n, a, b = map(int, input().split())
ans = n // (a + b) * a
x = n % (a + b)
ans += min(a, x)
print(ans)

### FIXED CODE ###

s = input()
if "A" in s and "B" in s:
    print("Yes")
else:
    print("No")
a=input()
s=input()
t=s if a>=3200 else red
print(t)

### FIXED CODE ###

a=int(input())
s=input()
t=s if a>=3200 else "red"
print(t)
import sys
num_bill, y = map(int, input().split())

for num_10000 in range(y // 10000 + 1):
    for num_5000 in range(min((y - num_10000 * 10000) // 5000 + 1, num_bill - num_10000 + 1)):
        (num_bill - num_10000 - num_5000)
        if ((num_bill - num_10000 - num_5000) * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, (num_bill - num_10000 - num_5000))
            sys.exit()

print('-1 -1 -1')

### FIXED CODE ###

import sys
num_bill, y = map(int, input().split())
bills = [1000, 5000, 10000]

num_1000, num_5000, num_10000 = 0, 0, 0

for num_10000 in range(y // 10000 + 1):
    if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
        print(num_10000, num_5000, num_1000)
        sys.exit()
        
    iter_num = min(((y - num_10000 * 10000) // 5000 + 1), (num_bill - num_10000 + 1))
    for num_5000 in range(iter_num):
        if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, num_1000)
            sys.exit()
        
        num_1000 = num_bill - num_10000 - num_5000
        if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, num_1000)
            sys.exit()

print('-1 -1 -1')
n,m=map(int,input().split())
a=list(map(int,input().split()))

import math
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] //math.gcd(ans, a[i])

cnt=0
i=1
tmp=ans
while 1:
    #print(tmp)
    if tmp%2==0 and (tmp//2)%2==1:
        if (tmp//2)%2<=m:
            cnt+=1
        else:
            break
    
    if tmp//2>m:
        break
    i+=1
    tmp=ans*i

print(cnt)






### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

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

cnt=1
while (a[0]%(2**cnt))==0:
    cnt+=1

cnt-=1
for item in a[1:]:
    if item%(2**cnt)!=0:
        print(0)
        exit()
    if (item//(2**cnt))%2==0:
        print(0)
        exit()


import fractions
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] //fractions.gcd(ans, a[i])

if ans%2==1:
    print(0)
    exit()

if ans//2>m:
    print(0)
    exit()

ans=ans//2

print((((m//ans)*(-1))//2)*(-1))
A = input()
print(int(A[0])+int(A[1]+int(A[2]))

### FIXED CODE ###

A = input()
print(int(A[0])+int(A[1])+int(A[2]))
A,B,C,K=map(int, input().split(' '))
A_array, B_array, C_array, cards = [1] * A, [0] * B, [-1] * C, []
cards.extend(A_array)
cards.extend(B_array)
cards.extend(C_array)
total = 0
for _ in range(K):
    tmp = max(cards)
    total += tmp
    cards.remove(tmp)

print(total)

### FIXED CODE ###

A,B,C,K=map(int, input().split(' '))
ans = 0
if A >= K:
    print(K)
elif A + B >= K:
    print(A)
else:
    print(A - (K-A-B))
a, b = map(int, input().split())
print(max(a + b, a - b, a * b)

### FIXED CODE ###

a, b = map(int, input().split())
print(max(a + b, a - b, a * b))
k=int(input())
if k%2==0:
  print(-1)
  exit()
  
ans=1
pin=7
mod=k

for i in range(1000000):
  if pin%k==0:
    print(ans)
    exit()
    
  cnt+=1
  pin*=10
  pin+=7
  pin%=mod
  

print('-1')
  


### FIXED CODE ###

k=int(input())
ans='-1'
a=7
for i in range(1,10**6+1):
  if a%k==0:
    ans=i
    break

  a=((10*a)+7)%k
    
print(ans)
N, M = map(int, input().split())
result = [0] * N

for i in range(N):
    K, A = list(map(int, input().split()))
    K = s[0]
    A = s[1:]
    for j in range(K):
        result[A[j]-1] = result[A[j]-1] + 1

print(result.count(N))


### FIXED CODE ###

N, M = map(int, input().split())
result = [0] * M

for i in range(N):
    s = list(map(int, input().split()))
    K = s[0]
    A = s[1:]
    for j in range(K):
        result[A[j]-1] = result[A[j]-1] + 1

print(result.count(N))
max_val = int(1e+6+1)
def make_kago(x):
    kago = [0 for _ in range(x+1)]
    sosuu = []
    for i in range(2,x+1):
        if kago[i] != 0:
            continue
        sosuu.append(i)
        for j in range(i, x+1, i):
            if kago[j] == 0:
                kago[j] = i
    return kago, sosuu

kago, sosuu = make_kago(max_val)

def prime_factorization(x):
    if x==0 or x==1:
        return None
    soinsuu = []
    while x!=1:
        soinsuu.append(kago[int(x)])
        x = x/kago[int(x)]
    
    soinsuu_dict = dict()
    for i in range(len(soinsuu)):
        if soinsuu[i] not in soinsuu_dict:
            soinsuu_dict[soinsuu[i]] = 1
        else:
            soinsuu_dict[soinsuu[i]]+=1
    return soinsuu_dict

N = int(input())
As = list(map(int, input().split()))

exists = [0 for _ in range(int(1e+6+1))]

complete_ok = True
for i, A in enumerate(As):
    soinsuu_dict = prime_factorization(A)
    keys = list(soinsuu_dict.keys())
    for key in keys:
        if exists[key] != 0:
            complete_ok = False
        exists[key] += 1

part_ok = False
for i in range(len(exists)):
    if exists[i] == len(As):
        part_ok = True

if complete_ok == True:
    print("pairwise coprime")
elif part_ok == False:
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###


max_val = int(1e+6+1)
def make_kago(x):
    kago = [0 for _ in range(x+1)]
    sosuu = []
    for i in range(2,x+1):
        if kago[i] != 0:
            continue
        sosuu.append(i)
        for j in range(i, x+1, i):
            if kago[j] == 0:
                kago[j] = i
    return kago, sosuu

kago, sosuu = make_kago(max_val)

def prime_factorization(x):
    if x==0:
        return None
    soinsuu = []
    while x!=1:
        soinsuu.append(kago[int(x)])
        x = x/kago[int(x)]
    
    soinsuu_dict = dict()
    for i in range(len(soinsuu)):
        if soinsuu[i] not in soinsuu_dict:
            soinsuu_dict[soinsuu[i]] = 1
        else:
            soinsuu_dict[soinsuu[i]]+=1
    return soinsuu_dict

N = int(input())
As = list(map(int, input().split()))

exists = [0 for _ in range(int(1e+6+1))]

complete_ok = True
exist_one = False

for i, A in enumerate(As):
    if A == 1:
        continue
    soinsuu_dict = prime_factorization(A)
    keys = list(soinsuu_dict.keys())
    for key in keys:
        if exists[key] != 0:
            complete_ok = False
        exists[key] += 1

part_ok = False
for i in range(len(exists)):
    if exists[i] == len(As):
        part_ok = True

if complete_ok == True:
    print("pairwise coprime")
elif part_ok == False:
    print("setwise coprime")
else:
    print("not coprime")
import sympy
N = int(input())
list(map(sympy.divisor_count,list(range(1,N + 1))[:: 2])).count(8)

### FIXED CODE ###

import math

N = int(input())

def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num


print(int(list(map(search_divisor_num,list(range(1,N + 1))[:: 2])).count(8)))
# coding: utf-8
import collections
import math

l = int(input())
st = []
for i in range(l):
    x = ''.join(sorted(input()))
    st.append(x)
c = collections.Counter(st)
cv = c.values()
sum = 0
for i in cv:
    if int(i) > 1:
        sum = sum + math.factorial(int(i))/2

print(math.floor(sum))

### FIXED CODE ###

# coding: utf-8
import collections
import math

l = int(input())
st = []
for i in range(l):
    x = ''.join(sorted(input()))
    st.append(x)
c = collections.Counter(st)
cv = c.values()
sum = 0
for i in cv:
    if int(i) > 1:
        tm = 0
        for j in range(int(i)-1):
            tm = tm + int(i)-1-j
        sum = sum + tm

print(math.floor(sum))
n = int(input())
a = list(map(int, input().split()))
q = int(input())
A = [0]*100000

for i in a:
    A[i] += 1
    
ans = sum(a)

for i in range(q):
    b, c = map(int, input().split())
    ans = ans+((c-b)*(A[b]))
    print(ans)
    A[c] += A[b]
    A[b] = 0


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
A = [0]*1000000

for i in a:
    A[i] += 1
    
ans = sum(a)

for i in range(q):
    b, c = map(int, input().split())
    ans = ans+((c-b)*(A[b]))
    print(ans)
    A[c] += A[b]
    A[b] = 0
data_str = input()
data = data_str.split(" ")
print(int(data[0]) * int(data[1]) +' '+2 * (int(data[0])+int(data[1])))


### FIXED CODE ###

data_str = input()
data = data_str.split(" ")
print(int(data[0]) * int(data[1]), 2 * (int(data[0])+int(data[1])))
def abc106_a():
    a, b = map(int, input().split())
    b = int(input())

    return a * b - a - b + 1


print(abc106_a())

### FIXED CODE ###

def abc106_a():
    a, b = map(int, input().split())

    return a * b - a - b + 1


print(abc106_a())
import itertools

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

candidate = list(range(a, b+1, 1))
if n == 1:
    if a == b:
        print(a)
    else:
        print(0)
elif n == 2:
    print(a)
elif n >= 3:
    c = list(itertools.combinations_with_replacement(candidate, n-2))
    suml = []
    for i in c:
        suml.append(sum(i) + 4 + 6)
    sum_set = set(suml)
    print(len(sum_set))

### FIXED CODE ###

import itertools

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

if n == 1:
    if a == b:
        print(1)
    else:
        print(0)
elif n == 2:
    print(1)
elif n >= 3:
    if a > b:
        print(0)
    else:
        smin = a * n + (b-a)
        smax = b * n - (b-a)
        print(smax-smin+1)
n = int(input())
s = input().split()
for i in (reverse(s)):
    print(s)


### FIXED CODE ###

n = int(input())
s = input().split()
s.reverse()
print(' '.join(s))
N,K=map(int,input().split())

l=[] # 与えられた寿司のリスト。寿司をタプル(ネタti,おいしさdi)で表す。既に食べた種類の寿司は，そのおいしさdiをdjに移す。食べた寿司はリストから削除する。
dj=[] # 既に食べた種類の寿司の「おいしさ基礎ポイント」を格納するリスト。食べた寿司の「おいしさ基礎ポイント」はリストから削除する。
s=set() # 既に食べた寿司の種類を格納するセット

for i in range(N):
    t,d=map(int,input().split())
    l.append((t,d))
l.sort(key=lambda x:x[1],reverse=True) # l内の寿司をおいしさdiで降順にソート

ans=K**2
j=0 # 既に食べたことのある種類の寿司を更に食べた回数

for i in range(K): # i番目に食べる寿司について
    while l and l[0][0] in s: # lが空でなく，先頭の寿司の種類がsに入っている（先頭の寿司が食べたことのある種類である）場合
        dj.append((l.pop(0))[1]) # 食べたことのない種類の寿司がlの先頭に現れるか，lが空になるまで，先頭の寿司のおいしさをdjに格納する
    if not dj or l[0][1]>=dj[0]-(2*K-1-2*j): # djが空である場合，又は，lの先頭の寿司のおいしさと，djの先頭の「寿司のおいしさ」から「種類ボーナスポイント」の差分を減じたものを比較し，前者が勝る場合
        ans+=l[0][1] # lの先頭の寿司のおいしさに「種類ボーナスポイント」の差分を加えたものを答えに加算
        s.add(l[0][0]) # その寿司の種類をsに追加
        l.pop(0) # その寿司をlから削除
    else: #　後者が勝る場合
        ans+=dj[0]-(2*K-1-2*j) # djの先頭の「寿司のおいしさ」を答えに加算
        dj.pop(0) # その「寿司のおいしさ」をdjから削除
        j+=1

print(ans)

### FIXED CODE ###

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

l=[] # 寿司リスト。ただし，「おいしさ」を第1要素にする
m=[] # 寿司タプルをそのまま入れる
s=set()

for i in range(N):
    t,d=map(int,input().split())
    l.append((d,t))
l.sort(reverse=True) 

ans=K**2
t=0 # 既に食べたことのある種類の寿司を更に食べた回数

i=0 # l内を走査する際の添字
j=0 # m内を操作する際の添え字

for _ in range(K): # _番目に食べる寿司について
    while i<N and l[i][1] in s:
        m.append(l[i]) # そのままmに追加する
        i+=1 # lの先頭の要素を削除せず，
    if (i<N and (m and j<len(m)) and l[i][0]>=m[j][0]-(2*K-1-2*t)) or (not m or j>=len(m)):
        ans+=l[i][0]
        s.add(l[i][1])
        i+=1
    else:
        ans+=m[j][0]-(2*K-1-2*t)
        j+=1
        t+=1

print(ans)
n,m=int(input().split())
print((n-1)*(m-1))

### FIXED CODE ###

n,m=map(int,input().split())
print((n-1)*(m-1))
from collections import deque

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


noz=[x-a for x in cards].count(0)
pl=[x-a for x in cards if x-a>0]
nl=[a-x for x in cards if x-a<0]
sl=[pl,nl][len(nl)<=len(pl)]
ll=[pl,nl][len(pl)<len(nl)]

sl.sort()
ll.sort()

sumfunc = lambda n, l: sum([l[x]*((n>>x)&1) for x in range(len(l))])

sumsl=[sumfunc(i,sl) for i in range(1,2**len(sl))]

count=0
p=sum([not sumsl[-1]<sumfunc(2**i,ll) for i in range(1,len(ll)+1)])
q=sum([sumsl[0]>=sumfunc(2**i-1,ll) for i in range(1,len(ll)+1)])

count=[sumfunc(j,ll) in sumsl for j in range(2**q-1,2**p)].count(True)

print((count+1)*(2**noz)-1)


### FIXED CODE ###

import sys

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

integers=[x-a for x in cards]
cards.append(a)
f=max(cards)*n


dp=[[0 for i in range(n+1)] for j in range(2*f+1) ]

for y in range(n+1):
    for x in range(2*f+1):
        if y==0 and x==f:
            dp[x][y]=1
        elif y>0 and (x-integers[y-1]<0 or x-integers[y-1]>2*f):
            dp[x][y]=dp[x][y-1]
        elif y>0 and x-integers[y-1]>=0 and x-integers[y-1]<=2*f:
            dp[x][y]=dp[x-integers[y-1]][y-1]+dp[x][y-1]
        else:
            dp[x][y]=0
print(dp[f][n]-1)
x = int(raw_input()) ,
y = int(raw_input())

print x*y ,
print 2*x+2*y

### FIXED CODE ###

a, b = map(int, raw_input().split())

print '{0} {1}'.format(a*b, 2*a + 2*b)
x = int(input())

list1 = list(map(int, input().split(" ")))

def calc():
    result = 1
    if 0 in result:
        print("-1")
        exit()
    for i in list1:
        result *= i
        if result > 1000000000000000000:
            print("-1")
            exit()
    print(result)

calc()

### FIXED CODE ###

def main():
    x = int(input())
    list1 = list(map(int, input().split(" ")))
    result = 1

    if 0 in list1:
        print(0)
        return 
    
    for i in list1:
        result *= i
        if result > 1000000000000000000:
            print("-1")
            exit()
    print(result)

main()
import sys

def rec(i):
    #if(i==0):print(i,H[i])
    #if(i>=1):print(i,H[i],H[i-1])
    #if(i>=2):print(i,H[i],H[i-2])
    if i==0:return 0

    res = abs(H[i]-H[i-1]) + rec(i-1)


    if(i==1): return res

    res2 = abs(H[i]-H[i-2]) + rec(i-2)

    return min(res,res2)

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

print(rec(N-1))

#7
#2 9 4 5 1 6 10


### FIXED CODE ###

import sys


N = int(input())

H = list(map(int,input().split()))

dp = [float('inf')]*N

dp[0] = 0
#print(N)
#print(H)
#print(dp)


for i in range(1,N):
    if(i==1):
        dp[1] = abs(H[1]-H[0])
    else:
        dp[i] = dp[i-1]+abs(H[i]-H[i-1])
        if(dp[i] > dp[i-2]+abs(H[i]-H[i-2])):
            dp[i] = dp[i-2]+abs(H[i]-H[i-2])
        #
        #print(i,dp)

print(dp[-1])

#7
#2 9 4 5 1 6 10
s = input()
f = 0
ans = 0
if s[0] == "B":
    ans += 1
    while s[0] == "B":
        s = s[1:]

s = s[::-1]

if s[0] == "B":
    ans += 1
    while s[0] == "B":
        s = s[1:]

print(ans+s.count("B")*2)

### FIXED CODE ###

s = input()
ans = 0
bw = s[0]
for i in s:
    if bw == "B" and i == "W":
        ans += 1
        bw = "W"
    elif bw == "W" and i == "B":
        ans += 1
        bw = "B"
print(ans)
a,b,c=map(int,input().split())
if abs(a-b)<abs(a-c):
  prinnt('A')
else:
  print('B')

### FIXED CODE ###

a,b,c=map(int,input().split())
if abs(a-b)<abs(a-c):
  print('A')
else:
  print('B')