Harryxun/stf_run huggingface dataset:
def resolve():
    from functools import cmp_to_key
    # aをbの上に配置するとき、W≤sa と W+wa≤sbを満たす必要: W≤min(sa,sb−wa)
    # bをaの上に配置するとき、同様に: W≤min(sb,sa−wb)
    def cmp(a, b):
        va = min(a[1], b[1] - a[0])
        vb = min(b[1], a[1] - b[0])
        if (va == vb): return 0
        return -1 if (va > vb) else 1

    N = int(input())
    # Block[w][s][v]
    Block = [list(map(int, input().split())) for _ in range(N)]
    Block.sort(key=cmp_to_key(cmp))

    max_W = 10**4+1
    dp = [[0]*(max_W+5) for _ in range(N+1)]
    # dp[i][tot] := i番目までを使って、重さの総和がtotである場合の価値の総和の最大値
    for i in range(N):
        for tot in range(max_W+1):
            dp[i+1][tot] = max(dp[i+1][tot], dp[i][tot])
            if tot <= Block[i][1]:
                dp[i + 1][tot+Block[i][0]] = max(dp[i + 1][tot+Block[i][0]], dp[i][tot] + Block[i][2])

    print(max(dp[N]))

if __name__ == "__main__":
    resolve()

### FIXED CODE ###


def resolve():
    from functools import cmp_to_key
    # aをbの上に配置するとき、W≤sa と W+wa≤sbを満たす必要: W≤min(sa,sb−wa)
    # bをaの上に配置するとき、同様に: W≤min(sb,sa−wb)
    def cmp(a, b):
        va = min(a[1], b[1] - a[0])
        vb = min(b[1], a[1] - b[0])
        if (va == vb): return 0
        return -1 if (va > vb) else 1

    N = int(input())
    # Block[w][s][v]
    Block = [list(map(int, input().split())) for _ in range(N)]
    Block.sort(key=cmp_to_key(cmp))

    max_W = 2*(10**4+1)
    dp = [[0]*(max_W+5) for _ in range(N+1)]
    # dp[i][tot] := i番目までを使って、重さの総和がtotである場合の価値の総和の最大値
    for i in range(N):
        w, s, v = Block[i]
        for tot in range(max_W):
            dp[i+1][tot] = max(dp[i+1][tot], dp[i][tot])
            if tot <= s:
                dp[i + 1][tot+w] = max(dp[i + 1][tot+w], dp[i][tot] + v)

    print(max(dp[N]))


if __name__ == "__main__":
    resolve()
N=int(input())
A=list(map(int,input().split()))

even=[0 for i in range(N)]
odd=[0 for i in range(N)]
even[0]=max(0,A[0])
for i in range(1,N):
    if i%2==1:
        even[i]=even[i-1]
        odd[i]=odd[i-1]+max(0,A[i])
    else:
        even[i]=even[i-1]+max(0,A[i])
        odd[i]=odd[i-1]

eval=-10**20
L=-1
R=-1
for i in range(N):
    for j in range(N):
        if (j-i)%2==0:
            if i%2==0:
                test=even[j]-even[i-1]*(i!=0)+A[j]*(A[j]<0)+A[i]*(A[i]<0)
                if eval<test:
                    eval=test
                    L,R=i,j
            else:
                test=odd[j]-odd[i-1]*(i!=0)+A[j]*(A[j]<0)+A[i]*(A[i]<0)
                if eval<test:
                    eval=test
                    L,R=i,j

print(eval)
#print(L,R)

for i in range(N-1,R,-1):
    print(i+1)

for i in range(L):
    print(1)

A=A[L:R+1]
for i in range(L+2,R-1,2):
    if A[i]>0:
        print(2)
    else:
        print(3)
print(2)


### FIXED CODE ###

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

