Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

class ModOperator:
    def __init__(self, MOD: int = 10 ** 9 + 7):
        self.MOD = MOD
        self.factorials = [1, 1]    # 階乗のメモ

    # x^n % MOD
    def mod_pow(self, x: int, n: int):
        bi = str(format(n, "b"))
        res = 1
        a = x
        for i in range(len(bi)):
            if n >> i & 1:
                res = (res * a) % self.MOD
            a = (a * a) % self.MOD
        return res
    
    # x! % MOD
    def mod_fact(self, x: int):
        if x < len(self.factorials):
            return self.factorials[x]
        else:
            res = self.factorials[-1]
            for i in range(len(self.factorials), x + 1):
                res = res * i % self.MOD
                self.factorials.append(res)
        return res % self.MOD

    # inverse of a number
    def mod_inv(self, x: int):
        return self.mod_pow(x, self.MOD - 2)
    
    # conmination nCk
    def mod_comb(self, n: int, k: int):
        numerator = self.mod_fact(n)
        denomintator1 = self.mod_fact(k)
        denomintator2 = self.mod_fact(n - k)
        denomintator = denomintator1 * denomintator2 % self.MOD
        return numerator * self.mod_inv(denomintator) % self.MOD


def main():
    n, a, b = map(int, input().split())
    op = ModOperator()
    print((op.mod_pow(2, n) - op.mod_comb(n, a) - op.mod_comb(n, b) - 1) % MOD)

    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

class ModOperator:
    def __init__(self, MOD: int = 10 ** 9 + 7):
        self.MOD = MOD

    def mod_pow(self, x: int, n: int):
        bi = str(format(n, "b"))
        res = 1
        a = x
        for i in range(len(bi)):
            if n >> i & 1:
                res = (res * a) % self.MOD
            a = (a * a) % self.MOD
        return res
    
    def mod_fact(self, x: int):
        res = 1
        for i in range(1, x + 1):
            res = res * i % self.MOD
        return res % self.MOD
    
    def mod_partial_fact(self, x: int, y: int):
        res = 1
        for i in range(x - y + 1, x + 1):
            res = res * i % self.MOD
        return res % self.MOD

    def mod_inv(self, x: int):
        return self.mod_pow(x, self.MOD - 2)
    
    def mod_comb(self, n: int, k: int):
        numerator = self.mod_partial_fact(n, k)
        denomintator = self.mod_fact(k)
        return numerator * self.mod_inv(denomintator) % self.MOD

def solve(n: int, a: int, b: int):
    op = ModOperator()
    print((op.mod_pow(2, n) - op.mod_comb(n, a) - op.mod_comb(n, b) - 1) % MOD)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(n, a, b)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import bisect
n,k= (int(i) for i in input().split())
array = []
for i in range(n):
 a,b= (int(i) for i in input().split())
 for j in range(b):
  bisect.insort(array, a, lo=0, hi=len(array))
print(array[k-1])

### FIXED CODE ###

import bisect
n,k= (int(i) for i in input().split())
array = []
for i in range(n):
 a,b= (int(j) for j in input().split())
 array.append((a,b))
array = sorted(array)
cnt = 0
for ab in array:
    a,b = ab
    cnt += b
    if cnt >= k:
        print(a)
        break
### BUGGY CODE ###

import numpy as np

MOD = 10**9+7
S = str(input())
check = []
ans = 0
plo = np.array([1]+[0] * 12)
N = len(S)
for i in range(N):
    if S[N - 1 - i] == '?':
        temp = np.copy(plo)
        for k in range(1, 10):
            j = (k * 10 ** i) % 13
            temp += np.r_[plo[-j:],plo[:-j]]
        plo = temp % MOD
    else:
        j = (int(S[N - 1 - i]) * 10 ** i) % 13
        plo = np.r_[plo[-j:],plo[:-j]]
print(plo[5])

### FIXED CODE ###

from copy import copy

