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

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

score = {}

for i, a in enumerate(A):
  if i ==0:
    continue
  
  s = i-a
  if s not in score:
    score[s] = []
  score[s].append(i)

from bisect import bisect_left
ans = 0
for i, a in enumerate(A):
  if i+a in score:
    index = bisect_left(score[i+a], i)
    ans += len(score[i+a]) - index
    score[i+a] = score[i+a][index:]
print(ans)

### FIXED CODE ###

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

score = {}

for i, a in enumerate(A):
  if i ==0:
    continue
  
  s = i-a
  if s not in score:
    score[s] = 0
  score[s]+=1

from bisect import bisect_left
ans = 0
for i, a in enumerate(A):
  if i+a in score:
    ans += score[i+a]
print(ans)
### BUGGY CODE ###

N = int(input());

A = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans *= A[i]

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

### FIXED CODE ###

N = int(input());

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

ans = 1

for i in range(N):
    ans *= A[i]
    if ans > 10**18:
        print(-1)
        exit()

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

# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")

H, W = LI()
S = RS(H)

def dfs(x, y):
    stack = [[x, y-1, 1], [x+1, y, 2], [x, y+1, 3], [x-1, y, 4]]
    ret = 1

    while stack:
        x, y, dist = stack.pop()

        if not(0 <= x < W) or not(0 <= y < H) or S[y][x] == "#":
            continue

        ret += 1

        if dist == 1:
            stack.append([x, y-1, 1])
        elif dist == 2:
            stack.append([x+1, y, 2])
        elif dist == 3:
            stack.append([x, y+1, 3])
        else:
            stack.append([x-1, y, 4])
    
    return ret


ans = 0
for x in range(W):
    for y in range(H):
        if S[y][x] == ".":
            ans = max(ans, dfs(x, y))

print(ans)


### FIXED CODE ###

# coding: utf-8

import sys
import math
import collections
import itertools
from functools import lru_cache
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")

H, W = LI()
S = RS(H)

L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]

for i in range(H):
    lf = 0
    rf = 0
    for j in range(W):
        if S[i][j] == ".":
            lf += 1
            L[i][j] = lf
        else:
            lf = 0

        if S[i][W-1-j] == ".":
            rf += 1
            R[i][W-1-j] = rf
        else:
            rf = 0

for i in range(W):
    uf = 0
    df = 0
    for j in range(H):
        if S[j][i] == ".":
            df += 1
            D[j][i] = df
        else:
            df = 0

        if S[H-1-j][i] == ".":
            uf += 1
            U[H-1-j][i] = uf
        else:
            uf = 0

ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            ans = max(ans, U[i][j]+D[i][j]+L[i][j]+R[i][j]-3)

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

from collections import deque
N,Q=map(int,input().split())
AB=[tuple(map(int,input().split())) for _ in range(N-1)]
k=[0]*N
for _ in range(Q):
    p,x=map(int,input().split())
    k[p-1]+=x
q=deque([1])
ab=AB[:]
while q:
    t=q.popleft()
    tab=ab[:]
    for a,b in tab:
        if t==a:
            q.append(b)
            k[b-1]+=k[t-1]
            ab.remove((a,b))
        elif t==b:
            q.append(a)
            k[a-1]+=k[t-1]
            ab.remove((a,b))
print(*k)

### FIXED CODE ###

from collections import deque
N,Q=map(int,input().split())
tr=[[] for _ in range(N)]
for _ in range(N-1):
    a,b=map(int,input().split())
    tr[a-1].append(b-1)
    tr[b-1].append(a-1)
k=[0]*N
for _ in range(Q):
    p,x=map(int,input().split())
    k[p-1]+=x
q=deque([0])
v=[True]*N
while q:
    t=q.popleft()
    if v[t]:
        v[t]=False
        for j in tr[t]:
            if v[j]:
                k[j]+=k[t]
                q.append(j)
print(*k)
### BUGGY CODE ###

from math import log2,ceil
from collections import defaultdict
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
cnt=defaultdict(lambda :0)
for i in range(n):
    temp=a[i]
    if temp==0:continue
    digit=log2(temp)
    for j in range(ceil(digit)+1):
        if (temp>>j)&1:
            cnt[j]+=1

