Harryxun/stf_run huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
X = input()
def popcount(n):
    cnt = 0
    while n:
        n %= "{:b}".format(n).count("1")
        cnt += 1
    return cnt

pl = [0]*(N+1)
for i in range(N+1):
    pl[i] = popcount(i)
bn = X.count("1")

modp = [0]*N
modm = [0]*N

for i in range(N):
    if X[i] == "1":
        modp[i] = pow(2, N-1-i, bn+1)
        modm[i] = pow(2, N-1-i, bn-1)

sp = sum(modp)
sm = sum(modm)
ans = [0]*N
for i in range(N):
    if X[i] == "1":
        if bn == 1:
            ans[i] = 0
            continue
        s = sp
        s -= modm[i]
        s %= bn-1
        ans[i] = pl[s]+1
    else:
        s = sm
        s += pow(2, N-1-i, bn+1)
        s %= bn+1
        ans[i] = pl[s]+1

print(*ans, sep="\n")


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# import random
# N = random.randint(0, 2*100000)
# X = ""
# for i in range(N):
#     if random.random() < 0.5:
#         X += "0"
#     else:
#         X += "1"
# print(N, X)


N = INT()
X = input()

def popcount(n):
    cnt = 0
    while n:
        n %= "{:b}".format(n).count("1")
        cnt += 1
    return cnt

pl = [0]*(N+1)
for i in range(N+1):
    pl[i] = popcount(i)
bn = X.count("1")

modp = [0]*N
modm = [0]*N

for i in range(N):
    if X[i] == "1":
        modp[i] = pow(2, N-1-i, bn+1)
        if not bn == 1:
            modm[i] = pow(2, N-1-i, bn-1)

sp = sum(modp)
sm = sum(modm)
ans = [0]*N
for i in range(N):
    if X[i] == "1":
        if bn == 1:
            ans[i] = 0
            continue
        s = sm
        s -= modm[i]
        s %= bn-1
        ans[i] = pl[s]+1
    else:
        s = sp
        s += pow(2, N-1-i, bn+1)
        s %= bn+1
        ans[i] = pl[s]+1

print(*ans, sep="\n")
def main():
    s = input()
    s1 = s[:int((len(s)-1)/2)]
    s2 = s[int((len(s)+3)/2-1):]
    rs1 = s1[::-1]
    rs2 = s2[::-1]

    if s1 == rs1 and s2 == rs2:
        print("Yes")
    else:
        print("No")
    
    return
    
main()
a

### FIXED CODE ###

def main():
    s = input()
    s1 = s[:int((len(s)-1)/2)]
    s2 = s[int((len(s)+3)/2-1):]
    rs = s[::-1]
    rs1 = s1[::-1]
    rs2 = s2[::-1]


    if s1 == rs1 and s2 == rs2 and s == rs:
        print("Yes")
    else:
        print("No")
    
    return
    
main()
N = int(input())
ans = 0
for i in range(N):
  x, u = input().split()
  x = int(x)
  u = str(u)
  if u == "BTC":
    ans += x*380000.0
  else:
    ans += x

print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(N):
  x, u = input().split()
  x = float(x)
  u = str(u)
  if u == "BTC":
    ans += x*380000.0
  else:
    ans += x

print(ans)
import sys
input = sys.stdin.readline
N = int(input())
# （１行読み込み→splitしてlist化→各要素に対して-1する）←を逆順にする（[::-1]）をN回繰り返す
A = [[x-1 for x in list(map(int, input().split()))][::-1] for i in range(N)]

def can_match(i, A, next_set):
    if not A[i]: # A[i]が空の場合
        return
    j = A[i][-1] # j = iさんの次の対戦相手

    if A[j][-1] == i: # jさんの次の対戦相手がiさんの場合（＝相思相愛の場合）
        if i < j: # 常に(小, 大)で格納する
            next_set.add((i,j))
        else: # 常に(小, 大)で格納する
            next_set.add((j,i))

# next_setの初期化
next_set = set() # setは集合を表す
for i in range(N):
    can_match(i, A, next_set)

# 試合できるか？何日かかるか？を判別する
day = 0
battle = 0
while next_set:
    day += 1
    current_set, next_set = next_set, set()
    for match in current_set:
        battle += 1
        del A[match[0]][-1]
        can_match(match[0], A, next_set)
        del A[1][-1]
        can_match(match[1], A, next_set)