MOD = 10**9 + 7
s = input()
count = [0 for _ in range(13)]
count[0] = 1
for i in range(len(s)):
    new = [0 for _ in range(13)]
    for m in range(13):
        new[(m * 10) % 13] = count[m]
    count = new
    if s[i] != "?":
        div = int(s[i])
        count = count[-div:] +  count[:-div]
    else:
        new = [0 for _ in range(13)]
        pre = sum(count[:3])
        SUM = sum(count) % MOD
        for j in range(13):
            pre += count[(j+3) % 13]
            pre -= count[j % 13]
            new[j] = (SUM - pre) % MOD
        count = new
print(count[5])
### BUGGY CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
print(max(a[1:]))
for i in range(1, n-1):
    if a[i] != a_max:
        print(a_max)
    else:
        print(max(max(a[:i]), max(a[i+1:])))
print(max(a[:n-1]))
        

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
ind_M = a.index(a_max)
tmpl = a
tmpl.pop(ind_M)
for i in range(n):
    if i != ind_M:
        print(a_max)
    else:
        print(max(tmpl))
### BUGGY CODE ###

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = MAP()
A = [None] * N
for i in range(N):
    A[i] = [a-1 for a in LIST()]

k = 0
valid = [1] * M
ans = INF
while k < M:
    cnt = [0] * M
    for i in range(N):
        mn = INF
        idx = -1
        for j in range(M):
            a = A[i][j]
            if valid[a]:
                # まだ有効なもののうち、一番順位が高いスポーツにカウント追加
                cnt[a] += 1
                break
    mx = max(cnt)
    ans = min(ans, mx)
    for i in range(M):
        # 票が最も集まったものは次から選ばないようにする
        if cnt[i] == mx:
            valid[i] = 0
            k += 1
print(ans)


### FIXED CODE ###

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = MAP()
A = list2d(N, M, 0)
for i in range(N):
    for j, a in enumerate(LIST()):
        # データの持ち方を変える
        A[i][a-1] = j

k = 0
valid = [1] * M
ans = INF
while k < M:
    cnt = [0] * M
    for i in range(N):
        mn = INF
        idx = -1
        for j in range(M):
            if valid[j] and A[i][j] < mn:
                mn = A[i][j]
                idx = j
        # 一番順位が高いスポーツにカウント追加
        cnt[idx] += 1
    mx = max(cnt)
    ans = min(ans, mx)
    for i in range(M):
        # 票が最も集まったものは次から選ばないようにする
        if cnt[i] == mx:
            valid[i] = 0
            k += 1
print(ans)
### BUGGY CODE ###

def main():
  from bisect import bisect
  n,k,*a=map(int,open(0).read().split())
  a.sort()
  i=bisect(a,0)
  a,b,c=a[i:],a[:i],a[i-1::-1]
  n,m=len(a),len(b)
  ok=10**18
  ng=-ok
  while ok-ng>1:
    x=(ok+ng)//2
    s=t=0
    i=n
    j=-1
    for y in a:
      while i and a[i-1]*y>x:i-=1
      while j+1<m and b[j+1]*y<=x:j+=1
      s+=j+1
      t+=i
      if y*y<=x:t-=1
    s+=t//2
    t=0
    i=m
    for y in c:
      while i and c[i-1]*y>x:i-=1
      t+=i
      if y*y<=x:t-=1
    s+=t//2
    if s>=k:ok=x
    else:ng=x
  print(ok)
main()

### FIXED CODE ###

from bisect import*
def solve(x):
  s=t=0
  i=n
  j=-1
  for y in a:
    while i and a[i-1]*y>x:i-=1
    while j+1<m and b[j+1]*y<=x:j+=1
    s+=j+1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  t=0
  i=m
  for y in c:
    while i and c[i-1]*y>x:i-=1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  return s
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bisect(t,0)
a,b,c=t[i:],t[:i],t[i-1::-1]
n,m=len(a),len(b)
ok=10**18
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if solve(mid)>=k:ok=mid
  else:ng=mid