#print(cnt)
ans=0
for digit,count in cnt.items():
    ans+=pow(2,digit)*count*(n-count)
print(ans%mod)

### FIXED CODE ###

import sys
input=sys.stdin.readline
n=int(input())
a=tuple(map(int,input().split()))
mod=10**9+7
cnt=[0]*60

for temp in a:
    if temp==0:continue
    digit=len(bin(temp))-2
    for j in range(digit):
        if (temp>>j)&1:
            cnt[j]=cnt[j]+1

#print(cnt)
ans=0
for i in range(60):
    if cnt[i]==0:continue
    ans=(ans+pow(2,i)*cnt[i]*(n-cnt[i]))%mod
print(ans%mod)
### BUGGY CODE ###

import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    a = LI()
    q = I()
    b = [0]*q
    c = [0]*q
    for i in range(q):
        b[i], c[i] = MI()
    a_sum = sum(a)
    a_dict = dict()
    for ai in a:
        a_dict[str(ai)] = a.count(ai)
    for i in range(q):
        temp1 = 0
        if str(b[i]) in a_dict:
            temp1 = a_dict[str(b[i])]
        temp2 = 0
        if str(c[i]) in a_dict:
            temp2 = a_dict[str(c[i])]
        a_dict[str(c[i])] = temp1+temp2
        a_sum += (c[i]-b[i])*temp1
        print(a_sum)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    a = LI()
    q = I()
    b = [0]*q
    c = [0]*q
    for i in range(q):
        b[i], c[i] = MI()
    a_num = [0]*100001
    for ai in a:
        a_num[ai] += 1
    a_sum = sum(a)
    for i in range(q):
        a_sum += (c[i]-b[i])*a_num[b[i]]
        a_num[c[i]] += a_num[b[i]]
        a_num[b[i]] = 0
        print(a_sum)

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

n = int(input())
import itertools
a_list = list(map(int,input().split()))
cand_list = list(itertools.combinations([i for i in range(n)],2))
count = 0
for cand in cand_list:
  if abs(cand[1] - cand[0]) == a_list[cand[0]] + a_list[cand[1]]:
    count += 1
    
print(count)


### FIXED CODE ###

n = int(input())
a_list = list(map(int,input().split()))
a_plus = {}
a_minus = {}
for i in range(1,n):
  a_minus[i] = 0
  
for i in range(n):
  minus = (i+1) - a_list[i]
  if 2 <= minus:
    a_minus[minus] += 1
  
count = 0

for j in range(n):
  plus = (j+1) + a_list[j]
  if plus <= n - 1:
    count += a_minus[plus]

    
print(count)
### BUGGY CODE ###

N = input()
A = map(int, raw_input().split())
 
MOD = 10 ** 9 + 7

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

def lcm(x, y):
    return x/gcd(x, y)*y
 
l = A[0]
for a in A:
    l = lcm(l, a)
 
res = 0

