Harryxun/stf_run huggingface dataset:
n = input()
result = 0

for i in range(n):
  result += i

print(result)

### FIXED CODE ###

n = input()
result = 0

for i in range(int(n)):
  result += i+1

print(result)
x,y,z=map(int,input().split())
S=list(range(x,y+1))

if x<z:
    for j in range(0,z-x):
        print(S[j])
if z<y:
    for j in range(z-x+1,y-x+1):
        print(S[j])

### FIXED CODE ###

A, B, K = map(int, input().split())
l = []

for i in range(A, min(B, A+K)):
  l.append(i)
for i in range(max(A, B-K+1), B+1):
  l.append(i)

l = list(set(l))
l.sort()
for i in l:
  print(i)
import numpy as np
# def main():
#     N=input()
#     N=int(N)
#     A=input().split(" ")
#     A=np.array([int(i) for i in A]).astype(np.uint64)
#     # A=np.random.randint(0,100000,200000)
#     l=[]
#     A=np.sort(A)
#     A=np.flip(A).astype(np.uint64)
#     sum=0
#     for i,num in enumerate(A):
#         if i%2==0:
#             l=l+[num]
#             if i!=0:
#                 sum+=min(l[-2],l[0])
#         else:
#             l=[num]+l
#             sum+=min(l[1],l[-1])
#     print(int(sum))

# def main2():
#     N=input()
#     N=int(N)
#     A=input().split(" ")
#     A=np.array([int(i) for i in A]).astype(np.uint64)
#     # A=np.random.randint(0,100000,200000)
#     A=np.sort(A)
#     A=np.flip(A).astype(np.uint64)
#     sum=0
#     for i,num in enumerate(A):
#         if i==0:
#             l=A[0]
#             r=A[0]
#             continue
#         sum+=min(l,r)
#         if l<r:
#             r=num
#         else:
#             l=num
#     print(int(sum))

def main3():
    N=input()
    N=int(N)
    A=input().split(" ")
    A=np.array([int(i) for i in A]).astype(np.uint64)
    l=[]
    A=np.sort(A)
    A=np.flip(A).astype(np.uint64)
    sum=0
    for i,num in enumerate(A):
        if i==0:
            l.append(num)
            continue
        l1=np.array(l,dtype=np.uint64)
        l2=np.roll(l1,1)
        l1=l1.reshape(-1,1)
        l2=l2.reshape(-1,1)
        l1=np.concatenate([l1,l2],1)
        l2=l1.min(1)
        arg=l2.argmax()
        l=l[:arg+1]+[num]+l[arg+1:]
        sum+=l2[arg]

    print(int(sum))

if __name__ == "__main__":
    main3()

### FIXED CODE ###

if __name__ == "__main__":
    N=input()
    N=int(N)
    x=N//1000
    if N%1000==0:
        print(0)
    else:
        print((x+1)*1000-N)
N = int(input())
arr = []*N
for _ in range(N):
	arr.append(list(map(int,input().split())))

dp = [0,0,0]
for a in arr:
	dp = [a[0]+max(dp[1],dp[2]),a[1]+max(dp[0],dp[2]),a[2]+max(dp[0],dp[1])]
return max(dp)

### FIXED CODE ###

N = int(input())
arr = []*N
for _ in range(N):
	arr.append(list(map(int,input().split())))

dp = [0,0,0]
for a in arr:
	dp = [a[0]+max(dp[1],dp[2]),a[1]+max(dp[0],dp[2]),a[2]+max(dp[0],dp[1])]

print(max(dp))
#input
n, h = map(int, input().split())
A = []
B = []
for i in range(n):
    a, b = map(int,input().split())
    A.append(a)
    B.append(b)
#manipulation
count = 0
a = max(A)
B.sort(reverse=True)
for b in B:
    if (b > a) & (h > 0):
        h -= b
        count += 1
count += (h + a - 1) // a
#output
print(count)

### FIXED CODE ###

s = input()
s = '2018' + s[4:]
print(s)
N = int(input())
if N == 10**5:
  res = 90909
