Harryxun/stf_run huggingface dataset:
n,k=map(int,input().split())
edge=[]
mod=10**9+7
for i in range(n-1):
    a,b=map(int,input().split())
    edge.append([a-1,b-1])
root=[[] for i in range(n)]
for [a,b] in edge:
    root[a].append(b)
    root[b].append(a)
def perm(k,n):
    x=1
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    x=1
    if l==0:
        return 1
    if l==1 and depth>1:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,min(depth+1,2),node)%mod
    return x
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)

### FIXED CODE ###

n,k=map(int,input().split())
mod=10**9+7
import sys
sys.setrecursionlimit(10**9)
root=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    root[a-1].append(b-1)
    root[b-1].append(a-1)
def perm(k,n):
    x=1
    if k-n+1<=0:
        return 0
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    x=1
    if l==0:
        return 1
    if l==1 and depth>1:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,2,node)%mod
    return x%mod
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    deck[suit[card[0]]][int(card[1])] = ""
for i in range(4):
    for j in deck[i]:
        if j != "":
            print(j)


### FIXED CODE ###

suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    deck[suit[card[0]]][int(card[1]) - 1] = ""
for i in range(4):
    for j in range(13):
        if deck[i][j] != "":
            print(deck[i][j])
from collections import Counter as co
from itertools import combinations as com
from operator import mul
from functools import reduce

def combinations_count(n, r):
  r = min(r, n - r)
  numer = reduce(mul, range(n, n - r, -1), 1)
  denom = reduce(mul, range(1, r + 1), 1)
  return numer//denom

n=int(input())
a=0
l=co([set(co(input())) for i in range(n)])
for d,s in l.items():
  if d>=2:a+=combinations_count(d, 2)
print(a)

### FIXED CODE ###

from collections import Counter as co
from operator import mul
from functools import reduce

def combinations_count(n, r):
  r = min(r, n - r)
  numer = reduce(mul, range(n, n - r, -1), 1)
  denom = reduce(mul, range(1, r + 1), 1)
  return numer//denom


n=int(input())
a=0
l=[''.join(list(map(str,sum(sorted(list(map(list,co(input()).items()))),[])))) for i in range(n)]
for d,s in co(l).items():
  if s>=2:a+=combinations_count(s, 2)
print(a)
import math