print(ok)
### BUGGY CODE ###

#%%
import numpy as np
#%%
def receive_round_setting():
    round_settings = input()
    N, K, Q = round_settings.split(' ')
    N, K, Q = int(N), int(K), int(Q)
    participants = np.full(N, K, dtype='i')
    round_settings = {'N':N, 'K':K, 'Q':Q,
                    'participants':participants}
    return round_settings

def answer_question(round_settings):
    for i in range(round_settings['Q']):
        answerer = int(input()) - 1
        round_settings['participants'] -= 1
        round_settings['participants'][answerer] += 1
    return round_settings
        
def announce_resutl(round_setting):
    for participant in round_settings['participants']:
        if participant > 0:
            print('Yes')
        else:
            print('No')

    return 

if __name__ == '__main__':
    round_settings = receive_round_setting()
    round_settings = answer_question(round_settings)
    announce_resutl(round_settings)


### FIXED CODE ###


import numpy as np
def receive_round_setting():
    round_settings = input()
    N, K, Q = round_settings.split(' ')
    N, K, Q = int(N), int(K), int(Q)
    participants = np.full(N, K, dtype='i')
    round_settings = {'N':N, 'K':K, 'Q':Q,
                    'participants':participants}
    return round_settings

def answer_question(round_settings):
    round_settings['participants'] -= 1*round_settings['Q']
    answerers = np.zeros(shape=round_settings['N'], dtype='i')
    for _ in range(round_settings['Q']):
        answerer = int(input()) - 1
        answerers[answerer] += 1
    round_settings['participants'] += answerers
    return round_settings
        
def announce_resutl(round_setting):

    [print('Yes') if participant > 0 else print('No')
    for participant in round_settings['participants']]

if __name__ == '__main__':
    round_settings = receive_round_setting()
    if round_settings['Q'] < round_settings['K']:
        announce_resutl(round_settings)
    else:
        round_settings = answer_question(round_settings)
        announce_resutl(round_settings)
    # round_settings = receive_round_setting()
    # round_settings = answer_question(round_settings)
    # announce_resutl(round_settings)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from heapq import heappush, heappop

A = []
inp = [None]
while inp[0] != "end":
    inp = [n for n in input().split()]
    if inp[0] == "insert":
        heappush(A, -int(inp[1]))
    elif inp[0] == "extract":
        print(-heappop(A))

### FIXED CODE ###

# -*- coding: utf-8 -*-
from heapq import heappush, heappop

A = []
inp = [None]
while inp[0] != "end":
    inp = input().split()
    if inp[0] == "insert":
        heappush(A, -int(inp[1]))
    elif inp[0] == "extract":
        print(-heappop(A))
### BUGGY CODE ###

x = int(input())


def func(p):
    q = 1
    while q <= x:
        q *= p
    return q / p


z = []
a = 1

while a <= x:
    z.append(func(a))
    a += 1

print(max(z))


### FIXED CODE ###

x = int(input())

if x == 1:
    print("1")
    exit()


def func(p):
    q = p
    while q < x:
        q *= p
        if q == x:
            return q
    if q / p == p:
        return 1
    else:
        return q // p


z = []
a = 2

while a <= x:
    z.append(func(a))
    a += 1

print(max(z))
### BUGGY CODE ###

import sys
from collections import deque

def main():
    input = sys.stdin.readline
    N = int(input())
    ans = 0
    q = deque()
    for _ in range(N):
        s = str(input().strip())
        for i in range(len(s)-1):
            if s[i:i+2] == 'AB':
                ans += 1

        q_ = deque()
        while len(q) > 0:
            s1 = q.popleft()

            if s[-1] == 'A' and s1[0] == 'B':
                ans += 1
                s = s + s1
            elif s[0] == 'B' and s1[-1] == 'A':
                ans += 1
                s = s1 + s
            else:
                q_.append(s1)

        q_.append(s)
        q = q_

    return ans


