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

class Combination:

    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
        self.MOD = MOD

    def factorial(self, k):
        '''k!を求める'''
        return self.fact[k]

    def inverse_factorial(self, k):
        '''k!の逆元を求める'''
        return self.inv_fact[k]

    def combination(self, k, r):
        '''kCrを求める'''
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD
      
h, w, k = map(int, input().split())
MOD = 10**9 + 7
comb = Combination(h*w, MOD)

kumi = comb.combination(h*w - 2, k - 2)
ans = 0

for i in range(h):
    for j in range(i, h):
        diff_h = abs(i - j)
        ans += diff_h * kumi * w * w
        ans %= MOD

for i in range(w):
    for j in range(i, w):
        diff_w = abs(i - j)
        ans += diff_w * kumi * h * h
        ans %= MOD

print(ans)

### FIXED CODE ###

class Combination:

    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
        self.MOD = MOD

    def factorial(self, k):
        '''k!を求める'''
        return self.fact[k]

    def inverse_factorial(self, k):
        '''k!の逆元を求める'''
        return self.inv_fact[k]

    def combination(self, k, r):
        '''kCrを求める'''
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD
      
h, w, k = map(int, input().split())
MOD = 10**9 + 7
comb = Combination(h*w, MOD)

kumi = comb.combination(h*w - 2, k - 2)
ans = 0

for d in range(0, h):
    ans += d * (h - d) * kumi * w * w
    ans %= MOD

for d in range(0, w):
    ans += d * (w - d) * kumi * h * h
    ans %= MOD

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

N = int(input())
A = list(map(int, input().split()))
if N == 1:
  print(1)
  exit(0)
  
mod = int(1e9+7)
#### 
# https://note.nkmk.me/python-gcd-lcm/
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 lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
L = lcm_list(A)
ans = 0
for a in A:
  ans += L // a
  ans %= mod
  
print(ans)

### FIXED CODE ###

from itertools import groupby
from collections import Counter

### https://atcoder.jp/contests/abc152/submissions/15835670
def fast_prime_factorization_many(lst):
  # 素因数分解（ロー法、複数）
  from subprocess import Popen, PIPE
  res = Popen(["factor"] + list(map(str, lst)), stdout=PIPE).communicate()[0].split(b"\n")[:-1]
  return [Counter(list(map(int, r.split()[1:]))) for r in res]

def main():
  import sys
  input = sys.stdin.readline
  N = int(input())
  A = list(map(int, input().split()))
  if N == 1:
    print(1)
    exit(0)
  
  mod = int(1e9+7)
  Factors = fast_prime_factorization_many(A)
  #print(Factors)
  ### lcmを求める
  lcm = 1
  max_factor = [0] * (1000010)
  for f in Factors:
    for k,v in f.items():
      v_prev = max_factor[k]
      if v_prev < v:
        for i in range(v-v_prev):
          lcm = lcm * k % mod
        max_factor[k] = v
        
  #print(lcm)
  ans = 0
  for a in A:
    wk =  lcm * pow(a,mod-2,mod)
    #print(wk)
    ans += wk
    ans %= mod
  print(ans)
  exit(0)
  
main()
### BUGGY CODE ###

"""
連続する部分文字列の種類は多くてN**2個ある。
N<=5000という制約から考えて、これらの連続する部分文字列に対して全探索ができる。
問題は、各部分文字列が条件を満たしているかどうかをどうやって調べるかだ。
これは、各部分文字列種ごとにどの区間で出現するかをメモしておけば良い。
dic["hogehoge"] => "hogehoge"という連続部分文字列が出現する区間をメモした配列
dic["hogehoge"] = [(0,7),(2,9),(6,13),(10,17)]　といった具合だ。
dic[hogehoge][x][1]とdic[hogehoge][x+1][1]が重複しているかを調べることで条件を満たすかどうかを判定できる。
区間(i,j)のjで昇順並びになっている必要があるが、実直にi,jでループして連続部分文字列を探索すれば、自然と昇順でメモされる。
計算量はO(N**2)で間に合う。
"""
N = int(input())
S = tuple(input())

