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

import collections
from scipy.misc import comb
n = int(input())
a = list(map(int,input().split()))
for i in range(len(a)):
  o = 0
  b = a[:]
  del b[i]
  c = collections.Counter(b)
  n = len(set(b))
  for i in c.values():
    o += comb(i,2,exact=True)
  print(o)
  

### FIXED CODE ###

from collections import Counter
def comb(x):
    return x*(x-1)//2
n = int(input())
a = list(map(int,input().split()))
c = Counter(a)
b = 0
for i in c.values():
    b+=comb(i)
for k in range(n):
    print(b-c[a[k]]+1)
### BUGGY CODE ###

n=int(input())
p=1
for i in range(1,n+1):
    p*=i
print(p%(10**9+7))

### FIXED CODE ###

n=int(input())
p=1
for i in range(1,n+1):
    p=(p*i)%(10**9+7)
print(p)
### BUGGY CODE ###

n=int(input())
ans=0
a=list(map(int,input().split()))
now=max(a)
noww=now
matc=list([] for i in range(n+2*now))
mat2=list([] for i in range(n+2*now))
for i in range(n):
  matc[now-a[i]].append(i)
  mat2[now+a[i]].append(i,)
  now+=1
#print(matc)
for j in range(n+2*noww):
  ans+=len(matc[j])*len(mat2[j])
print(ans)
       
       



### FIXED CODE ###

import numpy as np
n=int(input())
ans=0
a=list(map(int,input().split()))
now=max(a)
noww=now
k=n+2*now
matc=[0]*(n+2)
mat2=[0]*(n+2)
for i in range(n):
  neg=i-a[i]
  pos=i+a[i]
  if neg>=0:
    matc[neg]+=1
  if pos<=n:
    mat2[pos]+=1
  now+=1
#print(matc)
for j in range(n+2):
  ans+=matc[j]*mat2[j]
print(ans)
### BUGGY CODE ###

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

for i in range(m):
    price[price.index(max(price))] //= 2

print(sum(price))

### FIXED CODE ###

import math        # factorical（階乗) # hypot(距離)
import heapq
# from fractions import gcd # Python3.5以前 # lcm（最小公倍数） = (a*b)//gcd(a,b)
# from fractions import Fraction
# from math import gcd # Python3.6以降
# --------------------------------------------------------------

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

price = [-i for i in price]

heapq.heapify(price)