a, b = map(float, input().split())
c = int(a)
times = c * b
new_times = math.floar(times)
print(int(new_times))

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=float(b)*1000
b=int(b)
print(int((a*b)//1000))
list = input().split()

jack = list[0] + list[1] + list[2]

if jack >= 22:
  print("bust")
else:
  print("win")


### FIXED CODE ###

list = input().split()
 
jack = int(list[0]) + int(list[1]) + int(list[2])
 
if jack >= 22:
  print("bust")
else:
  print("win")
a = int(input())
b = input()

t = ["SS","SW","WS","WW"]

for j in range(4):
  for i in range(1,a):
    if t[j][i] == "S" and b[i] == "o":
      t[j]+="S" if t[j][i-1] == "S" else "W"
    elif t[j][i] == "S" and b[i] == "x":
      t[j]+="S" if t[j][i-1] == "W" else "W"
    elif t[j][i] == "W" and b[i] == "x":
      t[j]+="S" if t[j][i-1] == "S" else "W"
    elif t[j][i] == "W" and b[i] == "o":
      t[j]+="S" if t[j][i-1] == "W" else "W"
    else:
      t[j] = -1
      break
s = -1
if all(i == -1 f

### FIXED CODE ###

a = int(input())
b = input()

t = ["SS","SW","WS","WW"]
l = []
for j in range(4):
  if t[j][0] == "S" and b[0] == "o":
    l.append("S" if t[j][1] == "S" else "W")
  elif t[j][0] == "S" and b[0] == "x":
    l.append("S" if t[j][1] == "W" else "W")
  elif t[j][0] == "W" and b[0] == "x":
    l.append("S" if t[j][1] == "S" else "W")
  elif t[j][0] == "W" and b[0] == "o":
    l.append("S" if t[j][1] == "W" else "W")
  for i in range(1,a):
    if t[j][i] == "S" and b[i] == "o":
      t[j]+="S" if t[j][i-1] == "S" else "W"
    elif t[j][i] == "S" and b[i] == "x":
      t[j]+="S" if t[j][i-1] == "W" else "W"
    elif t[j][i] == "W" and b[i] == "x":
      t[j]+="S" if t[j][i-1] == "S" else "W"
    elif t[j][i] == "W" and b[i] == "o":
      t[j]+="S" if t[j][i-1] == "W" else "W"
    else:
      t[j] = -1
      break
s = -1
if all(i == -1 for i in t):
  print(-1)
else:
  for j,k in enumerate(t):
    # print(j,k)
    # if k !=-1:
    #   if t[j][-1] == "S" and b[-1] == "o" and t[j][0] == "S":
    #     s = t[j]
    #   elif t[j][-1] == "S" and b[-1] == "x" and t[j][0] == "W":
    #     s = t[j]
    #   elif t[j][-1] == "W" and b[-1] == "x" and t[j][0] == "S":
    #     s = t[j]
    #   elif t[j][-1] == "W" and b[-1] == "o" and t[j][0] == "W":
    #     s = t[j]
    if k !=-1:
      if k[-1] ==  k[0] :
        if k[-2] ==l[j]:
          s = k
  if s == -1:print(-1)
  else:print(s[:-1])
"""
偶数番目、機数番目をそれぞれリストに格納
偶数番目の中で、（全て）ー（もっとも要素数が多い数の数）
機数番目の中で、（全て）ー（もっとも要素数が多い数の数）
この和を求めれば良い
→一部WA
→ちょうど2種類ではなく、1種類になってしまうことがあるからでは？

偶数群と奇数群で、最頻値で場合わけ
一致している場合とそうでない場合で計算を変える

"""
import collections


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

even = []
odd = []
for nn in range(n):
    if nn % 2 == 0:
        even.append(V[nn])
    else:
        odd.append(V[nn])

e = collections.Counter(even)
o = collections.Counter(odd)

if e.most_common()[0][0] != o.most_common()[0][0]:
    print(n - e.most_common()[0][1] - o.most_common()[0][1])
else:
    print(N- max(e.most_common()[1][1] + o.most_common()[0][1],
    e.most_common()[0][1] + o.most_common()[1][1]))
    


### FIXED CODE ###

import collections
n = int(input())
V = list(map(int, input().split()))

even = []
odd = []
for nn in range(n):
    if nn % 2 == 0:
        even.append(V[nn])
    else:
        odd.append(V[nn])

e = collections.Counter(even).most_common()
o = collections.Counter(odd).most_common()

if e[0][0] != o[0][0]:
    print(n - e[0][1] - o[0][1])
else:
    if len(e) == 1 and len(o) == 1:
        print(n // 2)
    elif len(e) == 1 and len(o) >= 2:
        print(n - o[0][1])
    elif len(e) >= 2 and len(o) == 1:
        print(n - e[0][1])
    else:
        print(n - max(e[1][1] + o[0][1], e[0][1] + o[1][1]))
n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=A[0]
for k in A[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
limit=10**18
a.sort()
result=a[0]
for k in a[1:]:
    result*=k
    if result > limit:
        print(-1)
        exit()
print(result)
import fractions as gcd

a, b = map(int, input().split())
print(a*b // gcd(a,b))

### FIXED CODE ###

x = int(input())

while True:
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            x = x + 1
            break
    else:
        print(x)
        exit()
math_line = list(map(int,input().split()))
input_line = list(map(int,input().split()))

area = math_line[0]*math_line[1]　

black_cell = math_line[0]*input_line[1] + math_line[1]*input_line[0] 
duplicate =  black_cell - input_line[0]*input_line[1]

white_cell = area - duplicate

print(white_cell)

### FIXED CODE ###

math_line = list(map(int,input().split()))
input_line = list(map(int,input().split()))

area = math_line[0]*math_line[1]
black_cell = math_line[0]*input_line[1] + math_line[1]*input_line[0]
duplicate =  black_cell - input_line[0]*input_line[1]
white_cell = area - duplicate

print(white_cell)
N,M = map(int,input().split())
A=[int(n) for n in input().split()]
A.sort()
        
for _ in range(M):
    a = A[-1]//2
    del A[-1]
    for i in range(N):
        if A[i] >a:
            A.insert(i, a)
            break
print(sum(A))

### FIXED CODE ###

import heapq
N,M = map(int,input().split())
H=[]
for i in input().split():
    heapq.heappush(H,-int(i))
for i in range(M):
    a = heapq.heappop(H)
    heapq.heappush(H,-(-a//2))
print(-sum(H))
import fileinput

a, b = [int(i) for i in fileinput.input().next().strip().split()]
if a > b:
	print "a > b"
elif a < b:
	print "a < b"
else:
	print "a == b

### FIXED CODE ###

import fileinput
import sys

a, b = [int(i) for i in fileinput.input().next().strip().split()]
if a > b:
    print "a > b"
    sys.exit(0)
if a < b:
    print "a < b"
    sys.exit(0)
if a == b:
    print "a == b"
    sys.exit(0)
import fractions
 
N = int(input())
A = list(map(int,input().split()))
L = [0] * N
R = [0] * N

for i in range(1, N):
    L[i] = fractions.gcd(L[i-1], A[i-1])
    R[-i-1] = fractions.gcd(R[-i], A[-i])

ans = [0] * N

for i in range(0, N):
    ans[i] = fractions.gcd(L[i], R[i])

print(max(ans))

### FIXED CODE ###

A, B, T = map(int, input().split())
ans = ((T + 0.5) // A ) * B
print(round(ans))
H, W = map(int, input().split())
maze = [[_ for _ in input()] for _ in range(W)]
INF = 10 ** 5

# dp[i][j]:=(i,j)に到達するまでに黒壁を壊す回数の最小値
dp = [[INF] * W for _ in range(H)]

if maze[0][0] == '#':
    dp[0][0] = 1
else:
    dp[0][0] = 0

for i in range(H):
    for j in range(W):
        for [dy, dx] in [[1, 0], [0, 1]]:
            ny, nx = i + dy, j + dx
            if ny >= H or nx >= W:
                continue
            else:
                if maze[i][j] == '.' and maze[ny][nx] == '#':
                    dp[ny][nx] = min(dp[ny][nx], dp[i][j] + 1)
                else:
                    dp[ny][nx] = min(dp[ny][nx], dp[i][j])
print(dp[H - 1][W - 1])

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():
    H, W = map(int, input().split())
    maze = [[_ for _ in input()] for _ in range(W)]
    INF = 10 ** 5
    # dp[i][j]:=(i,j)に到達するまでに黒壁を壊す回数の最小値
    dp = [[INF] * W for _ in range(H)]

    if maze[0][0] == '#':
        dp[0][0] = 1
    else:
        dp[0][0] = 0

    for i in range(H):
        for j in range(W):
            for [dy, dx] in [[1, 0], [0, 1]]:
                ny, nx = i + dy, j + dx
                if ny >= H or nx >= W:
                    continue
                else:
                    if maze[i][j] == '.' and maze[ny][nx] == '#':
                        dp[ny][nx] = min(dp[ny][nx], dp[i][j] + 1)
                    else:
                        dp[ny][nx] = min(dp[ny][nx], dp[i][j])
    print(dp[H - 1][W - 1])


resolve()
index(['SUN','MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT])print(7 - ['SUN','MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))

### FIXED CODE ###

print(7 - ['SUN','MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))
N = input()
A = int(input())
B = int(input())

if N > 1:
  print(A+B)
else:
  print("Hello World")

### FIXED CODE ###

N = int(input())
if N ==1:
  print("Hello World")
elif N == 2:
  A = int(input())
  B = int(input())
  print(A+B)
# 2019-11-23 21:00:35(JST)
import sys

def main():
    m = int(sys.stdin.readline().rstrip())

    S = ''

    total = 0
    for i in range(m):
        d, c = sys.stdin.readline().split()
        c = int(c)
        s = d * c
        count = 0
        while len(s) >= 2:
            s = str(int(s[0]) + int(s[1])) + s[2:]
            count += 1
        total += count
        S += s

    
    while len(S) >= 2:
        S = str(int(S[0]) + int(S[1])) + S[2:]
        total += 1
    
    print(total)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# 2019-11-23 21:00:35(JST)
import sys
import collections
import math

def main():
    m = int(sys.stdin.readline().rstrip())

    a = collections.defaultdict(int)
    for _ in range(m):
        d, c = map(int, sys.stdin.readline().split())
        a[d] += c
    

    b = 0
    for i in range(10):
        b += (i + 9) * a[i]
    
    ans = math.ceil((b - 9)/ 9) - 1
    print(ans)
    
if __name__ == '__main__':
    main()
import bisect
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
ans = int(0)

N = I()
color = []
a = I()
maxcolor =[]
maxcolor.append(a)
lena = 1
for i in range(N-1):
    a = I()
    minmaxcolor = min(maxcolor)
    if a<=minmaxcolor:
        maxcolor.insert(0,a)
#        maxcolor.append(a)
        lena += 1
    else:
        acandi = bisect.bisect_left(maxcolor, a)
        maxcolor[acandi] = a-1
        """
        aupper = lena-1
        alower = int(0)
        acandi = aupper//2
        
        for _ in range(aupper+1):
            if maxcolor[acandi]>=a:
                alower = acandi
                acandi = (aupper+acandi+1)//2
            else:
                if aupper - alower <= 1:
                    maxcolor[acandi] = a
                    break
                else:
                    aupper = acandi
                    acandi = (acandi + alower) // 2
        """

#print(maxcolor)
ans = len(maxcolor)
print(ans)

### FIXED CODE ###

from collections import deque
import bisect
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
ans = int(0)

N = I()
color = []
a = I()
maxcolor =deque()
maxcolor.append(a)
lena = 1
for i in range(N-1):
    minmaxcolor = maxcolor[0]
    a = I()
    if a<=minmaxcolor:
        maxcolor.appendleft(a)
#        maxcolor.append(a)
        lena += 1
    else:
        acandi = bisect.bisect_left(maxcolor, a)
        maxcolor[acandi-1] = a
        """
        aupper = lena-1
        alower = int(0)
        acandi = aupper//2
        
        for _ in range(aupper+1):
            if maxcolor[acandi]>=a:
                alower = acandi
                acandi = (aupper+acandi+1)//2
            else:
                if aupper - alower <= 1:
                    maxcolor[acandi] = a
                    break
                else:
                    aupper = acandi
                    acandi = (acandi + alower) // 2
        """

#print(maxcolor)
ans = len(maxcolor)
print(ans)
nm = input().split()
n = int(nm[0])
m = int(nm[1])

p = []
r = []

for i in range(m):
	pr = input().split()
	p.append(int(pr[0]))
	r.append(pr[1])

ac = 0
wa = 0
flg = [False for i in range(n)]

if m != 0:
	for l in range(m):
		if r[l] == 'AC' and flg[p[l]] == False :
			ac += 1
			flg[p[l]] = True
		elif  flg[p[l]] == False :
			wa += 1

print(ac)
print(wa)


### FIXED CODE ###

nm = input().split()
n = int(nm[0])
m = int(nm[1])

p = []
r = []

for i in range(m):
	pr = input().split()
	p.append(int(pr[0]))
	r.append(pr[1])

ac = 0
wa = 0
flg = [0 for i in range(n)]

if m != 0:
	for l in range(m):
		if r[l] == 'AC' and flg[p[l]-1] !=  'ac':
			ac += 1
			wa += flg[p[l]-1]
			flg[p[l]-1] = 'ac'
		elif  flg[p[l]-1] != 'ac' :
			flg[p[l]-1] += 1

print(ac)
print(wa)
e,a = map(int,input().split())
cnt =0
if e==0 and a==0:
    break
else:
    for i in range(1,e+1):
        for j in range(i+1,e+1):
            for k in range(j+1,e+1):
                if i+j+k ==9:
                    cnt +=1
print(cnt)


### FIXED CODE ###

while True:
    e,a = map(int,input().split())
    if e ==0 and a ==0:
        break
    cnt = 0
    for i in range(1,e+1):
        for j in range(1,e+1):
            if j<=i:
                continue
            X = a - (i + j)
            if X > j and X <=e:
                cnt +=1
    print(cnt)
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
for i in p:
    num += 1
    k = 0
    while s[i][k] == '.':
        a[i][k] = num
        k += 1
    a[i][k] = num
    k += 1
    for j in range(k, w):
        if s[i][j] == '#':
            num += 1
        a[i][j] = num

for i in q:
    k = i
    while k < h and a[k][j] == 0:
        k += 1
    if k >= h:
        k = i
        while k < h and a[k][j] == 0:
            k -= 1
    for j in range(w):
        a[i][j] = a[k][j]
for i in range(h):
    print(*a[i][:])

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
if p:
    for i in p:
        num += 1
        m = 0
        while s[i][m] == '.':
            a[i][m] = num
            m += 1
        if m < w:
            if s[i][m] == '#':
                a[i][m] = num
                m += 1
            if m < w:
                for j in range(m, w):
                    if s[i][j] == '#':
                        num += 1
                    a[i][j] = num

if q:
    for i in q:
        m = i
        while m < h and a[m][0] == 0:
            m += 1
        if m >= h:
            m = i
            while m > 0 and a[m][0] == 0:
                m -= 1
        a[i][:] = a[m][:]
for i in range(h):
    print(*a[i][:])
if __name__ == '__main__':
	n = int(input())
	M = None
	R = int(input())
	S = 0
	tr = R
	for i in range(n - 1):
		a = int(input())
		if tr - a >= 0:
			continue
		else:
			M = tr - a if M is None and M < tr - a else M
			tr = a
	print(M)





### FIXED CODE ###

if __name__ == '__main__':
	n = int(input())
	lists = list()

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

	S = None
	while len(lists) > 1:
		mini = min(lists)
		mini_ind = lists.index(mini)
		l = len(lists)

		if mini_ind + 1 == l:
			if S is None or S < lists[mini_ind] - lists[mini_ind - 1]:
				S = lists[mini_ind] - lists[mini_ind - 1]
			lists.pop(mini_ind)
			continue


		maxi = max(lists[mini_ind : l])
		T = maxi - mini

		if S is None or S < T:
			S = T

		lists = lists[0 : mini_ind]
		continue

	print(S)
import io,sys
sys.setrecursionlimit(10**6)


def main():
    X,Y = map(int,sys.stdin.readline().rstrip().split())

    y = (Y-2*X)/2
    x = X-y

    if y>=0 and y == int(y) and x >= 0:
        print("Yes")
    else:
        print("No")
main()

### FIXED CODE ###

import io,sys
sys.setrecursionlimit(10**6)


def main():
    X = list(map(int,sys.stdin.readline().rstrip().split()))
    g = set([0,1,2,3,4,5])

    a = list(g - set(X))
    print(a[0])
main()
import math
n, a, b, c = list(map(int, input().split()))
ll = tuple([int(input()) for _ in range(n)])

def nearest(key, lst) :
    ans = math.inf
    d = math.inf
    for el in lst :
        if abs(el - key) < d :
            ans = el
            d = abs(el - key)
    return ans, d

def tend(lln) :
    llm = list(lln)
    al, ad = nearest(a, llm)
    llm.remove(al)
    bl, bd = nearest(b, llm)
    llm.remove(bl)
    cl, cd = nearest(c, llm)
    return ad + bd + cd

def synth(lln) :
    lol = []
    for i in range(len(lln)-1) :
        for j in range(i+1, len(lln)) :
            llm = list(lln)
            lj = llm.pop(j)
            li = llm.pop(i)
            llm.append(li+lj)
            lol.append(tuple(llm))
    return lol

def synth2(lolln) :
    lol = []
    for lln in lolln :
        lol.extend(synth(lln))
    return tuple(lol)


ans = tend(ll)
lolln = set((ll,))
for i in range(5) :
    if n >= i+4 :
        lolln = set(synth2(lolln))
        for lln in lolln :
            ans = min(ans, 10*(i+1)+tend(lln))

print(ans)

### FIXED CODE ###

from itertools import product, combinations

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

# 合成してから短縮/延長すればよい
# 合成方法を全探索する

ans = float("inf")
for n_use in range(3, n+1) : # 何本使うか
    for l_use in combinations(ll, n_use) : # どの竹を使うか
        for dist in product(*[range(3) for _ in range(n_use)]) : #竹をどう合成するか
            if len(set(dist)) != 3 :
                continue

            labc = [0, 0, 0]
            for i, l in zip(dist, l_use) :
                labc[i] += l
    
            diff = [abs(labc[i]-abc[i]) for i in range(3)]
            ans = min(ans, 10*(n_use-3)+sum(diff))

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

b = a[:]
b.sort()

c = [[]for _ in range(n+1)]

ct = 1
tmp = b[1]
sum = 0
for j in range(1,n):
  if b[j] == b[j-1]:
    ct += 1
  else :  
    c[tmp].append(ct)
    cm = int(ct*(ct-1)/2)
    c[tmp].append(cm)
    cm1 = int((ct-1)*(ct-2)/2)
    c[tmp].append(cm1)
    sum += cm
    tmp = b[j]
    ct = 1

c[tmp].append(ct)
cm = int(ct*(ct-1)/2)
c[tmp].append(cm)
cm1 = int((ct-1)*(ct-2)/2)
c[tmp].append(cm1)
sum += cm      

for k in a:
  print(sum-c[k][1] + c[k][2])

### FIXED CODE ###

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

b = a[:]
b.sort()

c = [[ 0 for _ in range(3)] for _ in range(n+1)]

ct = 1
tmp = b[1]
sum = 0
for j in range(1,n):
  if b[j] == b[j-1]:
    ct += 1
  else :  
    c[tmp][0] = ct
    cm = int(ct*(ct-1)/2)
    c[tmp][1] = cm
    cm1 = int((ct-1)*(ct-2)/2)
    c[tmp][2] = cm1
    sum += cm
    tmp = b[j]
    ct = 1

c[tmp][0] = ct
cm = int(ct*(ct-1)/2)
c[tmp][1] = cm
cm1 = int((ct-1)*(ct-2)/2)
c[tmp][2] = cm1
sum += cm      

for k in a:
  print(sum-c[k][1] + c[k][2])
n_list = n.split(" ")
a = int(n_list[0])
b = int(n_list[1])
k = int(n_list[2])

if k < a:
    a = a-k
elif k >= a and k-a < b:
    a = 0
    b = b - (k-a)
elif k-a >= b:
    a = 0
    b = 0

print(str(a) + " " + str(b))

### FIXED CODE ###

n = input()
n_list = n.split(" ")
a = int(n_list[0])
b = int(n_list[1])
k = int(n_list[2])

if k < a:
    a = a-k
    b = b
    print(str(a) + " " + str(b))
elif k >= a and k-a < b:
    b = b - (k-a)
    print(str(0) + " " + str(b))
elif k >= a and k-a >= b:
    a = 0
    b = 0
    print(str(0) + " " + str(0))
N, T= list(map(int, input().split()))
A = [int(x) for x in input().strip().split()]

result = 0
diff = 0
for i in range(N - 1):
    counter = 0
    if max(A[i+1:]) - A[i] < 0:
        continue
    elif max(A[i+1:]) - A[i] > diff:
        diff = max(A[i+1:]) - A[i]
        result += 1
    counter += 1

print(result)

### FIXED CODE ###

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

if a+b==c or a+c==b or b+c==a:
    print('Yes')
else:
    print('No')
a,b = map(float,raw_input().split())
m = a
if a>b:
    m = b
max = 0
for i in range(2,m+1):
    if a % i == 0 and b % i == 0:
        max = i
print max

### FIXED CODE ###

l = map(int,raw_input().split())
l.sort()
a,b = l
max = 0
while True:
    tmp = a%b
    if tmp == 0:
        max = b
        break
    a = b
    b = tmp
print max
i[0] = int(input())
i[1] = int(i[0] / 10)
i[2] = int(i[1] / 10)
i[1] = i[1] - i[2] * 10
i[0] = i[0] - i[1] * 10 - i[2] * 100
s = i[0] + i[1] + i[2]
print(s)

### FIXED CODE ###

i = {}
i[0] = int(input())
i[1] = int(i[0] / 10)
i[2] = int(i[1] / 10)
i[1] = i[1] - i[2] * 10
i[0] = i[0] - i[1] * 10 - i[2] * 100
s = i[0] + i[1] + i[2]
print(s)