even=[0 for i in range(N)]
odd=[0 for i in range(N)]
even[0]=max(0,A[0])
for i in range(1,N):
    if i%2==1:
        even[i]=even[i-1]
        odd[i]=odd[i-1]+max(0,A[i])
    else:
        even[i]=even[i-1]+max(0,A[i])
        odd[i]=odd[i-1]

eval=-10**20
L=-1
R=-1
for i in range(N):
    for j in range(i,N):
        if j==i:
            test=A[i]
            if eval<test:
                eval=test
                L,R=i,i
        elif (j-i)%2==0:
            if i%2==0:
                test=even[j]-even[i-1]*(i!=0)+A[j]*(A[j]<0)+A[i]*(A[i]<0)
                if eval<test:
                    eval=test
                    L,R=i,j
            else:
                test=odd[j]-odd[i-1]*(i!=0)+A[j]*(A[j]<0)+A[i]*(A[i]<0)
                if eval<test:
                    eval=test
                    L,R=i,j

print(eval)
print(N-1-R+L+(R-L)//2)
#print(L,R)

for i in range(N-1,R,-1):
    print(i+1)

for i in range(L):
    print(1)

for i in range(L+2,R-1,2):
    if A[i]>0:
        print(2)
    else:
        print(3)
        
if L!=R:
    print(2)
n = input()
lol=[]
for _ in range(n):
    lol.append(input())
print('AC X ',lol.count('AC'))
print('WA X ',lol.count('WA'))
print('TLE X ',lol.count('TLE'))
print('RE X ',lol.count('RE'))

### FIXED CODE ###

n = int(input())
lol=[]
for _ in range(n):
    lol.append(input())
print('AC x ',lol.count('AC'))
print('WA x ',lol.count('WA'))
print('TLE x ',lol.count('TLE'))
print('RE x ',lol.count('RE'))
input()
ls = list(map(int, input().split(' ')))

if ls.count(0) > 0:
    print(0)
else:
    result = 1
    for i in ls:
        result *= i
        if result > 10 ** 18:
            print(-1)
    print(result)

### FIXED CODE ###

x, y = map(int, input().split(' '))
result = False
for i in range(x+1):
    if (4 * (x - i) + 2 * i) == y:
        result = True
        break
s = 'Yes' if result else 'No'
print(s)
n = int(input())
p = list(map(int,input().split())

count = 0
for i in range(n-2):
    if min(p[i],p[i+1],p[i+2]) == p[i+1]:
        count += 1

print(count)


### FIXED CODE ###

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

count = 0
for i in range(n-2):
    dammy = sorted([p[i],p[i+1],p[i+2]])
    if dammy[1] == p[i+1]:
        count += 1
print(count)
# D - Decayed Bridges
from collections import deque

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

graph = [[] for _ in range(N)]
AB = deque()
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    AB.append([a, b])
    graph[a].append(b)
    graph[b].append(a)

def isDivided(a, b, graph):
    d = deque()
    d.append(a)
    done = [0] * N
    while len(d)>0:
        now = d.popleft()
        done[now] = 1
        for i in graph[now]:
            if i==b:
                return 0
            elif done[i]==0:
                d.append(i)
    return sum(done)

ans = 0
for i in range(M):
    a, b = AB.popleft()
    graph[a].remove(b)
    graph[b].remove(a)
    tmpa = isDivided(a, b, graph)
    tmpb = isDivided(b, a, graph)
    if tmpa!=0:
        ans += tmpa*tmpb
        print(ans)
    else:
        print(ans)



### FIXED CODE ###

# A - Favorite Sound

A, B, C = map(int, input().split())

print(min(B//A, C))
n, sum = map(int, input().split())

for x in range(n + 1):
    for y in range(n - x + 1):
        if x * 10000 + y * 5000 + (n-x-y) * 1000 == sum:
            print(f'{x} {y} {n-x-y}')
            exit()

print('-1 -1 -1')

### FIXED CODE ###

n, sum = [int(s) for s in input().split()]

for x in range(n + 1):
    for y in range(n - x + 1):
        if x * 10000 + y * 5000 + (n-x-y) * 1000 == sum:
            print(x, y, n-x-y)
            exit()

print(-1, -1, -1)
x = int(input())
if x>=30:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

x = int(input().strip())
if x>=30:
    print("Yes")
else:
    print("No")
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
d=sum(B)
for i in range(n-1):
  if A[i+1]-A[i]==1:
    d+=B[A[i]-1]
print(d)

### FIXED CODE ###

n=int(input())
print(n**3)
import sys

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

roop = 0
queue = [1]

start = -1

for now_town in queue:
    if not town_list[now_town - 1] in queue:
        queue.append(town_list[now_town - 1])

    # 循環した
    else:
        start = town_list[now_town - 1]
        break

if start == -1:
    print(queue[K])
    sys.exit()

before_len = queue.index(start)
roop = len(queue) - before_len

print(queue[before_len + (K - before_len) % roop])


### FIXED CODE ###

import sys
import time

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

queue = {}

start = -1
count = 1

now_town = 1

for i in range(K):
    if town_list[now_town - 1] in queue:
        start = town_list[now_town - 1]
        break
    queue[town_list[now_town - 1]] = count
    now_town = town_list[now_town - 1]
    count += 1

if start == -1:
    print(now_town)
    sys.exit()

roop = len(queue) - (queue[start] - 1)
before_len = queue[start]

print(list(queue.keys())[(K - before_len) % roop + before_len - 1])
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)
    
n = int(input())
ans=1
for i in range(n):
    t = int(input())
    ans = lcm(ans,t)
    
print(ans)

### FIXED CODE ###

n = int(raw_input())

def gcd(a,b):
    if a > b:
        a,b = b,a
    # a <= b
    while a > 0:
        a,b = b%a, a
    return b

def lcm(a,b):
    g = gcd(a,b)
    return a/g * b

x = 1
for i in range(n):
    ti = int(raw_input())
    x = lcm(x, ti)

print x
n = int(input())
h = list(map(int, input().split()))
h[0] -= 1
flag = True
for i in range(n - 1):
    # print(i)
    if h[i] > h[i + 1]:
        flag = False
        break
    elif h[i] <= h[i + 1] - 1:
        h[i + 1] -= 1

if flag:
    print("Yes")
else:
    print("No")


### FIXED CODE ###


A,B,C=list(map(int,input().split()))


C=C-(A-B)
if(C<0):
    print(0)
else:
    print(C)
s=input();print(max(0,int(s[:2])-2*int(s[2:])))

### FIXED CODE ###

a,b=map(int,input().split())
print(max(0,a-b-b))
from collections import deque
x,y,a,b,c = map(int,input().split())
P = deque(sorted(list(map(int,input().split())),reverse=True)[:x])
Q = deque(sorted(list(map(int,input().split())),reverse=True)[:y])
R = deque(sorted(list(map(int,input().split())),reverse=True))
p = P.pop()
q = Q.pop()
r = R.popleft()
ans = 0
while (p < r or q < r) and r != 0:
    ans += r
    if len(R) != 0:   
        r = R.pop()
    else:
        r = 0
    if p < q:
        p = P.pop()
    else:
        q = Q.pop()
ans += sum(P)+sum(Q)+p+q
print(ans)

### FIXED CODE ###

from collections import deque
x,y,a,b,c = map(int,input().split())
P = deque(sorted(list(map(int,input().split())),reverse=True)[:x])
Q = deque(sorted(list(map(int,input().split())),reverse=True)[:y])
R = deque(sorted(list(map(int,input().split())),reverse=True))
p = P.pop()
q = Q.pop()
r = R.popleft()
ans = 0

while p < r or q < r:
    ans += r
    if len(R) != 0:   
        r = R.popleft()
    else:
        r = 0
    if p < q:
        if len(P) != 0:   
            p = P.pop()
        else:
            p = 10**10
    else:
        if len(Q) != 0:   
            q = Q.pop()
        else:
            q = 10**10
            
ans += sum(P)+sum(Q)
if p != 10**10:
    ans += p
if q != 10**10:
    ans += q
print(ans)
N, K= map(int, input().split())
lists = list(map(int, input().split()))
lists.sort()
if K>=N:
  print(0)
else:
  del lists[-K:]
  SUM = sum(lists)
  print(SUM)

### FIXED CODE ###

H, A = map(int,input().split())
a = int(H/A)
b = H/A
if a==b:
  print(a)
else:
  c = a+1
  print(c)
import numpy as np

N = int(input())

A = np.array(list(map(int, input().split())))
B = np.array(list(map(int, input().split())))

c = np.sort(A) > np.sort(B)
if np.sum(c) != N:
  print("NO")
else:
  print("YES")




### FIXED CODE ###


ll = [1, 9, 7, 4]

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

if ( a in ll ):
  ll.remove(a)
  if ( b in ll ):
    ll.remove(b)
    if ( c in ll ):
      ll.remove(c)
      if ( d in ll ):
        print("YES")
      else:
        print("NO")
    else:
      print("NO")
  else:
    print("NO")
else:
  print("NO")
n = int(input())

print('{0}'.format(pow(n, 3))

### FIXED CODE ###

n = int(input())

print('{0}'.format(pow(n, 3)))
from collections import deque
from itertools import product

h, w = map(int, input().split())
c = tuple(map(lambda x: int(x)+1, input().split()))
d = tuple(map(lambda x: int(x)+1, input().split()))
s = ['#'*(w+4)] * 2
for _ in range(h):
    s.append(f'##{input()}##')
s.extend(['#'*(h+4)] * 2)

move_a_area = [(0, -1), (-1, 0), (1, 0), (0, 1)]
move_b_area = [(i, j) for i, j in product(range(-2, 3), repeat=2) if (i, j) not in [(0, 0)] + move_a_area]

cost = [[float('inf')] * (w+4) for _ in range(h+4)]
cost[c[0]][c[1]] = 0
yet = deque([(c[0], c[1], 0)])
done = deque()

while yet:
    y, x, m = yet.popleft()
    done.append((y, x, m))
    # Move A
    for dx, dy in move_a_area:
        hh, ww = y + dy, x + dx
        if s[hh][ww] == '#' or cost[hh][ww] <= m:
            continue
        cost[hh][ww] = m
        yet.append((hh, ww, m))
    # Move B
    if not yet:
        while done:
            y, x, m = done.popleft()
            for dx, dy in move_b_area:
                hh, ww = y + dy, x + dx
                if s[hh][ww] == '#' or cost[hh][ww] <= m + 1:
                    continue
                cost[hh][ww] = m + 1
                yet.append((hh, ww, m + 1))

print(v if (v := cost[d[0]][d[1]]) < float('inf') else -1)


### FIXED CODE ###

from collections import deque
from itertools import product

h, w = map(int, input().split())
c = tuple(map(lambda x: int(x)-1, input().split()))
d = tuple(map(lambda x: int(x)-1, input().split()))
s = list(input() for _ in range(h))

move_a_area = [(0, -1), (-1, 0), (1, 0), (0, 1)]
move_b_area = [(i, j) for i, j in product(range(-2, 3), repeat=2) if (i, j) not in [(0, 0)] + move_a_area]

cost = [[float('inf')] * w for _ in range(h)]
cost[c[0]][c[1]] = 0
que = deque([(c[0], c[1], 0)])

while que:
    y, x, m = que.popleft()
    # Move A
    for dx, dy in move_a_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m:
            continue
        cost[hh][ww] = m
        que.appendleft((hh, ww, m))
    # Move B
    for dx, dy in move_b_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m + 1:
            continue
        cost[hh][ww] = m + 1
        que.append((hh, ww, m + 1))

print(cost[d[0]][d[1]] if cost[d[0]][d[1]] < float('inf') else -1)
a=map(int,raw_input().split())
a.sort()
b=0
while a!=[]:
 b+=1
 a=[i for i in a if a[i]%a[0]!=0]
print(b)

### FIXED CODE ###

a=input()
def ip(a):
    i=2
    while i**2<=a:
        if a%i==0:return False
        i+=1
    return True
b=0
for i in range(int(a)):
    c=input()
    if ip(int(c)):b+=1
print(str(b))
n = int(input())

def solve(num):
    cnt = 0
    for i in range(1,num+1):
        if num % i == 0:
            cnt += 1
    return cnt

ans = 0
for i in range(1,n+1):
    if i % 2 == 0:
        continue
    if solve(i) == 8:
        ans += 1

print(ans

### FIXED CODE ###

n = int(input())

def solve(num):
    cnt = 0
    for i in range(1,num+1):
        if num % i == 0:
            cnt += 1
    return cnt

ans = 0
for i in range(1,n+1):
    if i % 2 == 0:
        continue
    if solve(i) == 8:
        ans += 1

print(ans)
n = int(input())
flag = False
memo = {}
for a in range(1,3500)[::-1]:
    for b in range(1,3500)[::-1]:
        if (a,b) not in memo:
            memo[(b,a)] = True
             
            if (N*a*b)%(4*a*b -N*n - N*b) == 0:
                c = int((N*a*b)/(4*a*b -N*n - N*b))
                flag = True
                break
        else:
            continue
    if flag:
        break
print(a,b,c)

### FIXED CODE ###

N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        a = 4 * h * n - h * N - n * N
        if a == 0:
            break
        w = int((h * n * N) / a)
        if w > 0 and 4 / N == 1 / h + 1 / n + 1 / w:
            print(h, n, w)
            exit()
N=int(input())
A=sorted(list(map(int,input().split())),reverse=True)
cnt=0
for i in range(len(A)-1):
	for j in range(i+1,len(A)):
		if A[i]%A[j]==0:
			break
	else:
		cnt+=1
if A[-2]!=A[-1]:
	cnt+=1
print(cnt)

### FIXED CODE ###

import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
Amax=A[-1]+1
B=np.zeros(Amax,dtype=int)
ans=0
#1～Amaxの範囲でjがA[i]の倍数の時,B[j]+=1
for i in A:
	for j in range(i,Amax,i):
		B[j]+=1
#B[i]==1:その数でしか割り切れない→count up
for i in A:
	if B[i]==1:
		ans+=1
print(ans)
a,b=map(int,input().split())
    if a<9 and b<9:
      print(a*b)
    else:
		print(-1)
      

### FIXED CODE ###

a,b=map(int,input().split())
if a >= 10 or b >= 10:
  print(-1)
else:
  print(a*b)
line = input()
count = 0

for i in range(3):
  if line[i] == 1:
    count += 1

return line

### FIXED CODE ###

line = input()
count  = 0

for i in range(3):
  if line[i] == '1':
    count += 1

print(count)
# -*- coding: utf-8 -*-

"""
参考：http://tutuz.hateblo.jp/entry/2018/08/06/074104
　　　https://www.hamayanhamayan.com/entry/2018/08/05/232127
・別解
・予め必要なA,C,?の個数は集めておく。
・Bの位置を決めて、4つの選び方パターンを全部数え上げる。
・3べきの計算はpowの第三引数modで高速化
"""

MOD = 10 ** 9 + 7
S = input()

# あるBの位置よりも左にあるAと?の個数
A, LQ = [0] * len(S), [0] * len(S)
for i in range(len(S)-1):
    a = lq = 0
    if S[i] == 'A':
        a += 1
    if S[i] == '?':
        lq += 1
    A[i+1] = A[i] + a
    LQ[i+1] = LQ[i] + lq
# あるBの位置よりも右にあるCと?の個数
C, RQ = [0] * len(S), [0] * len(S)
for i in range(len(S)-1, 0, -1):
    c = rq = 0
    if S[i] == 'C':
        c += 1
    if S[i] == '?':
        rq += 1
    C[i-1] = C[i] + c
    RQ[i-1] = RQ[i] + rq

ans = 0
for i in range(len(S)):
    if S[i] == '?' or S[i] == 'B':
        # (A,B,C) と選ぶ場合(後ろの3べきは使わなかった?の分)
        case1 = (A[i] * C[i] * pow(3, LQ[i] + RQ[i], MOD)) % MOD
        # (A,B,?) と選ぶ場合
        case2 = (A[i] * RQ[i] * pow(3, LQ[i] + RQ[i] - 1, MOD)) % MOD
        # (?,B,C) と選ぶ場合
        case3 = (LQ[i] * C[i] * pow(3, LQ[i] + RQ[i] - 1, MOD)) % MOD
        # (?,B,?) と選ぶ場合
        case4 = (LQ[i] * RQ[i] * pow(3, LQ[i] + RQ[i] - 2, MOD)) % MOD
        # 全部足し合わせてMOD
        ans = (ans + case1 + case2 + case3 + case4) % MOD

print(ans)


### FIXED CODE ###

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

"""
参考：http://drken1215.hatenablog.com/entry/2018/08/05/224100_1
・文字列DP
・こういう、ちょっと状況込み入ったDPがまだ自分でうまく書けない。
・もっと数こなして経験積まなきゃなー。
"""

MOD = 10 ** 9 + 7
S = input()

# 文字列Sのi文字目まで考えたときにABCのj文字目まで照合させた個数
dp = [[0] * 4 for i in range(len(S)+1)]
dp[0][0] = 1

for i in range(len(S)):
    # i文字目でABCカウントを進めない場合(真下に送る分)
    for j in range(4):
        if S[i] == '?':
            dp[i+1][j] = (dp[i+1][j] + dp[i][j] * 3) % MOD
        else:
            dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % MOD
    # i文字目でABCカウントを進める場合(右下に送る分)
    if S[i] == '?' or S[i] == 'A':
        dp[i+1][1] = (dp[i+1][1] + dp[i][0]) % MOD
    if S[i] == '?' or S[i] == 'B':
        dp[i+1][2] = (dp[i+1][2] + dp[i][1]) % MOD
    if S[i] == '?' or S[i] == 'C':
        dp[i+1][3] = (dp[i+1][3] + dp[i][2]) % MOD

print(dp[len(S)][3])
n,m=map(int,input().split());x=y=0
for(a,b)in sorted([list(map(int,input().split()))for i in range(m)],key=lambda x:x[1]):
 if a>x:
  x=b-1
  y+=1
print(y)

### FIXED CODE ###

a,b,c=sorted(map(int,input().split()));print(c-a)
def gcd(a,b):
  r = a%b
  while r > 0:
    a=b
    b=r
    r=a%b
  return b

n = int(input())
A = list(map(int,input().split()))
num = 1
ans = 0
for i in A:
  num = i // gcd(i,num) * num

for i in A:
  ans += num/i
  ans %= 1000000007
  
print(int(ans))

### FIXED CODE ###

from fractions import gcd


n = int(input())
A = list(map(int,input().split()))
num = 1
ans = 0
for i in A:
  num = i // gcd(i,num) * num

for i in A:
  ans += num//i
  
print(int(ans%1000000007))
import numpy as np
from decimal import Decimal

N = int(input())

nums = [Decimal(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    ok_count += two_five_exists[two_count, five_count]
    
    two_pair = min(18, 18 - two_count)
    five_pair = min(18, 18 - five_count)
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)



### FIXED CODE ###

import numpy as np
from decimal import Decimal

N = int(input())

nums = [Decimal(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    two_count = min(18, two_count)
    five_count = min(18, five_count)
    ok_count += two_five_exists[two_count, five_count]

    two_pair = 18 - two_count
    five_pair = 18 - five_count
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)
def d_cake_123_priority_queue(X, Y, Z, K, A, B, C):
    # editionalの解法3
    import heapq
    # 数列A, B, Cを降順ソート
    a, b, c = sorted(A, reverse=True), sorted(B, reverse=True), sorted(C, reverse=True)

    def evaluation(x, y, z):
        # heapqは最小値を取り出す方式なので、符号を反転させないといけない
        return (-(a[x] + b[y] + c[z]), x, y, z)

    # priority queue を定義し、(A_1 + B_1 + C_1, 1, 1, 1) を追加
    q = []
    heapq.heappush(q, evaluation(0, 0, 0))
    ans = []

    # priority queueに対するK回の操作の部分
    for _ in range(K):
        (e, x, y, z) = heapq.heappop(q)
        ans.append(-e)
        if x + 1 < X and evaluation(x + 1, y, z) not in q:
            heapq.heappush(q, evaluation(x + 1, y, z))
        if y + 1 < Y and evaluation(x, y + 1, z) not in q:
            heapq.heappush(q, evaluation(x, y + 1, z))
        if z + 1 < Z and evaluation(x, y, z + 1) not in q:
            heapq.heappush(q, evaluation(x, y, z + 1))
    return '\n'.join(map(str, ans[:K]))

X, Y, Z, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
print(d_cake_123_sort_modified(X, Y, Z, K, A, B, C))

### FIXED CODE ###

def d_cake_123_sort_all(X, Y, Z, K, A, B, C):
    # editionalの解法2
    a, b, c = sorted(A, reverse=True), sorted(B, reverse=True), sorted(C, reverse=True)
    ans = []
    for i, a_i in enumerate(a, 1):
        for j, b_j in enumerate(b, 1):
            for k, c_k in enumerate(c, 1):
                if i * j * k <= K:
                    ans.append(a_i + b_j + c_k)
                else:
                    break
    ans.sort(reverse=True)
    return '\n'.join(map(str, ans[:K]))

X, Y, Z, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
print(d_cake_123_sort_all(X, Y, Z, K, A, B, C))
from math import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def evencount(n):
  cnt=0
  while n%2==0:
    cnt+=1
    n//=2
  return cnt
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  a[i]//=2
if all(evencount(i) == evencount(a[i]) for i in a):
  d=lcm(*a)
  print((m+d)//2//d)
else:print(0)

### FIXED CODE ###

from math import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def evencount(n):
  cnt=0
  while n%2==0:
    cnt+=1
    n//=2
  return cnt
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  a[i]//=2
if all(evencount(i) == evencount(a[0]) for i in a):
  d=lcm(*a)
  print((m+d)//2//d)
else:print(0)
a=input()
b=eval(input().replace(" ","*"))
print(-1 if b>10**18 else b)

### FIXED CODE ###

_=input()
A=sorted(list(map(int,input().split())))
B=1
for a in A:
    B*=a
    if B>10**18:
        B=-1
        break
print(B)
k, x = map(int, input().split())

axis = list(range(-10, 11, 1))
df = pd.DataFrame(axis)
df = df.rename(columns = {0 : 'var'})

res = []

if k == 1:
    print(x)
else:
    for i in range(1, k):

        a = df[df['var'] == x + i]
        a = list(a['var'])
        res.append(a)
        
        a = df[df['var'] == x - i]
        a = list(a['var'])
        res.append(a)
    res.append([x])
    res = sum(res, []) #リスト一段解除
    res = sorted(res) #並び替え
    print(*res)


### FIXED CODE ###

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

res = []
if k == 1:
    print(x)
else:
    for i in range(1, k):
        res.append(x + i)
    for i in range(1, k):
        res.append(x - i)
    res.append(x)
    res = sorted(res)
    print(*res)
a = [input() for i in range(2)]
b = a[1]
x = int(max(b))-int(min(b))
print(x)

### FIXED CODE ###

x = int(input())

if x%2 == 0:
  print(x)
else:
  print(x*2)