dic = {}
#ここがTLEの原因になっている。
for i in range(N):
    for j in range(N):
        if S[i:j+1] not in dic:
            dic[S[i:j+1]] = []
        dic[S[i:j+1]].append((i,j))

ans = 0
for k,v in dic.items():
    if len(v) > 1:
        for i in range(1,len(v)):
            if v[i][0]<=v[i-1][1]:
                break
        else:
            ans = max(ans,len(k))
print(ans)

### FIXED CODE ###

"""
X文字が条件にあてはまるとき、X-1文字も条件に当てはまる。したがって、二分探索を使うのがよい。
一回の探索に、O(N**2)かかる。
探索はO(logN)回行うため、全体でO(N**2logN)で、ギリ間に合う。
"""
N = int(input())
S = input()

def is_ok(X):
    dic = {}
    for i in range(N+1-X):
        sub = S[i:i+X]
        if sub not in dic:
            dic[sub] = (i,i+X-1)
        else:
            if dic[sub][1] < i:
                return True
    return False

def bisearch(high,low):
    while high - low > 1:
        mid = (high+low)//2
        if is_ok(mid):
            low = mid
        else:
            high = mid
    return low
print(bisearch(N,0))
### BUGGY CODE ###

# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
for r in range(max_r + 1):
    if R * r > N:
        break
    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            b = x // B
            a = (r, g, b)

            ans.append(a)

print(len(ans))


### FIXED CODE ###

# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

# max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
cnt = 0

max_r = N // R
for r in range(max_r + 1):
    if R * r > N:
        break

    max_g = (N - R * r) // G

    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            # b = x // B
            # a = (r, g, b)
            cnt += 1
            # ans.append(a)

# print(len(ans))
print(cnt)
### BUGGY CODE ###

s = input()
MOD = 998244353
cnt_r = []
cnt_b = []
for i in s:
    cnt_r.append(2-int(i))
    cnt_b.append(int(i))
cursum_cnt_r = [0]*(len(s)+1)
cursum_cnt_b = [0]*(len(s)+1)
for i in range(len(s)):
    cursum_cnt_r[i+1] = cursum_cnt_r[i] + cnt_r[i]
    cursum_cnt_b[i+1] = cursum_cnt_b[i] + cnt_b[i]
cursum_cnt_r = cursum_cnt_r + [cursum_cnt_r[-1]]*len(s)
cursum_cnt_b = cursum_cnt_b + [cursum_cnt_b[-1]]*len(s)

#dp[ni][ri]:nこのボールを並べたときに赤色のボールがri個含まれるときの並べ方総数
dp = [[0]*(2*len(s)+1) for i in range(2*len(s)+1)]
dp[0][0] = 1
for ni in range(1,2*len(s)+1):
    for ri in range(0,ni+1):
        if ri == 0:
            if 0 <= ni <= cursum_cnt_b[ni]:
                #青色を選ぶ
                dp[ni][ri] = dp[ni-1][ri]
        elif ri == ni:
            if 0 <= ri <= cursum_cnt_r[ni]:
                #赤色を選ぶ
                dp[ni][ri] = dp[ni-1][ri-1]
        else:
            if 0 <= ri <= cursum_cnt_r[ni] and 0 <= ni-ri <= cursum_cnt_b[ni]:
                dp[ni][ri] += dp[ni-1][ri]
                dp[ni][ri] += dp[ni-1][ri-1]
        dp[ni][ri] %= MOD 

print(max(dp[2*len(s)]))

### FIXED CODE ###

s = input()
MOD = 998244353
cnt_r = []
cnt_b = []
for i in s:
    cnt_r.append(2-int(i))
    cnt_b.append(int(i))
