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

import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ct += 1
                break
print(ct)











### FIXED CODE ###

k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)
### BUGGY CODE ###



def third(n,q):
    n = int(n)
    q = float(q)
    if n == 1: return q/2
    else : return third(n-1,q)- (third(n-1,q)**3-q)/(3*third(n-1,q)**2)

kai = []
while(True):
    try:
        q = input()
        if q == -1:
            break
        else :
            n = 1
            q = float(q)
            while  (abs(q-third(n, q)**3) >= 0.00001*q):
                n += 1
            print '{:.6f}'.format(third(n, q))
    except EOFError:
        break

### FIXED CODE ###

while(True):
    try:
        q = input()
        if q == -1:
            break
        else :
            q = float(q)
            x = q/2
            while  (abs(q-x**3) >= 0.00001*q):
                x = x- (x**3-q)/(3*x**2)
            print '{:.6f}'.format(x)
    except EOFError:
        break
### BUGGY CODE ###

# coding: utf-8
n = int(input())

from collections import defaultdict
d = defaultdict(int)
    
for _ in range(n):
    d[input()] += 1

li = [k for k, v in d.items() if v == max(d.values())]
li.sort()

for l in li:
    print(l)

### FIXED CODE ###

# coding: utf-8
n = int(input())

from collections import defaultdict
d = defaultdict(int)
maxnum = 0
maxli = []

for _ in range(n):
    s = input()
    d[s] += 1
    if d[s] > maxnum:
        maxnum += 1
        maxli = [s]
    elif d[s] == maxnum:
        maxli.append(s)
    
maxli.sort()

for l in maxli:
    print(l)
### BUGGY CODE ###

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


def main():
    n = int(input())

    a = list()
    for i in range(n):
        a.append(int(input()))

    for i in range(n):
        tmp = a.copy()
        tmp.remove(a[i])
        print(max(tmp))


if __name__ == '__main__':
    main()


### FIXED CODE ###

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


def main():
    n = int(input())

    a = [None] * n
    for i in range(n):
        a[i] = int(input())

    a_sorted = sorted(a, reverse=True)
    a_max = max(a)

    for i in a:
        if i != a_max:
            print(a_max)
            continue

        index = a_sorted.index(i)
        if index == 0:
            print(a_sorted[index + 1])


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

import sys
sys.setrecursionlimit(3000)
h,w=map(int,input().split())
s=['#'*(w+2)]+['#'+input()+'#' for _ in [0]*h]+['#'*(w+2)]
l=[[0]*(w+2) for _ in [0]*(h+2)]
for i in range(h+2):
    for j in range(w+2):
        if s[i][j]=='#':
            l[i][j]=-1
def sol(m,n):
    global l
    if l[m][n]>=0:
        for i,j in [(m-1,n),(m+1,n),(m,n-1),(m,n+1)]:
            if l[i][j]==0 and [i,j]!=[1,1]:
                l[i][j]=l[m][n]+1
                sol(i,j)
            elif l[i][j]>l[m][n]+1:
                l[i][j]=l[m][n]+1
                sol(i,j)
