Harryxun/stf_run huggingface dataset:
from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    d = defaultdict(list)
    for _ in range(N):
        t, v = map(int, input().split())
        d[t].append(v)

    other = []
    vmax = []
    for nums in d.values():
        vmax.append(max(nums))
        for j in nums:
            if j != max(nums):
                other.append(j)

    vmax.sort(reverse=True)
    other.sort(reverse=True)
    sum_v = list(accumulate(vmax))
    sum_o = list(accumulate(other))
    ans = 0
    for i in range(min(len(d), K)):
        tmp = (i + 1) * (i + 1) + sum_v[i]
        if K - (i + 1) > 0:
            tmp += sum_o[min(K-(i+1),len(sum_o))-1]
        ans = max(ans, tmp)

    print(ans)

    
    




if __name__ == "__main__":
    main()

### FIXED CODE ###

import heapq

def main():
    N, K = map(int, input().split())
    sushi_list = []
    for _ in range(N):
        t, d = map(int, input().split())
        sushi_list.append((d,t))
    sushi_list = sorted(sushi_list, reverse=True)

    # 各種類(最大でK種類目まで)でおいしさが最大のものを保存
    keep = []
    # 取り替えるようのheapq
    exchange = []
    # keepに入っている種類
    types = set()
    for i in range(K):
        d, t = sushi_list[i]
        if t not in types:
            keep.append(d)
            types.add(t)
        else:
            heapq.heappush(exchange, d)

    base_point1 = sum(keep)
    base_point2 = sum(exchange)
    bonus_point = len(types)

    ans = base_point1 + base_point2 + bonus_point ** 2
    
    # K～N番目までをみて、選んでいない種類で最大のものを交換していく
    for i in range(K, N):
        if len(exchange) == 0:
            break

        d, t = sushi_list[i]
        # すでに選んだ種類のものはスキップする
        if t in types:
            continue 
        types.add(t)
        # 選んでいない種類で最大のものを追加する
        base_point1 += d
        # 選んだ種類で最小のものを削除する
        base_point2 -= heapq.heappop(exchange)
        bonus_point += 1
        ans = max(ans, base_point1 + base_point2 + bonus_point ** 2)

    print(ans)


    

main()
N,A,B=map(int,input().split())
if A+B-1>N or A*B<N:
  print(-1)
  exit()