cursum_cnt_r = [0]*(len(s)+1)
cursum_cnt_b = [0]*(len(s)+1)
for i in range(len(s)):
    cursum_cnt_r[i+1] = cursum_cnt_r[i] + cnt_r[i]
    cursum_cnt_b[i+1] = cursum_cnt_b[i] + cnt_b[i]
cursum_cnt_r = cursum_cnt_r + [cursum_cnt_r[-1]]*len(s)
cursum_cnt_b = cursum_cnt_b + [cursum_cnt_b[-1]]*len(s)

#dp[ni][ri]:nこのボールを並べたときに赤色のボールがri個含まれるときの並べ方総数
dp = [[0]*(2*len(s)+1) for i in range(2*len(s)+1)]
dp[0][0] = 1
for ni in range(1,2*len(s)+1):
    for ri in range(0,ni+1):
        if ri == 0:
            if 0 <= ni <= cursum_cnt_b[ni]:
                #青色を選ぶ
                dp[ni][ri] = dp[ni-1][ri]
        elif ri == ni:
            if 0 <= ri <= cursum_cnt_r[ni]:
                #赤色を選ぶ
                dp[ni][ri] = dp[ni-1][ri-1]
        else:
            if 0 <= ri <= cursum_cnt_r[ni] and 0 <= ni-ri <= cursum_cnt_b[ni]:
                dp[ni][ri] += dp[ni-1][ri]
                dp[ni][ri] += dp[ni-1][ri-1]
        dp[ni][ri] %= MOD 

print(max(dp[2*len(s)]))
### BUGGY CODE ###

import numpy as np
s = list(map(int,input()))
n = len(s)
ans = 0
mod = 2019
wa = [0 for i in range(n)]
wa[0] = s[n-1]
for i in range(1,n):
    ii = i
    now = 10
    aaa = 1
    while ii > 0:
        if ii%2 == 1:
            aaa = (aaa*now)%mod
        now = (now**2)%mod
        ii //= 2
    wa[i] = (wa[i-1]+s[n-i-1]*aaa)%mod
    if wa[i] == 0:
        ans += 1

for i in range(n):
    for j in range(i+1,n):
        if wa[i] == wa[j]:
            ans += 1

print(ans)


### FIXED CODE ###

import numpy as np
s = list(map(int,input()))
n = len(s)
ans = 0
mod = 2019
past = s[n-1]
ima = 0
d = dict()
d[s[n-1]] = 1
now = 10
for i in range(1,n):
    ima = (past+s[n-i-1]*now)%mod
    if ima == 0:
        ans += 1
    if ima in d:
        d[ima] += 1
    else:
        d[ima] = 1
    past = ima
    now = (now*10)%mod

for i in d.values():
    ans += i*(i-1)//2

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

from collections import deque

n,m=map(int, input().split())
g = [[] for _ in range(n + 1)]
d = deque()
ans = [0]*(n+1)

for i in range(m):
    a,b=map(int, input().split())
    g[a].append(b)
    g[b].append(a)

d = deque()
for i in g[1]: 
    d.append(i)
    ans[i]=1

for i in range(n):
    tmp = d[0]
    for j in range(n+1):
        if tmp in g[j] and ans[j]==0:
            ans[j]=tmp
            d.append(j)
    d.popleft()

if 0 in ans[2:]:
    print('No')
else:
    print('Yes')
    for i in range(2,n+1):
        print(ans[i])

### FIXED CODE ###

from collections import deque

n,m=map(int, input().split())
g = [[] for _ in range(n + 1)]
d = deque()
ans = [0]*(n+1)

for i in range(m):
    a,b=map(int, input().split())
    g[a].append(b)
    g[b].append(a)

d = deque()
for i in g[1]: 
    d.append(i)
    ans[i]=1

while d:
    tmp = d[0]
    for i in g[tmp]:
        if ans[i] == 0:
            ans[i]=tmp
            d.append(i)
    d.popleft()

if 0 in ans[2:]:
    print('No')