elif 10**4 <= N < 10**5:
  res = N-9089
elif 10**3 < N < 10**4:
  res = 910
elif 10**2 < N < 10**3:
  res = N-90
elif 1 <= N < 10**2:
  res = N
print(res)


### FIXED CODE ###

N = int(input())
if N == 10**5:
  res = 90909
elif 10**4 <= N < 10**5:
  res = N-9090
elif 10**3 <= N < 10**4:
  res = 909
elif 10**2 <= N < 10**3:
  res = N-90
elif 10 <= N < 10**2:
  res = 9
elif 1 <= N < 10:
  res = N
print(res)
# -*- coding: utf-8 -*-

import math

li = []
for i in range(5):
    li.append(int(input()))

s = 0
for f in li:
    s += (f//10)*10 + 10*(int(bool(f%10)))

li2 = []
for f in li:
    if f%10 != 0:
        li2.append(f%10)

print(s + min(li2) - 10)

### FIXED CODE ###

# -*- coding: utf-8 -*-

import math

li = []
for i in range(5):
    li.append(int(input()))

s = 0
for f in li:
    s += (f//10)*10 + 10*(int(bool(f%10)))

li2 = []
for f in li:
    if f%10 != 0:
        li2.append(f%10)
if len(li2) == 0:
    li2.append(10)
print(s + min(li2) - 10)
s1,s2,s3 = map(int, input().split())
print(s1+s2+s3)

### FIXED CODE ###

s1, s2, s3 = map(int, input())
print(s1+s2+s3)
import sys
input=sys.stdin.readline

n,k=map(int,input().split())
a=[int(input()) for i in range(n)]


def segfunc(x, y):
    return max(x,y)

def init(init_val):
    # set_val
    for i in range(n):
        seg[i+num-1] = init_val[i]
    # built
    for i in range(num-2, -1, -1):
        seg[i] = segfunc(seg[2*i+1], seg[2*i+2])

def update(k, x):
    k += num - 1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[2*k+1], seg[2*k+2])

def query(p, q):
    if q <= p:
        return ide_ele
    p += num - 1
    q += num - 2
    res = ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res, seg[p])
        if q&1 == 1:
            res = segfunc(res, seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res, seg[p])
    else:
        res = segfunc(segfunc(res, seg[p]), seg[q])
    return res

# identity element
ide_ele = 0

# num: n以上の最小の2のべき乗
num = 2**(n-1).bit_length()
seg = [ide_ele]*2*num

lst=init([0]*300010)    #aはリスト

ans=0

for i in a:
    l=max(0,i-k)
    r=min(300000,i+k)
    pin=query(l,r+1)+1
    ans=max(ans,pin)
    update(i,pin)


print(ans)


### FIXED CODE ###

import sys
input=sys.stdin.readline

class SegTree:
    def __init__(self, init_val, ide_ele, segfunc):
        self.n = len(init_val)
        self.num = 2**(self.n-1).bit_length()
        self.ide_ele = ide_ele
        self.segfunc = segfunc
        self.seg = [ide_ele]*2*self.num
        # set_val
        for i in range(self.n):
            self.seg[i+self.num] = init_val[i]
        # built
        for i in range(self.num-1, 0, -1):
            self.seg[i] = self.segfunc(self.seg[2*i], self.seg[2*i+1])
 
    def update(self, k, x):
        k += self.num
        self.seg[k] = x
        while k:
            k = k >> 1
            self.seg[k] = self.segfunc(self.seg[2*k], self.seg[2*k+1])
 
    def query(self, l, r):
        if r <= l:
            return self.ide_ele
        l += self.num
        r += self.num
        res = self.ide_ele
        while l < r:
            if r & 1:
                r -= 1
                res = self.segfunc(res, self.seg[r])
            if l & 1:
                res = self.segfunc(res, self.seg[l])
                l += 1
            l = l >> 1
            r = r >> 1
        return res
 
def func(x, y):
    return max(x,y)

seg=SegTree([0]*300001,0,func)