if __name__ == '__main__':
    print(main())


### FIXED CODE ###

import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    ans = 0
    ba = 0  # Num. of str that the first letter is B and the last one is A.
    xa = 0  # Num. of str that the last letter is A and the first one is not B.
    bx = 0  # Num. of str that the first letter is B and the last one is not A.
    for _ in range(N):
        s = str(input().strip())

        # Count the number of AB contained in the initial strings.
        for i in range(len(s)):
            if s[i:i+2] == 'AB':
                ans += 1

        if s[0] == 'B' and s[-1] == 'A':
            ba += 1
        elif s[-1] == 'A':
            xa += 1
        elif s[0] == 'B':
            bx += 1

    if ba == 0:
        # One xa ans one bx make one new "AB".
        #   xa + bx -> xABx
        ans += min(xa, bx)

    elif max(xa, bx) == 0:
        # N of ba make N-1 new "AB".
        # BxxA + BxxA + ... + BxxA -> BxxABxxAB...ABxxA
        ans += ba - 1

    else:  # There is at least one bx or ax and at least one ba.
        # N of ba make N-1 new "AB" and a ba.
        #   ba + ba + ... + ba -> baba...ba = ba
        # The last remaining ba and bx/ax make a new "AB" and a new bx/ax.
        #   ba + bx -> bABx = bx,  xa + ba -> xABa = xa
        # Then, bx and xa make a new "AB".
        #   xa + bx -> xABx 
        ans += ba + min(xa, bx)

    return ans


if __name__ == '__main__':
    print(main())
### BUGGY CODE ###


def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes) if b else print(no)
from collections import Counter,deque,defaultdict
# import itertools
# import math
import networkx as nx
# from bisect import bisect_left,bisect_right
n,m=n1()
ab=n3(m)

ans={}
d=[0]*(n+1)
p=[1]
p2=[]
while len(ans)<n-1:
    for c in p:
        d[c]=1
        for a,b in ab:
            if a==c and d[b]==0:
                p2.append(b)
                d[b]=1
                ans[b]=a
            if b==c and d[a]==0:
                p2.append(a)
                d[a]=1
                ans[a]=b
    p=p2.copy()
    p2=[]

A=list(ans.items())
A.sort(key=lambda x:x[0])
print("Yes")
for line in A:
    print(line[1])

### FIXED CODE ###


def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes) if b else print(no)
from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right

n,m=n1()
ab=n3(m)

node=defaultdict(list)
for a,b in ab:
    node[a].append(b)
    node[b].append(a)
    
p=deque([1])
d=[0]*(n+1)
while len(p)>0:
    c=p.popleft()
    for i in node[c]:
        if d[i]==0:
            d[i]=c
            p.append(i)
            
print("Yes")
for i in range(2,n+1):
    print(d[i])
### BUGGY CODE ###

import bisect

n = int(input())

d = {}
m = 1
for i in range(n):
    s = input()
    d.setdefault(s, 0)
    d[s] += 1
    if m < d[s]:
        m = d[s]

l = []
for i, j in d.items():
    if j == m:
        bisect.insort_left(l, i)
        
print("\n".join(l))


### FIXED CODE ###

from collections import Counter

n = int(input())

l = [input() for i in range(n)]

c = Counter(l)

ml = c.most_common()
mc = ml[0][1]

ml.sort()

for i in ml:
    if i[1] == mc:
        print(i[0])
### BUGGY CODE ###

#-------------------------------------------------------------------------------
#関数定義
def f(a,d,T):
    try:
        return T[d+1:].index(a)+(d+1)
    except ValueError:
        return len(T)

def g(a,d,T):
    try:
        return (d-1)-T[d-1::-1].index(a)
    except ValueError:
        return 0