sol(1,1)
if l[h][w]==0:print(-1)
else:print(h*w-l[h][w]-(sum(x.count('#') for x in s)-2*h-2*w-4)-1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(3000)
h,w=map(int,input().split())
s=['#'*(w+2)]+['#'+input()+'#' for _ in [0]*h]+['#'*(w+2)]
l=[[0]*(w+2) for _ in [0]*(h+2)]
for i in range(h+2):
    for j in range(w+2):
        if s[i][j]=='#':
            l[i][j]=-1
def sol(m,n):
    global l
    if l[m][n]>=0:
        for i,j in [(m-1,n),(m+1,n),(m,n-1),(m,n+1)]:
            if l[i][j]==0 and [i,j]!=[1,1]:
                l[i][j]=l[m][n]+1
                sol(i,j)
            elif l[i][j]>l[m][n]+1:
                l[i][j]=l[m][n]+1
                sol(i,j)
sol(1,1)
if l[h][w]==0:print(-1)
else:print(h*w-l[h][w]-(sum(x.count('#') for x in s)-2*h-2*w-4)-1)
### BUGGY CODE ###

from sys import stdin
import operator
readline = stdin.readline


def norm(self):
    return abs(self)


def closest_pair(p):
    m = 0
    p.sort(key=operator.attrgetter('real'))
    d = float('inf')
    for i in range(1, len(p)):
        for j in reversed(range(m, i)):
            tmp = p[i] - p[j]
            if d < tmp.real:
                m = j + 1
                break
            tmp = abs(tmp)
            if d > tmp:
                d = tmp
    return d


from itertools import combinations


def brute_force(p):
    return min(abs(p[i] - p[j]) for i, j in combinations(range(len(p)), 2))


def main():
    n = int(readline())
    p = [map(float, readline().split()) for _ in range(n)]
    p = [x + y * 1j for x, y in p]

    # print('{:.6f}'.format(brute_force(p)))
    print('{:.6f}'.format(closest_pair(p)))
main()

### FIXED CODE ###

from sys import stdin
from operator import attrgetter
readline = stdin.readline


def norm(a):
    return a.real * a.real + a.imag * a.imag


def closest_pair(p):
    if len(p) <= 1:
        return float('inf')
    m = len(p) // 2
    d = min(closest_pair(p[:m]), closest_pair(p[m:]))
    p = [pi for pi in p if p[m].imag - d < pi.imag < p[m].imag + d]
    return brute_force(p, d)

def brute_force(p, d=float('inf')):
    p.sort(key=attrgetter('real'))
    for i in range(1, len(p)):
        for j in reversed(range(i)):
            tmp = p[i] - p[j]
            if d < tmp.real:
                break
            tmp = abs(tmp)
            if d > tmp:
                d = tmp
    return d


def main():
    n = int(readline())
    p = [map(float, readline().split()) for _ in range(n)]
    p = [x + y * 1j for x, y in p]

    p.sort(key=attrgetter('imag'))
    print('{:.6f}'.format(closest_pair(p)))
main()
### BUGGY CODE ###

import sys,bisect
input=sys.stdin.readline

N=int(input())
vw=[(-1,-1)]
for i in range(N):
    vw.append(tuple(map(int,input().split())))

dp=[[0 for i in range(100001)] for i in range(2**9)]
for i in range(vw[1][1],100001):
    dp[1][i]=vw[1][0]
MAX=min(2**9,N+1)
for i in range(2,MAX):
    v,w=vw[i]
    for j in range(100001):
        dp[i][j]=max(dp[i//2][j],(dp[i//2][j-w]+v)*(j>=w))

for i in range(int(input())):
    v,L=map(int,input().split())
    if 2**9>v:
        print(dp[v][L])
    else:
        t=[]
        while v>=2**9:
            t.append(vw[v])
            v//=2
        n=len(t)
        ans=0
        for i in range(2**n):
            V=sum(t[j][0] for j in range(n) if i>>j &1==1)
            W=sum(t[j][1] for j in range(n) if i>>j &1==1)
            if L>=W:
                ans=max(ans,V+dp[v][L-W])
        print(ans)

### FIXED CODE ###

import sys,random,time,bisect
input=sys.stdin.buffer.readline

start=time.time()
N=int(input())
vw=[(-1,-1)]
for i in range(N):
    vw.append(tuple(map(int,input().split())))

dp=[[] for i in range(2**9)]
def make_dp(v):
    t=[[0,0] for i in range(15)]
    V=v
    id=0
    while v>=1:
        t[id]=vw[v]
        id+=1
        v//=2
    n=id
    temp=[[0,0] for i in range(2**n)]
    for i in range(n):
        for j in range(2**i,2**(i+1)):
            temp[j][0]=temp[j-2**i][0]+t[i][0]
            temp[j][1]=temp[j-2**i][1]+t[i][1]
    temp.sort(key=lambda x:x[1])
    for i in range(1,2**n):
        temp[i][0]=max(temp[i][0],temp[i-1][0])

    dp[V]=[0]*(10**5+1)
    for i in range(2**n-1):
        L=temp[i][1]
        R=temp[i+1][1]
        if L>10**5:
            break
        elif R>10**5:
            R=10**5+1
        for j in range(L,R):
            dp[V][j]=temp[i][0]
    else:
        L=temp[-1][1]
        if L<=10**5:
            for j in range(L,10**5+1):
                dp[V][j]=temp[-1][0]

MAX=min(2**9,N+1)
for i in range(1,MAX):
    make_dp(i)

Q=int(input())
query=[[] for i in range(N+1)]
for i in range(Q):
    v,L=map(int,input().split())
    query[v].append((L,i))

ans=[0]*Q
temp=[[0,0] for i in range(2**9)]
t=[[0,0] for i in range(15)]
def solve(v):
    V=v
    id=0
    while v>=2**9:
        t[id]=vw[v]
        id+=1
        v//=2
    n=id
    for i in range(n):
        for j in range(2**i,2**(i+1)):
            temp[j][0]=temp[j-2**i][0]+t[i][0]
            temp[j][1]=temp[j-2**i][1]+t[i][1]

    for L,ID in query[V]:
        res=0
        for i in range(2**n):
            if L>=temp[i][1]:
                res=max(res,temp[i][0]+dp[v][L-temp[i][1]])
        ans[ID]=res

for i in range(1,N+1):
    if query[i]:
        solve(i)

for i in range(Q):
    print(ans[i])
### BUGGY CODE ###

n = int(input())
dam = list(map(int, input().split()))
yama = [0] * n
yama_copy = [0] * n

min_dam = min(dam)
min_arg = dam.index(min(dam))

yama_bf = min_arg
yama_i = min_arg
for i in range(0, min_dam * 2 + 1, 2):
    yama_copy[yama_i] = i
    yama_i = (yama_i + 1) % n
    for j in range(n-1):
        yama_copy[yama_i] = (dam[yama_bf] - yama_copy[yama_bf]/2) * 2
        yama_bf = yama_i
        yama_i = (yama_i + 1) % n
    if dam[yama_bf] == yama_copy[yama_bf]/2 + yama_copy[min_arg]/2:
        break
    yama_copy = [0] * n
    yama_bf = min_arg
    yama_i = min_arg
yama_copy = map(int, yama_copy)
print(' '.join(map(str, yama_copy)))

### FIXED CODE ###

import numpy as np

n = int(input())
dam = list(map(int, input().split()))
yama = [-1] * n

min_dam = min(dam)
min_dam_arg = np.argmin(dam)

s = sum(dam)
yama[0] = s - 2 * sum(dam[1::2])
for i in range(1, n):
    yama[i] = 2 * (dam[i-1] - yama[i-1]/2)

yama = map(int, yama)
print(' '.join(map(str, yama)))
### BUGGY CODE ###

import bisect
N, = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
def g(x):
    mx, mn = N, -1
    idx = mx//2
    while mx-mn>1:
        if Q[idx] >= x:
            mx, idx = idx, (idx+mn)//2
            continue
        mn, idx = idx, (idx+mx)//2
    return idx+1
mxk = 29
msk = (1<<mxk) - 1
msk2 = (1<<(mxk-1))
r = 0
for i in range(mxk):
    for j in range(N):
        Q[j] = Q[j] & msk
        P[j] = P[j] & msk
    msk >>= 1
    Q.sort()
    b = 0
    for p in P:
        x = bisect.bisect_left(Q, 2*msk2 - (p&msk))
        z = bisect.bisect_left(Q, msk2 - (p&msk),0,x)
        if p & msk2:
            b += z+N-x
        else:
            b += x-z
    if b%2:
        r += 1<<(mxk-1-i)
    msk2 >>= 1
print(r)


### FIXED CODE ###

N, = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
mxk = 29
msk = (1<<mxk) - 1
msk2 = (1<<(mxk-1))
r = 0
for i in range(mxk):
    # 下からiビット目をみる
    for j in range(N):
        Q[j] = Q[j] & msk
        P[j] = P[j] & msk
    msk >>= 1
    P.sort()
    Q.sort()
    j1 = N-1
    j2 = N-1
    b = 0
    ss = N
#    print(P, Q)
    for l in range(N):
        if P[l] & msk2:
            ss = l
            break
        k1 = msk2 - (P[l]&msk)
        k2 = k1 + msk2
        while j1 >= 0:
            if Q[j1] < k1:
                break
            j1 -= 1
        while j2 >= 0:
            if Q[j2] < k2:
                break
            j2 -= 1
        b += j2 - j1
#        print("a",j2-j1,k1,k2,j1,j2)

    j1 = N-1
    j2 = N-1
#    print(ss)
    for l in range(ss, N):
        k1 = msk2 - (P[l]&msk)
        k2 = k1 + msk2
        while j1 >= 0:
            if Q[j1] < k1:
                break
            j1 -= 1
        while j2 >= 0:
            if Q[j2] < k2:
                break
            j2 -= 1
#        print("b",j1 - j2 + N)
        b += j1 + N - j2

#    b = 0
#    for p in P:
#        if p & msk2:
#            x = g(2*msk2 - (p&msk))
#            z = g(msk2 - (p&msk))
#            b += z+N-x
#        else:
#            x = g(2*msk2 - (p&msk))
#            z = g(msk2 - (p&msk))
#            b += x-z
#    print(b, r, i)
    if b%2:
        r += 1<<(mxk-1-i)
    msk2 >>= 1
print(r)
### BUGGY CODE ###

n = int(input())
list = [int(e) for e in input().split()]

for i in range(1,n+1):
    print(list.count(i))



### FIXED CODE ###

n = int(input())
list = [int(e) for e in input().split()]

import collections
list2 = collections.Counter(list)

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

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


#----------
N,C,K = list(map(int, input().rstrip().split()))

T_list = [int(input().strip()) for _ in range(N)]
T_list.sort()

#----------
num_bus=0
i=0
while i < len(T_list):

    # Busに何人乗せられるか時刻を比較
    member_bus=0
    break_flg=False
    for j in range(C):
        if (i+j) < len(T_list):
            if T_list[i+j] <= (T_list[i] + K):
                member_bus += 1

    num_bus += 1
    i = i + member_bus
            

print(num_bus)


### FIXED CODE ###

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


#----------
N,C,K = list(map(int, input().rstrip().split()))

T_list = [int(input().strip()) for _ in range(N)]
T_list.sort()

#----------
num_bus=0
i=0
while i < len(T_list):

    # Busに何人乗せられるか時刻を比較
    member_bus=0
    break_flg=False
    for j in range(C):
        if (i+j) < len(T_list):
            if T_list[i+j] <= (T_list[i] + K):
                member_bus += 1
            else:
                break_flg=True
        else:
            break_flg=True
        
        if break_flg:
            break

    num_bus += 1
    i = i + member_bus
            

print(num_bus)
### BUGGY CODE ###

n,m = map(int, input().split())
link = [[] for _ in range(n)]
for i in range(m):
    tmp = list(map(int,input().split()))
    link[tmp[0]-1].append([tmp[1]-1,tmp[2]])
    link[tmp[1]-1].append([tmp[0]-1,-tmp[2]])
from collections import deque
vis=[False]*n
dist=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i] = True
    Q = deque()
    Q.append([i,0])
    while Q:
        now,cnt = Q.popleft()
        vis[now]=True
        for nxt,nxt_dist in link[now]:
            if dist[nxt] != cnt+nxt_dist:# NG or 0
                if vis[nxt]:
                    print("No")
                    exit()
                dist[nxt] = cnt+nxt_dist
            if not vis[nxt]:
                Q.append([nxt,cnt+nxt_dist])
print("Yes")

### FIXED CODE ###

import sys
input=sys.stdin.readline

n,m = map(int, input().split())
link = [[] for _ in range(n)]
for i in range(m):
    tmp = list(map(int,input().split()))
    link[tmp[0]-1].append([tmp[1]-1,tmp[2]])
    link[tmp[1]-1].append([tmp[0]-1,-tmp[2]])
from collections import deque
INF=10**10
dist=[INF]*n
for i in range(n):
    if dist[i]!=INF:
        continue
    dist[i]=0
    Q = deque()
    Q.append([i,0])
    while Q:
        now,cnt = Q.popleft()
        for nxt,nxt_dist in link[now]:
            if dist[nxt] == INF:
                dist[nxt] = cnt+nxt_dist
                Q.append([nxt,cnt+nxt_dist])
            elif dist[nxt] != cnt+nxt_dist:
                    print("No")
                    exit()

print("Yes")
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N,M=map(int,input().split())
EDGE=[list(map(int,input().split())) for i in range(M)]

#REVEDGE=[[] for i in range(N+1)]
EDGELIST=[[] for i in range(N+1)]
LEAF=[]
for x,y in EDGE:
    #REVEDGE[y].append(x)
    EDGELIST[x].append(y)

for i in range(1,N+1):
    if EDGELIST[i]==[]:
        LEAF.append(i)

DIST=[-1]*(N+1)
for l in LEAF:
    DIST[l]=0

def distance(x):
    if DIST[x]!=-1:
        return DIST[x]
    ANS=0
    for to in EDGELIST[x]:
        if ANS<distance(to)+1:
            ANS=distance(to)+1

    return ANS

for i in range(1,N+1):
    DIST[i]=distance(i)

print(max(DIST))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N,M=map(int,input().split())
EDGE=[list(map(int,input().split())) for i in range(M)]

#REVEDGE=[[] for i in range(N+1)]
EDGELIST=[[] for i in range(N+1)]
LEAF=[]
for x,y in EDGE:
    #REVEDGE[y].append(x)
    EDGELIST[x].append(y)

for i in range(1,N+1):
    if EDGELIST[i]==[]:
        LEAF.append(i)

DIST=[-1]*(N+1)
for l in LEAF:
    DIST[l]=0

def distance(x):
    if DIST[x]!=-1:
        return DIST[x]
    ANS=0
    for to in EDGELIST[x]:
        if ANS<distance(to)+1:
            ANS=distance(to)+1

    DIST[x]=ANS
    return ANS

for i in range(1,N+1):
    DIST[i]=distance(i)

print(max(DIST))
### BUGGY CODE ###

N = int(input())
S = input()
n=0
if S.find("W")==-1 or S.find("R")==-1:
  print(0)
else:
  while S.find("W")<=S.rfind("R"):
    S = S[S.find("W")+1:S.rfind("R")]
    n+=1
  print(n)

### FIXED CODE ###

N = int(input())
S = input()
n=0
if S.find("W")==-1 or S.find("R")==-1:
  print(0)
else:
  while S.find("W")<S.rfind("R") and S.find("W")>=0:
    S = S[S.find("W")+1:S.rfind("R")]
    n+=1
  print(n)
### BUGGY CODE ###

import numpy as np

N, K = [int(item) for item in input().split()]
h =np.array([int(item) for item in input().split()])

dp = np.full(N+1, 10**10+1, dtype='int64')
dp[0] = 0

for i in range(1, N):
    start = max(0, i-K)
    cost = abs(h[start:i] - h[i])
    dp[i] = min(dp[start:i] + cost)

    # print(dp)
print(dp[N-1])


### FIXED CODE ###

import numpy as np

N, K = [int(item) for item in input().split()]
h =np.array([int(item) for item in input().split()])
# print(h.shape)
dp = np.full(N+K, 10**10+1, dtype='int64')
dp[0] = 0

for i in range(1, N):
    max1 = min(N, i+K)
    cost = abs(h[i:max1] - h[i-1])
    # print(cost.shape, dp[i:max1].shape)
    dp[i:max1] = np.minimum(dp[i:max1], dp[i-1] + cost)

    # print(dp)
print(dp[N-1])
### BUGGY CODE ###

def path(w,h,sm):
	if w < 0 or len(inp[h])-1 < w: return 0
	sm += inp[h][w]
	if h == c-1: return sm
	if h < c/2:	return max(path(w,h+1,sm),path(w+1,h+1,sm))
	else: return max(path(w,h+1,sm),path(w-1,h+1,sm))
		
c = 0
inp = []
while True:
	try:
		inp.append(map(int, raw_input().split(",")))
		c += 1
	except:
		print path(0,0,0)
		break

### FIXED CODE ###

def mx(p,w,h,l):
	if h <= c/2:
		if w == 0: p[h][w] += p[h-1][w]
		elif w == l-1: p[h][w] += p[h-1][w-1]
		else: p[h][w] += max(p[h-1][w],p[h-1][w-1])
	else:
		p[h][w] += max(p[h-1][w],p[h-1][w+1])
	return p

c = 0
p = []
while True:
	try:
		p.append(map(int, raw_input().split(",")))
		c += 1
	except:
		break
	
for h in range(1,c):
	l = len(p[h])
	for w in range(l):
		p = mx(p,w,h,l)
print p[c-1][0]
### BUGGY CODE ###

N = int(input())
S = input()

R = [0] * N
G = [0] * N
B = [0] * N

for i in range(1, N):
    if S[-i] == "R":
        R[-i] += R[-i + 1] + 1 if i != 1 else 1
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1]
    if S[-i] == "G":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1] + 1 if i != 1 else 1
        B[-i] += B[-i + 1]
    if S[-i] == "B":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1] + 1 if i != 1 else 1

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = j + 1
        if k >= N:
            break
        if S[i] == S[j]:
            continue
        if not ("R" in S[i] + S[j]):
            ans += R[k]
            if R[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "R":
                ans -= 1
        elif not ("G" in S[i] + S[j]):
            ans += G[k]
            if G[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "G":
                ans -= 1
        else:
            ans += B[k]
            if B[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "B":
                ans -= 1
print(ans)


### FIXED CODE ###

N = int(input())
S = input()

R = [0] * N
G = [0] * N
B = [0] * N

for i in range(1, N):
    if S[-i] == "R":
        R[-i] += R[-i + 1] + 1 if i != 1 else 1
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1]
    if S[-i] == "G":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1] + 1 if i != 1 else 1
        B[-i] += B[-i + 1]
    if S[-i] == "B":
        R[-i] += R[-i + 1]
        G[-i] += G[-i + 1]
        B[-i] += B[-i + 1] + 1 if i != 1 else 1

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = j + 1
        if k >= N:
            break
        if S[i] == S[j]:
            continue
        if not ("R" in S[i] + S[j]):
            ans += R[k]
            if R[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "R":
                ans -= 1
        elif not ("G" in S[i] + S[j]):
            ans += G[k]
            if G[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "G":
                ans -= 1
        else:
            ans += B[k]
            if B[k] > 0 and (2 * j - i) < N and S[2 * j - i] == "B":
                ans -= 1
print(ans)
### BUGGY CODE ###

n=int(input())
a=[-int(input())]
l=1
for i in range(1,n):
  b=-int(input())
  if a[-1]>b:
    if a[0]>b:a[0]=b;continue
    ok=l
    ng=0
    c=ok//2
    while ng+1<ok:
      if b<a[c]:ok=c
      else:ng=c
    a[ok]=b
  else:a.append(b);l+=1
print(l)

### FIXED CODE ###

import bisect
n=int(input())
x=[int(input())for _ in range(n)]
a=[-x[0]]
l=1
for i in range(1,n):
  b=-x[i]
  if a[-1]>b:
    if a[0]>b:a[0]=b;continue
    a[bisect.bisect_right(a,b)]=b
  else:a.append(b);l+=1
print(l)
### BUGGY CODE ###

l, r = map( int, input().split())

amr = []
for x in range(l,r+1):
    amr.append(x%2019)
# print(amr)
ij_mod = []
for i in range(len(amr)-1):
    for j in range(i+1,len(amr)):
        ij_mod.append((amr[i]*amr[j])%2019)
print(min(ij_mod))




### FIXED CODE ###

l, r = map( int, input().split())

amr = []
for x in range(l,r+1):
    if len(amr) >= 2019:
        break
    amr.append(x%2019)
# print(amr)
amr = list(set(amr))
ij_mod = []
for i in range(len(amr)-1):
    for j in range(i+1,len(amr)):
        ij_mod.append((amr[i]*amr[j])%2019)
print(min(ij_mod))
### BUGGY CODE ###

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

d=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  d[i][i]=0
num=[0 for i in range(n)]
g=[[i+1] for i in range(n-1)]
g.append([])
for i in range(1,n):
  g[i].append(i-1)
x-=1
y-=1
g[x].append(y)
g[y].append(x)

def bfs(start):
  #global d
  #global g
  q=[start]
  while q:
    now=q.pop(0)
    #print("now",now,"q",q,"d",d)
    for i in g[now]:
      if d[start][i]!=-1:
        continue
      else:
        d[start][i]=d[start][now]+1
        q.append(i)
 
for i in range(n):
  bfs(i)

for i in range(n-1):
  for j in range(i+1,n):
    num[d[i][j]]+=1

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

### FIXED CODE ###

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

d=[[-1 for i in range(n)] for j in range(n)]
for i in range(n):
  d[i][i]=0
num=[0 for i in range(n)]
g=[[i+1] for i in range(n-1)]
g.append([])
for i in range(1,n):
  g[i].append(i-1)
x-=1
y-=1
g[x].append(y)
g[y].append(x)

def bfs(start,dist=0):
  #global d
  #global g
  q=[start]
  while q:

    dist+=1
    now=q.pop(0)
    #print("now",now,"q",q,"d",d)
    for i in g[now]:
      if d[start][i]!=-1:
        continue
      else:
        d[start][i]=d[start][now]+1
        q.append(i)
 
for i in range(n):
  bfs(i)

for i in range(n-1):
  for j in range(i+1,n):
    if d[i][j]>=n:
      continue
    num[d[i][j]]+=1

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

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

"""
max_keta = len(str(bin(B)))-2
ans_str = [0] * max_keta
for x in range(A, B + 1):
    a = format(x, '0%db' % max_keta)
    #print(x, a)
    for i in range(len(a)):
        ans_str[i] += int(a[i])
    #print(ans_str)

j = 1
ans = 0
for aa in reversed(ans_str):
    ans += (int(aa) % 2) * j
    j *= 2
#print(a)
"""

ans = 0
for x in range(A, B+1):
    ans ^= x
print(ans)

### FIXED CODE ###

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


def f(x):
    if x % 2 == 1:
        return x ^ ((x//2) % 2) ^ (x-1)
    else:
        return x ^ ((x//2) % 2)


ans = f(A-1) ^ f(B)
print(ans)
### BUGGY CODE ###

ri = lambda: map(int, input().split())

N, M = ri()
H = list(ri())
G = [[0]*N for _ in range(N)]
for _ in range(M):
    a, b = ri()
    G[a-1][b-1] = H[b-1]
    G[b-1][a-1] = H[a-1]

T = [max(r) for r in G]
print(sum(1 for i, h in enumerate(T) if h == 0 or h < H[i]))


### FIXED CODE ###

ri = lambda: map(int, input().split())

N, M = ri()
H = list(ri())
T = [0]*N
for _ in range(M):
    a, b = ri()
    T[a-1] = max(T[a-1], H[b-1])
    T[b-1] = max(T[b-1], H[a-1])

print(sum(1 for i, h in enumerate(T) if h == 0 or h < H[i]))