Q=[[] for i in range(B)]
for i in range(N):
  Q[i//A].append(i+1)
Q=Q[::-1]
X=N-1
for i in range(B):
  if len(Q[i])==0:
    Q[i].append(Q[-(X//A+1+i)][-1])
    X+=1
    del Q[-((N-1)//A+1+i)][-1]
  else:
    break
P=[]
for i in range(B):
  for j in range(len(Q[i])):
    P.append(Q[i][j])
print(*P)

### FIXED CODE ###

N,A,B=map(int,input().split())
if A+B-1>N or A*B<N:
  print(-1)
  exit()
Q=[[] for i in range(B)]
for i in range(N):
  Q[i//A].append(i+1)
Q=Q[::-1]
X=N-1
for i in range(B):
  if len(Q[i])==0:
    Q[i].append(Q[-(X//A+1)][-1])
    del Q[-(X//A+1)][-1]
    X-=1
  else:
    break
P=[]
for i in range(B):
  for j in range(len(Q[i])):
    P.append(Q[i][j])
print(*P)
n = input()
     
S = range(1, 14)
H = range(1, 14)
C = range(1, 14)
D = range(1, 14)
     
for i in range(0, n):
   mk = raw_input()split()
   num = int, raw_input()split()
      if mk == 'S':
         S[num-1] = 0
      elif mk == 'H':
         H[num-1] = 0
      elif mk == 'C':
         C[num-1] = 0
      elif mk == 'D':
         D[num-1] = 0
     
for i in S:
   if S[i] != 0:
      print 'S '+str(S[i])
    
for i in H:
   if S[i] != 0:
      print 'H '+ str(H[i])
    
for i in C:
   if S[i] != 0:
      print 'C '+str(C[i])
    
for i in D:
   if S[i] != 0:
      print 'D '+str(D[i])

### FIXED CODE ###

n=input()
  
s=range(1,14)
h=range(1,14)
c=range(1,14)
d=range(1,14)
   
for i in range(n):
   m, k=raw_input().split()
   if m == 'S':
      s[int(k)-1] = 0
   elif m == 'H':
      h[int(k)-1] = 0
   elif m == 'C':
      c[int(k)-1] = 0
   elif m == 'D':
      d[int(k)-1] = 0
  
for i in range(0, 13):
   if s[i] != 0:
      print 'S '+str(s[i])
  
for i in range(0, 13):
   if h[i] != 0:
      print 'H '+str(h[i])
  
for i in range(0, 13):
   if c[i] != 0:
      print 'C '+str(c[i])
  
for i in range(0, 13):
   if d[i] != 0:
      print 'D '+str(d[i])
# import numpy as np
# import time

def main():
    s = input()
    # s = '<>>><<><<<<<>>><'
    n_list = [0] * (len(s)+1)
    # n_list = np.zeros(len(s)+1)

    for i in range(1, len(s)+1):
        if s[i-1] == '<':
            n_list[i] = n_list[i-1]+1
        else: # i = >
            if s[i] == '>':
                continue
            j = i # jは左側の                           文字のインデックス
            k = 1                          
            for j in range(i, 1, -1):
                if s[j-1] == '<':
                    n_list[j] = max(n_list[j-1], n_list[j+1])+1
                    break
                n_list[j-1] = k
                k+=1
        if s[0] == '>':
            n_list[0] = n_list[1]+1
        # print('i={} {}'.format(i, n_list))    
 
    # print(n_list)
    print(int(sum(n_list)))


if __name__ == "__main__":
    # start = time.time()
    main()    
    # elapsed_time = time.time() - start
    # print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")


### FIXED CODE ###

# import numpy as np
# import time

def main():
    s = input()
    # s = '<>>><<><<<<<>>><' # test
    # s = '>>>>>>>'
    n_list = [0] * (len(s)+1)
    # n_list = np.zeros(len(s)+1)

    for i in range(1, len(s)):
        if s[i-1] == '<':
            n_list[i] = n_list[i-1]+1
        else: # i = >
            if s[i] == '>':
                continue
            # j = i # jは左側の                           文字のインデックス
            k = 1                          
            for j in range(i, 1, -1):
                if s[j-1] == '<':
                    n_list[j] = max(n_list[j-1], n_list[j+1])+1
                    break
                n_list[j-1] = k
                k+=1
    
    if s[-1] == '<':
        n_list[-1] = n_list[-2]+1
    elif s[-1] == '>':
        # j = i # jは左側の                           文字のインデックス
        k = 1                     
        for j in range(len(s), 1, -1):
            if s[j-1] == '<':
                n_list[j] = max(n_list[j-1], n_list[j+1])+1
                break
            n_list[j-1] = k
            k+=1
    if s[0] == '>':
        n_list[0] = n_list[1]+1
            
        # print('i={} {}'.format(i, n_list))    
 
    # print(n_list)
    print(int(sum(n_list)))


if __name__ == "__main__":
    # start = time.time()
    main()    
    # elapsed_time = time.time() - start
    # print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
import datetime

def is_leap_year(y):
    return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)

def leap_year_count(target_y,benchmark_y):
    target = target_y // 4 - target_y // 100 + target_y // 400
    benchmark = benchmark_y // 4 - benchmark_y // 100 + benchmark_y // 400
    return target - benchmark

def ad2mayan(y, m, d):
    diff = 0
    if datetime.MAXYEAR < y:
        day_of_2012 = (datetime.date(2013, 1, 1) - datetime.date(2012, 12, 21)).days
        day_of_the_year = (datetime.date(1, m, d) - datetime.date(1, 1, 1)).days if is_leap_year(y) else (datetime.date(4, m, d) - datetime.date(4, 1, 1)).days
        
        days = (y - 2013) * 365 + leap_year_count(y, 2013)

        diff = day_of_2012 + days + day_of_the_year
    else:
        benchmark = datetime.date(2012, 12, 21)
        diff = (datetime.date(y, m, d) - benchmark).days
    
    ki, diff = diff % 20, diff // 20
    w, diff = diff % 18, diff // 18
    t, diff = diff % 20, diff // 20
    ka, diff = diff % 20, diff // 20
    b = diff % 13
    
    return b,ka,t,w,ki

def mayan2ad(b, ka, t, w, ki):
    ka += b * 20
    t += ka * 20
    w += t * 18
    ki += w * 20
    time = datetime.date(2012, 12, 21) + datetime.timedelta(ki)
    return time.year, time.month, time.day

import sys
f = sys.stdin

for line in f:
    t = list(map(int, line.split('.')))
    if len(t) == 3:
        print('.'.join(map(str, ad2mayan(*t))))
    elif len(t) == 5:
        print('.'.join(map(str, mayan2ad(*t))))

### FIXED CODE ###

import datetime
from datetime import timedelta
from datetime import date

def ad2mayan(y, m, d):
    days = 0
    while datetime.MAXYEAR < y:
        days += 365 * 400 + 97
        y -= 400

    days += (date(y, m, d) - date(2012, 12, 21)).days
    
    ki, days = days % 20, days // 20
    w, days = days % 18, days // 18
    t, days = days % 20, days // 20
    ka, days = days % 20, days // 20
    b = days % 13
    
    return b,ka,t,w,ki

def mayan2ad(b, ka, t, w, ki):
    ka += b * 20
    t += ka * 20
    w += t * 18
    ki += w * 20
    dt = datetime.date(2012, 12, 21) + timedelta(ki)
    return dt.year, dt.month, dt.day

import sys
f = sys.stdin


for line in f:
    if line[0] == '#':
        break
    t = list(map(int, line.split('.')))
    
    if len(t) == 3:
        print('.'.join(map(str, ad2mayan(*t))))
    elif len(t) == 5:
        print('.'.join(map(str, mayan2ad(*t))))
n=int(input())
v=map(int, input().split())
c=map(int, input().split())

vc=[v[i]-c[i] for i in range(n) if (v[i]-c[i]) > 0]
print(sum(vc))

### FIXED CODE ###

n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
vc=[(v[i]-c[i]) for i in range(n) if (v[i]-c[i]) > 0]
print(sum(vc))
r = float(input())
print '%f %f' % (2*pi*r, pi*r^2)

### FIXED CODE ###

import math
r = float(input())
print '%f %f' % (math.pi*r*r, 2*math.pi*r)
import bisect

n = int(input())
P = list(map(int, input().split(" ")))
sp = sorted(P, reverse=True)
bi = []
bisect.insort(bi,P.index(sp[0]))
C = 0
lc = 0
rc = 0
C1 = 0
for j in sp[1:]:
  i = P.index(j)
  #bisect.insort(bi,i)
  l = bisect.bisect_left(bi,i)
  if l == 0:
    lc = i + 1
    if len(bi) == 1:
      rc = n - bi[0]
    else:
      rc = bi[l+1] - bi[l]
    C1 = lc*rc
  elif l == len(bi):
    if len(bi) == 1:
      lc = bi[0] + 1
    else:
      lc = bi[l-1] - bi[l-2]
    rc = n - i
    C1 = lc*rc
  else: 
    if len(bi) == 2:
      lc = bi[0] + 1
      rc = bi[1] - i
      C1 = lc*rc
      lc = i - bi[0]
      rc = n - bi[1]
      C1 += lc*rc
    elif l == 1:
      lc = bi[0] + 1
      rc = bi[1] - i
      C1 = lc*rc
      lc = i - bi[0]
      rc = bi[2] - bi[1]
      C1 += lc*rc
    elif l == len(bi) - 1:
      lc = bi[l-1] - bi[l-2]
      rc = bi[l] - i
      C1 = lc*rc
      lc = i - bi[l-1]
      rc = n - bi[l]
      C1 += lc*rc
    else:
      lc = bi[l-1] - bi[l-2]
      rc = bi[l] - i
      C1 = lc*rc
      lc = i - bi[l-1]
      rc = bi[l+1] - bi[l]
      C1 += lc*rc
  C += (P[i]*C1)
  bisect.insort(bi,i)
  
print(C)

### FIXED CODE ###

n = int(input())
print(n**3)
from itertools import product
al=list(product([0,1],repeat=10))
n=int(input())
a=[list(map(int, input().split())) for i in range(n)]
p=[list(map(int, input().split())) for i in range(n)]
ans-100000000000
for i in al:
    if sum(i)==0:continue
    q=0
    for j in range(n):
        count=0
        for k in range(10):
            if a[j][k]==1 and i[k]==1:
                count+=1
        q+=p[j][count]
    ans=max(ans,q)
print(ans)

### FIXED CODE ###

from itertools import product
al=list(product([0,1],repeat=10))
n=int(input())
a=[list(map(int, input().split())) for i in range(n)]
p=[list(map(int, input().split())) for i in range(n)]
ans=-100000000000
for i in al:
    if sum(i)==0:continue
    q=0
    for j in range(n):
        count=0
        for k in range(10):
            if a[j][k]==1 and i[k]==1:
                count+=1
        q+=p[j][count]
    ans=max(ans,q)
print(ans)
N,A,B = map(int,input().split())
ans = 0
for i in range(N):
  s = str(i)
  if 1<=i<=9:
    if A<=i<=B:
      ans += i
  elif 10<=i<=99:
    if A<=((int(s[0])+int(s[1])))<=B:
      ans += i
  elif 100<=i<=999:
    if A<=((int(s[0])+int(s[1])+int(s[2])))<=B:
      ans += i
  elif 1000<=i<=9999:
    if A<=((int(s[0])+int(s[1])+int(s[2])+int(s[3])))<=B:
      ans += i
  else:
    if A<=((int(s[0])+int(s[1])+int(s[2])+int(s[3])+int(s[4])))<=B:
      ans += i
print(ans)

### FIXED CODE ###

N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
  K = str(i)
  if len(K) == 1:
    if A<=int(K[0])<=B:
      ans += i
  elif len(K) == 2:
    if A<=int(K[0])+int(K[1])<=B:
      ans += i
  elif len(K) == 3:
    if A<=int(K[0])+int(K[1])+int(K[2])<=B:
      ans += i
  elif len(K) == 4:
    if A<=int(K[0])+int(K[1])+int(K[2])+int(K[3])<=B:
      ans += i
  elif len(K) == 5:
    if A<=int(K[0])+int(K[1])+int(K[2])+int(K[3])+int(K[4])<=B:
      ans += i
print(ans)
from itertools import combinations

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

c = [0] * (10 ** 9 + 1)
for e in a:
    c[e] += 1

for x, y in combinations(set(a), 2):
    t = [0] * (10 ** 9 + 1)
    i, j = x, y
    t[i] += 1
    t[j] += 1
    for _ in range(N - 2):
        k = i ^ j
        t[k] += 1
        if t[k] > c[k]:
            j = -1
            break
        i, j = j, k
    if j ^ x == y:
        print('Yes')
        exit()
print('No')


### FIXED CODE ###

from itertools import product

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

c = {}
for e in a:
    c.setdefault(e, 0)
    c[e] += 1

if len(set(c)) > 3:
    print('No')
    exit()

t = {}
for x, y in product(set(c), repeat=2):
    i = x
    j = y
    t[i] = 1
    if t[i] > c[i]:
        continue
    t.setdefault(j, 0)
    t[j] += 1
    if t[j] > c[j]:
        continue
    for _ in range(N - 2):
        k = i ^ j
        t.setdefault(k, 0)
        t[k] += 1
        c.setdefault(k, 0)
        if t[k] > c[k]:
            j = -1
            break
        i, j = j, k
    if j ^ x == y:
        print('Yes')
        exit()
print('No')
N = input()
A = list(map(int, input().split()))
A.sort(reverse=True)

now = A[0]
tateyoko = [0, 0]
count = 0
nowflag = False
for i in range(1, N):
  if (A[i] == now) and !nowflag:
    tateyoko[count] = now
    count += 1
    nowflag = True
  else:
    nowflag = False
  if count == 2:
    break
  now = A[i]
  
print(tateyoko[0] * tateyoko[1])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
max1=0;max2=0
count=0
for i in range(n-3):
  if a[i]==a[i+1]:
    max1=a[i]
    a[i+1]=0
    count=i+1
    break
if count==0:
  print(0)
  exit()
for j in range(count,n-1):
  if a[j]==a[j+1]:
    max2=a[j]
    break
print(max1*max2)
#=============================================================================
# パナソニックコンテスト D
#=============================================================================
N=int(input())
ans=[]

def dfs(s):
    global N
    for i in range(max(s)+2):
        ns=s+[i]
        if len(ns)!=N:
            dfs(ns)
        if len(ns)>N:
            continue
        if len(ns)==N and ns not in ans:
            ans.append(ns)
s=[0]
dfs(s)
abc=list("abcdefghi")
ans.sort()
for item in ans:
    for i in range(N):
        item[i]=abc[item[i]]
    print("".join(item))


### FIXED CODE ###

#=============================================================================
# パナソニックコンテスト D
#=============================================================================
import sys
sys.setrecursionlimit(10**8)
N=int(input())
abc=list("abcdefghij")
def dfs(s,v):
    global N
    for i in range(v+2):
        ns=s+abc[i]
        if len(ns)<N :
            if i!=v+1:
                dfs(ns,v)
            else:
                dfs(ns,v+1)
        if len(ns)==N:
            print("".join(ns))
if N==1:
    print("a")
else:
    dfs("a",0)
def radi(deg):
    return deg * (math.pi / 180)

def resolve():
    ha, hb, h, m = map(int, input().split())
    hr = radi(30*h+(m/2))
    mr = radi(6*m)
    hx = ha * math.cos(hr)
    mx = hb * math.cos(mr)
    hy = ha * math.sin(hr)
    my = hb * math.sin(mr)
    v = (abs(hx - mx)**2 + abs(hy - my)**2)**0.5
    print(v)
resolve()

### FIXED CODE ###

import math

def calc_angle(h, m):
	# validate the input
	if (h < 0 or m < 0 or h > 12 or m > 60):
		print('Wrong input')

	if (h == 12):
		h = 0
	if (m == 60):
		m = 0

	# Calculate the angles moved by
	# hour and minute hands with
	# reference to 12:00
	hour_angle = 0.5 * (h * 60 + m)
	minute_angle = 6 * m

	# Find the difference between two angles
	angle = abs(hour_angle - minute_angle)

	# Return the smaller angle of two
	# possible angles
	angle = min(360 - angle, angle)

	return angle

def resolve():
	a, b, h, m = map(int, input().split())
	ang = calc_angle(h, m)
	radi = math.radians(ang)
	v = (a**2 + b**2 - 2*a*b*math.cos(radi))**0.5
	print(v)
resolve()
arphs = list(ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ)
n = int(input())
s = list(input())
i = []
for x in s:
  i.append(arphs.index(x) + n)
print("".join(i))

### FIXED CODE ###

arphs = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
n = int(input())
s = list(input())
i = []
for x in s:
  i.append(arphs[arphs.index(x) + n])
print("".join(i))
import math
a,b,n=map(int,input().split())
ma=-1
ans=a*n
print(math.floor(ans/b))
        
    

### FIXED CODE ###

k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
    if i%k==0:
        print("OK")
        break
else:
    print("NG")
import math

K = int(input())
sum_gcd = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        n = math.gcd(a, b)
        for c in range(1, K+1):
            sum_gcd += np.gcd(n, c)
print(sum_gcd)

### FIXED CODE ###

from math import gcd

k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        p = gcd(a,b)
        for c in range(1,k+1):
            ans += gcd(p,c)
print(ans)
N = int(input())
arr = list(map(int, input(),split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			ans.append(arr.pop(idx2-1))
			break
		elif idx2 == 1:
			exit(-1)
 
for idx in range(0, N):
	print(ans.pop(-1))
  	print("\n")


### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			tmp = arr.pop(idx2-1)
			ans.append(tmp)
			break
		elif idx2 == 1:
			print(-1)
			exit()

for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)
N=int(input())
print(0.5 if N%2==0 else ((N+1)//2)/n)

### FIXED CODE ###

N=int(input())
print(0.5 if N%2==0 else ((N+1)//2)/N)
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H,W,N=map(int,input().split())

sr,sc=map(int,input().split())
S=input()[:-1]
T=input()[:-1]

left=0
right=W+1
up=0
down=H+1

ans="YES"
for i,(s,t) in enumerate(zip(reversed(S),reversed(T))):
    if i!=0:
        if t=='R':
            left=max(0,left-1)
        elif t=="L":
            right=min(W+1,right+1)
        elif t=="D":
            up = max(0,up-1)
        else:
            down=min(H+1,down+1)


    if s=="R":
        right-=1
    elif s=="L":
        left+=1
    elif s=="D":
        down-=1
    else:
        up+=1

    if right-left==1 or down-upp==1:
        ans="NO"
        break

if not left<sc<right or not up<sr<down:
    ans="NO"
print(ans)


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
stS = [v for v in input()[:-1]]
stT = [v for v in input()[:-1]]

ans = "YES"
# T=U,A=D
T = "U"
A = "D"
m = sr
# print("U")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m -= 1
        if m <= 0:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m < H:
            m += 1

T = "D"
A = "U"
m = sr
# print("D")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m += 1
        if m > H:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m > 1:
            m -= 1

T = "R"
A = "L"
m = sc
# print("R")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m += 1
        if m > W:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m > 1:
            m -= 1
T = "L"
A = "R"
m = sc
# print("L")
for s, t in zip(stS, stT):
    #print("m->", m)
    if s == T:
        m -= 1
        if m <= 0:
            ans = "NO"
            print(ans)
            exit()
    if t == A:
        if m < H:
            m += 1
print(ans)
mport math
N = int(input())
i = int(math.sqrt(2*N))

if i * (i+1) == 2 * N:
    print('Yes')
    print(i+1)
    S = [[] for k in range(i+1)]
    now = 0
    for k in range(1, N+1):
        l = now % (i+1)
        m = (now + 1) % (i+1)
        S[l].append(k)
        S[m].append(k)
        now = m
    for j in range(i+1):
        print(i, end = ' ')
        for n in range(i):
            if n < i-1:
                print(S[j][n], end = ' ')
            else:
                print(S[j][n])
else:
    print('No')


### FIXED CODE ###

import numpy
N = int(input())
i = int(numpy.sqrt(2*N))

if i * (i+1) == 2 * N:
    print('Yes')
    print(i+1)
    S = [[] for k in range(i+1)]
    k = 1
    for now in range(0, i+1):
        for now2 in range(now+1, i+1):
            S[now].append(k)
            S[now2].append(k)
            k += 1
    for j in range(i+1):
        print(i, end = ' ')
        values = map(str, S[j])
        print(' '.join(values))
else:
    print('No')
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)
exit(1)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

S = readline().rstrip().decode()
T = readline().rstrip().decode()

cnt = [[0] * 26 for i in range(26)]

for i in range(len(S)):
    cnt[ord(S[i]) - ord('a')][ord(T[i]) - ord('a')] += 1

for j in range(26):
    n = 0
    for i in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

for i in range(26):
    n = 0
    for j in range(26):
        if cnt[i][j] != 0:
            n += 1
    if n > 1:
        print("No")
        exit(0)

print("Yes")
n,m=map(int, input().split())
l = ['0']*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] == '0':
	l[index] = c
    else:
        if l[index] == c:
            continue
	else:
            msg=-1
            break
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) >1:
    print(-1)
else:
    print(msg.join(l))



### FIXED CODE ###

n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
if l[0] is None and len(l) != 1:
    l[0]='1'
l = list(map(lambda x: '0' if x is None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) != 1:
    print(-1)
else:
    print(msg.join(l))
import sys

#+++++


def main():
	s = input()
	a = ''.join(sorted(s)) == 'abc'
	if a:
		print('Yes')
	else:
		print('No')
	#print(' '.join([str(v) for v in l]))
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

### FIXED CODE ###

import sys

#+++++


def main():
	s = input()
	#a ='Yes' if ''.join(sorted(s)) == 'abc' else 'No'
	for c in 'abc':
		if c not in s:
			print('No')
			return 
	print('Yes')
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)