#-------------------------------------------------------------------------------
#インポート
from math import inf
from random import random,randint
import time
from copy import copy
#-------------------------------------------------------------------------------
#定数
TIME_LIMIT=1.88 #ループの時間制限
PROB=0.001 #突然変異の確率  
A=26 #アルファベットの数
START=time.time()
C_MIN,C_MAX=1,5
#-------------------------------------------------------------------------------
#読み込み部
D=int(input())

C=[0]+list(map(int,input().split())) #減る満足度のベース
S=[0]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))           
#-------------------------------------------------------------------------------
#貪欲部
L=[0]*(A+1)
T=[0]
for d in range(1,D+1):
    Y=-inf
    E=0
    for a in range(1,A+1):
        X=S[d][a]
        for s in range(1,A+1):
            if a!=s:
                X-=C[s]*(d-L[s])

        if X>Y:
            Y=X
            E=a
    L[E]=d
    T.append(E)
#-------------------------------------------------------------------------------
#調節部
while time.time()-START<=TIME_LIMIT:
    d=randint(1,D)
    p=T[d]
    q=randint(1,A)
    Y=(d-g(p,d,T))*(f(p,d,T)-d)
    Z=(d-g(q,d,T))*(f(q,d,T)-d)
        
    if (S[d][q]-S[d][p])+Z*C[q]-Y*C[p]>0 or random()<PROB:
        T[d]=q

for i in range(1,D+1):
    print(T[i])


### FIXED CODE ###

from random import randint
A=26

D=int(input())

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

S=[0]*D
for i in range(D):
    S[i]=list(map(int,input().split()))

for j in range(D):
    print(randint(1,A))
### BUGGY CODE ###

from collections import Counter
n, k = map(int, input().split())
a = Counter((i for i in input().split()))

sort_count = sorted(a.items(), key=lambda x: x[1])

total = 0
while len(sort_count) > k:
    _, n = sort_count.pop(0)
    total += n

print(total)


### FIXED CODE ###

from collections import Counter


n, k = map(int, input().split())
a = Counter((i for i in input().split()))

sort_count = sorted(a.values())


total = 0
l = len(sort_count)

if len(sort_count) <= k:
    print(0)
else:
    print(sum(sort_count[:l-k]))
### BUGGY CODE ###

N = int(input())
numbers = [int(input()) for _ in range(N)]

M = 998244353
count_all = (3 ** N - 3 * (2 ** N - 2) - 3) % M

S = sum(numbers)
count3 = [0 for _ in range(S + 1)]
count3[0] = 2
count3[numbers[0]] = 1
count2 = [0 for _ in range(S + 1)]
count2[0] = 1
count2[numbers[0]] = 1

for i in range(1, N):
  count3_next = [0 for _ in range(S + 1)]
  count2_next = [0 for _ in range(S + 1)]
  for j in range(S + 1):
    if (count3[j] > 0):
      count3_next[j + numbers[i]] += count3[j]
      count3_next[j] += 2 * count3[j]
      count2_next[j + numbers[i]] += count2[j]
      count2_next[j] += count2[j]
  count3 = count3_next
  count2 = count2_next

count_invalid = 0
for i in range(S):
  if (i > S / 2):
    count_invalid += count3[i] - 2 * count2[i]
