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

N = int(input())
Alist = sorted(list(map(int, input().split())))
Blist = sorted(list(map(int, input().split())))
Clist = sorted(list(map(int, input().split())))

def binary_search(num_list, target):
    ans_counter = 0
    if target <= num_list[0]:
        return -1
    
    if num_list[-1] < target:
        return(len(num_list))
    
    while True:

        middle = num_list[len(num_list) // 2]
        left = num_list[:len(num_list) // 2]
        right = num_list[len(num_list) // 2:]

        if target > left[-1] and right[0] >= target:
            ans_counter += len(left)
            return ans_counter

        elif target <= left[-1]:
            num_list = left
    
        elif right[0] < target:
            ans_counter += len(left)
            num_list = right
ans = 0
for C in Clist:
    b_point = 0
    b_point =  binary_search(Blist, C)

    if b_point >= 0:
        for B in Blist[:b_point]:
            a_point =  binary_search(Alist, B)
#            print(B,C,a_point) 
            ans += (a_point)

print(ans)
#for C in Clist:
    




### FIXED CODE ###

import bisect

N = int(input())
Alist = sorted(list(map(int, input().split())))
Blist = sorted(list(map(int, input().split())))
Clist = sorted(list(map(int, input().split())))

ans = 0

for B in Blist:
    Aindex = bisect.bisect_left(Alist, B)
    Cindex = bisect.bisect_right(Clist, B)

#    print(B, Aindex, N-Cindex)
    ans += Aindex * (N - Cindex)

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

import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

counts = {}

for a in A:
    if a not in counts:
        counts[a] = 1
    else:
        counts[a] += 1

for a in A:
    ans = 0
    counts[a] -= 1

    for k, v in counts.items():
        if v >= 2:
            ans += v * (v - 1) // 2
    counts[a] += 1
    print(ans)


### FIXED CODE ###

import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

counts = {}

for a in A:
    if a not in counts:
        counts[a] = 1
    else:
        counts[a] += 1

alls = 0
for k, v in counts.items():
    if v >= 2:
        alls += v * (v - 1) // 2
for a in A:
    acc = counts[a]
    print(alls - (acc - 1))
### BUGGY CODE ###

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

MAX_N = int(1e4)
dp = [[-1 for i in range(10)] for i in range(MAX_N + 10)]
for j in range(1, 9 + 1):
    dp[0][j] = 0

mc = [2, 5, 5, 4, 5, 6, 3, 7, 6]

for i in range(N + 1):
    for j in range(1, 9 + 1):
        if j not in A:
            continue

        if i < mc[j - 1]:
            continue

        for k in range(1, j + 1):
            tmp = dp[i - mc[j - 1]][k]
            if tmp == -1:
                continue
            if tmp == 0:
                tmp = ""
            tmp = str(tmp)
            dp[i][j] = max(dp[i][j], int(tmp + str(j)), int(str(j) + tmp))


ans = 0
for j in range(1, 9 + 1):
    ans = max(ans, dp[N][j])
print(ans)


### FIXED CODE ###

import math


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

MAX_N = int(1e4)
dp = [-1 for i in range(MAX_N + 20)]
dp[0] = 0

mc = [2, 5, 5, 4, 5, 6, 3, 7, 6]

for i in range(N + 1):
    for j in A:
        tmp = dp[i]
        if tmp == -1:
            continue
        if tmp == 0:
            dp[i + mc[j - 1]] = max(dp[i + mc[j - 1]], j)
        else:
            dp[i + mc[j - 1]] = max(dp[i + mc[j - 1]], tmp * 10 + j)

ans = dp[N]
print(ans)
### BUGGY CODE ###

import collections

N = int(input())
S = [input() for i in range(N)]
C = collections.Counter(S)

ans = []
flag = 0

for n in range(len(C)):
    if int(C.most_common()[n][1]) < flag:
        break
    else:
        ans.append(C.most_common()[n][0])
        flag = int(C.most_common()[n][1])

ans.sort()

for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

import collections

N = int(input())
S = [input() for i in range(N)]
C = collections.Counter(S)
L = C.most_common()

ans = []
flag = 0

for n in range(len(C)):
    if L[n][1] < flag:
        break
    else:
        ans.append(L[n][0])
        flag = (L[n][1])

ans.sort()

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

from functools import reduce
import fractions
n = int(input())
a = list(map(int, input().split()))


def R(r):
    r_list = [a[i] for i in range(n) if i >= r]
    if r_list == []:
        return reduce(fractions.gcd, [a[i] for i in range(n) if i != n - 1])
    else:
        return reduce(fractions.gcd, r_list)


def L(l):
    l_list = [a[i] for i in range(n) if i <= l]
    if l_list == []:
        return reduce(fractions.gcd, [a[i] for i in range(n) if i != 0])
    else:
        return reduce(fractions.gcd, l_list)


def M(m):
    return fractions.gcd(L(m-1), R(m + 1))


t = []
for j in range(n):
    t.append(M(j))
print(max(t))


### FIXED CODE ###

from functools import reduce
import fractions
n = int(input())
a = list(map(int, input().split()))
L = [0] * (n + 1)
R = [0] * (n + 1)
for i in range(n-1):
    L[i + 1] = fractions.gcd(L[i], a[i])
    R[n - i - 1] = fractions.gcd(R[n - i], a[n - i - 1])

rl = [0] * n
for i in range(n):
    rl[i] = fractions.gcd(L[i], R[i + 1])
print(max(rl))
### BUGGY CODE ###

S = list(input())
tmp = len(S)
frag = True
while frag == True and len(S) != 0:
    i = 0
    frag = False
    while i < len(S)-1 and frag == False :
        if S[i] != S[i+1] :
            del S[i]
            del S[i]
            frag = True
        else:
            i += 1
print(tmp - len(S))


### FIXED CODE ###

S = list(input())
print(int(min(S.count('0'),S.count('1')))*2)
### BUGGY CODE ###

n=int(input())
s=list(input())
l=[]
for i in range(n):
  l.append(s[0:i].count('W')+s[i:n].count('E'))
print(min(l))

### FIXED CODE ###

n=int(input())
s=input()
c=s[1:n].count('E')
l=[]
l.append(c)
for i in range(1,n):
  if s[i-1:i+1]=='WW':c+=1
  elif s[i-1:i+1]=='EE':c-=1
  l.append(c)
print(min(l))
### BUGGY CODE ###

from collections import Counter

N = int(raw_input())
a = map(int, raw_input().split())
a.sort()

while(True):
    mn = min(a)
    while(a.count(mn) == 1):
        try:
            mn = a[a.index(mn)+1]
        except:
            mn = min(a)
            break

    mx = max(a)
    while(a.count(mx) == 1):
        try:
            mx = a[a.index(mx)-1]
        except:
            mx = max(a)
            break

    a.remove(mn)
    a.remove(mx)

    count = Counter(a)
    if max(count.values()) == 1:
        break

print len(a)


### FIXED CODE ###

N = int(raw_input())
a = set(map(int, raw_input().split()))
print len(a) if len(a) % 2 != 0 else len(a)-1
### BUGGY CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h, w = LI()
ch, cw = LI()
dh, dw = LI()
s = [list(input()) for _ in range(h)]

dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]

que = deque([(cw-1, ch-1)])
d = [[10**10] * w for _ in range(h)]
d[ch-1][cw-1] = 0
while que:
    x, y = que.popleft()
    if x == dw -1 and y == dh - 1:
        print(0)
        quit()
    for i in range(4):
        nx, ny = x + dx[i], y + dy[i]
        if 0 <= nx < w and 0 <= ny < h:
            if s[ny][nx] == '.' and d[ny][nx] > d[y][x]:
                d[ny][nx] = d[y][x]
                que.append((nx, ny))

d = [[10**10] * w for _ in range(h)]
d[ch-1][cw-1] = 0
H = []
heappush(H, (0, cw-1, ch-1))
while H:
    D, x, y = heappop(H)
    for i in range(4):
        nx, ny = x + dx[i], y + dy[i]
        if 0 <= nx < w and 0 <= ny < h:
            if s[ny][nx] == '.' and d[ny][nx] > D:
                d[ny][nx] = D
                heappush(H, (D, nx, ny))
    for i in range(-2, 3):
        for j in range(-2, 3):
            nx, ny = x + i, y + j
            if 0 <= nx < w and 0 <= ny < h:
                if s[ny][nx] == '.' and d[ny][nx] > D + 1:
                    d[ny][nx] = D + 1
                    heappush(H, (D + 1, nx, ny))
if d[dh-1][dw-1] == 10**10:
    print(-1)
else:
    print(d[dh-1][dw-1])

### FIXED CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h, w = LI()
ch, cw = LI()
dh, dw = LI()
s = [input() for _ in range(h)]

dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]
que = deque([(cw-1, ch-1)])
d = [[10**10] * w for _ in range(h)]
d[ch-1][cw-1] = 0
while que:
    x, y = que.popleft()
    for i in range(4):
        nx, ny = x + dx[i], y + dy[i]
        if 0 <= nx < w and 0 <= ny < h:
            if s[ny][nx] == '.' and d[ny][nx] > d[y][x]:
                d[ny][nx] = d[y][x]
                que.appendleft((nx, ny))
    for i in range(-2, 3):
        for j in range(-2, 3):
            nx, ny = x + i, y + j
            if 0 <= nx < w and 0 <= ny < h:
                if s[ny][nx] == '.' and d[ny][nx] > d[y][x] + 1:
                    d[ny][nx] = d[y][x] + 1
                    que.append((nx, ny))
if d[dh-1][dw-1] == 10**10:
    print(-1)
else:
    print(d[dh-1][dw-1])
### BUGGY CODE ###

# input
n = int(input())
inp_ls = input().split(" ")
a_ls = [int(e) for e in inp_ls[:n]]

cnt = 0
for i in range(n-1):
	abs_val = i+1
	for j in range(n-abs_val):
		if abs_val <= a_ls[j]: continue
		if a_ls[j] + a_ls[j+abs_val] == abs_val: cnt += 1

# result
print(cnt)

### FIXED CODE ###

def count_j(arg_ls, th, b_idx, e_idx):
	if b_idx-1 == e_idx: return 0
	if b_idx == e_idx: return int(arg_ls[b_idx] > th)
	cent_idx = (e_idx+1 - b_idx) // 2 + b_idx
	cent_j = arg_ls[cent_idx]
	if cent_j > th:
		return count_j(arg_ls, th, b_idx, cent_idx-1) + (e_idx+1 - cent_idx)
	else:
		return count_j(arg_ls, th, cent_idx, e_idx)

n = int(input())
inp_ls = input().split(" ")
a_ls = [int(e) for e in inp_ls[:n]]

i_dic = {}
for i,a in enumerate(a_ls):
	val = -a+(i+1)
	if val not in i_dic: i_dic[val] = []
	i_dic[val].append(i+1)

cnt = 0
for i in range(len(a_ls)):
	val = a_ls[i] + (i+1)
	cand_ls = i_dic.get(val, [])
	result = count_j(cand_ls, (i+1), 0, len(cand_ls)-1)
	cnt += result

print(cnt)
### BUGGY CODE ###

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

n = []
for i in range(1, N+1):
    if i in l:
        n.append(l.count(i))

ans = 0
for i in range(len(n) - K):
    ans += min(n)
    n.remove(min(n))

print(ans)


### FIXED CODE ###

from collections import Counter
N, K = list(map(int, input().split()))
l = list(sorted(Counter(map(int, input().split())).values()))

ans = 0
w = len(l)
for v in l:
    if w <= K:
        print(ans)
        break
    w -= 1
    ans += v
### BUGGY CODE ###

# ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]
dist=[inf]*N
visited=[False]*N
for i in range(M):
    a,b,c=map(int,input().split())
    if mat[a-1][b-1]>c:
        mat[a-1][b-1]=mat[b-1][a-1]=c

for i in range(R):
    r[i]-=1

ans=inf
for i in range(N):
    for j in range(N):
        for k in range(N):
            mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j])

