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

N=int(input())
A=list(map(int,input().split()))
removal=0
B=set(A)
for i in B:
  if A.count(i)-i<0:
    removal+=A.count(i)
  else:
    removal+=A.count(i)-i
print(removal)
  

### FIXED CODE ###

import bisect
N=int(input())
A=list(map(int,input().split()))
A.sort()
removal=0
B=set(A)
for i in B:
  m=(bisect.bisect_right(A,i)-bisect.bisect_left(A,i))
  if m-i<0:
    removal+=m
  else:
    removal+=m-i
print(removal)
### BUGGY CODE ###

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
 
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
 
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
 
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
 
    return result
 
N , M , K = map(int,input().split())
 
ans = 0
for t in range(K+1):
    temp = M*pow(M-1,N-t-1,998244353)
    temp = temp*cmb(N-1, t)%998244353
    ans = (ans+temp)%998244353
print(ans)

### FIXED CODE ###

def cmb(n, r, p):
  if (r < 0) or (n < r):
    return 0
  r = min(r, n - r)
  return fac[n] * finv[r] * finv[n-r] % p

N , M , K = map(int,input().split())
MOD = 998244353

fac = [-1]*(N+1); fac[0] = 1; fac[1] = 1
finv = [-1]*(N+1); finv[0] = 1; finv[1] = 1
inv = [-1]*(N+1); inv[0] = 0; inv[1] = 1
for i in range(2,N+1):
  fac[i] = fac[i-1]*i%MOD
  inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
  finv[i] = finv[i-1]*inv[i]%MOD

ans = 0
for t in range(K+1):
    temp = M*pow(M-1,N-t-1,MOD)
    temp = temp*cmb(N-1,t,MOD)
    ans = (ans+temp)%MOD
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
left = -10**9
right = 10**9
def cal(num):
  tmp = 0
  for i in range(n):
    tmp += abs(a[i]-(num+(i+1)))
  return tmp
 

while abs(right-left)>1:
  mid = (right+left)//2
  if cal(mid-1)<cal(mid+1):
    ans = mid
    right = mid
  else:
    left = mid
print(min(cal(left),cal(right)))
    

### FIXED CODE ###

from functools import lru_cache
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
left = -10**9
right = 10**9

@lru_cache(maxsize=100000)
def cal(num):
  tmp = 0
  for i in range(n):
    tmp += abs(a[i]-(num+(i+1)))
  return tmp
 

while abs(right-left)>1:
  mid = (right+left)//2
  if cal(mid-1)<cal(mid+1):
    right = mid
  else:
    left = mid
print(min(cal(left),cal(right)))
### BUGGY CODE ###

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

cnt = 0
l = []
for i in P :
    l.append(i)
    m = min(l)

    if i == m :
        cnt = cnt + 1

print(cnt)


### FIXED CODE ###

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

cnt = 0
pre_m = P[0]
for i in range(1, N+1) :
   
    m = min(P[i-1:i])
    if pre_m > m :
        pre_m = m
    else :
        m = pre_m

    if P[i-1] == m :
        cnt = cnt + 1

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

n = int(input())
lst = []
cnt = 0
for _ in range(n):
  s = input()
  if s not in lst:
    cnt += 1
    lst.append(s)
print(cnt)

### FIXED CODE ###

n = int(input())
st = set()
cnt = 0
for _ in range(n):
  s = input()
  st.add(s)
print(len(st))
### BUGGY CODE ###

import sys
readline = sys.stdin.readline

# dp[i][j] = i個目までのコインで、表の個数がj個である確率
# dp[i][j] = dp[i - 1][j] * (1 - P[i]) + dp[i - 1][j - 1] * P[i]
# dp[0][0] = 1 # 0個目までのコインで、表の個数が0個である確率は1

N = int(readline())
P = list(map(float,readline().split()))