for a in A:
    res = (res + l // a) % MOD

print(res)



### FIXED CODE ###

N = input()
A = map(int, raw_input().split())
 
MOD = 10 ** 9 + 7

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

def lcm(x, y):
    return x/gcd(x, y)*y
 
l = A[0]
for a in A:
    l = lcm(l, a)
 
res = 0
for a in A:
    res = (res + (l * pow(a, MOD - 2, MOD)) % MOD) % MOD
 
print(res)
### BUGGY CODE ###

S = input()
Q = int(input())
turn = 0
for i in range(Q):
  s = input().split()
  if s[0] == "1": # 反転
    turn += 1
  elif s[0] == "2": # 足す
    if (s[1] == "1" and turn % 2 == 0) or (s[1] == "2" and turn % 2 == 1):
      S = s[2] + S
    elif (s[1] == "2" and turn % 2 == 0) or (s[1] == "1" and turn % 2 == 1):
      S = S + s[2]
if turn % 2 == 0:
  print(S)
else:
  print(S[::-1])

### FIXED CODE ###

S = input()
Q = int(input())
turn = 0
head = ""
tail = ""
for i in range(Q):
  s = input().split()
  if s[0] == "1": # 反転
    turn += 1
  elif s[0] == "2": # 足す
    if (s[1] == "1" and turn % 2 == 0) or (s[1] == "2" and turn % 2 == 1):
      head = s[2] + head
    elif (s[1] == "2" and turn % 2 == 0) or (s[1] == "1" and turn % 2 == 1):
      tail = tail + s[2]
if turn % 2 == 0:
  print(head + S + tail)
else:
  print((head + S + tail)[::-1])
### BUGGY CODE ###

n = input()
l = len(n)
count = 0
for i in range(l-3):
  x = 0
  for j in range(i+3, l):
    if j == i+3:
      x = int(n[i]) + int(n[i+1]) + int(n[i+2]) + int(n[i+3])
    else:
      x += int(n[j])
    
    if x % 3 == 0:
      integer = int(n[i:j+1])
      if integer % 2019 == 0:
        count += 1
print(count)


### FIXED CODE ###

n = input()
mod = [0]*2019
mod[0] += 1
T = 0
d = 1 # 桁数
for i, s in enumerate(n[::-1]):
  T += int(s) * d
  T %= 2019
  d = (d * 10) % 2019
  mod[T] += 1
  
res = 0  
for m in mod:
  res += m*(m-1)/2
print(int(res))
### BUGGY CODE ###

s = input()
n = len(s)
t = input()
m = len(t)

dp = [['' for _ in range(m+1)] for _ in range(n+1)]

for i in range(n):
    for j in range(m):
        if t[j]!=s[i]:
            dp[i+1][j+1] = dp[i+1][j] if(len(dp[i+1][j])>len(dp[i][j+1])) else dp[i][j+1]
        else :
            dp[i+1][j+1]= dp[i][j+1] + t[j]

print(dp[n][m])

### FIXED CODE ###

s = input()
n = len(s)
t = input()
m = len(t)

dp = [[0 for _ in range(m+1)] for _ in range(n+1)]

for i in range(n):
    for j in range(m):
        if t[j]!=s[i]:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])
        else :
            dp[i+1][j+1]=dp[i][j]+1

ans = ''

i = len(s)
j = len(t)
while (i>0  and j>0):
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans += s[i-1]
        i -= 1
        j -= 1

print(ans[::-1])
### BUGGY CODE ###

def z_algorithm(N, S):    
    Z = [0] * N     # 重複ありの最大長    
    left = 0
    right = 0
    max_length = 0
    
    for i in range(1, len(S)):
        k = 0        
        if i < right and Z[i-left] <= right - i:
            Z[i] = Z[i-left]
            continue
        elif i < right:
            k = right - i
        
        while i + k < N:         
            if S[i+k] == S[k]:
                k += 1
            else:
                break

        Z[i] = k
        left = i
        right = i + k
        #重複しない場合の最大長　は　i
        max_length = max(max_length, min(Z[i], i))
        
    return max_length
    
N = int(input())
S = input()

ans = 0
for i in range(N):
    s = S[i:]
    n = N - i
    if ans >= len(s) // 2:
        break
    ans = max(ans, z_algorithm(n, s))
    
print(ans)

### FIXED CODE ###

N = int(input())
S = input()
B = 127
MOD = 10 ** 11 + 7

H = [0] * (len(S) + 1)
P = [1] * (len(S) + 1)
b = pow(B, N-1)
for i in range(len(S)):
    H[i+1] = (H[i] + ord(S[i]) * b) % MOD
    P[i+1] = (P[i] * B) % MOD
    b //= B

l = 0
r = N
ans = 0
while r - l > 1:
    mid = (l + r) // 2
    tmp = {}
    for i in range(N - mid + 1):
        h = ((H[mid+i] - H[i]) * P[mid+i-1]) % MOD
        if h in tmp and i - tmp[h] >= mid:
            l = mid
            ans = mid
            break
        else:
            if not h in tmp:
                tmp[h] = i
    else:
        r = mid
        
print(ans)
### BUGGY CODE ###

import collections

h, w = map(int, input().split())

visited = [[-float("inf")]*(w) for _ in range(h)]
q = collections.deque([])