for rr in itertools.permutations(r,R):
    t_sum=0
    for j in range(1,R):
        t_sum+=mat[rr[j-1]][rr[j]]
    ans=min(ans,t_sum)
print(ans)


### FIXED CODE ###

# ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]

for i in range(M):
    a,b,c=map(int,input().split())
    if mat[a-1][b-1]>c:
        mat[a-1][b-1]=mat[b-1][a-1]=c

for i in range(R):
    r[i]-=1

ans=inf
for k in range(N):
    for i in range(N):
        for j in range(N):
            mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j])

for rr in itertools.permutations(r,R):
    t_sum=0
    for j in range(1,R):
        t_sum+=mat[rr[j-1]][rr[j]]
    ans=min(ans,t_sum)
print(int(ans))
### BUGGY CODE ###

import bisect
import collections

def read():
    N = int(input().strip())
    S = str(input().strip())
    return N, S

def dig(S, T, N):
    for i in range(N):
            if S[i] == T[0]:
                for j in range(i+1, N):
                    if S[j] == T[1]:
                        for k in range(j+1, N):
                            if S[k] == T[2]:
                                return True
    return False


def solve(N, S):
    d = [collections.deque() for i in range(10)]
    count = 0
    for p in range(1000):
        T = '{:03d}'.format(p)
        count += 1 if dig(S, T, N) else 0
        
    return count
    