dp = [[0] * (N + 1) for i in range(N + 1)]
dp[0][0] = 1
for i in range(len(P)):
  for j in range(i + 2):
    if j - 1 >= 0:
      dp[i + 1][j] = dp[i][j] * (1 - P[i]) + dp[i][j - 1] * P[i]
    else:
      dp[i + 1][j] = dp[i][j] * (1 - P[i])
  
ans = 0
for i in range((N // 2) + 1, len(dp[-1])):
  ans += dp[-1][i]
  
print(ans)

### FIXED CODE ###

n=int(input())
p=list(map(float,input().split()))
dp=[[0 for j in range(n+1)] for i in range(n+1)]

dp[0][0]=1
for i in range(n):
  for j in range(n):
    dp[i+1][j+1]+=dp[i][j]*p[i]
    dp[i+1][j]+=dp[i][j]*(1-p[i])
ans=0
for i in range(n,-1,-1):
  if i>n-i:
    ans+=dp[-1][i]
  else:
    break
print(ans)
### BUGGY CODE ###

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

#output
from collections import Counter
l = Counter(A).most_common()

maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A).most_common()
    while l[K][1] > 0:
        for i in range(K+1):
            l[i] = (l[i][0], l[i][1]-1)
        l.sort(key = lambda x:x[1], reverse = True)
        maximum_operation[K] += 1

for m in maximum_operation:
    print(m)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)
l.sort()
p = sum(l)

maximum_operation = [0] * N

ll = []
for x in reversed(range(1, N+1)):
    a = bisect.bisect_left(l, x)
    if a == 0:
        b = M*x
        c = 0
    elif a >= M:
        b = 0
        c = p
    else:
        b = (M-a)*x
        c = sum(l[0:a]) 
    ll.append((b + c)/x)

for K in range(M):
    maximum_operation[K] = N - bisect.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)
### BUGGY CODE ###

n,m=(int(x) for x in input().split())
l = [int(i) for i in input().split()]

l.sort(reverse=True)
for i in range(m):
    l[0]=l[0]//2
    l.sort(reverse=True)
total=0
for j in range(len(l)):
    total+=l[j]

print(total)

### FIXED CODE ###

import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))
### BUGGY CODE ###

import sys
from operator import mul
from functools import reduce

def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())
    ab = set([a, b])

    def comb_c(n, r):
        r = min(r, n - r)
        a = reduce(mul, range(n, n - r, -1), 1) % MOD
        b = reduce(mul, range(1, r + 1), 1)
        return a * pow(b, MOD - 2, MOD) % MOD

    n2 = (n - 1) // 2
    ans = 1
    for i in range(1, n2 + 1):
        ans += comb_c(n, i) * 2
    if n % 2 == 0:
        ans += comb_c(n, n2 + 1)
    ans -= comb_c(n, a)
    ans -= comb_c(n, b)
    ans %= MOD
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    MOD = 10 ** 9 + 7
    n, a, b = map(int, input().split())

    def comb_c(n, r):
        if r > n - r:
            r = n - r
        a, b = 1, 1
        for i in range(r):
            a = a * (n - i) % MOD
            b = b * (i + 1) % MOD
        return a * pow(b, MOD-2, MOD)

    ans = pow(2, n, MOD) - 1
    ans -= comb_c(n, a)
    ans -= comb_c(n, b)
    ans %= MOD
    print(ans)

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

import copy

n = int(input())
a = []

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

for i in range(n):
    buf = copy.deepcopy(a)
    buf.pop(i)
    print("{}".format(max(buf)))

### FIXED CODE ###

n = int(input())
a = []

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

_max = max(a)
max_idx = a.index(_max)
a.remove(_max)
second = max(a)
for i in range(n):
    if i == max_idx:
        print("{}".format(second))
    else:
        print("{}".format(_max))
### BUGGY CODE ###

import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
#print(A)

for i in range(1, N+1):
    print(np.count_nonzero(A == i))