a = []
for i in range(h):
    _a = list(input())
    a.append(_a)
    for j in range(w):
        if _a[j] == "#":
            q.appendleft([i, j])
            visited[i][j] = 0

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

while 0 < len(q):
    cy, cx = q.pop()
    for i in range(4):
        x = cx + dx[i]
        y = cy + dy[i]

        if x < 0 or w <= x or y < 0 or h <= y:
            continue

        if a[y][x] == "." and visited[y][x] == -float("inf"):
            visited[y][x] = visited[cy][cx] + 1
            q.appendleft([y, x])

ans = -1
for i in range(h):
    for j in range(w):
        ans = max(ans, visited[i][j])
print(ans)


### FIXED CODE ###

from subprocess import call
call (('pypy3', '-c', """
from collections import deque

def main():
    h, w = map(int, input().split())
    A = [list(input()) for _ in range(h)]
    d = [[10**9] * w for _ in range(h)]
    que = deque([])
    
    for i in range(h):
        for j in range(w):
           if A[i][j] == "#":
               que.append([i, j])
               d[i][j] = 0
           else:
               d[i][j] = 10 ** 9
            
    while que:
        x, y = que.popleft()
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4): 
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < h and 0 <= ny < w and d[nx][ny] == 10**9:
                d[nx][ny] = d[x][y] + 1
                que.append([nx, ny])
    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, d[i][j])
    print(ans)
    
    return
    
main()

"""))
### BUGGY CODE ###

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

mev = 0
idx = 0

for i in range(N-K+1):
    ev = sum(p[i:i+K])

    if ev > mev:
        idx = i
        mev = ev

print(sum(map(lambda x: (x+1.0)/2.0, p[idx:idx+K])))



### FIXED CODE ###

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

#累積和を前計算
sum_list = [0 for _ in range(300000)]
sum = 0

for i in range(len(p)):
    sum += p[i]
    sum_list[i] = sum

#答えを計算
mev = 0
idx = 0
for i in range(N-K+1):
    ev = sum_list[i+K]-sum_list[i]
    if ev > mev:
        idx = i
        mev = ev

mev = 0.0
if N != K:
    for i in range(idx+1,idx+1+K):
        mev += (p[i] + 1.0) / 2.0

else:
    for i in range(len(p)):
        mev += (p[i] + 1.0) / 2.0

print(mev)
### BUGGY CODE ###

n=int(input())
a = [input() for i in range(n)]
b = sorted(list(set(a)))
d = {}
m = 0

for i in b:
    t = a.count(i)
    if m > 0 and t < m:
        continue

    d.setdefault(t,[])
    d[t].append(i)

for i in d[max(d.keys())]:
    print(i)

### FIXED CODE ###

from collections import defaultdict

n=int(input())

d=defaultdict(int)


for i in range(n):
    d[input()] +=1

m =max(d.values())

for i,j in sorted(d.items()):
    if j == m :print(i)
### BUGGY CODE ###

H,W,M=map(int,input().split())
tgts=set()
for _ in range(M):
    i,j=map(int,input().split())
    tgts.add((i,j))

#print(tgts)

rows=[0]*(H+1)
cols=[0]*(W+1)

for i,j in tgts:
    rows[i]+=1
    cols[j]+=1

ans=0
for i in range(1,H+1):
    for j in range(1,W+1):
        k=rows[i]+cols[j]
        if (i,j) in tgts:
            k-=1
        ans=max(ans,k)

print(ans)
	

### FIXED CODE ###

from collections import defaultdict as ddict

ii=jj=0
ia,ja=[],[]
rows=ddict(int)
cols=ddict(int)
H,W,M=map(int,input().split())
tgts=set()
for _ in range(M):
    i,j=map(int,input().split())
    tgts.add((i,j))

    rows[i]+=1
    cols[j]+=1
    x=rows[i]
    if x>ii:
        ii=x
        ia=[i]
    elif x==ii:
        ia.append(i)
    y=cols[j]
    if y>jj:
        jj=y
        ja=[j]
    elif y==jj:
        ja.append(j)



