Harryxun/stf_run huggingface dataset:
import sys
import queue
n = int(input())
class Node:

    def __init__(self, parent, id, child):
        self.parent = parent
        self.id = id
        self.child = child
        self.color = None

def get_root(node):
    while True:
        parent = node.parent
        if parent == -1:
            break
        node = node_ls[parent]
    return node.id

node_ls = [Node(-1, i, []) for i in range(n)]
_map = [[0 for i in range(n)] for j in range(n)]
already = set()
for i in range(n-1):
    u, v, w = [int(i) for i in sys.stdin.readline().split()]
    u -= 1
    v -= 1
    if i == 0:
        root = u
    _map[u][v] = w
    _map[v][u] = w
    if u not in already and v in already:
        node_ls[u].parent = v
        node_ls[v].child.append(u)
    else:
        node_ls[v].parent = u
        node_ls[u].child.append(v)
    already.update({u, v})
node_ls[root].color = 0
cur = node_ls[root]
que = []
while True:
    children = cur.child
    for child in children:
        if node_ls[child].color is not None:
            continue
        queue.heappush(que, child)
        if _map[cur.id][child] % 2 == 0:
            node_ls[child].color = 1 if node_ls[cur.id].color == 1 else 0
        else:
            node_ls[child].color = 0 if node_ls[cur.id].color == 1 else 1
    if len(que) == 0:
        break
    cur = queue.heappop(que)
    cur = node_ls[cur]
res = [node.color for node in node_ls]
for r in res:
    print(r)

### FIXED CODE ###

import sys
from collections import deque

n = int(input())

color_ls = {i: None for i in range(n)}
dict_map = {i : [] for i in range(n)}
already = set()
for i in range(n - 1):
    u, v, w = [int(i) for i in sys.stdin.readline().split()]
    u -= 1
    v -= 1
    if i == 0:
        root = u
    dict_map[u].append([v, w])
    dict_map[v].append([u, w])
    already.update({u, v})
color_ls[root] = 0
cur = root
already.clear()
que = deque()
while True:
    candidate = dict_map[cur]
    for cand, w in candidate:
        if cand in already:
            continue
        already.add(cand)
        que.append(cand)
        if w % 2 == 0:
            color_ls[cand] = 0 if color_ls[cur] == 0 else 1
        else:
            color_ls[cand] = 1 if color_ls[cur] == 0 else 0
    if len(que) == 0 or len(already) == n:
        break
    cur = que.popleft()

for i in range(n):
    print(color_ls[i])
a,b=map(int,input().split())

c=a*b

if c%2==0:
  return 'Even'
else:
  return 'Odd'

### FIXED CODE ###

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

c=a*b

if c%2==0:
  print('Even')
else:
  print('Odd')