### FIXED CODE ###

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

import collections
c = collections.Counter(A)

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

sa = input()
sb = input()
sc = input()
turn = sa[0]
sa = sa[1:]
while True:
    if turn == 'a':
        if not sa:
            win = 'A'
            break
        else:
            turn = sa[0]
            sa = sa[1:]
    if turn == 'b':
        if not sb:
            win = 'B'
            break
        else:
            turn = sb[0]
            sb = sb[1:]
    if turn == 'c':
        if not sc:
            win = 'C'
            break
        else:
            turn = sc[0]
            sc = sc[1:]

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
ans=(a+b)*h/2
print(int(ans))
### BUGGY CODE ###

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

l=[]
while len(l) < n:
    for i in range(a):
        if len(l) < n:
            l.append('b')
        else:
            break
    for j in range(b):
        if len(l) < n:
            l.append('r')
        else:
            break

print(l.count('b'))

### FIXED CODE ###

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

q=n//(a+b)
mod=n%(a+b)
ans=a*q
if a < mod:
    ans+=a
else:
    ans+=mod
print(ans)
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline

n, m = map(int, input().split())

graph = [[] for _ in range(n)]
in_degree = [0] * n
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    in_degree[b] += 1

v_root = in_degree.index(0)

ans = [0] * n
queue = deque([v_root])
while queue:
    v = queue.popleft()
    for v_next in graph[v]:
        ans[v_next] = v + 1
        queue.append(v_next)

print(*ans, sep='\n')


### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())

graph = [[] for _ in range(n)]
graph2 = [[] for _ in range(n)]
in_degree = [0] * n
out_degree = [0] * n
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph2[b].append(a)
    in_degree[b] += 1
    out_degree[a] += 1

v_root = in_degree.index(0)

depth = [-1] * n
ans = [0] * n
depth[v_root] = 0


def dfs(v):
    if depth[v] == -1:
        for v_par in graph2[v]:
            d = dfs(v_par)
            if depth[v] < d + 1:
                depth[v] = d + 1
                ans[v] = v_par + 1
    return depth[v]


for i in range(n):
    if out_degree[i] == 0:
        # print(i)
        _ = dfs(i)

print(*ans, sep='\n')
### BUGGY CODE ###

nq = str(input()).split()
n = int(nq[0])
q = int(nq[1])
p = [str(input()).split() for i in range(n)]
p = [(str(i[0]), int(i[1]), 0) for i in p]
ans = []
while len(p) != 0:
    t = p.pop(0)
    if t[1] > q:
        p = [(s[0], s[1], s[2]+q) for s in p]
        p.append((t[0], t[1]-q, t[2]+q))
    elif t[1] <= q:
        p = [(s[0], s[1], s[2]+t[1]) for s in p]
        ans.append((t[0], t[2] + t[1]))
for t in ans:
    print('{0} {1}'.format(t[0], t[1]))

### FIXED CODE ###

nq = str(input()).split()
n = int(nq[0])
q = int(nq[1])
p = [str(input()).split() for i in range(n)]
p = [(str(i[0]), int(i[1])) for i in p]
ans = []
time = 0
while len(p) != 0:
    t = p.pop(0)
    if t[1] > q:
        #p = [(s[0], s[1], s[2]+q) for s in p]
        time += q
        p.append((t[0], t[1]-q))
    elif t[1] <= q:
        #p = [(s[0], s[1], s[2]+t[1]) for s in p]
        ans.append((t[0], t[1]+time))
        time += t[1]
for t in ans:
    print('{0} {1}'.format(t[0], t[1]))
### BUGGY CODE ###

n = int(input())

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

ans = []

for i in range(1, n+1):
    ans.append(a.index(i) + 1)

print(' '.join(map(str,ans)))

### FIXED CODE ###

n = int(input())

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

ans = [0] * n

for i in range(n):
    ans[a[i] - 1] = i + 1 