if (S % 2 == 0):
  count_invalid += count3[S // 2] - 2 * count2[S // 2]

print((count_all - 3 * count_invalid) % M)


### FIXED CODE ###

import numpy as np

N = int(input())
numbers = [int(input()) for _ in range(N)]

M = 998244353
count_all = (3 ** N - 3 * (2 ** N - 2) - 3) % M

S = sum(numbers)
count3 = np.zeros((N, S + 1), dtype=np.int64)
count3[0, 0] = 2
count3[0, numbers[0]] = 1
count2 = np.zeros((N, S + 1), dtype=np.int64)
count2[0, 0] = 1
count2[0, numbers[0]] = 1

for i in range(1, N):
    count3[i, numbers[i]:] += count3[i - 1, :-numbers[i]]
    count3[i, :] += 2 * count3[i - 1, :]
    count3[i, :] %= M
    count2[i, numbers[i]:] += count2[i - 1, :-numbers[i]]
    count2[i, :] += count2[i - 1, :]
    count2[i, :] %= M

invalid_from = S // 2 + 1
if (S % 2 == 0):
  invalid_from = S // 2
count_invalid = np.sum(count3[N - 1, invalid_from:-1]) - 2 * np.sum(count2[N - 1, invalid_from:-1])
count_invalid %= M

print((count_all - 3 * count_invalid) % M)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

k,q=map(int,input().split())
D=list(map(int,input().split()))


for query in range(q):
    n,x,m=map(int,input().split())

    D2=[d%m for d in  D]
    S=sum(D2)
    D0=D2.count(0)
    ANS=(n-1)//k*(k-D0) - (((n-1)//k*S)+(x%m))//m 

    x2=(x+S*((n-1)//k))%m

    for i in range(n-(n-1)//k*k-1):
        nx=(x2+D[i])%m

        if nx>x2:
            ANS+=1
        x2=nx

    print(ANS)
    
        


### FIXED CODE ###

import sys
input = sys.stdin.readline

k,q=map(int,input().split())
D=tuple(map(int,input().split()))

def sum_count(A):
    S=0
    C=0
    for a in A:
        if a==0:
            C+=1
        else:
            S+=a
    return S,C

for query in range(q):
    n,x,m=map(int,input().split())

    D2=[d%m for d in  D]
    S,D0=sum_count(D2)
    R=(n-1)//k
    ANS=R*(k-D0) - (R*S+x%m)//m 
    x2=(x+S*R)%m
    rest=n-R*k-1
    S2,DR0=sum_count(D2[:rest])
    ANSR=rest - DR0 - (x2+S2)//m

    print(ANS+ANSR)
### BUGGY CODE ###

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

b = []

for i in range(n):
    if i % 2 != n % 2:
        b.insert(0, a[i])
    else:
        b.append(a[i])

print(" ".join(map(str, b)))


### FIXED CODE ###

from collections import deque

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

b = deque()

for i in range(n):
    if i % 2 != n % 2:
        b.appendleft(a[i])
    else:
        b.append(a[i])

print(" ".join(map(str, b)))
### BUGGY CODE ###

import itertools
n=int(input())
a=list(map(int,input().split()))
ind=list(itertools.combinations(range(1,n+1), 2))

cnt=0
for i in range(len(ind)):
    if ind[i][1]-ind[i][0]==a[ind[i][1]-1]+a[ind[i][0]-1]:
        cnt+=1
print(cnt)

### FIXED CODE ###

import collections

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

d = dict(collections.Counter([i + A[i] for i in range(N)]))
ans = sum([d.get(j - A[j], 0) for j in range(N)]) # .get()の第２引数は、第１引数がなかった場合に返す値

print(ans)
### BUGGY CODE ###

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


for i in range(n):
    for k in range(1,n-i):
        if l[i]-l[i+k]>1:
            print("No")
            exit()
   
print("Yes")

### FIXED CODE ###

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

min=0
ans=True

for i in range(n):
    if l[i]-1>=min:
        min=l[i]-1
    elif l[i]>=min:
        min=l[i]
    else:
        ans=False

        
if ans:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

from itertools import combinations
from bisect import bisect

N = int(input())
L = sorted(map(int,input().split()))

def it():
    for i,j in combinations(range(N),2):
        if i+1 < j:
            a,c = L[i],L[j]

            yield max(0,j-bisect(L,abs(a-c), hi=j,lo=i+1))
print(sum(it()))

### FIXED CODE ###

from itertools import combinations
from bisect import bisect

N = int(input())
L = sorted(map(int,input().split()))

def it():
    for i,j in combinations(range(N),2):
        if i+1 < j:
            a,c = L[i],L[j]

            yield max(0,j-bisect(L,abs(a-c), hi=j,lo=i+1))
print(sum(it()))