for i in range(m):
    sm = heapq.heappop(price)
    sm = -(-sm//2)
    heapq.heappush(price,sm)

price = [-i for i in price]

print(sum(price))
### BUGGY CODE ###

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return set(lower_divisors + upper_divisors)-{n}
def main():
    from collections import Counter
    n,*a=map(int,open(0).read().split())
    d=Counter(a)
    s=set(a)
    c=0
    for t in s:
        if d[t]<2:
            for t in make_divisors(t):
                if t in s:break
            else:c+=1
    print(c)
main()

### FIXED CODE ###

m=8**7
c=[0]*m
for a in[*open(0)][1].split():c[int(a)]+=1
i=r=0
while~i+m:
 i+=1;r+=c[i]==1
 if c[i]:c[::i]=[0]*-(-m//i)
print(r)
### BUGGY CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import Counter
def resolve():
    S = sr()
    N = len(S)
    a = [0]*(N+1)
    t = ''
    for i in range(N):
        t = S[-1-i]+t
        a[i] = int(t)%2019
    A = Counter(a)
    ans = 0
    for n in A.values():
        ans += n*(n-1)//2
    print(ans)
resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    S = sr()
    N = len(S)
    a = [0]*2019
    a[0] += 1
    t = 0
    r = 1
    for s in reversed(S):
        t += int(s)*r
        t %= 2019
        r *= 10
        r %= 2019
        a[t] += 1
    ans = 0
    for i in range(2019):
        ans += a[i]*(a[i]-1)//2
    print(ans)
resolve()
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
c = []
d = [[-1 for i in range(w)] for j in range(h)]
q = deque()
for i in range(h):
	s = input()
	c.append(s)
	for j in range(w):
		if c[i][j] == '#':
			q.append([i, j, 0])
			d[i][j] = 0

dirr = [[1, 0], [0, 1], [-1, 0], [0, -1]]

while len(q) != 0:
	y, x, z = q[0]

	for i in range(4):
		ny, nx = y + dirr[i][0], x + dirr[i][1]
		if 0 <= ny < h and 0 <= nx < w and d[ny][nx] == -1 and c[ny][nx] != "#":
			q.append([ny, nx, z + 1])
			d[ny][nx] = z + 1

	q.popleft()

print(z)



### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
c = []
d = [[-1 for i in range(w)] for j in range(h)]
q = deque()
for i in range(h):
	s = input()
	c.append(s)
	for j in range(w):
		if c[i][j] == '#':
			q.append([i, j, 0])
			d[i][j] = 0

dirr = [[1, 0], [0, 1], [-1, 0], [0, -1]]

while len(q) != 0:
	y, x, z = q[0]

	for i in range(4):
		ny, nx = y + dirr[i][0], x + dirr[i][1]
		if 0 <= ny < h and 0 <= nx < w and d[ny][nx] == -1 and c[ny][nx] != "#":
			q.append([ny, nx, z + 1])
			d[ny][nx] = z + 1

	q.popleft()

print(z)
### BUGGY CODE ###

import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    R,C = NMI()
    #sy, sx = NMI()
    #gy, gx = NMI()
    board = [list(input()) for _ in range(R)]


    #移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    #すべての点をINFで初期化
    INF = R*C*2
    distance = [[INF for _ in range(C)] for _ in range(R)]

    #地点を保存するqueを作成
    que = deque([])
    
    #スタート地点を取り出す
    for r in range(R):
        for c in range(C):
            if board[r][c] == '#':
                que.append((r,c))
                #スタート地点の距離は0
                distance[r][c] = 0

    #queが空になるまでループ
    while len(que) != 0:
        #取り出してきた状態
        pop = que.popleft()



        #移動4方向をループ
        for i in range(len(dx)):
            #移動した後の点をny,nxとする
            ny = pop[0]+dy[i]
            nx = pop[1]+dx[i]

            #nyが0以上R未満   nxが0以上C未満     盤上で黒ではない        まだ訪れたことがない
            if 0<= ny < R and 0 <= nx < C and board[ny][nx]!='#' and distance[ny][nx] == INF:
                #つまり移動可能でまだ行ったことがなければqueへ入れる
                que.append((ny,nx))
                #その距離をもとのpopの最短距離+1でdistanceに記録
                distance[ny][nx] = distance[pop[0]][pop[1]]+1
    
    ans = 0
    for r in range(R):
        ans = max(max(distance[r]),ans)
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    R,C = NMI()
    #sy, sx = NMI()
    #gy, gx = NMI()
    board = [list(input()) for _ in range(R)]
    
    ans = 0

    #移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    #すべての点をINFで初期化
    INF = R*C*2
    distance = [[INF for _ in range(C)] for _ in range(R)]

    #地点を保存するqueを作成
    que = deque([])
    
    #スタート地点を取り出す
    for r in range(R):
        for c in range(C):
            if board[r][c] == '#':
                que.append((r,c))
                #スタート地点の距離は0
                distance[r][c] = 0

                
    cnt = 0
    
    #queが空になるまでループ
    while len(que) != 0:
        #取り出してきた状態
        pop = que.popleft()
        
        #移動4方向をループ
        for i in range(len(dx)):
            #移動した後の点をny,nxとする
            ny = pop[0]+dy[i]
            nx = pop[1]+dx[i]

            #nyが0以上R未満   nxが0以上C未満   まだ訪れたことがない
            if 0<= ny < R and 0 <= nx < C and distance[ny][nx] == INF:
                #つまり移動可能でまだ行ったことがなければqueへ入れる
                que.append((ny,nx))
                #その距離をもとのpopの最短距離+1でdistanceに記録
                distance[ny][nx] = distance[pop[0]][pop[1]]+1
                if ans < distance[ny][nx]:
                    ans = distance[ny][nx]
                
    print(ans)


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

def main():
    s = input()
    sl = len(s)
    t = input()
    tl = len(t)

    # dp[s][t]: value
    dp = [[(0, "") for _ in range(tl + 1)] for _ in range(sl + 1)]

    for si in range(sl):
        for ti in range(tl):
            if s[si] == t[ti]:
                dp[si + 1][ti + 1] = (dp[si][ti][0] + 1, dp[si][ti][1] + s[si])
            else:
                dp[si + 1][ti + 1] = max(dp[si + 1][ti], dp[si][ti + 1])

    # import pprint
    # print("dp={}".format(pprint.pformat(dp)))

    print(dp[sl][tl][1])


main()


### FIXED CODE ###

def main():
    s = input()
    sl = len(s)
    t = input()
    tl = len(t)

    # dp[s][t]: value
    dp = [[(0) for _ in range(tl + 1)] for _ in range(sl + 1)]

    for si in range(sl):
        for ti in range(tl):
            if s[si] == t[ti]:
                dp[si + 1][ti + 1] = dp[si][ti] + 1
            else:
                dp[si + 1][ti + 1] = max(dp[si + 1][ti], dp[si][ti + 1])

    # import pprint
    # print("dp={}".format(pprint.pformat(dp)))

    ret = []
    si, ti = sl, tl
    while 0 < si and 0 < ti:
        if dp[si][ti] == dp[si - 1][ti]:
            si -= 1
        elif dp[si][ti] == dp[si][ti - 1]:
            ti -= 1
        else:
            ret.insert(0, s[si - 1])
            si -= 1
            ti -= 1

    print("".join(ret))


main()
### BUGGY CODE ###

import math
A, B, N = map(int, input().split())
x = 0
ans1 = 0
while x <= N and x <= 10**9:
    ans = int((A*x)/B) - A * int(x / B)
    ans1 = max(ans1, ans)
    x += 1

print(ans1)


### FIXED CODE ###

import math

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


ans1 = 0

if N > B - 1:
    x = B-1
    print(int((A * x) / B) - A * int(x / B))
elif N <= B - 1:
    x = N
    print(int((A * x) / B) - A * int(x / B))
### BUGGY CODE ###

from collections import deque
def bfs(G, start):
    label[start] = start
    queue = deque()
    visited = [False] * (len(G))
    queue.append(start)
    while queue:
        target = queue.popleft()
        label[target] = start
        for j in G[target]:
            if visited[j] == False:
                visited[j] = True
                queue.append(j)
    # visited = [k for k, x in enumerate(visited) if x ]
    # return set(visited)

N, M, K = map(int, input().split())
F_G = [[] for _ in range(N)]
B_G = [[] for _ in range(N)]
label = [-1] * N
link = [0] * N
# 無向グラフの作成
for _ in range(M):
    a, b = map(int, input().split())
    link[a-1] += 1
    link[b-1] += 1
    F_G[a-1].append(b-1)
    F_G[b-1].append(a-1)

sub = list(range(N))
# bfsでラベル付けすることで連結成分を作成
for i in sub:
    if label[i] == -1:
        bfs(F_G, i)

for _ in range(K):
    c, d = map(int, input().split())
    if label[c-1] == label[d-1]:
        link[c-1] -= 1
        link[d-1] -= 1
    B_G[c-1].append(d-1)
    B_G[d-1].append(c-1)

for i in range(len(link)):
    link[i] -= len(F_G[i])
    num = len([x for x in label if x == label[i]])
    link[i] += (num-len(F_G[i]))-1
print(*link)

### FIXED CODE ###

N,M,K = map(int,input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
CD = [tuple(map(int, input().split())) for _ in range(K)]

"""
Union-Find木実装のキモ(計算量削減)
1. Unionの工夫
   マージテク：大きい方を動かさずに小さい方をくっつける
2. Findの工夫
   経路圧縮 : 集合の要素を根に直接つなぎ変える.木をフラットにする.
"""

# Union-Findを用いて連結成分を考える(Union-Find木の実装)
class UnionFind:
    # まずは最初の状態を作る
    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.rank = [0] * N
        self.count = 0

    # そのノードの根を返す過程で,集合の要素を根に直接つなぎかえる
    def root(self, a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]

    # aとbの根が同じ,つまり同じ連結成分内かどうかを返す
    def is_same(self, a, b):
        return self.root(a) == self.root(b)

    # 連結成分同士を効率的に(rankが大きい方を動かさずにrankが小さい方をくっつける)
    def unite(self, a, b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self.rank[ra] < self.rank[rb]:
            self.parent[ra] = rb
        else:
            self.parent[rb] = ra
            if self.rank[ra] == self.rank[rb]: self.rank[ra] += 1
        self.count += 1

blocks = [[] for _ in range(N)]
for c, d in CD:
    c, d = c-1, d-1
    blocks[c].append(d)
    blocks[d].append(c)

# friendsは友達の数を保持する
friends = [0] * N
uf = UnionFind(N)
for a,b in AB:
    a, b = a-1, b-1
    friends[a] += 1
    friends[b] += 1
    # aとbが同連結成分内であれば何もする必要がない
    if uf.is_same(a, b): continue
    # 異なれば結合
    uf.unite(a, b)

for i in range(N):
    uf.root(i)

from collections import Counter
ctr = Counter()
for i in range(N):
    r = uf.root(i)
    ctr[r] += 1

ans = []
for i in range(N):
    tmp = ctr[uf.root(i)] - friends[i] -1
    for b in blocks[i]:
        if uf.is_same(i, b):
            tmp -= 1
    ans.append(tmp)
print(*ans)
### BUGGY CODE ###

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

res = 0
for j in range(n):
    for i in range(j):
        res = res + (a[j] * a[i] % (10**9 +7))
print(res % ((10 **9)+7))

### FIXED CODE ###

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

res = 0
ruiseki = 0
for j in range(n):
    if j == 0:
        continue
    ruiseki += a[j-1]
    res = res + a[j]*ruiseki
print(res % ((10 **9)+7))
### BUGGY CODE ###

import math
k = int(input())

ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      ans += math.gcd(math.gcd(a,b),c)

print(ans)


### FIXED CODE ###

import math
k = int(input())

ans = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    tmp = math.gcd(a,b)
    for c in range(1,k+1):
      ans += math.gcd(c,tmp)

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

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

for i, a in enumerate(A):
    table.append([a,i])
table.sort(reverse=True)

# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    for x in range(i+1):
        y = i - x

        #左端に置く場合と右端に置く場合でmax
        DP[x][y] = max((DP[x-1][y] + table[i-1][0] * abs(table[i-1][1]  - x+1)) * (x>0),\
                     (DP[x][y-1] + table[i-1][0] * abs(table[i-1][1]   - (N - y))*(y>0)))


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


### FIXED CODE ###

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

for i, a in enumerate(A):
    table.append([a,i])
table.sort(reverse=True)

# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    for x in range(i+1):
        y = i - x

        #左端に置く場合と右端に置く場合でmax
        DP[x][y] = max((DP[x-1][y] + table[i-1][0] * abs(table[i-1][1]  - x+1)) * (x>0),\
                     (DP[x][y-1] + table[i-1][0] * abs(table[i-1][1] - (N - y))*(y>0)))


ans = 0
for i in range(N+1):
    for j in range(N+1):
        ans = max(ans, DP[i][j])
print(ans)
### BUGGY CODE ###


N = int(input())
h = [int(x) for x in input().split(" ")]


cnt = 0
for i in range(1, N):
    left = 0
    right = i
    while(right < N):
        if h[right] + h[left] == i:
            cnt += 1
            #print((left, right))
        left += 1
        right += 1
print(cnt)



### FIXED CODE ###

from collections import Counter

N = int(input())
h = [int(x) for x in input().split(" ")]
 
L = [0] * N
R = [0] * N
cnt = 0
for i in range(0, N):
    L[i] = i + 1 + h[i]
    R[i] = i + 1- h[i]
LC = Counter(L)
RC = Counter(R)

cnt = 0
for key,values in LC.most_common():
    if key in RC:
        num = RC[key]
        cnt += values * num

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

#coding:utf-8
N, K = map(int,input().split())
P = list(map(int,input().split()))
P = [(p+1)/2 for p in P]
mx = 0
for i in range(N-K+1):
    mx = max(mx,sum(P[i:K+i]))
print (mx)

### FIXED CODE ###

#coding:utf-8
N, K = map(int,input().split())
P = list(map(int,input().split()))
P = [(p+1)/2 for p in P]
mx = sum(P[:K])
sm = sum(P[:K])
for i in range(N-K):
    sm = sm - P[i] + P[K+i]
    mx = max(mx,sm)
print (mx)
### BUGGY CODE ###

from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

l = {}
r = {}

for i in range(n):
    x = i + an[i]
    if x not in l:
        l[x] = [i]
    else:
        l[x].append(i)

    x = i - an[i]
    if x not in r:
        r[x] = [i]
    else:
        r[x].append(i)

sum = 0
for k in l:
    if k in r:
        for i in range(len(l[k])):
            for j in range(len(r[k])):
                if l[k][i] != r[k][j]:
                    sum += 1
print(sum)


### FIXED CODE ###

from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

l = {}
r = {}

for i in range(n):
    x = i + an[i]
    if x not in l:
        l[x] = [i]
    else:
        l[x].append(i)

    x = i - an[i]
    if x not in r:
        r[x] = [i]
    else:
        r[x].append(i)

sum = 0
for k in l:
    if k in r:
        sum += len(l[k])*len(r[k])

print(sum)
### BUGGY CODE ###

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

for i in range(0,N):
    if A[i]%(10**9)+7==0:
        del A[i]

for i in range(0,len(A)-1):
    for j in range(i+1,len(A)):
        b+=A[i]*A[j]
        
print(b%(10**9+7))

### FIXED CODE ###

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

for j in range(0,len(A)):
    c+=A[j]

for i in range(0,len(A)):
        c=c-A[i]
        b+=A[i]*c
        
print(b%(10**9+7))
### BUGGY CODE ###

x=int(input())
times=0
money=100
while money<x:
  money*1.01
  times+=1
  
print(times)

### FIXED CODE ###

x= int(input())
save=100
k=0
while save<x:
  save= int(save*1.01)
  k+=1
  
print(k)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
def main():
    S=input()
    Q=int(input())
    query=[]
    for i in range(Q):
        li = input().split(' ')
        query.append(li)
    f=True
    for i in range(Q):
        if(query[i][0]=='1'):
            f=not f
            continue
        else:
            F=query[i][1]
            C=query[i][2]
            
            if(f):
                if(F=='1'):
                    S=C+S
                else:
                    S=S+C
            else:
                C=C[::-1]
                if(F=='1'):
                    S=S+C
                else:
                    S=C+S
        
    if(not f):
        S=S[::-1]
    print(S) 



    

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque
def main():
    S=input()
    Q=int(input())
    query=[list(input().split()) for _ in range(Q)]
    
    d=deque(S)
    c=0

    for q in query:
        if q[0]=="1":
            c+=1
        elif q[0]=="2":
            if (c%2==0 and q[1]=="1") or (c%2==1 and q[1]=="2"):
                d.appendleft(q[2])
            else:
                d.append(q[2])
    if(c%2!=0):
        d.reverse()
    print("".join(d))

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

import sys


n,a,b=[int(x) for x in str(input()).split()]
A=[]
for i in range(n):
  A.append([int(x) for x in sys.stdin.readline().split()])



#print(A)
def f(ma,mb,cost,index):

  newa=ma+A[index][0]
  newb=mb+A[index][1]
  newc=cost+A[index][2]
  
  #print(index,newa,newb,newc)
  if newa*b==a*newb:
    return newc
  elif index==n-1:
    return 100000000000000000000
  else:
    ith=f(newa,newb,newc,index+1)
    return min(ith,f(ma,mb,cost,index+1))



if f(0,0,0,0)<100000000000000000000:
  print(f(0,0,0,0))
else:
  print(-1)


### FIXED CODE ###

N,Ma,Mb=[int(x) for x in input().split()]
A=[]
B=[]
C=[]
for i in range(N):
	a,b,c=[int(x) for x in input().split()]
	A.append(a)
	B.append(b)
	C.append(c)


ANS=[[[-1 for k in range(401)] for j in range(401)] for i in range(41)]

INF=1000000000000000000000

def f(ind,wa,wb):
	global Ma
	global Mb
	global N
	if ANS[ind][wa][wb]==-1:
		if ind==0:
			if (wa+A[0])*Mb==(wb+B[0])*Ma:
				ANS[ind][wa][wb] = C[0]
			elif wa*Mb==wb*Ma and (wa!=0 and wb!=0):
				ANS[ind][wa][wb] = 0
			else:
				ANS[ind][wa][wb] = INF
		else:
			ANS[ind][wa][wb] = min(f(ind-1,wa,wb),f(ind-1,wa+A[ind],wb+B[ind])+C[ind])
	return ANS[ind][wa][wb]

ans=f(N-1,0,0)

if ans==INF:
	print(-1)
else:
	print(ans)
### BUGGY CODE ###

In = input().split(" ")
T = int(In[0])
A = int(In[1])
K = int(In[2])

if K>=T+A:
  print("0 0")
  
elif (K > T):
  print("0 {0}".format(A-(K-T)))
elif (T > K):
  print("{0} {1}".format(T-K, A))
else:
  for i in range(K):
    if T >= 1:
      T -= 1
    elif A >= 1:
      A -= 1
  print("{0} {1}".format(T, A))

### FIXED CODE ###

In = input().split(" ")
T = int(In[0])
A = int(In[1])
K = int(In[2])
 
if K <= T:
  print("{0} {1}".format(T-K,A))
elif K <= T+A:
  print("0 {0}".format(A-(K-T)))
else:
  print("0 0")
### BUGGY CODE ###

n = int(input())
s = str(input())
s = s.replace("W","1")
s = s.replace("E","0")
m = int(s[:])
box = [0]*(n)
p = 0
for i in range(1,n+1):
    box[i-1] = sum(list(map(int,s[:i])))
k = 0
full = box[n-1]
for j in range(n):
    if j == 0:
        p = n-full+box[0]
        if p > k:
            k = p
    elif j == n-1:
        p = (n-1)-full+int(s[n-1])
        if p > k:
            k = p
    else:
        p = j-box[j-1]+full-box[j]
        if p > k:
            k = p
print(n-k-1)

### FIXED CODE ###

n = int(input())
s = str(input())
s = s.replace("W","1")
s = s.replace("E","0")
fl = sum(list(map(int,s)))
k = 0
p = 0
for i in range(n):
    if i == 0:
        p = fl - int(s[0])
        k = p
    elif i == n-1:
        p = n-1-fl+int(s[n-1])
        if p > k:
            k = p
    else:
        if (s[i-1] == "1" and s[i] == "1"):
            p -= 1
        elif (s[i-1] == "1" and s[i] == "0"):
            continue
        elif (s[i-1] == "0" and s[i] == "1"):
            continue
        else:
            p += 1
            if p > k:
                k = p
print(n-k-1)
### BUGGY CODE ###

n = int(input())
a_ = [int(i) for i in input().split()]
a = [[a_[i], i+1] for i in range(n)]
a.sort(reverse=True)

dp = [[0 for i in range(n+1)] for j in range(n+1)]
x_plus_y = 0
ans = 0

for i in range(n):
    if x_plus_y == 0:
        dp[0][1] = a[i][0] * abs((n - a[i][1]))
        dp[1][0] = a[i][0] * abs((a[i][1] - 1))

    else:
        for x in range(x_plus_y + 1):
            y = x_plus_y - x
            dp[x][y+1] = max(dp[x][y+1], a[i][0] * abs((n - y) - a[i][1]) + dp[x][y])
            dp[x+1][y] = max(dp[x+1][y] , a[i][0] * abs((a[i][1] - (1+x))) + dp[x][y])

            if x_plus_y == n-1:
                ans = max(ans, dp[x][y+1], dp[x+1][y])

    x_plus_y += 1

print(ans)


### FIXED CODE ###

n = int(input())
a_ = [int(i) for i in input().split()]
a = [[a_[i], i+1] for i in range(n)]
a.sort(reverse=True)

dp = [[0 for i in range(n+1)] for j in range(n+1)]
x_plus_y = 0
ans = 0

for i in range(n):
    if x_plus_y == 0:
        dp[0][1] = a[i][0] * abs((n - a[i][1]))
        dp[1][0] = a[i][0] * abs((a[i][1] - 1))

    else:
        for x in range(x_plus_y + 1):
            y = x_plus_y - x
            dp[x][y+1] = max(dp[x][y+1], a[i][0] * abs((n - y) - a[i][1]) + dp[x][y])
            dp[x+1][y] = max(dp[x+1][y] , a[i][0] * abs((a[i][1] - (1+x))) + dp[x][y])

            if x_plus_y == n-1:
                ans = max(ans, dp[x][y+1], dp[x+1][y])

    x_plus_y += 1

print(ans)