ans=0
for i in ia:
    for j in ja:
        k=rows[i]+cols[j]
        if (i,j) in tgts:
            k-=1
        else:
            ans=k
            break
        ans=max(ans,k)

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

N, Q = map(int,input().split())
S = input()
points = []
for i in range(N-1):
  if S[i] == 'A' and S[i+1] == 'C':
    points.append(i)
for _ in range(Q):
  r, l = map(int,input().split())
  List = [n for n in points if n >= r -1 and n+1 <= l-1]
  print(len(List))

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
index = [0] *(N+1)
for i in range(N):
  index[i+1] = index[i] + (1 if S[i:i+2] =='AC' else 0)
for _ in range(Q):
  r, l = map(int,input().split())
  print(index[l-1] - index[ r -1])
### BUGGY CODE ###

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

ans = -float('inf')
for i in range(N):
    s = 0
    for k in range(K):
        i = P[i]-1
        s += C[i]
        ans = max(ans, s)
print(ans)

### FIXED CODE ###

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

ans = -float('inf')
for i in range(N):
    s = 0
    j = i
    for k in range(K):
        j = P[j]-1
        s += C[j]
        ans = max(ans, s)
        if j==i: break
    d,m = divmod(K, k+1)
    if m==0 and d>1:
        m = k+1
        d -= 1
    s *= d
    ans = max(ans, s)
    for k in range(m):
        j = P[j]-1
        s += C[j]
        ans = max(ans, s)

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

N, M = map(int, input().split())
A = []
for i in range(M):
	curr = int(input())
	A.append(curr)

mod = 1000000007

ans = [0] * (N + 1)

ans[0] = 1

for i in range(len(ans)):
	if i in A:
		continue
	ans[i] %= mod
	if(i+1 < len(ans) and i+1 not in A):
		ans[i+1] += ans[i] % mod
	if(i+2 < len(ans) and i+2 not in A):
		ans[i+2] += ans[i] % mod

print(ans[N])

### FIXED CODE ###

N, M = map(int, input().split())
A = []
for i in range(M):
	curr = int(input())
	A.append(curr)

mod = 1000000007

ans = [0] * (N + 1)

ans[0] = 1

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

for i in range(len(ans)):
	if ans[i] == -1:
		continue
	if(i+1 < len(ans) and ans[i+1] != -1):
		ans[i+1] += ans[i]
		ans[i+1] %= mod
	if(i+2 < len(ans) and ans[i+2] != -1):
		ans[i+2] += ans[i]
		ans[i+2] %=mod

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

n,m,l = map(int,input().split())
d = [[float("inf")]*n for _ in [0]*n]
for i in range(m):
    a,b,c = map(int,input().split())
    if l >= c:
        d[a-1][b-1] = d[b-1][a-1] = c
for i in range(n):
    d[i][i] = 0

for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])

edge = [[float("inf")]*n for _ in [0]*n]
for i in range(n):
    for j in range(n):
        if d[i][j] <= l:
            edge[i][j] = 1

for k in range(n):
    for i in range(n):
        for j in range(n):
            edge[i][j] = min(edge[i][j],edge[i][k] + edge[k][j])

q = int(input())
for _ in [0]*q:
    s,t = map(int,input().split())
    if edge[s-1][t-1] == float("inf"):
        print(-1)
    else:
        print(edge[s-1][t-1]-1)

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    n,m,l = map(int,input().split())
    d = [[10**12]*n for _ in [0]*n]
    for i in range(m):
        a,b,c = map(int,input().split())
        if l >= c:
            d[a-1][b-1] = d[b-1][a-1] = c
    for i in range(n):
        d[i][i] = 0

    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])

    edge = [[10**12]*n for _ in [0]*n]
    for i in range(n):
        for j in range(n):
            if d[i][j] <= l:
                edge[i][j] = 1

    for k in range(n):
        for i in range(n):
            for j in range(n):
                edge[i][j] = min(edge[i][j],edge[i][k] + edge[k][j])

    q = int(input())
    for _ in [0]*q:
        s,t = map(int,input().split())
        if edge[s-1][t-1] >= 10**12:
            print(-1)
        else:
            print(edge[s-1][t-1]-1)

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