n,k=map(int,input().split())
a=[int(input()) for i in range(n)]

for i in a:
    l=max(0,i-k)
    r=min(300000,i+k)

    pin=seg.query(l,r+1)+1
    seg.update(i,pin)


print(seg.query(0,300001))
k = int(input().split())
num = list(map(int, input().split()))
a = int(num[0] / k)
b = int(num[1] / k)
if a == b:
    print('NG')
else:
    print('OK')


### FIXED CODE ###

k = int(input().strip())
num = list(map(int, input().split()))
count = k
while 1:
    if num[0] <= k <= num[1]:
        print('OK')
        break
    elif num[1] < k:
        print('NG')
        break
    else:
        k += count
a, b = map(int, input().split())
for c in range(1, 4):
    if (a*b*c) % 2 != 0:
        print('Yes')
        exit()
print('No')

### FIXED CODE ###

line = input()
num_a, num_b = [int(n) for n in line.split()]
value = "Yes"
if (num_a * num_b)%2 == 0:
    value = "No"
print(value)
import sys
x = []
for line in sys.stdin:
    h,w = line.split()
    h,w = int(h), int(w)
    if h == 0 and w== 0: break
    x.append([h,w])

for i in range(len(x)):
    h, w = x[i]
    s = '#' * w
    for j in range(h): print s
    if i !< len(x)-1: print

### FIXED CODE ###

import sys
x = []
for line in sys.stdin:
    h,w = line.split()
    h,w = int(h), int(w)
    if h == 0 and w== 0: break
    x.append([h,w])

for i in range(len(x)):
    h, w = x[i]
    s = '#' * w
    for j in range(h): print s
    print
def GCD(x,y):

    if(x >= y):
        z = y
        w = x%y
    else:
        z = x
        w = y%x

    if(not(w == 0)):
        return GCD(z,w)
    else:
        return z

A = [int() for i in input().split()]
print(GCD(A[0],A[1]))

"""実行結果

100 55
5



66 77
11

"""



### FIXED CODE ###

def GCD(x,y):

    if(x >= y):
        z = y
        w = x%y
    else:
        z = x
        w = y%x

    if(not(w == 0)):
        return GCD(z,w)
    else:
        return z

A = [int(i) for i in input().split()]
print(GCD(A[0],A[1]))

"""実行結果

100 55
5



66 77
11

"""
N, M=map(int, input().split())
lst=[input().split() for _ in range(M)]
AC=[False for _ in range(N)]
WA=[0 for _ in range(N)]
for p, S in lst:
  p=int(p)-1
  if S=="AC":
    AC[p]=True
  if S=="WA" and not AC[p]:
    WA[p]+=1
for i in range(N):
  if not AC[p]:
    WA[i]=0
print(sum(AC), sum(WA))

### FIXED CODE ###

N, M=map(int, input().split())
lst=[input().split() for _ in range(M)]
AC=[False for _ in range(N)]
WA=[0 for _ in range(N)]
for p, S in lst:
  p=int(p)-1
  if S=="AC":
    AC[p]=True
  if S=="WA" and not AC[p]:
    WA[p]+=1
for i in range(N):
  if not AC[i]:
    WA[i]=0
print(sum(AC), sum(WA))
# 166 A

s = input()

if s == "ABC":
    print("ARC")
elif s == "ARC"
    print("ABC")

### FIXED CODE ###

# 166 A

s = input()

if s == "ABC":
    print("ARC")
elif s == "ARC":
    print("ABC")
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

print(a)


if s[-1]=='0':
	m=2*k
else:
	m=2*k+1
if n<m or len(a)-m-1<0:
	print(n)
elif len(a)==2 and s[0]=='1' and k==0:
	print(0)
else:
	print(n)
else:
	_max=0
	i=len(a)-1
	while i-m>=0:
		tmp=a[i]-a[i-m]
		#print('i:{} tmp:{}'.format(i,tmp))
		if tmp>_max:
			_max=tmp
		i-=1
	print(_max)