else:
    print('Yes')
    for i in range(2,n+1):
        print(ans[i])
### BUGGY CODE ###

import sys

input = sys.stdin.readline

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

X = [0 for _ in range(N)]

for i in range(N):
    j = i
    f = 1
    while j < N+i:
        X[i] += f * A[j % N]
        j += 1
        f *= -1

print(*X)

### FIXED CODE ###

import sys

input = sys.stdin.readline

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

X = [0 for _ in range(N)]


for i in range(N):
    X[0] += (-1)**i * A[i]
for i in range(1, N):
    X[i] = -X[i-1] + 2*A[i-1]
 
 
print(*X)
### BUGGY CODE ###

## Atcoder problem solving


# type tree
import heapq


def main():
    n, m = map(int, input().split())
    G = [[] for i in range(n+1)]
    Edge = []
    is_root = [True]*(n+1)
    
    for _ in range(n+m-1):
        x, y = map(int, input().split())
        G[x].append(y)
        Edge.append((x, y))
        is_root[y] = False

    #determine root
    root = -1
    for i in range(1, n+1):
        if is_root[i] == True:
            root = i
            break

    que = [(0, root)]
    heapq.heapify(que)

    #dijkstra
    dis = [10**10]*(n+1)
    dis[root] = 0
    while que:

        cost, node = heapq.heappop(que)
        for c in G[node]:
            if dis[c] > cost - 1:
                dis[c] = cost - 1
                heapq.heappush(que,(cost - 1, c))


    par = [0]*(n+1)

    for x, y in Edge:
        if dis[y] + 1 == dis[x]:
            par[y] = x

    for i in range(1, n+1):
        print(par[i])

    return


if __name__ == "__main__":
    main()



### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# restore the tree


from collections import deque
n, m = map(int, input().split())


in_node = [0 for i in range(n + 1)]

# in_node[x]=xに入るノードの数

parent_node = [0 for i in range(n + 1)]

# parent[i]=ねつき木における頂点iの親を返す

in_graph = {i: [] for i in range(1, n + 1)}

out_graph = {i: [] for i in range(1, n + 1)}

# graph[i]=頂点iに入るノードの集合リスト

# out_graph[i]=頂点iから出るノードの集合リスト

for _ in range(n + m - 1):
    a, b = map(int, input().split())
    in_graph[b].append(a)
    out_graph[a].append(b)
    in_node[b] += 1

root = -1


for i in range(1, n + 1):
    if in_node[i] == 0:
        parent = i
        break



flag = True
d = deque()
d.append(parent)
while d:
    x = d.popleft()
    not_yet = False
    for node in out_graph[x]:
        in_node[node] -= 1
        if in_node[node] == 0 and parent_node[node] == 0:
            parent_node[node] = x
            d.append(node)
            not_yet = True

    if not_yet:
        flag = True
    else:
        flag = False

for i in range(1,n+1):
    print(parent_node[i])
### BUGGY CODE ###

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

ans = max(A) - min(A)

for i in range(N):
  A[-(i+1)] -= K
  if max(A) - min(A) < ans:
    ans = max(A) - min(A)

print(ans)

### FIXED CODE ###

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

dist = [0] * (N)

for i in range(N-1):
  dist[i] = A[i+1] - A[i]
dist[N-1] = A[0] - A[-1] + K

print(K - max(dist))
### BUGGY CODE ###

import re

target = 'AC'

N, Q = map(int, input().split())  # 長さNとQ個の問い

S = str(input())  # 文字列S

starts_ends = []

for _ in range(Q):
    starts_ends.append(list(map(int, input().split())))

for i in range(Q):
    start, end = starts_ends[i]
    portion_S = S[start-1:end]
    print(len(re.findall('AC', portion_S)))


### FIXED CODE ###

# 累積和を使う
N, Q = map(int, input().split())  #長さN, Q個の問い