X = int(input())
def f(i):
    return i*(i+1)/2

for i in range(1,10**10000000):
    if  f(i) >= X:
        print(i)
        break


### FIXED CODE ###

X = int(input())
def f(i):
    return i*(i+1)/2

for i in range(1,10**1000000):
    if  f(i) >= X:
        print(i)
        break
### BUGGY CODE ###

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

flag=False
for y in range(4000):
    for z in range(2300):
        x = n-(y+z)
        if 5*y+9*z == n*10-Y*(10**(-3)) and x >= 0:
            print(x,end="  ")
            print(y,end=" ")
            print(z,end="")
            flag = True
            break
    if flag:
        break

if not flag:
    print("-1 -1 -1")


### FIXED CODE ###

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

for y in range(n+1):
    for z in range(n-y+1):
        x = n-(y+z)
        if 5*y+9*z == n*10-Y*(10**(-3)) and x >= 0:
            print(x,end="  ")
            print(y,end=" ")
            print(z,end="")
            exit()

print("-1 -1 -1")
### BUGGY CODE ###

import sys
import math
import heapq
from collections import defaultdict, deque
sys.setrecursionlimit(10**6) 
input = sys.stdin.readline
def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

'''C Tsundoku'''
def count(i,n,j,m,a,b,k):
    if i==n:
        if j==m:
            return 0
        if b[j]<=k:
            return 1+count(i,n,j+1,m,a,b,k-b[j])
        return 0
    elif j==m:
        if i==n:
            return 0
        if a[i]<=k:
            return 1+count(i+1,n,j,m,a,b,k-a[i])
        return 0
    else:
        if a[i]>k and b[j]>k:
            return 0
        if a[i]>k:
            return 1+count(i,n,j+1,m,a,b,k-b[j])
        if b[j]>k:
            return 1+count(i+1,n,j,m,a,b,k-a[i])
        return max(1+count(i,n,j+1,m,a,b,k-b[j]),1+count(i+1,n,j,m,a,b,k-a[i]))

n,m,k=rm()
a=rl()
b=rl()
i=0;j=0;
print(count(i,n,j,m,a,b,k))

### FIXED CODE ###

import sys
import math
import heapq
from collections import defaultdict, deque
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

'''C Tsundoku'''
n,m,k=rm()
a=rl()
b=rl()
c=[0]*(n+1)
d=[0]*(m+1)
for i in range(n):
    c[i+1]=c[i]+a[i]
for i in range(m):
    d[i+1]=d[i]+b[i]
ans=0;j=m
for i in range(n+1):
    if c[i]>k:
        break
    while c[i]+d[j]>k:
        j-=1
    ans=max(ans,i+j)
print(ans)
### BUGGY CODE ###

n = int(input())

d = [0]*(n+1)

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

ans = sum(d)

print(ans)

### FIXED CODE ###

n = int(input())

d = [0]*(n+1)

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

ans = sum(d)

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

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

N, M = map(int, input().split())
G = [[] for _ in range(N)]
has_parent = [False] * N
LRD = [None] * M
for i in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    G[L].append((R, D))
    G[R].append((L, -D))


def dfs(v):
    visited[v] = True
    for u, d in G[v]:
        if dist[u] == float('inf'):
            dist[u] = dist[v] + d
        elif dist[u] != dist[v] + d:
            print('No')
            exit()
        if not visited[u]:
            dfs(u)


dist = []
visited = [False] * N
for v in range(N):
    if not visited[v]:
        dist = [float('inf')] * N
        dist[v] = 0
        dfs(v)
print('Yes')


### FIXED CODE ###

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    G[L].append((R, D))
    G[R].append((L, -D))

visited = [False] * N
dist = [float('inf')] * N
for i in range(N):
    if not visited[i]:
        dist[i] = 0
        stack = [i]
        while stack:
            v = stack.pop()
            visited[v] = True
            for u, d in G[v]:
                if dist[u] == float('inf'):
                    dist[u] = dist[v] + d
                elif dist[u] != dist[v] + d:
                    print('No')
                    exit()
                if not visited[u]:
                    stack.append(u)
print('Yes')