if __name__ == '__main__':
    inputs = read()
    output = solve(*inputs)
    print("%d" % output)


### FIXED CODE ###

import bisect
import collections

def read():
    N = int(input().strip())
    S = str(input().strip())
    return N, S


def solve(N, S):
    d = [collections.deque() for i in range(10)]
    count = 0
    for i in range(N):
        s = int(S[i])
        d[s].append(i)
    for p in range(1000):
        T = '{:03d}'.format(p)
        p0 = int(T[0])
        p1 = int(T[1])
        p2 = int(T[2])
        k0 = 0
        if len(d[p0]) > k0:
            idx0 = d[p0][k0]
            k1 = bisect.bisect_left(d[p1], idx0+1)
            if len(d[p1]) > k1:
                idx1 = d[p1][k1]
                k2 = bisect.bisect_left(d[p2], idx1+1)
                if len(d[p2]) > k2:
                    idx2 = d[p2][k2]
                    if  S[idx0] + S[idx1] + S[idx2] == T:
                        count += 1
    return count
    
if __name__ == '__main__':
    inputs = read()
    output = solve(*inputs)
    print("%d" % output)
### BUGGY CODE ###

n=int(input())
segSize=n+1
def init_max(init_max_val):
    for i in range(segSize):
        seg_max[i+num_max-1]=init_max_val[i]
    for i in range(num_max-2,-1,-1) :
        seg_max[i]=max(seg_max[2*i+1],seg_max[2*i+2]) 
    