S = str(input())  # 長さNの文字列S(これはA, C, G, Tのいずれかの文字のみ)

starts_ends = []
# 始点lと終点rがQセット与えられる
for _ in range(Q):
    starts_ends.append(list(map(int, input().split())))

# print('hoge')
# print(N)
# print(Q)
# print(S)
# print(starts_ends)

# 'AC'を探す旅に出る
cumulative_sum = [0, 0]
for i in range(1, len(S)):
    if S[i] == 'C' and S[i-1] == 'A':
        cumulative_sum.append(cumulative_sum[i]+1)
    else:
        cumulative_sum.append(cumulative_sum[i])

for i in range(Q):
    start, end = starts_ends[i]
    print(cumulative_sum[end] - cumulative_sum[start])
### BUGGY CODE ###

n, k = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))
bit = k.bit_length()
table = [[0]*bit for _ in range(n)]
for i in range(n):
    table[i][0] = A[i]

for i in range(1, bit):
    for j in range(n):
        table[j][i] = table[table[j][i-1]][i-1]

ans = 0
for i in reversed(range(bit)):
    if (1 << i) <= k:
        k -= 1 << i
        ans = table[ans][i]
print(ans+1)

### FIXED CODE ###

from collections import Counter
import sys
sys.setrecursionlimit(10**7)
n, k = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))

# A[0]から出発して何回でループするか数える

visited = [0]*n


def dfs(v):
    if visited[v]+1 == 3:
        return 0
    visited[v] += 1
    dfs(A[v])


dfs(0)

c = Counter(visited)
loop_cnt = c[2]
init_cnt = c[1]
k_ = k-init_cnt
k_ %= loop_cnt

cnt = 0
visited = [0]*n


ans = 0
loop = k if k < init_cnt else k_+init_cnt
for _ in range(loop):
    ans = A[ans]
print(ans+1)
### BUGGY CODE ###

N,K = map(int,input().split())
S = input()
l = [1]
for i in range(N-1):
    if S[i] == S[i+1]:
        l[-1] += 1
    else:
        l.append(1)
if S[0] == "0":
    l = [0] + l
if S[-1] == "0":
    l += [0]

if len(l) <= 2*K + 1:
    print(sum(l))
