Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**6)


class UnionFind():
	def __init__(self, n):
		self.size = n
		self.root = [-1 for _ in range(n+1)]
		self.rnk = [0 for _ in range(n+1)]

	def findRoot(self, a):
		if self.root[a] < 0:
			return a
		else:
			return self.findRoot(self.root[a])

	def uniteTree(self, a, b):
		a = self.findRoot(a)
		b = self.findRoot(b)

		if a == b:
			return

		elif self.rnk[a] > self.rnk[b]:
			self.root[a] += self.root[b]
			self.root[b] = a

		elif self.rnk[b] > self.rnk[a]:
			self.root[b] += self.root[a]
			self.root[a] = b

		elif self.rnk[a] == self.rnk[b]:
			self.root[b] += self.rnk[a]
			self.root[a] = b
			self.rnk[b] += 1

	def judgeTree(self, a, b):
		return self.findRoot(a) == self.findRoot(b)

	def count(self, a):
		return self.rnk[self.findRoot(a)] * (-1)

N, K, S = map(int, input().split())
P = []
Q = []
R = []
L = []

for _ in range(K):
	p_tmp, q_tmp = map(int, input().split())
	P.append(p_tmp)
	Q.append(q_tmp)

for _ in range(S):
	r_tmp, l_tmp = map(int, input().split())
	R.append(r_tmp)
	L.append(l_tmp)
	
road = UnionFind(N)
train = UnionFind(N)

for i in range(K):
	road.uniteTree(P[i], Q[i])

for i in range(S):
	train.uniteTree(R[i], L[i])

ans = [1 for _ in range(N)]

for i in range(1, N+1):
	for j in range(1, N+1):
		if i == j:
			continue
		else:
			if road.judgeTree(i,j) and train.judgeTree(i,j):
				ans[i-1] += 1

for i in ans:
	print(i, end = " ")

### FIXED CODE ###

import sys
import collections as c
sys.setrecursionlimit(10**6)

import sys
sys.setrecursionlimit(10**7)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)

    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    def Unite(self, x, y):
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    def Count(self, x):
        return -self.root[self.Find_Root(x)]

N, K, L = map(int,input().split())
p = []
q = []
l = []
r = []

for _ in range(K):
	p_tmp, q_tmp = map(int ,input().split())
	p.append(p_tmp)
	q.append(q_tmp)

for _ in range(L):
	l_tmp, r_tmp = map(int, input().split())
	l.append(l_tmp)
	r.append(r_tmp)

road = UnionFind(N)
train = UnionFind(N)

for i in range(K):
	road.Unite(p[i], q[i])

for i in range(L):
	train.Unite(l[i], r[i])

ar = []

for i in range(1,N+1):
	a = road.Find_Root(i)
	b = train.Find_Root(i)
	ar.append(str([a,b]))

Car = c.Counter(ar)

for i in range(N):
	print(Car[ar[i]], end = " ")
s = str(input())

print('Yes' if s.count(a)+s.count(b)=2 else 'No')

### FIXED CODE ###

s = str(input())

print('Yes' if s.count('a')==1 and s.count('b')==1 else 'No')
import sys
print(int(sys.argv[1]) ** 2)

### FIXED CODE ###

r = input()
print(int(r) ** 2)
def func(n):
    if n>=3:
        return (func(n-1)+func(n-2))%(10**9+7)
    elif n==2:
        return 2
    else:
        return 1

N, M = map(int, input().split())
if M:
    a=[]
    for _ in range(M):
        a.append(int(input()))

    a=[-1]+a+[N+1]
    answer=1
    for i in range(M+1):
        if a[i+1]-a[i]==1:
            print(0)
            break
        answer=( func(a[i+1]-a[i]-2)*answer )%(10**9+7)
    else:
        print(answer)

else:
    print(func(N))


### FIXED CODE ###

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

N, M = map(int, input().split())
a=[]
for _ in range(M):
    a.append(int(input()))

lst=[None]*(N+1)
def func(n):
    #if n in a:
    #    return 0
    if n<=1:
        return 1
    else:
        if lst[n]:
            return lst[n]
        else:
            temp=(func(n-1)+func(n-2))%(10**9+7)
            lst[n]=temp
            return temp