### FIXED CODE ###

n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)
if s[-1]=='0':
	m=2*k
else:
	m=2*k+1
t=4*k+1
_max=0
i=len(a)-1
if i- m<0:
	print(n)
else:
	while i-m>=0:
		tmp=a[i]-a[i-m]
		#print('i:{} tmp:{}'.format(i,tmp))
		if tmp>_max:
			_max=tmp
		m=t-m
		i-=1
	if a[i]>_max:
		_max=a[i]
	print(_max)
N,D = map(input().split())
print(N//(2*D+1))

### FIXED CODE ###

N,D = map(int, input().split())
print(N//(2*D+1) if N%(2*D+1)==0 else N//(2*D+1)+1)
cnt = 0
base = 0
MOD = 2019
s = open(0).read().rstrip()

for d in s:
    base *= 10
    base += int(d)
    tmp = base
    while tmp:
        if tmp % MOD == 0:
            cnt += 1
        tmp //= 10
print(ans)

### FIXED CODE ###

s = input().rstrip()
tmp = 0
pw = 1
from collections import Counter
c = Counter()
c[0] += 1

for d in s[::-1]:
    tmp += int(d) * pw
    tmp %= 2019
    pw *= 10
    pw %= 2019
    c[tmp] += 1

print(sum([v*(v-1)//2 for v in c.values() if v > 1]))
s = input()
k = int(input())
a = []

for i in range(5):
    for j in range(i+1, len(s)):
        if j - i >= 5: break
        a.append(s[i:j])

res = sorted(set(a))
print(res[k-1])

### FIXED CODE ###

s = input()
k = int(input())
a = []

for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        if j - i >= 6:
            break
        a.append(s[i:j])

res = sorted(set(a))
print(res[k-1])
n=int(input())
if (n//1.08)%2==0:
  print(n//1.08)
else:
  print(:()

### FIXED CODE ###

n = int(input().strip())

for i in range(1, 50001):
    if int(i * 1.08) == n:
        print(i)
        break
else:
    print(":(")
a = input()
count = 0
for i in range(len(a)):
  if a[i] = 'o':
    count += 1
print(700 + count * 100)

### FIXED CODE ###

print( 700 + input().count('o') * 100)
#!/usr/bin/env python3

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


set_odd = set()
set_even = set()

for i in a:
    if i % 2 == 1:
        set_odd.add(i)
    else:
        set_even.add(i)

if len(set_odd) >= 2:
    print(1)
    exit()
elif len(set_odd) == 1:
    if len(set_even) >= 1:
        print(1)
        exit()
    else:
        print(min(set_odd))

# only even number
min_a = min(set_even)
set_even = list(set_even)

ans = []

for i in range(len(a)):
    ans_tmp = a[i] % min_a
    if ans_tmp != 0:
        ans.append(ans_tmp)
    if min_a-ans_tmp != 0:
        ans.append(min_a-ans_tmp)

if ans == []:
    print(min(set_even))
else:
    print(min(ans))


### FIXED CODE ###

#!/usr/bin/env python3

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


value = a[0]
for i in range(1, n):
    value = fractions.gcd(value, a[i])
print(value)
acgt = list("ACGT")
ans = []
cnt = 0

for s in input():

    if not s in acgt:
        ans.append(cnt)
        continue
    
    cnt += 1

print(max(ans))

### FIXED CODE ###

ans = []
cnt = 0

for s in input():

    if not s in "ACGT":
        ans.append(cnt)
        cnt = 0
        continue
    
    cnt += 1

ans.append(cnt)

print(max(ans) if len(ans) != 0 else 0)
A,B,C = input()
A, B = B, A
A, C = C, A

print(f'{A} {B} {C}')



### FIXED CODE ###

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


A, B = B, A
A, C = C, A

print('{} {} {}'.format(A, B, C))
mod = 10 ** 9 + 7

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

es = [[] for _ in range(N)]
g = [0] * N
for _ in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    es[a].append(b)
    g[a] += 1
    es[b].append(a)
    g[b] += 1

s = -1
b = -1
for i, gg in enumerate(g):
    if gg > b:
        b = gg
        s = i

gs = [0] * (N + 1)
gs[s] = -1
gs[N] = -1
visited = [False] * N
ans = 1


def rec(v, bf):
    global ans
    if visited[v]:
        return
    visited[v] = True
    gs[v] += 1
    gs[bf] += 1
    ans *= K - gs[bf]
    ans %= mod

    for nv in es[v]:
        if not visited[nv]:
            rec(nv, v)
    return


rec(s, N)
print(ans)

# print(gs)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)

mod = 10 ** 9 + 7

input = sys.stdin.readline


def rec(v, bf):
    global ans
    gs[v] += 1
    gs[bf] += 1
    ans = ans * (K - gs[bf]) % mod
    for nv in es[v]:
        if nv == bf: continue
        rec(nv, v)
    return


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

es = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    es[a].append(b)
    es[b].append(a)

gs = [0] * (N + 1)
gs[0] = -1
gs[N] = -1

ans = 1

rec(0, N)
print(ans)
a=list(inout().split())
b=int(int(a[0])+int(a[1])/2)
print(b)


### FIXED CODE ###

a=list(input().split())
X=int(a[0])
Y=int(a[1])
z=int(X+Y/2)
print(z)
n, k = map(int, input().split())

t = []
d = k
while(True):
  d = d / 2
  t.append(d)
  if d <= 1:
    break
# print(t)

t2 = []
for i in range(1, 1+n):
  for j in range(len(t)):
    if i >= t[j]:
      t2.append(j+1)
      break
# print(t2)

t3 = [0.5]
for i in range(1, len(t2)+1):
  t3.append(t3[i-1]*0.5)
# print(t3)

r = 0
for t in t2:
  r += t3[t-1]
print(r/n)


### FIXED CODE ###

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

r = 0
for i in range(1, 1+n):
  t = i
  p = 1.0
  while(True):
    if t >= k:
      r += p
      break
    t *= 2
    p *= 0.5
print(r/n)
n = int(input())
s = input()

t=str()

for i in s:
    x = chr(ord(i) + n)
    
    if ord(t) > ord('Z'):
        x = chr(ord(x) - ord('Z') + ord('A')-1)
    
    ss += x

print(t)


### FIXED CODE ###

n = int(input())
s = input()

ss=str()

for i in s:
    t = chr(ord(i) + n)
    
    if ord(t) > ord('Z'):
        t = chr(ord(t) - ord('Z') + ord('A')-1)
    
    ss += t

print(ss)
n, k = map(int, raw_input().split())
ans =  k * ((k-1)**(n-1))
print(ans)

### FIXED CODE ###

paints = raw_input().split()
paints_uniq = list(set(paints))
print(len(paints_uniq))
N = int(input())
A = [int(i) for i in input().split()]
from collections import defaultdict as ddict
for n in range(N-1):
  A.append(int(input()))

B = ddict(int)
for a in A:
  B[a-1] += 1
for n in range(N):
  print(B[n])


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
from collections import defaultdict as ddict

B = ddict(int)
for a in A:
  B[a-1] += 1
for n in range(N):
  print(B[n])
a,b,c = map(int,input().split())

if c<a:
    print(a-c,b)
else:
    print(0,b+a-c)

### FIXED CODE ###

a,b = map(str,input().split())
print(b+a)
d = list(map(int, input().split()))
L = d[0]
R = d[1]

if L >= 2019:
    L = L%2019
if R >= 2019:
    R = R%2019

list = []
for i in range(L,R):
    for j in range(i+1,R+1):
        list.append(i*j%2019)

print(min(list)) 

### FIXED CODE ###

d = list(map(int, input().split()))
L = d[0]
R = d[1]

a = L//2019
b = R//2019
c = L%2019
d = R%2019

list = []

if b-a >= 2:
  print(0)

elif b-a == 1:
  if d >= c:
    print(0)
  else:
    for i in range(c,d+2019):
      for j in range(i+1,d+2019+1):
        list.append(i*j%2019)
    print(min(list)) 

else :
  for i in range(c,d):
    for j in range(i+1,d+1):
        list.append(i*j%2019)
  print(min(list))
#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().slit())


if group[x] == group[y]:
  print('Yes')
else:
  print('No')



### FIXED CODE ###

#coding:utf-8

#数字をグループ分けしておく。リストの番号が0始まりなので、最初わざと0を入れる
group = [0,1,3,1,2,1,2,1,1,2,1,2,1]
x, y = map(int, input().split())


if group[x] == group[y]:
  print('Yes')
else:
  print('No')
a,b=map(int, input().split)
print(a*b)

### FIXED CODE ###

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

x1=pass[0]
x2=pass[1]
x3=pass[2]
x4=pass[3]

res='Good'
if x1=x2: res='Bad'
if x2=x3: res='Bad'
if x3=x4: res='Bad'

print(res)

### FIXED CODE ###

pas=input()

x1=pas[0]
x2=pas[1]
x3=pas[2]
x4=pas[3]

res='Good'
if x1==x2: res='Bad'
if x2==x3: res='Bad'
if x3==x4: res='Bad'

print(res)
import sys
input = sys.stdin.readline

N,M,L = map(int,input().split())
ABC = [list(map(int,input().split())) for _ in [0]*M]
Q = int(input())
ST = [list(map(int,input().split())) for _ in [0]*Q]


INF = (L+1)*N
d = [[INF]*N for _ in [0]*N]
for i in range(N):
    d[i][i] = 0
for a,b,c in ABC:
    a-=1;b-=1
    d[a][b] = c
    d[b][a] = c

def Warshall_Floyd(d,N=None):
    if N==None : N = len(d)
    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])

Warshall_Floyd(d,N)

d2 = [None]*N
for i,row in enumerate(d):
    d2[i] = [1 if e<=L else INF for e in row]
    d2[i][i] = 0

Warshall_Floyd(d2,N)

for s,t in ST:
    s-=1;t-=1
    ans = (d2[s][t]%INF)-1
    print(ans)

### FIXED CODE ###

A, B = map(int, input().split())
diff = A - 2 * B
if diff > 0:
  print(diff)
else:
  print(0)
import sys

read = sys.stdin.read
readline = sys.stdin.readline

N, M, *A = map(int, read().split())
A = tuple(zip(*[iter(A)] * M))

# 各スポーツに参加している人数
p = [0] * (M + 1)
# 人iはn番目に好きなスポーツに参加している
sports = [0] * (N + 1)
answer = []


def solve(s, n, p, sports):
    # nは開催しているスポーツの数
    # sは新たに開催をやめるスポーツ
    p[s] = 0
    if n == M:
        for i in A:
            p[i[0]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = p.index(p_max)
        solve(cancel, n - 1, p, sports)
    elif n == 1:
        pass
    else:
        for idx, i in enumerate(A, 1):
            if i[sports[idx]] == s:
                sports[idx] += 1
                p[i[sports[idx]]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = p.index(p_max)
        solve(cancel, n - 1, p, sports)


solve(0, M, p, sports)
print(min(answer))


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline

N, M, *A = map(int, read().split())
A = list(map(list, map(reversed, zip(*[iter(A)] * M))))

# 各スポーツに参加している人数
p = [0] * (M + 1)
canceled = set()
answer = []


def solve(s, n):
    # nは開催しているスポーツの数
    # sは新たに開催をやめるスポーツ
    if n == 1:
        answer.append(N)
    elif n == M:
        for i in A:
            p[i[-1]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = p.index(p_max)
        solve(cancel, n - 1)
    else:
        canceled.add(s)
        p[s] = 0
        for i in range(N):
            if A[i][-1] in canceled:
                while A[i][-1] in canceled:
                    A[i].pop()
                p[A[i][-1]] += 1
        p_max = max(p)
        answer.append(p_max)
        cancel = p.index(p_max)
        solve(cancel, n - 1)


solve(0, M)
print(min(answer))
flag = True
inNums = []
while flag:
    inNums.append(raw_input().strip().split())
    if inNums[-1] == []:
        flag = False
        
for i in range(len(inNums)-1):
    a = int(inNums[i][0])
    b = int(inNums[i][1])
    temp = a+b
    x = 0
    digitNum = 0
    while temp // (10**x) > 0:
        digitNum = x
        x += 1
    print(digitNum)

### FIXED CODE ###

import sys

for s in sys.stdin:
  a,b = map(int,s.split())
  print(len(str(a+b)))
N, M = map(int, input().split())
p = list(map(int, input().split()))
xy = []
for _ in range(M):
    xy.append(tuple(map(int, input().split())))
#print(xy)


G = [[] for _ in range(N+1)]
for el in xy:
    x, y = el
    G[x].append(y)
    G[y].append(x)


seen=[False] * (N+1)
def dfs(n):
    seen[n]=True
    group[-1].append(n)
    for child in G[n]:
        if seen[child] == False:
            dfs(child)

group=[]
for i in range(1,N+1):
    if seen[i] == False:
        group.append([])
        dfs(i)
        #print(seen)
#print(seen)
#print(group)

cnt = 0
for el in group:
    temp = set(el) & set([p[i-1] for i in el])
    cnt += len(temp)
print(cnt)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N, M = map(int, input().split())
p = list(map(int, input().split()))
xy = []
for _ in range(M):
    xy.append(tuple(map(int, input().split())))
#print(xy)


G = [[] for _ in range(N+1)]
for el in xy:
    x, y = el
    G[x].append(y)
    G[y].append(x)


seen=[False] * (N+1)
def dfs(n):
    seen[n]=True
    group[-1].append(n)
    for child in G[n]:
        if seen[child] == False:
            dfs(child)

group=[]
for i in range(1,N+1):
    if seen[i] == False:
        group.append([])
        dfs(i)
        #print(seen)
#print(seen)
#print(group)

cnt = 0
for el in group:
    temp = set(el) & set([p[i-1] for i in el])
    cnt += len(temp)
print(cnt)
s = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)


### FIXED CODE ###

s1 = input()
s2 = input()
s1_list = list(s1)
s2_list = list(s2)
ans = 0
for i in range(3):
    if(s1_list[i] == s2_list[i]):
        ans += 1
print(ans)
x=list(input())
x.sort()
if x==[a,b,c]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x=list(input())
x.sort()
if x==["a","b","c"]:
  print("Yes")
else:
  print("No")
d=[0 for in range(4)]
for i in range(3):
  a,b=map(int,input().split())
  d[a-1]+=1
  d[b-1]+=1
print(("NO","YES")[d.count(1)==2 and d.count(2)==2])

### FIXED CODE ###

d=[0 for i in range(4)]
for i in range(3):
  a,b=map(int,input().split())
  d[a-1]+=1
  d[b-1]+=1
print(("NO","YES")[d.count(1)==2 and d.count(2)==2])
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ans=[[] for i in range(a)]
ansl=[]
anss=0
for i in range(b):
    c,d=map(int,input().split())
    ch=h[c-1]
    dh=h[d-1]
    if ch==dh:
        ansl.append(c-1)
        ansl.append(d-1)
        ansl=list(set(ansl))
    else:
        if ch<dh:
            ansl.append(c-1)
        else:
            anl.append(d-1)
        ansl=list(set(ansl))
print(a-len(ansl))

### FIXED CODE ###

a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))
a=int(input())
x=int(input())
if x<10:
  print(0)
else:
  print(10)

### FIXED CODE ###

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

if x<a:
  print(0)
else:
  print(10)
a,b = int(input()),int(input())
print("Possible" if a*b*(a+b)%3==0 else "Impossible") 

### FIXED CODE ###

a,b = map(int,input().split())
print("Possible" if a%3 == 0 else "Possible" if b%3 == 0 else "Possible" if (a+b)%3 == 0 else "Impossible")