print(' '.join(map(str,ans)))
### BUGGY CODE ###

import sys

def parse(inp):
    n,m = map(int,next(inp).split())
    a = sorted(list(map(int,next(inp).split())))
    bc =[]
    for _ in range(m):
        bc.append(list(map(int,next(inp).split())))
    bc.sort(key = lambda x:x[1],reverse=True)
    return n,m,a,bc
  
def main(inp):
    n,m,a,bc = inp
    for i in range(m):
        for j in range(bc[i][0]):
            if(a[j] < bc[i][1]): a[j] = bc[i][1]
            else: return sum(a)
        a.sort()
    return sum(a)
  
print(main(parse(sys.stdin)))

### FIXED CODE ###

import sys

def parse(inp):
    n,m = map(int,next(inp).split())
    a = sorted(list(map(int,next(inp).split())))
    bc =[]
    for _ in range(m):
        bc.append(list(map(int,next(inp).split())))
    bc.sort(key = lambda x:x[1],reverse=True)
    return n,m,a,bc
  
def main(inp):
    n,m,a,bc = inp
    changable = sum(row[0] for row in bc)
#     print(changable)
    new =[]
    for i in range(m):
        if(len(new)==n): break
        for _ in range(bc[i][0]):
            if(len(new)==n): break
            new.append(bc[i][1])
    if(changable < n):
        for _ in range(n-changable):
            new.append(0)
#     print(new)
        
    for i in range(n):
        if(a[i] < new[i]): a[i] = new[i]
        else: break
    
    return sum(a)
  
print(main(parse(sys.stdin)))
### BUGGY CODE ###

n = int(input())
TA = [list(map(int, input().split())) for _ in range(n)]

T = A = 0
for t, a in TA:
  _t, _a = t, a
  while t<T or a<A:
    t += _t; a += _a
  T = t; A = a
print(T+A)

### FIXED CODE ###

n = int(input())
TA = [list(map(int, input().split())) for _ in range(n)]