a=[-1]+a+[N+1]
answer=1
for i in range(M+1):
    if a[i+1]-a[i]==1:
        print(0)
        break
    answer=( func(a[i+1]-a[i]-2)*answer )%(10**9+7)
else:
    print(answer)
import numpy as np
s = input()
t = input()

dp = np.zeros((len(t)+1, len(s)+1))
for i in range(1, len(t)+1):
    ti = t[i-1]
    dp[i] = dp[i-1]
    for j in range(1, len(s)+1):
        if ti == s[j-1]:
            dp[i][j] = dp[i][j-1] + 1
        else:
            if dp[i][j-1] >= dp[i][j]:
                dp[i][j] = dp[i][j-1]
ans = ''
sl = len(s)
tl = len(t)
while sl > 0 and tl > 0:
    if s[sl-1] == t[tl-1]:
        sl -= 1
        tl -= 1
        ans = s[sl] + ans
        continue

    if dp[tl][sl] == dp[tl][sl-1]:
        sl -= 1
    elif dp[tl][sl] == dp[tl-1][sl]:
        tl -= 1
print(ans)


### FIXED CODE ###

s = input()
t = input()
dp = [[0] * (len(s)+1) for _ in range(len(t)+1)]
for i in range(1, len(t)+1):
    ti = t[i-1]
    dp[i] = dp[i-1][:]
    for j in range(1, len(s)+1):
        if ti == s[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i][j-1], dp[i-1][j])

ans = ''
sl = len(s)
tl = len(t)
while sl > 0 and tl > 0:
    if s[sl-1] == t[tl-1]:
        sl -= 1
        tl -= 1
        ans = s[sl] + ans
        continue
    if dp[tl][sl] == dp[tl][sl-1]:
        sl -= 1
    elif dp[tl][sl] == dp[tl-1][sl]:
        tl -= 1
print(ans)
N=int(input())
listA=list(map(int, input().split()))
Q=int(input())

listB=[] #appendのために宣言が必要
while True:
    try:
        listB.append(list(map(int,input().split())))

    except:
        break;
        
sum=sum(listA)
numlist=[0]*(4+1)
for i in range(4+1):
  numlist[i]=listA.count(i)
  
for i in range(Q):
  B=listB[i][0]
  C=listB[i][1]
  sum=sum+(C-B)*numlist[B]
  numlist[C]+=numlist[B]
  numlist[B]=0
  # print(numlist)
  print(sum)


### FIXED CODE ###

N=int(input())
listA=list(map(int, input().split()))
Q=int(input())

listB=[] #appendのために宣言が必要
while True:
    try:
        listB.append(list(map(int,input().split())))

    except:
        break;
        
sum=sum(listA)
numlist=[0]*(10**5+1)
for i in listA:
  numlist[i]+=1
  
for i in range(Q):
  B=listB[i][0]
  C=listB[i][1]
  if numlist[B]!=0:
    sum=sum+(C-B)*numlist[B]
    # print(C)
    numlist[C]+=numlist[B]
    numlist[B]=0
    # print(numlist)
  print(sum)