if battle == N*(N-1)//2:
    print(day)
else:
    print(-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
# （１行読み込み→splitしてlist化→各要素に対して-1する）←を逆順にする（[::-1]）をN回繰り返す
A = [[x-1 for x in list(map(int, input().split()))][::-1] for i in range(N)]

def can_match(i, A, next_set):
    if not A[i]: # A[i]が空の場合
        return
    j = A[i][-1] # j = iさんの次の対戦相手

    if A[j][-1] == i: # jさんの次の対戦相手がiさんの場合（＝相思相愛の場合）
        if i < j: # 常に(小, 大)で格納する
            next_set.add((i,j))
        else: # 常に(小, 大)で格納する
            next_set.add((j,i))

# next_setの初期化
next_set = set() # setは集合を表す
for i in range(N):
    can_match(i, A, next_set)

# 試合できるか？何日かかるか？を判別する
day = 0
battle = 0
while next_set:
    day += 1
    current_set, next_set = next_set, set()
    for match in current_set:
        battle += 1
        del A[match[0]][-1]
        can_match(match[0], A, next_set)
        del A[match[1]][-1]
        can_match(match[1], A, next_set)

if battle == N*(N-1)//2:
    print(day)
else:
    print(-1)
a,b = map(int,input())
print(6-a-b)

### FIXED CODE ###

a = int(input())
b= int(input())
print(6-a-b)
X, Y = map(int, input().split())

for i in range(X+1):
    foot=i*2+(X-i)*4
    if foot==Y:
        print('Yes')
        exit()

print('No')

### FIXED CODE ###

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

for i in range(5):
    if x[i] == 0:
        print(i+1)
    else:
      pass
X = int(input())
t = X//2 + X
a=set(range(2,t))
l=map(lambda c:range(2*c,t,c),a)
result=a.difference(*l)
result=list(sorted(result))
matchingVals = filter(lambda x : x>X, result)
res = list(matchingVals)
print(res[0])

### FIXED CODE ###

def check(num):
    if num > 1:
        for i in range(2, num):
            if (num % i) == 0:
                return False
                break
        else:
            return True
    else:
        return False


a = int(input())

for i in range(a, 100500):
    if check(i):
        print(i)
        break
import re
s1 = input()
t = input()
pre = ""
count = 0
ans = ""
start = 0
end = 0
it = ""

for w in s1:
  if w != "?" and pre == "?":
    pre = w
    count = 0
    it = ""
  elif w == "?" and pre == "?":
    count += 1
    it += w
  elif w == t[count]:
    count += 1
    it += w
  else:
    if w == "?":
      pre = w
      count += 1
      it += w
  # if count >= len(t):
  #   print("きたよ")
  #   print(w)
  #   end = s1.index(w)
  #   start = end - len(t)
#print(f"count is {count}")
#print("endは" + end)
#replace = "?" * len(t)
#print("replace is" + it)
if count >= len(t):
  it = it.replace("?","\?")
  # 合致した最も後方のものを置換
  ans = re.sub(it,t,s1)
  ans = ans.replace("?","a")
  #print(ans)
  # if end < len(s1) - 1:
  #   ans = s1[:start] + t + s1[end+1:]
  #   # 全てaに置換
  #   ans = ans.replace("?","a")
  #   print(ans)
  # else:
  #   ans = s1[:start] + t
  #   ans = ans.replace("?","a")
  print(ans)
else:
  print("UNRESTORABLE")

### FIXED CODE ###

# pythonはindexでstringの文字を変更できない
s = list(input())
t = list(input())
x = 0
ans = []
gotk = False

# pythonて関数にするとスコープの外の変数参照できないんだっけ？

# 0 <= k <= s - t
def match(k):
  for i in range(len(t)):
    if s[i + k] != t[i] and s[i + k] != "?":
      return False
  return True

def construct(k,s):
  for i in range(len(t)):
    s[i + k] = t[i]
  for i in range(len(s)):
    if s[i] == "?":
      s[i] = "a"
  return s

# 大きいkから探せば良い(今回逆順にしてるためrangeの第二引数が直前まで処理されることに注意！)
for i in range(len(s) - len(t),-1,-1):
  if match(i):
    x = i
    gotk = True
    break

if gotk == True:
  ans = construct(x,s)
  print("".join(ans))
else:
  print("UNRESTORABLE")
# -*- coding: utf-8 -*-
import sys
N,Q=map(int, sys.stdin.readline().split())

al=[ [] for _ in range(N+1) ]	#隣接リスト
for _ in range(N-1):
	u,v=map(int, sys.stdin.readline().split())
	al[u].append(v)
	al[v].append(u)

increment=[ 0 for _ in range(N+1) ]
for _ in range(Q):
    p,x=map(int, sys.stdin.readline().split())
    increment[p]+=x

socre=[ 0 for _ in range(N+1) ] #各頂点のカウンターの値を記録
visit=[ 0 for _ in range(N+1) ] #0なら未訪問、1なら訪問済み
point=0
def dfs(par,cur):
    visit[cur]=1
    global point
    point+=increment[cur]
    socre[cur]+=point       #各頂点のカウンターの値を記録
    old=point   #拡張点が子孫に遷移する前のカウンターの値を記録
    for to in al[cur]:
        if visit[to]==0:
            dfs(cur,to)
            point=old   #子孫に遷移し、増えたカウンターの値を自分の時の点数に戻す
dfs(-1,1)

for i in range(1,N+1):
    print socre[i],

### FIXED CODE ###

import sys
from collections import deque

N,Q=map(int, sys.stdin.readline().split())

 
al=[ [] for i in range(N+1) ]
 
for _ in range(N-1):
	a,b=map(int, sys.stdin.readline().split())
	al[a].append(b)
	al[b].append(a)

Visit=[ None for i in range(N+1) ] 
score=[ 0 for i in range(N+1) ] 

for _ in range(Q):
	p,x=map(int, sys.stdin.readline().split())
	score[p]+=x


q=deque()
q.append(1)

while q:
	fro=q.popleft()
	Visit[fro]=1
	for to in al[fro]:
		if Visit[to] is None:
			score[to]+=score[fro]
			q.append(to)


for i,ans in enumerate(score):
	if i==0:	continue
	print ans,
N,K=map(int,input().split())
a=[]
while K>0:
  d=int(input())
  b=list(map(int,input().split())
  a.extend(b)
  K=K-1
e=collection.Counter(a)
print(N-len(e))

### FIXED CODE ###

import collections
N,K=map(int,input().split())
a=[]
d=[]
while K>0:
  K=K-1
  d.append(int(input()))
  b=list(map(int,input().split()))
  a.extend(b)
e=collections.Counter(a)
print(N-len(e))
n = int(input())
s = list(input())

A_index = [i for i, x in enumerate(s) if x == 'A']
print(A_index)

count = 0
for j in A_index :
  print(j)
  if j != n-1 :
    if s[j+1] == 'B' :
      if s[j+2] == 'C' :
        count += 1

print(count)

### FIXED CODE ###

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

A_index = [i for i, x in enumerate(s) if x == 'A']

count = 0
for j in A_index :
  if j != n-1 :
    if s[j+1] == 'B' :
      if j != n-2 :
        if s[j+2] == 'C' :
          count += 1

print(count)
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    
    rui = [a[0]]
    for i in range(1, n):
        rui.append(rui[i - 1] + a[i])
    rui = [0] + rui
    ansl = []
    for i in range(n):
        for j in range(i,n):
            ansl.append(rui[j + 1] - rui[i])
    ansl = sorted(ansl, reverse=True)
    
    cnt = 0
    anscnt = 0
    ansbit = 0
    L = []
    for i in range(50):
        bit = (1 << (50 - i))
        l = []
        for j in range(len(ansl)):
            if ansl[j] & bit == 0:
                l.append(ansl[j])
            else:
                L.append(ansl[j])
                #ans &= ansl[j]
                cnt += 1
        if cnt >= k:
            ansbit = i
            break
        else:
            anscnt += len(L)
            for j in range(len(L)):
                ans &= L[j]
            L = []
        ansl = l

    ans = 0
    for i in range(ansbit,50):
        bit = (1 << (50 - i))
        LL = []
        cnt = 0
        for j in range(len(L)):
            if L[j] & bit == 0:
                l.append(L[j])
            else:
                cnt+=1
                LL.append(L[j])

        if cnt >= k:
            L = LL
            ans |= bit
                

    
    print(ans)
    
                    


if __name__ == '__main__':
    main()


### FIXED CODE ###

from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    
    rui = [a[0]]
    for i in range(1, n):
        rui.append(rui[i - 1] + a[i])
    rui = [0] + rui
    ansl = []
    for i in range(n):
        for j in range(i,n):
            ansl.append(rui[j + 1] - rui[i])
    ansl = sorted(ansl, reverse=True)
    
    cnt = 0
    ansbit = 0
    L = []
    for i in range(51):
        bit = (1 << (50 - i))
        l = []
        for j in range(len(ansl)):
            if ansl[j] & bit == 0:
                l.append(ansl[j])
            else:
                L.append(ansl[j])
                cnt += 1
        if cnt >= k:
            ansbit = i
            break
        else:
            L = []
        # ansl = l

    ans = 0
    for i in range(51):
        bit = (1 << (50 - i))
        LL = []
        cnt = 0
        for j in range(len(L)):
            if L[j] & bit != 0:
                cnt+=1
                LL.append(L[j])

        if cnt >= k:
            L = LL
            ans |= bit

        if len(L) < k:
            break
                

    
    print(ans)
    
                    


if __name__ == '__main__':
    main()
import math
N = int(input())
X = []
for _ in range(N):
  x, l = map(int,input().split())
  X.append([x+l, x-l])
sorted_X = sorted(X, key=lambda x:(x[1], x[2]))
ans = 1
cnt = sorted_X[0][0]
for i in range(N):
  if sorted_X[i][1] >= cnt:
    ans += 1
    cnt = sorted_X[i][0]
print(ans)

### FIXED CODE ###

import math
N = int(input())
X = []
for _ in range(N):
  x, l = map(int,input().split())
  X.append([x+l, x-l])
sorted_X = sorted(X, key=lambda x:(x[0], x[1]))
ans = 1
cnt = sorted_X[0][0]
for i in range(N):
  if sorted_X[i][1] >= cnt:
    ans += 1
    cnt = sorted_X[i][0]
print(ans)
n = int(input())
a = set([input() for i in range(n)])
print(len(a))

### FIXED CODE ###

s = input()
print("2018{}".format(s[4::]))
#054_A
a,b=map(int,input().split())
print('Draw' if a==b else 'Alice' if (a-2)%13>(b-2)%13 else 'Bob')

### FIXED CODE ###

#065_A
x,a,b=map(int,input().split())
print('delicious' if b<=a else 'safe' if b-a<=x else 'dangerous')
a = 0
a = int(input())
b = input()
c = 0
c = int(input())
d = b[k-1]
new = [e for e in b if e != d]
while(len(new)>i):
  f = new[i]
  b[f] = '*'
  i = i+1
print(b)  

### FIXED CODE ###

N=int(input())
S=str(input())
K=int(input())
W=S[K-1]
for i in range(N):
  if S[i]!=W:
    S=S.replace(S[i],'*')
print(S)
X,A=input().split()
if x>=A:
  print(10)
else:
  print(0)
 

### FIXED CODE ###

X,A=input().split()
if int(X)>=int(A):
  print(10)
else:
  print(0)
l = list(input())
ans = list("keyence")
count = 0
check = 0
check2 = 0
for i in range(len(l)):
  if l[i] == ans[count]:
    check2 = 0
    count += 1
  else:
    if check2 == 1:
      continue
    else:
      check += 1
      check2 = 1
  if count == 7 and 1 >= check:
    print("YES")
    exit()
\
print("NO")
    
    

### FIXED CODE ###

l = list(input())
ans = list("keyence")

minus = len(l)-7

for i in range(len(l)-minus):
  l1 = l[:i]+l[i+minus:]
  
  if l1 == ans:
    print("YES")
    exit()
    
print("NO")
int A, int B
x=A*B
if x%2==0:
  return 'Yes'
else:
  returun 'No'

### FIXED CODE ###

A,B=list(map(int,input().split()))
x=A*B
if x%2==0:
  print('No')
else:
  print('Yes')
a = input()
b = input()
if 2800 <= a and a<3200:
    print("red")
elif 3200 <=a and a <=5000:
    print(b)


### FIXED CODE ###

a = int(input())
b = input()
if 2800 <= a and a<3200:
    print("red")
elif 3200 <=a and a <=5000:
    print(b)
n = int(input())
alist=list(map(int,input().split()))
print(sum(min(alist[i-1],alist[i],alist[i+1]) for i in range(1,n-1))\
      +min(alist[-2],alist[-1])+alist[-1]+min(alist[0],alist[1]))

### FIXED CODE ###

n = int(input())
alist=list(map(int,input().split()))
alist.insert(0,1e7)
alist.append(1e7)
core = 0
for i in range(n):
  core +=min(alist[i],alist[i+1])
print(core)
import sys

def comb(n, k):
    if k == 0:
        return 0
    if n < k:
        return 0
    res=1
    for i in range(n - k + 1, n + 1):
        res *= i
    for i in range(1,k + 1):
        res //= i
    return res

n=input()
k = int(input())
l = len(n)

if l == 1:
    if k >= 2:
        print(0)
        sys.exit()
    print(top)
    sys.exit()

top = int(n[0])

if k == 1:
    z = 9
elif k == 2:
    z = 81
else:
    z = 729

ans = comb(l - 1, k) * z
ans += comb(l - 1, k - 1) * (top - 1) * (z // 9)

if k == 1:
    ans+=top    
elif k == 2:
    for i in range(1, l):
        if i==1 or int(n[1:i]) == 0:
            ans += int(n[i])
        else:
            ans += 9
elif k == 3:
    for i in range(1, l):
        for j in range(i + 1, l):
            flag1 = i == 1 or int(n[1:i]) == 0
            flag2 = j == i + 1 or int(n[i + 1 :j]) == 0
            if not(flag1) and not(flag2):
                ans += 81
            elif flag1 and not (flag2):
                ans += 9 * int(n[i])
            elif not (flag1) and flag2:
                ans += 81
            else:
                ans += 9 * (int(n[i]) - 1) + int(n[j])

print(ans)


### FIXED CODE ###

import sys

def comb(n, k):
    if k == 0:
        return 0
    if n < k:
        return 0
    res=1
    for i in range(n - k + 1, n + 1):
        res *= i
    for i in range(1,k + 1):
        res //= i
    return res

n=input()
k = int(input())
l = len(n)

top = int(n[0])

if l == 1:
    if k >= 2:
        print(0)
        sys.exit()
    print(top)
    sys.exit()

if k == 1:
    z = 9
elif k == 2:
    z = 81
else:
    z = 729

ans = comb(l - 1, k) * z
ans += comb(l - 1, k - 1) * (top - 1) * (z // 9)

if k == 1:
    ans+=top
elif k == 2:
    for i in range(1, l):
        if i==1 or int(n[1:i]) == 0:
            ans += int(n[i])
        else:
            ans += 9
elif k == 3:
    for i in range(1, l):
        for j in range(i + 1, l):
            flag1 = i == 1 or int(n[1:i]) == 0
            flag2 = j == i + 1 or int(n[i + 1 :j]) == 0
            if not(flag1) and not(flag2):
                ans += 81
            elif flag1 and not (flag2):
                ans += 9 * int(n[i])
            elif not (flag1) and flag2:
                ans += 81
            else:
                if int(n[i]) == 0:
                    continue
                ans += 9 * (int(n[i]) - 1) + int(n[j])

print(ans)
n, a, b = map(int, input().split())
MOD = 10**9+7

def comb(n, r):
    x = 1; y = 1
    for i in range(r):
        x *= n-i
        y *= r-i
    return x*pow(y, MOD-2, MOD)

print(pow(2, n, MOD)-1 -comb(n, a) -comb(n, b))

### FIXED CODE ###

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

if N >= 10:
    print(R)
else:
    print(R+100*(10-N))
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
min_val = sorted(A)[0]
for _ in range(M):
  B, C = map(int, input().split())
  if min_val <= C:
  	A.extend([C]*B)
    A = sorted(A, reverse=True)
    min_val = A[0]
  
A = sorted(A, reverse=True)
print(sum(A[:N]))

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]
BC = []
for _ in range(M):
    B, C = map(int, input().split())
    BC.append([B, C])
BC = sorted(BC, key=lambda x: x[1], reverse=True)
# print("A: {}".format(A))
# print("BC: {}".format(BC))

A_dash = []
for ij in BC:
    i, j = ij
    A_dash.extend([j]*i)
    if len(A_dash) >= N:
        break
A_dash = A_dash[:N]

A_dash.extend(A)
A_dash = sorted(A_dash, reverse=True)[:N]

print(sum(A_dash))
import numpy as np
from numpy.random import *

def quicksort(array):
    if len(array) < 2:
        return array # ?????¬??±??????
    else:
        pivot = array[0] # ?????°??±??????
        # ???????????????????°???????????????????????????¨?????????
        less = [i for i in array[1:] if i <= pivot]

        # ????????????????????§??????????????????????????¨?????????
        greater = [i for i in array[1:] if i > pivot]

        return quicksort(less) + [pivot] + quicksort(greater)


array = randint(0, 1000, 10) 
sorted_array = quicksort(array)
print(sorted_array[0])
print(sorted_array[1])
print(sorted_array[2])

### FIXED CODE ###

array = []
for _ in range(10):
    array.append(int(input()))

sorted_array = sorted(array,reverse=True)
for i in range(3):
    print(sorted_array[i])
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
ans=[]
m = max(1, min(a))
M = max(a)+1
for x in range(m,M):
    ans.append(c[x-1]+c[x]+c[x+1])
print(max(ans))

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
m = max(1, min(a))
M = max(a)
ans=[]
for x in range(m,M):
    ans.append(c[x-1]+c[x]+c[x+1])
if m >= M:
    ans.append(n)
print(max(ans))
n=int(input())
if n[1]=='7':
  print('Yes')
if n[2]=='7':
   print('Yes')
if n[3]=='7':
   print('Yes')
else:
   print('No')
    

### FIXED CODE ###

n=input()
if n[0]=='7':
  print('Yes') 
elif n[1]=='7':
  print('Yes')  
elif n[2]=='7':
  print('Yes')  
else:
   print('No')
a, b, k = map(int, input().split())
li =[]
for i in range(1, min(a, b)):
    if a % i == 0 and b % i == 0:
        li.append(i)

print(li[-k])

### FIXED CODE ###

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

def ooo(x):
    lix =[]
    for i in range(1, x+1):
        if x % i == 0:
            lix.append(i)
    return lix

lia = ooo(a)
lib = ooo(b)
li = lia + lib

li2 =[]
for n in range(len(li)):
    if not li[n] in li2: 
        if li.count(li[n]) == 2:
            li2.append(li[n])

li2.sort(reverse=True)
print(li2[k-1])
n, k = map(int, input().split())
r, ss, p = map(int, input().split())
s = input()
hands = [None]*n
wins = {'r':'p', 's':'r', 'p':'s'}
h_s = {'r':r, 's':ss, 'p':p}
ans = 0
for i, c in enumerate(s):
    if i - k >= 0:
        if wins[c] == hands[i-k]:æ
            hs = set(wins.keys())
            hs.remove(wins[c])
            if i + k < n:
                if wins[s[i+k]] in hs:
                    hs.remove(wins[s[i+k]])
            hands[i] = hs.pop()
            continue
    hand = wins[c]
    hands[i] = hand
    ans += h_s[hand]

print(ans)
        




### FIXED CODE ###

n, k = map(int, input().split())
r, ss, p = map(int, input().split())
s = input()
hands = [None]*n
wins = {'r':'p', 's':'r', 'p':'s'}
h_s = {'r':r, 's':ss, 'p':p}
ans = 0
for i, c in enumerate(s):
    if i - k >= 0:
        if wins[c] == hands[i-k]:
            hs = set(wins.keys())
            hs.remove(wins[c])
            if i + k < n:
                if wins[s[i+k]] in hs:
                    hs.remove(wins[s[i+k]])
            hands[i] = hs.pop()
            continue
    hand = wins[c]
    hands[i] = hand
    ans += h_s[hand]

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

a.sort()
start1=a[0]
start2=a[m-1]

a.pop(0)
a.pop(m-2)

centre=(start1+start2)/2
a.append(centre)
a.sort()
c=a.index(centre)
cent_left=a[c-1]
cent_right=a[c+1]

print(abs(cent_left-start1) + abs(start2-cent_right))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
kyori=[]
if n>=m:
    print(0)
    
else:
    for i in range(m-1):
        kyori.append(a[i+1]-a[i])
    b=0
    kyori.sort()
    for i in range(m-n):
        b+=kyori[i]
    
    print(b)
import sys

n = int(input())

def main():
    for i in range(1, 3500):
        for j in range(1, 3500):
            z = n * i * j / (4 * i * j - n * i - n * j)
            if z >= 1 and z == int(z):
                print(i, j, z)
                sys.exit()


main()


### FIXED CODE ###

import sys

n = int(input())

def main():
    for i in range(1, 3500):
        for j in range(1, 3500):
            z = 4 * i * j - n * i - n * j
            if z > 0:
                x = n * i * j / z
                if x == int(x):
                    print(i, j, int(x))
                    sys.exit()


main()