T = A = 1
for t, a in TA:
  r = max(A//a, T//t)
  if r*a >= A and r*t >= T:
    A = r*a; T = r*t
  else:
    A = (r+1)*a; T = (r+1)*t

print(T+A)
### BUGGY CODE ###

from collections import Counter
N, Q = map(int, input().split())
S = list(input())
qs = [list(map(int, input().split())) for _ in range(Q)]
for q in qs:
    string = S[q[0]-1:q[1]]
    print((''.join(string)).count('AC'))

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
S = list(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
cnt = [0]*N
is_a = False
for i in range(N-1):
  if S[i] + S[i+1] == 'AC':
    cnt[i+1] = 1
for i in range(1, N):
  cnt[i] += cnt[i-1]

for l, r in lr:
  l -= 1
  r -= 1
  print(cnt[r]-cnt[l])
### BUGGY CODE ###

n,m=map(int,input().split())
A=[input().split() for _ in range(m)]
ans="IMPOSSIBLE"
for i in range(m):
  if A[i][0]=="1":
    if [A[i][1],str(n)] in A:
      ans="POSSIBLE"
      break
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
A=set()
B=set()
for i in range(m):
  a,b=input().split()
  if a=="1":
    A.add(b)
  if b==str(n):
    B.add(a)
print("POSSIBLE" if A&B else "IMPOSSIBLE")
### BUGGY CODE ###

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

c = 0
bc = 0

while True:
    if c > N:
        ans = bc
        break
    c += A
    bc += A
    if c > N:
        ans = bc - (c - N)
        break
    c += B

print(ans)

### FIXED CODE ###

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

sumAB = A + B
c = N // sumAB
k = N % sumAB
if k < A:
    ans = A * c + k
else:
    ans = A * c + A

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

INF = 10**10 - 1 #無限大
SMAX = 3000 + 1

# 文字列入力
s1 = input()
s2 = input()

'''
dpの初期化
s1の文字列位置を一次軸、一致文字列長を二次軸に取り
その値として：s2の使用済文字数の最小値を入れる
　　　　　　　0列は 0 それ以外がINFで初期化
'''
dp = [[INF] * (len(s1)+1) for i in range(len(s1)+1)]
for i in range(0,len(s1)+1):
    dp[i][0] = 0
#print(dp[0])

for s1pos in range(1,len(s1)+1):
    s = s1[s1pos-1:s1pos]
    #print("s=",s,"--------")
    for psLen in range(1,s1pos+1):
        s2pos = dp[s1pos-1][psLen-1] + 1
        spos = s2[s2pos-1:].find(s)
        dp[s1pos][psLen] = dp[s1pos-1][psLen]
        if spos == -1:
            pass
        else:
            if dp[s1pos][psLen] > s2pos+spos:
                dp[s1pos][psLen] = s2pos+spos
        #print("s=",s,"ps2=",s2[s2pos-1:],"spos=",spos,"s1pos=",s1pos,"s2pos=",s2pos,"dp=",dp[s1pos])

#答えは、DP配列を最善値を出したところを逆方向に辿る
Ans = ""
pos1 = len(s1)
pos2 = len(s1)
for s1pos in range(pos1,0,-1):
    s = s1[s1pos-1:s1pos]
    for psLen in range(pos2,0,-1):
        if dp[s1pos][psLen] < INF:
            if dp[s1pos-1][psLen] > dp[s1pos][psLen]:
                Ans = s + Ans
                pos2 = psLen - 1
                break
            else:
                continue
    #print("s1pos=",s1pos,"s=",s,"dp=",dp[s1pos],"Ans=",Ans)

print(Ans)


### FIXED CODE ###

INF = 10**10 - 1 #無限大
SMAX = 3000 + 10

# 文字列入力
s1 = input()
s2 = input()

'''
dpの初期化
s1の文字列位置を一次軸、s2の文字列位置を二次軸に取り
その値として：LCSの最長値として更新していく
　　　　　　　初期値はすべて０
'''
dp = [ [0] * (SMAX) for i in range(SMAX)]

for s1pos in range(1,len(s1)+1):
    s1s = s1[s1pos-1:s1pos]
    for s2pos in range(1,len(s2)+1):
        s2s = s2[s2pos-1:s2pos]
        if s1s == s2s:
            dp[s1pos][s2pos] = dp[s1pos-1][s2pos-1] + 1
        dp[s1pos][s2pos] = max(dp[s1pos][s2pos],dp[s1pos][s2pos-1],dp[s1pos-1][s2pos])
    #print("s1pos=",s1pos,"dp=",dp[s1pos])

#print("LCS_len",dp[len(s1)][len(s2)])

res = ""
s1pos = len(s1)
s2pos = len(s2)
while (s1pos > 0 and s2pos > 0):
    # (s1pos-1, s2pos) -> (s1pos, s2pos) と更新されていた場合
    if (dp[s1pos][s2pos] == dp[s1pos-1][s2pos]):
        s1pos -= 1 # DP の遷移を遡る
    # (s1pos, s2pos-1) -> (s1pos, s2pos) と更新されていた場合
    elif (dp[s1pos][s2pos] == dp[s1pos][s2pos-1]):
        s2pos -= 1 # DP の遷移を遡る
    # (s1pos-1, s2pos-1) -> (s1pos, s2pos) と更新されていた場合
    else:
        res = s1[s1pos-1:s1pos] + res # 該当文字を取得
        s1pos -= 1 # DP の遷移を遡る
        s2pos -= 1 # DP の遷移を遡る

print(res)
### BUGGY CODE ###

n = int(input())
a = list(map(int,(input().split(' '))))
ans = []
l = range(1,n+1)
for i in range(n):
   ans.append(str(a.index(l[i])+1))
  
#print((ans)  )
print(' '.join(ans))

### FIXED CODE ###

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

from collections import OrderedDict
od = OrderedDict()

for n,i in enumerate(a):
  od[(n+1)] = i

#print(od)

od_sorted_value = OrderedDict(
    sorted(od.items(), key=lambda x: x[1], reverse=False)
)
#print(od_sorted_value)

ans = list(od_sorted_value.items())
for i,n in ans:
  print(i)
### BUGGY CODE ###

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7

N = int(input())
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    edge[x].append(y)
    edge[y].append(x)

# 頂点iから伸びてる枝それぞれのサイズ
ans = 0


def dfs(s, p=-1):
    global ans
    res = 1
    tmp = pow(2, N - 1, mod) - 1
    for t in edge[s]:
        if t == p:
            continue
        size = dfs(t, s)
        res += size
        tmp = (tmp - pow(2, size, mod) + 1 + mod) % mod
    if N != res:
        tmp = (tmp - pow(2, N - res, mod) + 1 + mod) % mod
    ans = (ans + tmp) % mod
    return res


dfs(1)
div = pow(2, N, mod)
ans = ans * pow(div, mod - 2, mod) % mod
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7

N = int(input())
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    edge[x].append(y)
    edge[y].append(x)

# 頂点iから伸びてる枝それぞれのサイズ
ans = 0
pow2 = [1] * (N + 1)
for i in range(1, N + 1):
    pow2[i] = pow2[i - 1] * 2 % mod


def dfs(s, p=-1):
    global ans
    res = 1
    tmp = pow2[N-1] - 1
    for t in edge[s]:
        if t == p:
            continue
        size = dfs(t, s)
        res += size
        tmp = (tmp - pow2[size] + 1 + mod) % mod
    if N != res:
        tmp = (tmp - pow2[N-res] + 1 + mod) % mod
    ans = (ans + tmp) % mod
    return res


dfs(1)
div = pow2[N]
print(ans*pow(div, mod-2, mod) % mod)
### BUGGY CODE ###

r,g,b,n=map(int, input().split())
ans=0
for i in range(3001):
  for j in range(3001):
    v=i*r + j*g
    #print((n-v)/b)
    if n>=v and (n-v)%b == 0:
      ans+=1
print(ans)

### FIXED CODE ###

r,g,b,n=map(int, input().split())
ans=0
for i in range(3001):
  for j in range(3001):
    v=i*r + j*g
    #print((n-v)/b)
    if n>=v:
      if (n-v)%b == 0:
        ans+=1
print(ans)
### BUGGY CODE ###

n, m = [int(_) for _ in input().split()]
c = []
flag = True
g = [[-1, -1] for _ in range(n)]
for i in range(m):
    l, r, d = [int(_) for _ in input().split()]
    l -= 1
    r -= 1
    if g[l][0] != -1 and g[r][0] != -1 and g[l][0] == g[r][0]:
        if c[g[l][0]][g[r][1]][1] - c[g[l][0]][g[l][1]][1] != d:
            flag = False
            break
    elif g[l][0] != -1 and g[r][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        r_pos = c[g[r][0]][g[r][1]][1]

        for j in c[g[r][0]]:
            j[1] += l_pos + d - r_pos
        c[g[l][0]].extend(c[g[r][0]])
        del c[g[r][0]]
    elif g[l][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        c[g[l][0]].append([r, l_pos+d])
        g[r][0] = g[l][0]
        g[r][1] = len(c[g[l][0]])-1
    elif g[r][0] != -1:
        r_pos = c[g[r][0]][g[r][1]][1]
        c[g[r][0]].append([l, r_pos-d])
        g[l][0] = g[r][0]
        g[l][1] = len(c[g[r][0]])-1
    else:
        c.append([[l, 0], [r, d]])
        g[l][0] = max(g, key=lambda x: x[0])[0]+1
        g[r][0] = g[l][0]
        g[l][1] = 0
        g[r][1] = 1
if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, m = [int(_) for _ in input().split()]
c = []
flag = True
g = [[-1, -1] for _ in range(n)]
g_num = 0
for i in range(m):
    l, r, d = [int(_) for _ in input().split()]
    l -= 1
    r -= 1
    if g[l][0] != -1 and g[r][0] != -1 and g[l][0] == g[r][0]:
        if c[g[l][0]][g[r][1]][1] - c[g[l][0]][g[l][1]][1] != d:
            flag = False
            break
    elif g[l][0] != -1 and g[r][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        r_pos = c[g[r][0]][g[r][1]][1]
        if r_pos > l_pos+d:
            for j in c[g[l][0]]:
                j[1] += r_pos - d - l_pos
                if j[1] > 10**9:
                    flag = False
                    break
                g[j[0]][1] += g[c[g[r][0]][-1][0]][1] + 1
            c[g[r][0]].extend(c[g[l][0]])
            for j in c[g[l][0]]:
                g[j[0]][0] = g[r][0]

        else:
            for j in c[g[r][0]]:
                j[1] += l_pos + d - r_pos
                if j[1] > 10**9:
                    flag = False
                    break
                g[j[0]][1] += g[c[g[l][0]][-1][0]][1] + 1
            c[g[l][0]].extend(c[g[r][0]])
            for j in c[g[r][0]]:
                g[j[0]][0] = g[l][0]

    elif g[l][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        c[g[l][0]].append([r, l_pos+d])
        g[r][0] = g[l][0]
        g[r][1] = g[c[g[l][0]][-2][0]][1]+1
    elif g[r][0] != -1:
        r_pos = c[g[r][0]][g[r][1]][1]
        c[g[r][0]].append([l, r_pos-d])
        g[l][0] = g[r][0]
        g[l][1] = g[c[g[r][0]][-2][0]][1]+1
    else:
        c.append([[l, 0], [r, d]])
        g[l][0] = g_num
        g[r][0] = g[l][0]
        g[l][1] = 0
        g[r][1] = 1
        g_num += 1
    if not flag:
        break
if flag:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

#coding utf-8
import heapq
N,M=map(int,input().split())
AB= [[int(i) for i in input().split()] for i in range(N)]
work=[]
heapq.heapify(work)
ans=0
for i in range(1,M+1):
  for j in range(N):
    if AB[j][0]==i:
      heapq.heappush(work,-AB[j][1])
  if work:
    tmp=heapq.heappop(work)
    ans-=tmp
  
print(ans)

### FIXED CODE ###

#coding utf-8
import heapq
N,M=map(int,input().split())
AB= [[int(i) for i in input().split()] for i in range(N)]
AB.sort(reverse=True)
work=[]
heapq.heapify(work)
ans=0
for i in range(1,M+1):
  while AB and AB[-1][0] <=i:
      tmp=AB.pop()
      heapq.heappush(work,-tmp[1])
  if work:
    tmp=heapq.heappop(work)
    ans-=tmp
  
print(ans)
### BUGGY CODE ###

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

ans = []
def solve(b,i):
    if i == 0:
        return True
    for j in range(i-1,-1,-1):
        if b[j] == j+1:
            p = b[:j] + b[j+1:]
            if solve(p,i-1):
                ans.append(j+1)
                return True


    return False

solve(b,n)
if len(ans) == n:
    for i in range(n):
        print(ans[i])
else:
    print(-1)

### FIXED CODE ###

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

ans = []
def solve(b,i):
    if i == 0:
        return True
    for j in range(i-1,-1,-1):
        if b[j] > j+1:
            return False
        if b[j] == j+1:
            p = b[:j] + b[j+1:]
            if solve(p,i-1):
                ans.append(j+1)
                return True

    return False

solve(b,n)
if len(ans) == n:
    for i in range(n):
        print(ans[i])
else:
    print(-1)