else:
    cnt = 0
    for i in range((len(l)-2*K-1)//2+1):
        cnt = max(cnt,sum(l[2*i:2*i+2*K+1]))
    print(cnt)

### FIXED CODE ###

N,K = map(int,input().split())
S = input()
l = [1]
for i in range(N-1):
    if S[i] == S[i+1]:
        l[-1] += 1
    else:
        l.append(1)
if S[0] == "0":
    l = [0] + l
if S[-1] == "0":
    l += [0]
s = [0]
for i in range(len(l)):
    s.append(s[-1]+l[i])
if len(l) <= 2*K + 1:
    print(s[-1])
else:
    cnt = 0
    for i in range((len(l)-2*K-1)//2+1):
        cnt = max(cnt,s[2*K+2*i+1]-s[2*i])
    print(cnt)
### BUGGY CODE ###

x = int(input())
flg = 0
now_flg = 1
while flg == 0:
    mx  = int(x**0.5)
    for i in range(2, mx+1):
        if x % i == 0:
            now_flg = 0
            break
    fig = now_flg
    if flg == 0:
        x+=1
print(x)


### FIXED CODE ###

def com(_x):
    _flg = 1
    mx  = int(_x**0.5)
    for i in range(2, mx+1):
        if _x % i == 0:
            _flg = 0
            break
    return _flg


def main():
    x = int(input())
    flg = 0
    while flg == 0:
        #print("a")
        flg = com(x)
        if flg == 0:
            x+=1
    print(x)



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

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = [0]*(n+1)
d = [0]*(m+1)
for i in range(n):
    c[i+1] = a[i]+c[i]
for i in range(m):
    d[i+1] = b[i]+d[i]
ans = 0
for i in range(n+1)[::-1]:
    for j in range(m+1)[::-1]:
        if c[i] + d[j] <= k:
            ans = max(ans,i+j)
            break
print(ans)


### FIXED CODE ###

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = [0]*(n+1)
d = [0]*(m+1)
for i in range(n):
    c[i+1] = a[i]+c[i]
for i in range(m):
    d[i+1] = b[i]+d[i]
for i in range(m+1)[::-1]:
    if d[i] <= k:
        x = i
        break
ans = x
for i in range(1,n+1):
    while c[i] + d[x] > k:
        if x >= 1:
            x -= 1
        else:
            break
    if c[i] + d[x] <= k:
        ans = max(ans,i+x)
print(ans)
### BUGGY CODE ###

from sys import stdin

class DList:
    class Cell:
        def __init__(self, k):
            self.key  = k
            self.prev = None
            self.next = None

    def __init__(self):
        self.head = DList.Cell(None)
        self.last = DList.Cell(None)
        self.head.next = self.last
        self.last.prev = self.head

    def insert(self, x):
        c = DList.Cell(x)
        c.prev = self.head
        c.next = self.head.next
        c.next.prev = c
        self.head.next = c

    def delete(self, x):
        c = self.__find(x)
        if c != None:
            self.__delete(c)

    def __delete(self, c):
        c.prev.next = c.next
        c.next.prev = c.prev

    def __find(self, x):
        c = self.head.next
        while c != None and c.key != x:
            c = c.next
        return c

    def deleteFirst(self):
        self.__delete(self.head.next)
    def deleteLast(self):
        self.__delete(self.last.prev)

    def print(self):
        c = self.head.next
        sep = ''
        while c != self.last:
            print(sep + str(c.key), end='')
            c = c.next
            sep = ' '
        print()

dlist = DList()

n = int(stdin.readline())
for i in range(n):
    cmd = tuple(stdin.readline().split())
    if   cmd[0] == 'insert':
        dlist.insert(int(cmd[1]))
    elif cmd[0] == 'delete':
        dlist.delete(int(cmd[1]))
    elif cmd[0] == 'deleteFirst':
        dlist.deleteFirst()
    elif cmd[0] == 'deleteLast':
        dlist.deleteLast()

dlist.print()



### FIXED CODE ###

from sys import stdin

class DList:
    class Cell:
        def __init__(self, k):
            self.key  = k
            self.prev = None
            self.next = None

    def __init__(self):
        self.head = DList.Cell(None)
        self.last = DList.Cell(None)
        self.head.next = self.last
        self.last.prev = self.head

    def insert(self, x):
        c = DList.Cell(x)
        c.prev = self.head
        c.next = self.head.next
        c.next.prev = c
        self.head.next = c

    def delete(self, x):
        c = self.__find(x)
        if c != None:
            self.__delete(c)

    def __delete(self, c):
        c.prev.next = c.next
        c.next.prev = c.prev

    def __find(self, x):
        c = self.head.next
        while c != None and c.key != x:
            c = c.next
        return c

    def deleteFirst(self):
        self.__delete(self.head.next)
    def deleteLast(self):
        self.__delete(self.last.prev)

    def __iter__(self):
        self.it = self.head.next
        return self
    def __next__(self):
        if self.it == self.last:
            raise StopIteration
        k = self.it.key
        self.it = self.it.next
        return k

dlist = DList()

n = int(stdin.readline())
for i in range(n):
    cmd = stdin.readline()
    if   cmd.startswith('insert'):
        dlist.insert(cmd[7:-1])
    elif cmd.startswith('deleteFirst'):
        dlist.deleteFirst()
    elif cmd.startswith('deleteLast'):
        dlist.deleteLast()
    elif cmd.startswith('delete'):
        dlist.delete(cmd[7:-1])

print(' '.join(dlist))
### BUGGY CODE ###

def main():
	import sys
	from operator import itemgetter
	import numpy as np
	inputs = sys.stdin.readline
	N, Q= map(int,inputs().split())
	E = [None]*2*N
	for n in range(N):
		a,b,c = map(int,inputs().split())
		E[2*n] = (a - c, 1, c)
		E[2*n + 1] = (b - c, -1, c)
	E.sort(key=itemgetter(0))
	ARRAY = np.array(E)
	mini = 1000000001
	kouho = {1000000001}
	my_add = kouho.add
	my_discard = kouho.discard
	q = 0
	d = int(inputs())
	flag = False
	cont = False
	for e in ARRAY:
		while(e[0] > d):
			if cont == True:
				if mini < 1000000001:
					print(mini)
				else:
					print(-1)
			else:
				mini = min(kouho)
				if mini < 1000000001:
					print(mini)
				else:
					print(-1)
			cont = True
			if q < Q-1:
				q = q + 1
				d = int(inputs())
			else:
				flag = True
				q = q + 1
				break
		if flag == True:
			break
		if e[1] == 1:
			my_add(e[2])
			if mini > e[2]:
				mini = e[2]
		elif e[1] == -1:
			my_discard(e[2])
			cont = False
	for t in [None]*(Q-q):
		print(-1)

main()

### FIXED CODE ###

import sys
from operator import itemgetter
def main():
	inputs = sys.stdin.readline
	N, Q= map(int,inputs().split())
	E = [None]*2*N
	for n in range(N):
		a,b,c = map(int,inputs().split())
		E[2*n] = (a - c, 1, c)
		E[2*n + 1] = (b - c, -1, c)
	E.sort(key=itemgetter(0))
	tuple(tuple(E))
	mini = 1000000001
	kouho = {1000000001}
	my_add = kouho.add
	my_discard = kouho.discard
	q = 0
	d = int(inputs())
	flag = False
	cont = False
	for e in E:
		while e[0] > d:
			if cont == True:
				print(mini-(mini//1000000001)*1000000002)
			else:
				mini = min(kouho)
				print(mini-(mini//1000000001)*1000000002)
			cont = True
			q = q + 1
			if q > Q-1:
				flag = True
				break
			d = int(inputs())
		if flag == True:
			break
		if e[1] == 1:
			my_add(e[2])
			if mini > e[2]:
				mini = e[2]
		elif e[1] == -1:
			my_discard(e[2])
			if mini == e[2]:
				cont = False
	for t in [None]*(Q-q):
		print(-1)
main()
### BUGGY CODE ###

num = int(input())
if num == 2:
	print(2)
	exit()

flag = False
while True:
    for i in range(2, int(num**0.5)+1):
        if num % i ==0:
            flag = False
            break
        else:
            flag = True
    if flag:
        print(num)

### FIXED CODE ###

num = int(input())

flag = False
while True:
    if num == 2:
        print(2)
        exit()
    for i in range(2, int(num**0.5)+1):
        if num % i ==0:
            flag = False
            break
        else:
            flag = True
    if flag:
        print(num)
        exit()
    else:
        num+=1
### BUGGY CODE ###


N=int(input().strip())
L=list(map(int,input().strip().split()))
L.sort()

count=0
for i,a in enumerate(L):
    for  j,b in enumerate(L[i+1:]):
        MAX=N-1 # index
        MIN=i+1+j+1
        gap=MAX-MIN
        while gap>1:
            mid=(MAX+MIN)//2
            if L[mid] < a+b:
                MIN=mid
            else:
                MAX=mid
            gap=MAX-MIN
        if L[MAX]<a+b:
            count+=MAX-(i+1+j+1)+1
        elif L[MIN]<a+b:
            count+=MIN-(i+1+j+1)+1
print(count)

### FIXED CODE ###

import bisect
 
N = int(input())
L = list(map(int, input().split()))
L.sort()
 
c = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    c += bisect.bisect_right(L, L[i]+L[j]-1) - j - 1
 
 
print(c)