def update_max(k,x):
    k += num_max-1
    seg_max[k] = x
    while k:
        k = (k-1)//2
        seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    
def query_max(p,q):
    if q<=p:
        return ide_ele_max
    p += num_max-1
    q += num_max-2
    res=ide_ele_max
    while q-p>1:
        if p&1 == 0:
            res = max(res,seg_max[p])
        if q&1 == 1:
            res = max(res,seg_max[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res,seg_max[p])
    else:
        res = max(max(res,seg_max[p]),seg_max[q])
    return res

ide_ele_max = 0
num_max =2**(segSize-1).bit_length()
seg_max=[ide_ele_max]*2*num_max
mod=998244353


XD=[tuple(map(int,input().split()))for i in range(n)]
XD.sort()
X=[x for x,d in XD]
X.append(XD[-1][0])

import bisect

init_max(list(range(segSize)))
update_max(n,n)
combs=[1]*(n+2)
t=0
for x,d in XD[::-1]:
    idx=n-1-t
    t+=1
    p=bisect.bisect_right(X,x+d-1)
    p=query_max(idx,p)
    update_max(idx,p)
    combs[idx]=(combs[p+1]+combs[idx+1])%mod
print(combs[0])

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

n=int(readline())
segSize=n+1
def init_max(init_max_val):
    for i in range(segSize):
        seg_max[i+num_max-1]=init_max_val[i]
    for i in range(num_max-2,-1,-1) :
        seg_max[i]=max(seg_max[2*i+1],seg_max[2*i+2]) 
    
def update_max(k,x):
    k += num_max-1
    seg_max[k] = x
    while k:
        k = (k-1)//2
        seg_max[k] = max(seg_max[k*2+1],seg_max[k*2+2])
    
def query_max(p,q):
    if q<=p:
        return ide_ele_max
    p += num_max-1
    q += num_max-2
    res=ide_ele_max
    while q-p>1:
        if p&1 == 0:
            res = max(res,seg_max[p])
        if q&1 == 1:
            res = max(res,seg_max[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = max(res,seg_max[p])
    else:
        res = max(max(res,seg_max[p]),seg_max[q])
    return res
ide_ele_max = 0
num_max =2**(segSize-1).bit_length()
seg_max=[ide_ele_max]*2*num_max
mod=998244353

m = map(int,read().split())
XD = sorted(zip(m,m))
X=[x for x,d in XD]

from bisect import bisect_right
X=[bisect_right(X,x+d-1)for x,d in XD]

init_max(list(range(segSize)))
update_max(n,n)
combs=[1]*(n+1)
t=0
for x,d in reversed(XD):
    idx=n-1-t
    t+=1
    p=X[idx]
    p=query_max(idx,p)
    update_max(idx,p)
    combs[idx]=(combs[p+1]+combs[idx+1])%mod
print(combs[0])
### BUGGY CODE ###

def main():
        N, K = map(int, input().split())
        # K: fixed

        ans = 0

        if N%K==0:
                ans = 0
        else:
                if N>=K:
                        temp = K
                        while temp<N:
                                temp += K
                        upper = temp-N
                        lower = abs(upper-K)
                        ans = min(upper, lower)
                else:
                        ans = min(N, K-N)

        print("{}".format(ans))

if __name__=="__main__":
        main()

### FIXED CODE ###

def main():
        N, K = map(int, input().split())
        # K: fixed
        ans = 0
        r = N%K

        if N%K==0:
                ans = 0
        else:
                ans = min(r, abs(r-K))

        print("{}".format(ans))

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

# coding: utf-8

n = int(input())
s = input().rstrip().split()
q = int(input())
t = input().rstrip().split()
count = 0
for x in t:
    if x in s:
        count += 1
print(count)

### FIXED CODE ###

# coding: utf-8

n = int(input())
s = tuple(map(int, input().rstrip().split()))
q = int(input())
t = tuple(map(int, input().rstrip().split()))
# print("s:",s)
count = 0

def binary_search(array, value):
    ''' array must be sorted'''
    # print("value:{}".format(value))
    size = len(array)
    start = 0
    end = size - 1
    found = False
    while True:
        middle = (start + end)//2
        # print("s:{0}, e:{1}, m:{2}".format(start, end, middle))
        v = array[middle]
        if v == value:
            # print("v[{}]={} == {}".format(middle, v, value))
            return True
        elif start == end:
            # print("s:{} == e:{}".format(start, end)) 
            return False
        elif v > value:
            # print("v[{}]={} > {}".format(middle, v, value))
            end = middle
        elif v < value:
            # print("v[{}]={} < {}".format(middle, v, value))
            start = middle + 1

for i in range(q):
    if binary_search(s, t[i]):
        count += 1
print(count)
### BUGGY CODE ###

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

ans = 1

for i in range(N):
  ans *= A[i]
  i += 1

if ans > 10**18:
  print('-1')
else:
  print(ans)

### FIXED CODE ###

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

ans = 1

if 0 in A:
  ans = 0
else:
  for i in range(N):
    ans *= A[i]
    i += 1
    if ans > 10**18:
      ans = -1
      break

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

M=10**9+7
s=input()
r=range
dp=[[0]*13,[0]*13]
dp[0][0]=1
t=0
for c in s:
  for i in r(13):
    if c=='?':
      for j in r(10):
        dp[t^1][(i*10+j)%13]+=dp[t][i]
    else:
      dp[t^1][(i*10+int(c))%13]+=dp[t][i]
  dp[t]=[0]*13
  t^=1
  for i in r(13): dp[t][i]%=M
print(dp[len(s)%2][5])

### FIXED CODE ###

M=10**9+7
s=input()
r=range
dp=[[0]*13,[0]*13]
dp[0][0]=1
t=0
for c in s:
  for i in r(13):
    if c=='?':
      for j in r(10):
        dp[t^1][(i*10+j)%13]+=dp[t][i]
    else:
      dp[t^1][(i*10+int(c))%13]+=dp[t][i]
  dp[t]=[0]*13
  t^=1
  for i in r(13): dp[t][i]%=M
print(dp[len(s)%2][5])
### BUGGY CODE ###

n = int(input())
num = []
for i in range(n):
  num.append(int(input()))
  
for i in range(n):
  subnum = num[0:i] + num[i+1:n]
  subnum = sorted(subnum)
  print(subnum[n-2])

### FIXED CODE ###

n = int(input())
num = []
maxnum = 0
count = 1
for i in range(n):
  a = int(input())
  if a>maxnum:
    maxnum = max(maxnum,a)
    count = 1
  elif a==maxnum:
    count += 1
  num.append(a)
  
for i in range(n):
  if count>1:
    print(maxnum)
  else:
    if num[i]!=maxnum:
      print(maxnum)
    else:
      subnum = num[0:i] + num[i+1:n]
      subnum = sorted(subnum)
      print(subnum[n-2])
### BUGGY CODE ###

n = int(input())
a = [0]
for i in range(n):
  a.append(int(input()))
a.append(0)
for i in range(1,n+1):
  print(max(max(a[:i]),max(a[i+1:])))

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
max_1 = max(a)
a[a.index(max_1)] = -1
max_2 = max(a)
a[a.index(-1)] = max_1
for i in range(0,n):
  if a[i] == max_1:
    print(max_2)
  else:
    print(max_1)
### BUGGY CODE ###

def recur(ba,bb):
    if(ba <= 0 and bb <= 0):
        return 0
    if(ba <= 0):
        #only b twice
        return max(bb+(bb-1),recur(0,max(0,bb-2)))
    elif(bb<=0):
        return max(ba+(ba-1),recur(max(0,ba-2),0))
    else:
        tb = max(bb+bb-1,recur(ba,bb-2))
        ta = max(ba+ba-1,recur(ba-2,bb))
        bt = max(ba+bb,recur(ba-1,bb-2))
        return max(max(tb,ta),bt)

a,b = [int(i) for i in input().split()]

print(recur(a,b))


### FIXED CODE ###

def recur(ba,bb):
    tb = (2*bb)-1
    ta = (2*ba)-1
    bt = ba+bb
    return max(max(tb,ta),bt)

a,b = [int(i) for i in input().split()]

print(recur(a,b))
### BUGGY CODE ###

def binarySearch(S,t):
    if len(S) == 1:
        return S[0] == t
    m = len(S)//2
    if S[m] == t:
        return True
    if S[m] > t:
        return binarySearch(S[:m],t)
    if len(S) > 2:
        return binarySearch(S[m+1:],t)
    return False

if __name__=='__main__':
    n=int(input())
    S=list(map(int,input().split()))
    q=int(input())
    T=list(map(int,input().split()))
    cnt = 0
    for t in T: cnt += binarySearch(S,t)
    print(cnt)

### FIXED CODE ###

def binarySearch(A, key):
    left = 0
    right = len(A)
    while left < right:
        mid = (left + right) // 2
        if A[mid] == key:
            return mid
        elif key < A[mid]:
            right = mid
        else:
            left = mid + 1
    return -1

if __name__=='__main__':
    n=int(input())
    S=list(map(int,input().split()))
    q=int(input())
    T=list(map(int,input().split()))
    cnt = 0
    print(sum(map(lambda t: binarySearch(S,t) >= 0, T)))
### BUGGY CODE ###

L, R = map(int, input().split())
temp = 2019

for i in range(L, R):
    for j in range(i+1, R+1):
        temp = min(temp, (i*j) % 2019)

print(temp)

### FIXED CODE ###

L, R = map(int, input().split())
temp = 2019

for i in range(L, R):
    for j in range(i+1, R+1):
        temp = min(temp, (i*j) % 2019)
        if (i*j) % 2019 == 0:
            print(temp)
            exit(0)
print(temp)
### BUGGY CODE ###

N = int(input())
P = list(map(int,input().split()))
count = 0
for i in range(N):
    flag = True
    for j in range(i):
        if P[i] > P[j]: 
            flag = False
            break
    if flag:
        count += 1
print(count)



### FIXED CODE ###

N = int(input())
P = list(map(int,input().split()))
count = 0
minmum = P[0]
for i in range(N):
    if minmum >= P[i]:
        count += 1
        minmum = P[i]
print(count)