import collections
def check(val):
  flag=1
  for v in range(2,val**.5+1):
    if(val%v==0):
      if(v in x or val//v in x):
        flag=0
        break
  if(flag):
    count+=1
n=int(input())
a=list(map(int,input().split()))
count=0
x=collections.Counter(a)
if(1 in x):
  if(x[1]==1):
    print(1)
  else:
    print(0)
else:
  for each in a:
    if(x[each]==1):
      check(each)
  print(count)
    

### FIXED CODE ###


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

List.sort()
seive=[0]*(List[~0]+1)
count=0
for each in List:
    for i in range(each,List[-1]+1,each):
        seive[i]+=1
        
for each in List:
    if(seive[each]==1):
        count+=1


print(count)
a, b = int(input())
X = b - a
ans = 0
for i in range(X):
    ans += i
print(ans)

### FIXED CODE ###

a, b = map(int, input().split())
X = b - a
ans = 0
for i in range(X):
    ans += i
print(ans-a)
N = int(input())
A = [int(x) for x in input().split()]

result = 1
for idx in A:
  result *= idx
  
if result >= 10**18:
  print("-1")
else:
  print(result)

### FIXED CODE ###

data = input().split(" ")
a ,b= int(data[0]) , int(data[1])
print(a*b)
cnt = 0
while red >= green:
    green *= 2
    cnt += 1
while green >= blue:
    blue *= 2
    cnt += 1

if cnt <= k:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

red, green, blue = map(int, input().split())
k = int(input())

ans_list = []
def doble_calc(value, num):
    if num == 1:
        return value
    elif num == 2:
        return value*2
    elif num == 3:
        return value*2*2
    elif num == 4:
        return value*2*2*2
    elif num == 5:
        return value*2*2*2*2
    elif num == 6:
        return value*2*2*2*2*2
    elif num == 7:
        return value*2*2*2*2*2*2
    
for i in range(1, k+2):
    for j in range(1, k+2):
        for l in range(1, k+2):
            if i + j + l == k+3:
                red_calc = doble_calc(red, i)
                green_calc = doble_calc(green, j)
                blue_calc = doble_calc(blue, l)
                ans_list.append([red_calc, green_calc, blue_calc])
            
for i in ans_list:
    if i[0] < i[1] < i[2]:
        print('Yes')
        break
else:
    print('No')
N,K=map(int,(input().split()))
TO=list(map(int,input().split()))

visit_flag=[[0]*2 for i in [1]*N]
visit_count=0
first_visit=0
last_visit=0
next_town=1
visit_flag[0][0]=1
visit_flag[0][1]=0

for i in range(K):
    visit_count+=1
    next_town = TO[next_town-1]
    if visit_flag[next_town-1][0]==0:
        visit_flag[next_town-1][0]=1
        visit_flag[next_town-1][1]=visit_count
    else:
        first_visit=visit_flag[next_town-1][1]
        last_visit=visit_count
        break

roop=last_visit-first_visit
span=visit_flag[next_town-1][1]

if K<=roop:
    next_town = 1
    for i in range(K):     
        next_town = TO[next_town-1]
    ans=next_town
else:
    if roop==0:
        ans=next_town
    else:
        for i in range((K-span)%roop):
            next_town = TO[next_town-1]
            ans=next_town

print(ans)

### FIXED CODE ###

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

visit_flag=[[0]*2 for i in [1]*N]
visit_count=0
first_visit=0
last_visit=0
next_town=1
visit_flag[0][0]=1
visit_flag[0][1]=0

for i in range(K):
    visit_count+=1
    next_town = TO[next_town-1]
    if visit_flag[next_town-1][0]==0:
        visit_flag[next_town-1][0]=1
        visit_flag[next_town-1][1]=visit_count
    else:
        first_visit=visit_flag[next_town-1][1]
        last_visit=visit_count
        break

roop=last_visit-first_visit
span=visit_flag[next_town-1][1]

if K<=roop:
    next_town = 1
    for i in range(K):     
        next_town = TO[next_town-1]
    ans=next_town
else:
    if roop==0:
        ans=next_town
    else:
        for i in range((K-span)%roop):
            next_town = TO[next_town-1]
        ans=next_town

print(ans)
a,b = map(int, input().split())
if (a * b % 2 == 0):
  return 'Even'
else:
  return 'Odd'

### FIXED CODE ###

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

if (a*b % 2 == 0):
  print('Even')
else:
  print('Odd')
A,B,C = map(int,input().split())
K = int(input())
L = max(A,B,C)
if L ==A:
print((A*(2**K))+B+C
elif L ==B:
print(A+(B*(2**K))+C)
else:
print(A+B+(C*(2**K)))

### FIXED CODE ###

A,B,C = map(int,input().split())
K = int(input())
L = max(A,B,C)
if L == A:
  print((A*(2**K))+B+C)
elif L == B:
  print(A+(B*(2**K))+C)
else:
  print(A+B+(C*(2**K)))
n, m  = map(int, input().split())
g     = {}
used  = {i:[False for _ in range(11)] for i in range(n)}
color     = [0  for _ in range(n)]

for _ in range(m):
    u, v = map(int, input().split())
    u-=1
    v-=1
    if u not in g:
        g[u] = []
    if v not in g:
        g[v] = []
    g[u].append(v)
    g[v].append(u)
    
q = int(input())
Q = []

for _ in range(q):
    node, dis, col = map(int, input().split())
    Q.append([node-1, dis, col])
Q = Q[::-1]

def bfs(now, dist, col):
    if dist < 0:
        return
    
    if used[now][dist]:
        return
 
    used[now][dist] = True
    
    if not color[now]:
        color[now] = col
 
    for x in g[now]:
        bfs(x, dist - 1, col)
            
for node, dis, col in Q:
    bfs(node, dis, col)

for x in color:
    print(x)

### FIXED CODE ###

n, m  = map(int, input().split())
g     = {}
used  = {i:[False for _ in range(11)] for i in range(n)}
color     = [0  for _ in range(n)]

for _ in range(m):
    u, v = map(int, input().split())
    u-=1
    v-=1
    if u not in g:
        g[u] = []
    if v not in g:
        g[v] = []
    g[u].append(v)
    g[v].append(u)
    
q = int(input())
Q = []

for _ in range(q):
    node, dis, col = map(int, input().split())
    Q.append([node-1, dis, col])
Q = Q[::-1]

def bfs(now, dist, col):
    if dist < 0:
        return
    
    if used[now][dist]:
        return
 
    used[now][dist] = True
    
    if not color[now]:
        color[now] = col
 
    if now in g:
        for x in g[now]:
            bfs(x, dist - 1, col)
            
for node, dis, col in Q:
    bfs(node, dis, col)

for x in color:
    print(x)
A, B, C, D = map(int, input().split())
AC = (A - 1) // C
AD = (A - 1) // D
BC = B // C
BD = B // D
BCD = B // lcm(C, D)
ACD = (A - 1) // lcm(C, D)
tmp = (BC + BD) - (AC + AD) - (BCD - ACD)
ans = (B - A + 1) - tmp
print(ans)

### FIXED CODE ###

import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B, C, D = map(int, input().split())
AC = (A - 1) // C
AD = (A - 1) // D
BC = B // C
BD = B // D
BCD = B // lcm(C, D)
ACD = (A - 1) // lcm(C, D)
tmp = (BC + BD) - (AC + AD) - (BCD - ACD)
ans = (B - A + 1) - tmp
print(ans)
def lmc(a,b):
  i = 1
  while(1):
    c = a*i
	if c % b == 0:
      return c
	i += 1

print("a= ",end="")
a= int(input())
print("b= ",end="")
b= int(input())
print(lmc(a,b))

### FIXED CODE ###

def LMC(a,b):
  i = 1
  while(1):
    c = a * i
    if c % b == 0:
      return c
    i += 1

num_line = [int(i) for i in input().split(" ")]
print(LMC(num_line[0],num_line[1]))
S=input()
print(min(abs(int(S[i:i+3])-753) for i in range(len(S)-2)))

### FIXED CODE ###

X=int(input())
if X==3 or X==5 or X==7:
    print('YES')
else:
    print('NO')
[a,b]=int(input().split())

if a < b:
   print('a < b')
elif a > b:
   print('a < b')
else:
   print('a == b')

### FIXED CODE ###

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

if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
# coding: utf-8
import os
from sys import stdin, stdout

__LOCAL__ = True
if(__LOCAL__):
    __dirname = os.path.dirname(__file__)
    __basename = os.path.splitext(os.path.basename(__file__))[0]
    __inputname = './input/' + __basename + '.txt'
    __outputname = './output/' + __basename + '.txt'
    input_path = os.path.join(__dirname, __inputname)
    output_path = os.path.join(__dirname, __outputname)
    stdin = open(input_path)
    stdout = open(output_path, "w")

def TLEmain():
    A, B = map(int,stdin.readline().rstrip().split(' '))
    ans = 0
    for x in range(A,B+1):
        ans ^= x
    print(ans)

def xorsum(A):
    if(A&1):
        return (A+1)//2 & 1
    else:
        return ((A+1)//2 & 1) ^ A

def main():
    A, B = map(int,stdin.readline().rstrip().split(' '))
    if(A==B):
        ans = A
        stdout.write("{}\n".format(ans))
    else:
        ans = xorsum(A-1)^xorsum(B)
        stdout.write("{}\n".format(ans))     

if __name__ == "__main__":
    main()
    

### FIXED CODE ###

# coding: utf-8
import os
from sys import stdin, stdout

__LOCAL__ = False
if(__LOCAL__):
    __dirname = os.path.dirname(__file__)
    __basename = os.path.splitext(os.path.basename(__file__))[0]
    __inputname = './input/' + __basename + '.txt'
    __outputname = './output/' + __basename + '.txt'
    input_path = os.path.join(__dirname, __inputname)
    output_path = os.path.join(__dirname, __outputname)
    stdin = open(input_path)
    stdout = open(output_path, "w")

def TLEmain():
    A, B = map(int,stdin.readline().rstrip().split(' '))
    ans = 0
    for x in range(A,B+1):
        ans ^= x
    print(ans)

def xorsum(A):
    if(A&1):
        return (A+1)//2 & 1
    else:
        return ((A+1)//2 & 1) ^ A

def main():
    A, B = map(int,stdin.readline().rstrip().split(' '))
    if(A==B):
        ans = A
        stdout.write("{}\n".format(ans))
    else:
        ans = xorsum(A-1)^xorsum(B)
        stdout.write("{}\n".format(ans))     

if __name__ == "__main__":
    main()
t = input()

if t >= 30:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

t = int(input())

if t >= 30:
  print('Yes')
else:
  print('No')
N = input()
S = [int(c) for c in N]

A = [0] * (len(S)+1)
B = [0] * (len(S)+1)

for i in range((len(S)//2)+1):
  A[i*2+1] = 1
  B[i*2] = 1
  
  
ca =0
cb =0
for i in range(len(S)):
  ca += abs(S[i]-A[i])
  cb += abs(S[i]-B[i])
print(min(ca, cb))
  
  

### FIXED CODE ###

N = input()
S = [int(c) for c in N]

A = [0] * (len(S)+4)
B = [0] * (len(S)+4)

for i in range((len(S)//2)+1):
  A[i*2+1] = 1
  B[i*2] = 1
  
ca =0
cb =0
for i in range(len(S)):
  ca += abs(S[i]-A[i])
  cb += abs(S[i]-B[i])
print(min(ca, cb))
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=I()
A=[I() for i in range(N)]
counts = collections.Counter(A)
ans=0
for i in counts.values():
    if values%2 == 1: 
        ans += 1
print(ans)


### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=I()
A=[I() for i in range(N)]
counts = collections.Counter(A)
ans=0
for i in counts.values():
    if i%2 == 1: 
        ans += 1
print(ans)
n, m = (int(xi) for xi in input().split())

a = []
diff = []
a0 = 0
a1 = int(input())
a.append(a1)
diff.append(a1+1)

if m>1:
    for xi in range(m-1):
        a0 = a1
        a1 = int(input())
        a.append(a1)
        diff.append(a1-a0)

if a1==n-1:
    diff.append(n-a1+1)
else:
    diff.append(n-a1+1)

# print(diff)
# print(a)

p = [0]
p.append(1)
p.append(1)
for xi in range(3,max(diff)+2):
    add = (p[xi-1]+p[xi-2])%1_000_000_007
    p.append(add)

# print(p)

# print(len(diff))
out = 1
for xi in range(len(diff)):
    out *= p[diff[xi]-1]

print(out% 1_000_000_007 )


### FIXED CODE ###

n, m = (int(xi) for xi in input().split())

a = []
diff = []
a0 = 0
if m>0:
    a1 = int(input())
    a.append(a1)
    diff.append(a1+1)

    if m>1:
        for xi in range(m-1):
            a0 = a1
            a1 = int(input())
            a.append(a1)
            diff.append(a1-a0)

    if a1==n-1:
        diff.append(n-a1+1)
    else:
        diff.append(n-a1+1)


else:
    if n==1: diff.append(n+1)
    diff.append(n+2)

# print(diff)
# print(a)

p = [0]
p.append(1)
p.append(1)
for xi in range(3,max(diff)+2):
    add = (p[xi-1]+p[xi-2])%1_000_000_007
    p.append(add)

# print(p)

# print(len(diff))
out = 1
for xi in range(len(diff)):
    out *= p[diff[xi]-1]

print(out% 1_000_000_007 )
x,y,z,k = map(int,input().split())
num = []
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in A:
    num.append((i,'A'))
for i in B:
    num.append((i,'B'))
for i in C:
    num.append((i,'C'))
num.sort(reverse = True)
A = []
B = []
C = []
po = 0
while(po < x*y*z and len(A)*len(B)*len(C) < 222222):
    if(num[po][1] == 'A'):
        A.append(num[po][0])
    elif (num[po][1] == 'B'):
        B.append(num[po][0])
    else:
        C.append(num[po][0])
    po+=1
ans = []
#print(A,B,C)
for a in A:
    for b in B:
        for c in C:
            ans.append(a+b+c)
ans.sort(reverse = True)
for i in range(k):
    print(ans[i])


### FIXED CODE ###

x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])
import math
N, a, b = map(int, input().split())
MOD = 10 ** 9 + 7

#def combinations_count(n, r):
#    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
#print(combinations_count(4, 2))
# 6
ans = 0
X = 1
for i in range(1, N + 1):
  X = int(X * (N + 1 - i) / i)
  if i != a:
    if i != b:
      ans += X
      
print(ans)

### FIXED CODE ###

import math
n, a, b = map(int, input().split())
p = 10 ** 9 + 7
#ans = 2 ** n - 1 - N C a - N C b

def modpow(a, n, MOD):
  res = 1
  while (n > 0):
    if (n & 1):
      res = res * a % MOD
    a = a * a % MOD
    n >>= 1
  return res

def cmb(n, r, p):
  A = 1
  for i in range(r):
    A *= (n - i)
    A *= modpow(i + 1, p - 2, p)
    A %= p
  return A

ans = (modpow(2, n, p) - 1) % p
ans -= cmb(n, a, p) + cmb(n, b, p)

print(ans % p)
cake_a = int(input())
cake_b = int(input())

if cake_a > 8 or cake_b > 8:
    print(":(")
    exit(0)
    
print("Yay!")


### FIXED CODE ###

input_line = input().split()

cake_a = int(input_line[0])
cake_b = int(input_line[1])

if cake_a > 8 or cake_b > 8:
    print(":(")
else:
    print("Yay!")
S = input()
print(S[0],S[1]) 
cnt = len(S) - 1 #数字の間の数
 
ans = 0
 
for i in range(2 ** cnt):
  sign = [""] * cnt
  for j in range(cnt):
    if ((i>>j)&1):
      sign[j] = "+"
            
  formula = ""      
  for k in range(cnt):
    formula += S[k] + sign[k]
    print(sign)
  formula += S[cnt]
  print(formula,i)       
  ans += eval(formula)
print(ans)

### FIXED CODE ###

S = input()
 
cnt = len(S) - 1 #数字の間の数
 
ans = 0
 
for i in range(2 ** cnt):
  sign = [""] * cnt
  for j in range(cnt):
    if ((i>>j)&1):
      sign[j] = "+"
            
  formula = ""      
  for k in range(cnt):
    formula += S[k] + sign[k]
  formula += S[cnt]   
  ans += eval(formula)
print(ans)
n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)/2))
else:
  print(int((b-a-1)/2+1+min(n-b,a-1))

### FIXED CODE ###

n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)//2))
else:
  print(int((b-a-1)//2+min(n-b,a-1)+1))
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list()
a=0
b=0
for i in range(N+M):
  if a+1<=N and b+1<=M and A[a]<B[b]:
    C.append(A[a])
    a+=1
  elif a+1<=N and b+1<=M and A[a]>B[b]:
    C.append(B[b])
    b+=1
  elif  a+1<=N and b+1<=M and A[a]==B[b]:
    if a+2==N:
      C.append(B[b])
      b+=1
    elif b+2==M:
      C.append(A[a])
      a+=1
    elif A[a+1]<B[b+1]:
      C.append(A[a])
      a+=1
    else:
      C.append(B[b])
      b+=1
  elif a==N:
    C.append(B[b])
    b+=1
  elif b==M:
    C.append(A[a])
    a+=1
import numpy as np
L=np.array(C).cumsum()
print(len(L[L <= K]))

### FIXED CODE ###

N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
c=0
k=M
import numpy as np
A=np.array(A).cumsum()
B=np.array(B).cumsum()
for i in range(N):
  d=K-A[i]
  if d<0:
    for j in reversed(range(M)):
      if K-B[j]>=0:
        if c<j+1:
          c=j+1
        break
    break
  else:
    for j in reversed(range(k)):
      if d>=B[j]:
        if c<i+j+2:
          c=i+j+2
        k=j+1
        break
    if d<B[0]:
      if c<i+1:
        c=i+1
      k=0
for j in reversed(range(M)):
  if K-B[j]>=0:
    if c<j+1:
      c=j+1
print(c)