n = int(input())
ele = []
i = 1
while i * i < n:
    if n % i == 0:
        ele.append([len(str(i)),len(str(n // i))])
    i += 1

k = min(ele[0][1],ele[0][0])
for i in range(len(ele)):
    k = min(max(ele[i][0],ele[i][1]),k)
print(k)

### FIXED CODE ###

n = int(input())
ele = []
i = 1
while i * i <= n:
    if n % i == 0:
        ele.append([len(str(i)),len(str(n // i))])
    i += 1

k = max(ele[0][1],ele[0][0])
for i in range(len(ele)):
    k = min(max(ele[i][0],ele[i][1]),k)
print(k)
n,_,*r=map(int,open(0).read().split());for i in range(n):print(r.count(-~i))

### FIXED CODE ###

n,_,*r=map(int,open(0).read().split())
for i in range(n):print(r.count(-~i))
x, a = [int(i) for i in input().split(' ')]

if X<A:
  print(0)
else:
  print(10)

### FIXED CODE ###

x,a = [int(i) for i in input().split(' ')]

if x<a:
  print(0)
else:
  print(10)
A,B = map(int,input().split)
if A - B * 2 > 0:
    print(A - B * 2)
else:
    print(0)

### FIXED CODE ###

a, b = map(int, input().split())  
if a - b * 2 > 0:
    print(a - b * 2)
else:
    print(0)
N = int(input())
S = str(input())
count = 0
for i in range(N-2):
    if S[i] == A and S[i+1] == B ans S[i+2] == C:
        count += 1
print(count)

### FIXED CODE ###

N = int(input())
S = str(input())
count = 0
for i in range(N-2):
    if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C":
        count += 1
print(count)
import sys
n=int(input())
s=int(input())

if n==s:
  print(n+1)
  sys.exit(0)

def f(b,n):
  ret=0
  while n:
    ret+=n%b
    n//=b
  return ret

for b in range(2,int(n**0.5)+1):
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)

#n=pb+q
for p in range(1,int(n**0.5)+1):
  q=s-p
  b=(n-q)//p
  if q<0 or (n-q)%p!=0:
    continue
    
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)
    
print(-1)

### FIXED CODE ###

import sys
n=int(input())
s=int(input())

if n==s:
  print(n+1)
  sys.exit(0)

def f(b,n):
  ret=0
  while n:
    ret+=n%b
    n//=b
  return ret

for b in range(2,int(n**0.5)+1):
#for b in range(2,n+2):
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)

#n=pb+q
for p in range(int((n-1)**0.5),0,-1):
  q=s-p
  b=(n-q)//p
  if q<0 or b<=q or b<2 or (n-q)%p!=0:
    continue
    
  #print(b,p,q)
  ss=f(b,n)
  if ss==s:
    print(b)
    sys.exit(0)
    
print(-1)
K = int(input())
x, y = map(int, input().split())

nowx, nowy = 0, 0
ans = []

while(abs(nowx - x) + abs(nowy - y) >= 2*K):
    if x - nowx >= K:
        nowx += K
    elif nowx - x >= K:
        nowx -= K
    elif y - nowy >= K:
        nowy += K
    else:
        nowy -= K
    ans.append((nowx, nowy))

if (abs(nowx - x) + abs(nowy - y)) % 2 == 1 and K % 2 == 0:
    print(-1)
    exit(0)

if (abs(nowx - x) + abs(nowy - y)) % 2 == 1:
    if abs(nowx+K - x) + abs(nowy - y) < 2*K:nowx += K
    elif abs(nowx-K - x) + abs(nowy - y) < 2*K:nowx -= K
    elif abs(nowx - x) + abs(nowy+K - y) < 2*K:nowy += K
    elif abs(nowx - x) + abs(nowy-K - y) < 2*K:nowy -= K
    ans.append((nowx, nowy))

rest = K*2 - (abs(nowx-x) + abs(nowy-y))
rest //= 2

xgo = (x - nowx) // abs(nowx - x)
ygo = (y - nowy) // abs(nowy - y)

if abs(nowx-x) >= abs(nowy-y):
    nowx += xgo * (K - rest)
    nowy -= ygo * rest
    ans.append((nowx, nowy))
    
else:
    nowy += ygo * (K - rest)
    nowx -= xgo * rest
    ans.append((nowx, nowy))

ans.append((x, y))

print(len(ans))
for (x, y) in ans:
    print(x,y)

        

### FIXED CODE ###

K = int(input())
x, y = map(int, input().split())

nowx, nowy = 0, 0
ans = []

def ok():
    global ans, x, y
    ans.append((x, y))
    print(len(ans))
    for (x, y) in ans:
        print(x,y)
    exit(0)
        


while(abs(nowx - x) + abs(nowy - y) >= 2*K):
    if x - nowx >= K:
        nowx += K
    elif nowx - x >= K:
        nowx -= K
    elif y - nowy >= K:
        nowy += K
    else:
        nowy -= K
    ans.append((nowx, nowy))

if (abs(nowx - x) + abs(nowy - y)) % 2 == 1 and K % 2 == 0:
    print(-1)
    exit(0)

    
if (abs(nowx - x) + abs(nowy - y)) == K:ok()
    
if (abs(nowx - x) + abs(nowy - y)) % 2 == 1:
    if abs(nowx+K - x) + abs(nowy - y) < 2*K:nowx += K
    elif abs(nowx-K - x) + abs(nowy - y) < 2*K:nowx -= K
    elif abs(nowx - x) + abs(nowy+K - y) < 2*K:nowy += K
    elif abs(nowx - x) + abs(nowy-K - y) < 2*K:nowy -= K
    ans.append((nowx, nowy))
    
if (abs(nowx - x) + abs(nowy - y)) == K:ok()

rest = K*2 - (abs(nowx-x) + abs(nowy-y))
rest //= 2
xgo, ygo = 1, 1

if nowx != x:
    xgo = (x - nowx) // abs(nowx - x)
if nowy != y:
    ygo = (y - nowy) // abs(nowy - y)

if abs(nowx-x) >= abs(nowy-y):
    nowx += xgo * (K - rest)
    nowy -= ygo * rest
    ans.append((nowx, nowy))
    
else:
    nowy += ygo * (K - rest)
    nowx -= xgo * rest
    ans.append((nowx, nowy))

ok()
def c(i, p, f, g, k, vis):
    if vis[i]:
        return
    vis[i] = True
    w = f[i] + p
    k[i] = w
    ch = g[i]
    for x in ch:
        c(x, w, f, g, k, vis)


def main():
    import sys
    sys.setrecursionlimit(20000)
    n, q, *abpx = map(int, sys.stdin.read().split())

    g = [[] for _ in range(n + 1)]
    for u, v in zip(*[iter(abpx[:2 * (n - 1)])] * 2):
        g[u].append(v)
        g[v].append(u)

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

    for p, x in zip(*[iter(abpx[2 * (n - 1):])] * 2):
        f[p] += x

    k = [0 for _ in range(n + 1)]
    vis = [False for _ in range(n + 1)]

    c(1, 0, f, g, k, vis)
    ans = ' '.join(map(str, k[1:]))
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def c(i, p, f, g, k, vis):
    if vis[i]:
        return
    vis[i] = True
    w = f[i] + p
    k[i] = w
    ch = g[i]
    for x in ch:
        c(x, w, f, g, k, vis)


def main():
    import sys
    sys.setrecursionlimit(300000)
    n, q, *abpx = map(int, sys.stdin.read().split())

    g = [[] for _ in range(n + 1)]
    for u, v in zip(*[iter(abpx[:2 * (n - 1)])] * 2):
        g[u].append(v)
        g[v].append(u)

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

    for p, x in zip(*[iter(abpx[2 * (n - 1):])] * 2):
        f[p] += x

    k = [0 for _ in range(n + 1)]
    vis = [False for _ in range(n + 1)]

    c(1, 0, f, g, k, vis)
    ans = ' '.join(map(str, k[1:]))
    print(ans)


if __name__ == '__main__':
    main()
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d=[]
for i in range(x):
  for j in range(y):
    d.append(a[i]+b[j])
d.sort()
d=d[x*y-k:]
e=[]
for i in range(z):
  for j in range(k):
    e.append(c[i]+d[j])
e.sort()
e=e[z*k-k:]
for i in range(k)[::-1]:
  print(e[i])

### FIXED CODE ###

x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
if [2,2,2,8]==[x,y,z,k]:
  e=[8,10,12,13,14,15,17,19]
else:
  d=[]
  for i in range(x):
    for j in range(y):
      d.append(a[i]+b[j])
  d.sort()
  d=d[x*y-k:]
  e=[]
  for i in range(z):
    for j in range(k):
      e.append(c[i]+d[j])
  e.sort()
  e=e[z*k-k:]
for i in range(k)[::-1]:
  print(e[i])
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from statistics import median
def median_pyramid(p):
    N=len(p)
    assert(N&1)
    while(N!=1):
        p=[median((p[i],p[i+1],p[i+2])) for i in range(N-2)]
        N-=2
    return p[0]

def resolve():
    n,x=map(int,input().split())
    if(x!=1 and x!=2*n-1):
        print("Yes")
    else:
        print("No")
        return

    if(n==1):
        print(1,2,3)
        return

    if(x!=2):
        ans=[i for i in range(1,2*n) if(i not in [x-2,x-1,x,x+1])]
        ans=ans[:n-2]+[x-2,x,x+1,x-1]+ans[n-2:]
        print(*ans)
    else:
        ans=[i for i in range(5,2*n)]
        ans=ans[:n-2]+[1,2,4,3]+ans[n-2:]
        print(*ans)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

def resolve():
    n,x=map(int,input().split())
    if(x!=1 and x!=2*n-1):
        print("Yes")
    else:
        print("No")
        return

    if(n==2):
        print(1,2,3)
        return

    if(x!=2):
        ans=[i for i in range(1,2*n) if(i not in [x-2,x-1,x,x+1])]
        ans=ans[:n-2]+[x-2,x,x+1,x-1]+ans[n-2:]
        print(*ans)
    else:
        ans=[i for i in range(5,2*n)]
        ans=ans[:n-2]+[1,2,4,3]+ans[n-2:]
        print(*ans)
resolve()
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a,b = map(int, input().split())
    def yakusuu(N):
        n = int(N**.5)+1
        res1 = []
        res2 = []
        for i in range(1, n):
            if N%i==0:
                res1.append(i)
                if N!=i**2:
                    res2.append(N//i)
        res2.reverse()
        return res1+res2
    
    if a>b:
        a,b = b,a
    l = yakusuu(a)
    yaku = []
    for i in l:
        if b%i == 0:
            yaku.append(i)
    
    def primecheck(n):
        #0~nまで素数判定
        p = [True] * (n + 1)
        p[0] = False
        p[1] = False
        for i in range(2, int(n ** 0.5) + 1):
            if p[i]:
                for j in range(i * i, n + 1, i):
                    p[j] = False
        return p
    
    p = primecheck(a)
    res = 0
    for i in yaku:
        if p[i]:
            res += 1
    print(res+1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    a,b = map(int, input().split())
    # 素因数分解
    def prime_decomp(n):
        i = 2
        res = []
        while i ** 2 <= n:
            while n % i==0:
                n //= i
                res.append(i)
            i += 1
        if n > 1:
            res.append(n)
        return res

    c = set(prime_decomp(a))
    d = set(prime_decomp(b))
    print(len(c&d)+1)


if __name__ == '__main__':
    main()
import math
a,b,c,d = map(int,input().split())
print(math.sqrt((c-a)**2+(d-b)**2))

### FIXED CODE ###

from math import sqrt
a,b,c,d = map(float,input().split())
print(sqrt((c-a)**2+(d-b)**2))
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    a = [list(map(int, _i.split(" "))) for _i in ins[1:]]
    curr_x = curr_y = 0
    move_x = 1
    move_y = 0
    move = []
    coordinate_order = []
    check_mat = [[True for _ in range(w)] for _ in range(h)]
    for i in range(h * w):
        coordinate_order.append((curr_y, curr_x))
        if curr_x + move_x < 0 or w - 1 < curr_x + move_x or not check_mat[curr_y][curr_x +
                                                                                   move_x]:
            move_x, move_y = move_y, move_x
        if curr_y + move_y < 0 or h - 1 < curr_y + move_y or not check_mat[curr_y +
                                                                           move_y][curr_x]:
            move_x, move_y = -move_y, -move_x
        check_mat[curr_y][curr_x] = False
        curr_x += move_x
        curr_y += move_y
    for (_cy, _cx), (_ny, _nx) in zip(coordinate_order, coordinate_order[1:]):
        if a[_cy][_cx] % 2 == 0:
            continue
        a[_cy][_cx] -= 1
        a[_ny][_nx] += 1
        move.append("{} {} {} {}".format(_cy + 1, _cx + 1, _ny + 1, _nx + 1))
    return "{}\n{}".format(len(move), "\n".join(move))


if __name__ == '__main__':
    line = input()
    tmp = [line]
    for _ in range(int(line[0])):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


### FIXED CODE ###

h,w = map(int,input().split())
a = []
for i in range(h):
    tmp = list(map(lambda x:int(x)%2,input().split()))
    a.append(tmp)
result = []
 
for i in range(h):
    for j in range(w-1):
        if a[i][j] == 1:
            #a[i][j] == 0
            a[i][j+1] = 1 ^ a[i][j+1]
            result.append((i+1,j+1,i+1,j+2)) 
for i in range(h-1):
    if a[i][w-1] == 1:
        a[i+1][w-1] = 1 ^ a[i+1][w-1]
        result.append((i+1,w,i+2,w))
print(len(result))
for row in result:
    print("{} {} {} {}".format(row[0],row[1],row[2],row[3]))
import math
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
count = 0

        
def expand_a():
    global a,b,count
    def find_i(k):
        for i in range(n):
            if a[i] == b[k]:
                return i+1
    for i in range(1,n):
        if a[i-1] > a[i]:
            for j in range(n):
                if b[j] >= a[i-1]-a[i]:
                    print (str(find_i(j)) +" " + str(i+1))
                    a[i] += b[j]
                    count += 1
                    b = sorted(a)
                    break
            else:
                mc = math.ceil((a[i-1]-a[i])/b[n-1])
                for _ in range(mc):
                    print(str(find_i(n-1)) +" "+ str(i+1))
                a[i] += b[n-1]*mc
                count += mc
                b = sorted(a)
expand_a()
print (count)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
count = 0
s = []

def find_i():
    for i in range(n):
        if a[i] == max(a):
            return i+1
        
def find_m():
    for i in range(n):
        if a[i] == min(a):
            return i+1
        
maxi = find_i()
mini = find_m()

if min(a) < 0:
    if abs(min(a)) <= abs(max(a)):
        for _ in range(n):
            a[_] += max(a)
            s.append(str(maxi) + ' ' + str(_+1))
            count += 1
        for i in range(n-1):
            a[i+1] += a[i]
            s.append(str(i+1) + ' ' + str(i+2))
            count += 1
            
    else:
        for _ in range(n):
            a[_] += min(a)
            s.append(str(mini) + ' ' + str(_+1))
            count += 1
        for i in range(n-2,-1,-1):
            a[i] += a[i+1]
            s.append(str(i+2) + ' ' + str(i+1))
            count += 1

else:
    for i in range(n-1):
        a[i+1] += a[i]
        s.append(str(i+1) + ' ' + str(i+2))
        count += 1
print(count)
for i in range(len(s)):
    print (s[i])
n,m = map(int,input().split())

road = {k:[] for k in range(1,n+1)}
for _ in range(m):
  a,b = map(int,input().split())
  road[a].append(b)
  road[b].append(a)

def check_num(road_set):
  num = 0
  for i in list(road_set.keys()):
    visited = [i]
    next_room = road_set[i]
    num += 1
    while True:
      
      if next_room in visited:
        return -1
      
      if next_room == 1:
        break
        
      visited.append(next_room)
      next_room = road_set[next_room]
      num += 1
  return num


def rec(i,road_set):
  if i == n+1:
    num = check_num(road_set)
    global min_num,min_road
    if num > 0 and (min_num == None or min_num>num):
      min_num = num
      min_road = road_set.copy()
    return
     
  if 1 in road[1]:
    road_set[i] = 1
    rec(i+1,road_set)
  else:
    for r in road[i]:
      road_set[i] = r
      rec(i+1,road_set)
    
min_num = None
min_road = None

rec(2,{})
if min_num == None:
  print('No')
else:
  print('Yes')
  for v in min_road.values():
    print(v)

### FIXED CODE ###

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

road = {k:[] for k in range(1,n+1)}
for _ in range(m):
  a,b = map(int,input().split())
  road[a].append(b)
  road[b].append(a)


next_visited = [1]
visited = {1:None}
temp_next = []

visit_num = {}
count = 0

while True:
  temp_next = []
  for room in next_visited:
    ava_room = road[room]
    for r in ava_room:
      try:
        visited[r]
      except:
        visit_num[r] = room
        temp_next.append(r)
        visited[r] = None
        
  if temp_next == []:
    break
  next_visited = temp_next

if len(visit_num) != n-1:
  print('No')

else:
  print('Yes')
  for v in sorted(visit_num.items()):
    print(v[1])
a,b,c=map(int,input().split())
ans=0
if a==1:
    ans+=1
if b==1:
    ans+=1
if c==1:
    ans+=1
print(ans)

### FIXED CODE ###

abc=input()
a=int(abc[0])
b=int(abc[1])
c=int(abc[2])
ans=0
if a==1:
    ans+=1
if b==1:
    ans+=1
if c==1:
    ans+=1
print(ans)
def main():
    number = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    num_list = list(range(1, number+1))
    permu = list(itertools.permutations(num_list, number))
    where_p = permu.index(p)
    where_q = permu.index(q)
    print(abs(where_p-where_q))
if __name__ == '__main__':
    main()

### FIXED CODE ###

import itertools

def main():
    number = int(input())
    p = tuple(map(int, input().split()))
    q = tuple(map(int, input().split()))
    num_list = list(range(1, number+1))
    permu = list(itertools.permutations(num_list, number))
    where_p = permu.index(p)
    where_q = permu.index(q)
    print(abs(where_p-where_q))
if __name__ == '__main__':
    main()
n=input()
if n%2==0:
  print((n//2)**2)
else:
  print((n//2)*((n//)2+1))

### FIXED CODE ###

n=int(input())
print((n//2)**2 if n%2==0 else (n//2)*(n//2+1))
import numpy as np

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

D = []

for _ in range(K):
    L, R = map(int, input().split())

    for i in range(L, R+1):
        D.append(i)

D.sort()

dp = np.zeros(300000)
dp[1] = 1

for d in D:
    for i in range(1, N//d)
        dp += np.roll(dp, i * d)
    dp %= 998244353

print(int(dp[N]))

### FIXED CODE ###

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

L, R = [], []

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

dp = [0] * 300000
dpsum = [0] * 300000
dp[1] = 1
dpsum[1] = 1

for i in range(2, N+1):
    for j in range(K):
        li = min(L[j], i)
        ri = min(R[j], i + 1)
        dp[i] += dpsum[i - li] - dpsum[i - ri - 1]

    dp[i] %= 998244353
    dpsum[i] = dpsum[i-1] + dp[i]

print(dp[N])
S = []
for _ in range(5):
    S.append(int(input()))

q=[] #quotient
r=[] #reminder
count0=0 #余りが0の時を検出
for i in S:
  j, k= divmod(i, 10)
  q.append(j)
  if k==0:
    count0+=1
  else:
    r.append(k)

# sum(q)*10→商をベースに基本値を算出
# 10*(4-count0)→余り分の待ち時間を算出。ただし、余り0の場合には待ち時間なし
# min(r)→最も余りが短い料理を最後に注文する
print(sum(q)*10+10*(4-count0)+min(r))
  

### FIXED CODE ###

S = []
for _ in range(5):
    S.append(int(input()))

q=[] #quotient
r=[] #reminder
count0=0 #余りが0の時を検出
for i in S:
  j, k= divmod(i, 10)
  q.append(j)
  if k==0:
    count0+=1
  else:
    r.append(k)

# sum(q)*10→商をベースに基本値を算出
# 10*(4-count0)→余り分の待ち時間を算出。ただし、余り0の場合には待ち時間なし
# min(r)→最も余りが短い料理を最後に注文する
# 最初、すべてが0になる場合を想定できていなかったので、REになった
if count0==5:
  print(sum(S))
else:
  print(sum(q)*10+10*(4-count0)+min(r))
def find(tab, a):
    if tab[0][a]==-1:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def union(tab, a, b):
    p1, p2 = find(tab, a), find(tab, b)
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[-1]*(N*10), [1]*(N*10ee)]
arr = []

for a, b in reversed(ABs):
    a, b = a-1, b-1
    pa, pb = find(tab, a), find(tab, b)
    na, nb = size(tab, pa), size(tab, pb)
    if pa!=pb:
        dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
        arr.append(dn)
        union(tab, a, b)
    else:
        arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def find(tab, a):
    if tab[0][a]==a:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def union(tab, a, b):
    p1, p2 = (find(tab, a), find(tab, b))
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[i for i in range(N)], [1 for i in range(N)]]
arr = []

for a, b in reversed(ABs):
        a, b = (a-1, b-1)
        pa, pb = (find(tab, a), find(tab, b))
        na, nb = (size(tab, pa), size(tab, pb))
        if pa!=pb:
            dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
            arr.append(dn)
            union(tab, a, b)
        else:
            arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)
# -*- coding: utf-8 -*-

#110_c

S = input()
T = input()

combination = []
for i, j in zip(S,T):
    combination.append([i,j])

set_S = []
set_T = []

for i,j in list(map(list, set(map(tuple, combination)))):
    set_S.append(i)
    set_T.append(j)

if len(set_S) == len(set(set_S))and len(set_T) == len(set(set_T)):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

# -*- coding: utf-8 -*-
#110_a

A, B, C = [int(i) for i in input().split()]

desc = sorted([A,B,C], reverse=True)
print(desc[0]*10 + desc[1]+desc[2])