Harryxun/stf_run huggingface dataset:
import statistics

def quickSort(arr):
  left = []
  right = []
  if len(arr) <= 1:
   return arr
  median = int(statistics.median(arr))
  medianFlg = 0

  for element in arr:
   if element < median:
    left.append(element)
   elif element > median:
    right.append(element)
   else:
    medianFlg += 1
  left = quickSort(left)
  right = quickSort(right)
  return left + [median] * medianFlg + right

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
t1 = time.time()
PP=quickSort(P)
QQ=quickSort(Q)
S=PP[A-X:A]+QQ[B-Y:B]+R
SS=quickSort(S)
D=0
for r in range(X+Y):
 D+=SS[C+r]
print(D)
t2 = time.time()
elapsed_time = t2-t1
print(f"経過時間：{elapsed_time}")import time
import statistics

def quickSort(arr):
  left = []
  right = []
  if len(arr) <= 1:
   return arr
  median = int(statistics.median(arr))
  medianFlg = 0

  for element in arr:
   if element < median:
    left.append(element)
   elif element > median:
    right.append(element)
   else:
    medianFlg += 1
  left = quickSort(left)
  right = quickSort(right)
  return left + [median] * medianFlg + right

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
PP=quickSort(P)
QQ=quickSort(Q)
S=PP[A-X:A]+QQ[B-Y:B]+R
SS=quickSort(S)
D=0
for r in range(X+Y):
 D+=SS[C+r]
print(D)


### FIXED CODE ###

def merge_sort(arr):
 if len(arr) <= 1:
  return arr
 mid = len(arr) // 2
# ここで分割を行う
 left = arr[:mid]
 right = arr[mid:]
# 再帰的に分割を行う
 left = merge_sort(left)
 right = merge_sort(right)
# returnが返ってきたら、結合を行い、結合したものを次に渡す
 return merge(left, right)
def merge(left, right):
 merged = []
 l_i, r_i = 0, 0
# ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
 while l_i < len(left) and r_i < len(right):
    # ここで=をつけることで安定性を保っている
  if left[l_i] <= right[r_i]:
   merged.append(left[l_i])
   l_i += 1
  else:
   merged.append(right[r_i])
   r_i += 1

# 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
 if l_i < len(left):
  merged.extend(left[l_i:])
 if r_i < len(right):
  merged.extend(right[r_i:])
 return merged

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
PP=merge_sort(P)
QQ=merge_sort(Q)
S=PP[A-X:A]+QQ[B-Y:B]+R
SS=merge_sort(S)
D=0
for r in range(X+Y):
 D+=SS[C+r]
print(D)
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = []
for i in range(M):
  b, c = map(int, input().split())
  for i in range(b):
    C.append(c)

A.sort()
C.sort(reverse=True)
j = 0
while (j < len(C)) and (A[j] < C[j]):
  A[j] = C[j]
  j += 1
  
print(sum(A))

### FIXED CODE ###

A, B = map(int, input().split())

if 13 <= A:
  ans = B
elif A < 6:
  ans = 0
else:
  ans = B / 2
  
print(int(ans))
import math
a, b, x = map(int,input().split())
def fnc(n,x):
    if n == -1:
        return 0
    return n//x
print(fnc(b,x) - func((a-1),x))

### FIXED CODE ###

import math
a, b, x = map(int,input().split())
print(b//x - (a-1)//x)
n=int(input())
A=sorted(map(int,input().split()))
L=[A[0]]
if n==0:
    print(0)
else:
    c=0
    if A[0]!=A[1]:
        c=1
    for i in range(n-1):
        flag=0
        for l in L:
            if A[i+1]%l==0:
                flag=1
                break
            if l>=int(A[i+1]**0.5+1):
                break
        if flag==0:
            L.append(A[i+1])
            c+=1
    print(c)

### FIXED CODE ###

from collections import defaultdict
n=int(input())
A=sorted((map(int,input().split())))
maxA=max(A)
L=[0]*(maxA+1)
AD=defaultdict(int)
for a in A:
	L[a]=1
	AD[a]+=1
for a in A:
	if AD[a]>=2:
		L[a]=0
	for i in range(2*a,maxA+1,a):
		L[i]=0
print(sum(L))
S = input()
if S[-1] = "s"
	print( S + "es" )
	else print( S + "s" )

### FIXED CODE ###

S = input()
if S[-1] == "s":
  print( S + "es" )
else: 
  print( S + "s" )
n = int(input())
s = []
for i in range(n):
    tmp = int(input())
    s.append(tmp)
sorted(s)
max_s = sum(s)
 
if max_s % 10 != 0:
    print(max_s)
else:
    for j in range(n):
        if s[j] % 10 != 0:
            print(max_s - s[j])
            break
        elif j == n-1:
            assert False


### FIXED CODE ###

n = int(input())
s = []
for i in range(n):
    tmp = int(input())
    s.append(tmp)
s.sort()
max_s = sum(s)
 
if max_s % 10 != 0:
    print(max_s)
else:
    for j in range(n):
        if s[j] % 10 != 0:
            print(max_s - s[j])
            break
        elif j == n-1:
            print(0)
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k = map(int, input().split())
a = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ord_ = [-1] * (n + 1) # 何回目に訪れたか
s = []
current = 0
while ord_[v] == -1:
    ord_[v] = len(s)
    s.append(v)
    current = a[current] -1
c = len(s) - ord_[current]
l = ord_[current]

if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])



### FIXED CODE ###

#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k = map(int, input().split())
a = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ord_ = [-1] * (n + 1)
s = []
v = 1
while ord_[v] == -1:
    ord_[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - ord_[v]
l = ord_[v]

if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter
    n = int(input())
    a = list(map(int, readline().split()))

    def factorization(n):
        factors = []

        if n < 2:
            return n

        while n % 2 == 0:
            factors.append(2)
            n //= 2

        for i in range(3, int(n ** 0.5) + 5, 2):
            while n % i == 0:
                factors.append(i)
                n //= i
        if n != 1:
            factors.append(n)

        return Counter(factors)

    a_fac = [0] * n

    for i, num in enumerate(a):
        a_fac[i] = factorization(num)

    lcm = Counter([1])

    for i, fac in enumerate(a_fac):
        add_temp = fac - lcm
        add = Counter({key: value for key, value in add_temp.items() if value > 0})
        lcm += add

    b = [0] * n

    for i, fac in enumerate(a_fac):
        b_fac = lcm - fac
        temp = 1
        for key, value in b_fac.items():
            temp *= pow(key, value, MOD)
            temp %= MOD
        b[i] = temp

    ans = 0
    for elem in b:
        ans += elem
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter
    n = int(input())
    a = list(map(int, readline().split()))

    def factorization(n):
        factors = []

        while n % 2 == 0:
            factors.append(2)
            n //= 2

        for i in range(3, int(n ** 0.5) + 5, 2):
            while n % i == 0:
                factors.append(i)
                n //= i
        if n != 1:
            factors.append(n)

        return Counter(factors)

    a_fac = [0] * n

    for i, num in enumerate(a):
        a_fac[i] = factorization(num)

    lcm = {1: 1}

    for fac in a_fac:
        for key, value in fac.items():
            lcm[key] = max(lcm.get(key, 0), value)

    ans = 0

    lcmmod = 1

    for key, value in lcm.items():
        lcmmod *= pow(key, value, MOD)
        lcmmod %= MOD

    for ele in a:
        ainv = pow(ele, MOD - 2, MOD)
        ans += ((lcmmod*ainv) % MOD)
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()
N = int(input())
p = map(int, input().split())

# 昇順のリスト
asc_l = list(range(1, N))

diff_l = p - asc_l
diff_l.count(0) >= N - 2

### FIXED CODE ###

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

k = 0
counter = 1
for e in p:
    if e == counter:
        counter += 1
    else:
        k += 1
        counter += 1

if k <= 2:
    print('YES')
else:
    print('NO')
def popcount(x): #xは10進数の整数
    return bin(x).count('1')
def count(n):
    ans = 0
    while n != 0:
        ans += n % 2
        n //= 2
    return ans
ma = 2*10**5
dp = [0] * ma
for i in range (1, ma):
    dp[i] = dp[i % count(i)] + 1
def solve(N, x):
    p = popcount(int(x, 2))
    nowp_p = int(x, 2) % (p+1)
    if p-1 != 0: 
        nowp_m = int(x, 2) % (p-1)
    x = list(x)#list
    for i in range(N):
        if x[i] == '0':
            print(dp[(nowp_p + 2**(N-i-1)) % (p + 1)] + 1)
        elif x[i] == '1':
            if p == 1:
                print(0)
            else:
                print(dp[(nowp_m - 2**(N-i-1) + p - 1) % (p - 1)] + 1)
N = int(input())
x = input() #str
solve(N, x)

### FIXED CODE ###

def solve(L,R,d):
    count = 0
    for i in range(L,R+1):
        if i % d == 0:
            count += 1
    return count
L, R, d = map(int, input().split())
print(solve(L,R,d))
import math

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

area_base = a ** 2
volum_bottle = area_base * b

k = 2 * (volum_bottle - x) / a ** 2

if k <= b:
  K_t = k / a
  angle = math.degree(math.atan(K_t))
else:
  L_t = a * (b ** 2) / (2 * x)
  angle = math.degree(math.atan(L_t))
  
print(round(angle, 10))

### FIXED CODE ###

import math

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

area_base = a ** 2
volum_bottle = area_base * b

k = (2 * (volum_bottle - x)) / a ** 2

if k <= b:
  K_t = k / a
  angle = math.degrees(math.atan(K_t))
else:
  L_t = a * (b ** 2) / (2 * x)
  angle = math.degrees(math.atan(L_t))
  
print(round(angle, 10))
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for j in range(n):
    ans=cost+abs(a[j]-a[j+2])-abs(a[j+1]-a[j])-abs(a[j+1]-a[j+2])
    print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)
a=int(input())
b=int(input())
if a>=b:
	c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue


### FIXED CODE ###

a,b=map(int,input().split())
if a>=b:
    c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue
N=int(input())
S=input

ans=1

for i in range(1,N):
    X=S[:i]
    Y=S[i:]
    setX=set(X)
    setY=set(Y)
    intersectionXY=setX & setY
    _temp=len(intersectionXY)
    if _temp>ans:
        ans=_temp
    else:
        pass
print(ans)

### FIXED CODE ###

N=int(input())
S=input()



ans=0

for i in range(1,N):
    X=S[:i]
    Y=S[i:]
    setX=set(X)
    setY=set(Y)
    intersectionXY=setX & setY
    _temp=len(intersectionXY)
    if _temp>ans:
        ans=_temp
    else:
        pass
print(ans)
n_k = list(map(int, input().split()))
n = n_k[0]
k = n_k[1]
a = list(map(int, input().split()))
a_pos = list(filter(lambda v: v > 0, a))
a_neg = list(filter(lambda v: v < 0, a))

a_pos.sort(reverse=True)
a_neg.sort()

ans = 1
if len(a_pos) == 0 and k % 2 == 1:
    j = len(a_neg) - 1
    for i in range(k):
        ans = ans * a_neg[j] % 100000007;
        j = j - 1
else:
    i = 0
    while True:
        if i >= k:
            break
        if i == k - 1 or len(a_neg) < 2 or a_pos[0] > a_neg[0] * a_neg[1]:
            ans = ans * a_pos[0] % 1000000007
            a_pos.pop(0)
            i = i + 1
        else:
            ans = ans * a_neg[0] * a_neg[1] % 1000000007
            a_neg.pop(0)
            a_neg.pop(0)
            i = i + 2
print(ans)


### FIXED CODE ###

import sys

input = sys.stdin.readline

n_k = list(map(int, input().split()))
n = n_k[0]
k = n_k[1]
a = list(map(int, input().split()))
a_pos = list(filter(lambda v: v >= 0, a))
a_neg = list(filter(lambda v: v < 0, a))

a_pos.sort(reverse=True)
a_neg.sort()

mod = 10**9+7

ans = 1
if n == k:
    for a_i in a:
        ans = ans * a_i % mod
elif len(a_pos) == 0 and k % 2 == 1:
    for i in reversed(range(len(a_neg) - k, len(a_neg))):
        ans = ans * a_neg[i] % mod
else:
    i_p = 0
    i_n = 0
    i = 0
    while i < k:
        if i_p < len(a_pos) and (i == k - 1 or i_n+1 >= len(a_neg) or a_pos[i_p] * (a_pos[i_p+1] if i_p+1 < len(a_pos) else 1) > a_neg[i_n] * a_neg[i_n+1]):
            ans = ans * a_pos[i_p] % mod
            i_p += 1
            i += 1
        else:
            ans = ans * a_neg[i_n] % mod * a_neg[i_n+1] % mod
            i_n += 2
            i += 2
print(ans)
S = raw_input().split(' ')
S[0] = int(S[0])
S[1] = int(S[1])
 
d = str(S[0]/S[1])
r = str(S[0]%S[1])
f = str(1.0*S[0]/S[1])
 
print(d + " " + r + " " + format(f, '.7f'))

### FIXED CODE ###

S = raw_input().split(' ')
S[0] = int(S[0])
S[1] = int(S[1])
 
d = str(S[0]/S[1])
r = str(S[0]%S[1])
f = format(1.0*S[0]/S[1], ".8f")
 
print(d + " " + r + " " + f)
N,M = (int(x) for x in input().split())

#魔法実行回数
magic_act_num = 0

known = [False for x in range(N)]
judge = 0
for i in range(M):
	x,y,z = (int(x) for x in input().split())

	# zは気にしなくてよい
	if i == 0:
		known[x-1]=True
		known[y-1]=True
		judge += 2
		magic_act_num+=1
	else:
		if known[x-1] == True:
			if known[y-1] == True:
				continue
			else:
				known[y-1] = True
				judge += 1
		else:
			if known[y] == True:
				known[x-1] = True
				judge += 1
			else:
				known[x-1] = True
				known[y-1] = True
				judge += 2
				magic_act_num+=1

magic_act_num += (N-judge)

print(magic_act_num)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

class UnionFind:
    def __init__(self, num):
        self.p = [x for x in range(num)]
    def root(self, x):
        if self.p[x] == x:
            return x
        else:
            self.p[x] = self.root(self.p[x])
            return self.p[x]
    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx != ry:
            self.p[ry] = rx

def main():
    N, M = (int(x) for x in input().split())
    u = UnionFind(N)

    for i in range(M):
        x,y,_ = map(int, input().split())
        u.unite(x-1, y-1)

    rlist = set()
    for i in range(N):
        rlist.add(u.root(i))

    print(len(rlist))

if __name__ == '__main__':
    main()
N = int(input())
mapping = 'zabcdefghijklmnopqrstuvwx'
res = []
for i in range(1, 99):
    if N <= 26 ** i:
        for j in range(i):
            res.append(mapping[N % 26])
            N //= 26
        break
    else:
        N -= 26 ** i
print(''.join(res))

### FIXED CODE ###

N = int(input())
res = []
while N:
    r = N % 26
    if r == 0:
        r = 26
    res.append(chr(r + 96))
    if r == 26:
        N -= 1
    N //= 26
res.reverse()
print(''.join(res))
def main():
  N, M = list(map(int, input().split(' ')))

  root = [[] for i in range(M+1)]
  for i in range(M):
    A, B = list(map(int, input().split(' ')))
    root[A].append(B)
    root[B].append(A)

  mitisurube = [-1 for i in range(N+1)]
  cost = [-1 for i in range(N+1)]
  next_ = [1]
  cost[1] = 0

  while next_:
    now_pos = next_.pop(0)
    for next_pos in root[now_pos]:
      if cost[next_pos] == -1 or cost[next_pos] > cost[now_pos] + 1:
        cost[next_pos] = cost[now_pos] + 1
        mitisurube[next_pos] = now_pos
        next_.append(next_pos)
  #print('root')
  #print(*root)
  #print('cost')
  #print(*cost)
  #print('mitisirube')
  if mitisurube.count(-1) < 3:
    print('Yes')
    print(*mitisurube[2:], sep='\n')
  else:
    print('No')

if __name__ == '__main__':
  main()

### FIXED CODE ###

from collections import deque

def main():
  N, M = list(map(int, input().split(' ')))

  root = [[] for i in range(N+1)]
  for i in range(M):
    A, B = list(map(int, input().split(' ')))
    root[A].append(B)
    root[B].append(A)

  mitisurube = [-1 for i in range(N+1)]
  next_ = deque()
  next_.append(1)

  while next_:
    now_pos = next_.popleft()
    for next_pos in root[now_pos]:
      if mitisurube[next_pos] == -1:
        mitisurube[next_pos] = now_pos
        next_.append(next_pos)
  #print('root')
  #print(*root)
  #print('mitisirube')
  print('Yes')
  print(*mitisurube[2:], sep='\n')

if __name__ == '__main__':
  main()
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from math import ceil
    K=int(input())
    X,Y=map(int,input().split())

    # defaultは 0 <= Y <= X
    def trans(u,v):
        if(abs(X)<abs(Y)): u,v=v,u
        if(X<0): u=-u
        if(Y<0): v=-v
        return u,v

    x,y=max(abs(X),abs(Y)),min(abs(X),abs(Y))
    if(K%2==0 and (X+Y)&1):
        print(-1)
        return

    # x+y<K
    if(x+y<K and (x+y)&1):
        print(3)
        print(*trans(x,-K+x))
        print(*trans(x+(K+x-y)//2,-(K-x-y)//2))
        print(*trans(x,y))
        return
    if(x+y<K and (not (x+y)&1)):
        print(2)
        print(*trans((x+y)//2,-k+(x+y)//2))
        print(*trans(x,y))
        return

    # x+y>=K
    c=(-x-y)%K
    n=ceil((x+y)/K)+(c&1)
    l=(K*n-x-y)//2
    print(n)
    nx,ny=K-l,-l
    print(*trans(nx,ny))
    while(nx+K<=x):
        nx+=K
        print(*trans(nx,ny))
    nx,ny=x,ny+(K-(x-nx))
    print(*trans(nx,ny))
    while(ny+K<=y):
        ny+=K
        print(*trans(nx,ny))
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from math import ceil
    K=int(input())
    X,Y=map(int,input().split())
    # defaultは 0 <= Y <= X
    def trans(u,v):
        if(abs(X)<abs(Y)): u,v=v,u
        if(X<0): u=-u
        if(Y<0): v=-v
        return u,v

    x,y=max(abs(X),abs(Y)),min(abs(X),abs(Y))
    if(K%2==0 and (X+Y)&1):
        print(-1)
        return

    # x+y<K
    if(x+y<K and (x+y)&1):
        print(3)
        print(*trans(x,-K+x))
        print(*trans(x+(K+x-y)//2,-(K-x-y)//2))
        print(*trans(x,y))
        return
    if(x+y<K and (not (x+y)&1)):
        print(2)
        print(*trans((x+y)//2,-K+(x+y)//2))
        print(*trans(x,y))
        return

    # x+y=K
    if(x+y==K):
        print(1)
        print(*trans(x,y))
        return
    
    # x+y>K
    c=(-x-y)%K
    n=ceil((x+y)/K)+(c&1)
    l=(K*n-x-y)//2
    print(n)
    nx,ny=K-l,-l
    print(*trans(nx,ny))
    while(nx+K<=x):
        nx+=K
        print(*trans(nx,ny))
    nx,ny=x,ny+(K-(x-nx))
    print(*trans(nx,ny))
    while(ny+K<=y):
        ny+=K
        print(*trans(nx,ny))
resolve()
from itertools import*
from numpy import*
n,k=map(int,input().split())
k2=k+1
s=input()
if len(s)==1:
    if s=="1":
        print(1)
    else:
        print(0)
    exit()
p=[len(list(v))for k,v in groupby(s)if k=="0"]
q=[len(list(v))for k,v in groupby(s)if k=="1"]
if len(p)==1 and len(q)==0 and k>0:
    print(sum(p))
    exit()
elif len(q)==1 and len(p)==0:
    print(sum(q))
    exit()
if len(p)==1 and len(q)==1:
    if k>0:
        print(sum(p)+sum(q))
        exit()
    else:
        print(q[0])
        exit()

if s[0]=="1" and s[-1]=="0":
    x=[0]+p
    y=[0]+q+[0]
elif s[0]=="0" and s[-1]=="1":
    x=[0]+p+[0]
    y=[0]+q
else:
    x=[0]+p+[0]
    y=[0]+q+[0]
x1=array(x[:-k])
x2=array(x[k:])
x3=sum(x[:k])
t=x3+cumsum(x2-x1)
y1=array(y[:-k2])
y2=array(y[k2:])
y3=sum(y[:k2])
f=y3+cumsum(y2-y1)

print(max(max(t+f),x3+y3))

### FIXED CODE ###

from itertools import*
from numpy import*
n,k=map(int,input().split())
k=2*k+1
s=input()
x=[0]*(s[0]=="0")+[len(list(v))for k,v in groupby(s)]+[0]*(s[-1]=="0")
#print(x)
x1=array(x[k:])
x2=array(x[:-k])
x3=sum(x[:k])
y=[x3]+list(x3+cumsum(x1-x2))
print(max(y[::2]))
s = list(input())
k = int(input())
ansnum = 0

for j in range(k):
    # listj = []
    # for i in range(len(s)-j):
    #     #print(s[i:i+j+1])
    #     listj.append(s[i:i+j+1])
    listj = [s[i:i + j + 1] for i in range(len(s) - j)]
    listj.sort()
    # print('listj:',listj)
    # print('j:',j)
    if len(listj) >= 2 and listj[0] == listj[1]:
        # print('choufuku')
        pass
    else:
        # j+1文字で重複なしの場合(j=0,1,2,3,4)
        s = ''.join(s)
        lens = len(s)
        for i in range(len(listj)):
            num = s.index(''.join(listj[i]))
            a = lens - num
            # print('index:',num)
            # print('ansnum:',ansnum)
            if a < k - ansnum:
                ansnum += a
            else:
                ans = s[num:num + k - ansnum]
                ansnum = k + 1
                break
    if ansnum > k:
        break

#print('ans:',ans)
print(ans)

### FIXED CODE ###

s = list(input())
k = int(input())
subs = []
for i in range(min(k,len(s))):
  for j in range(len(s)-i):
    subs.append(''.join(s[j:j+i+1]))
subs = list(set(subs))
subs.sort()
#print(subs)
print(subs[k-1])
import numpy as np
N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=(n+1)
t=np.empty(N+1)
t[0] = 0
t=np.cumsum(n)
print(max(t[K:]-t[:-K])*0.5)

### FIXED CODE ###

import numpy as np

N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=(n+1)
t=np.empty(N+1)
t[0] = 0
t[1:]=np.cumsum(n)
print(max(t[K:]-t[:-K])*0.5)
d = int(input())
t = int(input())
s = int(input())
if (t*s >= d):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

D, T, S = map(int, input().split())
if T*S >= D:
  print("Yes")
else:
  print("No")
S=int(input())
print(2018+S[4::])

### FIXED CODE ###

s=input()
print("2018"+s[4:])
n,m = input().split()

int(n)
int(m)


print((m-1)*(n-1))

### FIXED CODE ###

n,m = input().split()

n = int(n)
m = int(m)


print((m-1)*(n-1))
import numpy as np
A,B = map(int,input().split())
b = np.arange(A,B+1)
def bin2np(a):
  return list(map(int,list(bin(a)[2:])))
# 1番長い二進数の配列を知る
max_length = len(bin2np(b[-1]))
## ここから、足りない分だけ前に挿入していく
bin2list = []
for a in b:
  c = bin2np(a)
  for _ in range(max_length-len(c)):
    c.insert(0,0)
  #print(c)
  bin2list.append(c)
bin2list = np.array(bin2list)
bin2s = list(map(str,np.where(np.sum(bin2list,axis=0)==1,1,0)))
print(int("".join(bin2s),2))
    

### FIXED CODE ###

import numpy as np
H,W = map(int,input().split())
h,w = map(int,input().split())
matrix = np.ones((H,W))
h_num = np.random.choice(H,h,replace=False)
w_num = np.random.choice(W,w,replace=False)

for _ in h_num:
  matrix[_,:] = 0
for _ in w_num:
  matrix[:,_] = 0

print(int(np.sum(matrix)))
N = input(int(N))
B = list(map(int, input().split()))
sum = B[0]

for i in range(1,N):
  sum += max(B[i-1], B[i])
print(sum)

### FIXED CODE ###

N = int(input())
B = list(map(int, input().split()))
sum = 0
 
for i in range(1,N-1):
  sum += min(B[i], B[i-1])
print(sum + B[N-2] + B[0])
INF = float('inf')
H,W = map(int,input().split())
s = [input() for _ in range(H)]
cost = [[INF]*W for _ in range(H)]
cost[0][0] = 1

def bfs(h,w):
    for dh,dw in [[1,0],[-1,0],[0,1],[0,-1]]:
        if 0<=h+dh<H and 0<=w+dw<W:
            if s[h+dh][w+dw] == '.' and cost[h+dh][w+dw] > cost[h][w]+1:
                cost[h+dh][w+dw] = cost[h][w]+1
                bfs(h+dh,w+dw)

bfs(0,0)

count = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            count += 1
 
ans = -1
if cost[H-1][W-1] != INF:
    ans = H*W-count-cost[-1][-1]
print(ans)

### FIXED CODE ###

import queue
H,W = map(int,input().split())
maze = [0]*H
for i in range(H):
    maze[i] = input()
inf = float('inf')
d = [[inf for i in range(W)] for i in range(H)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]


def bfs():
    que = queue.Queue()
    que.put((0,0))
    d[0][0] = 0
    while que.qsize():
        p = que.get()
        if p == (H-1,W-1):
            break
        for i in range(4):
            nx = p[0]+dx[i]
            ny = p[1]+dy[i]
            if 0 <= nx and nx <= H-1 and 0 <= ny and ny <= W-1 \
            and maze[nx][ny] != '#' and d[nx][ny] == inf:
                d[nx][ny] = d[p[0]][p[1]] + 1
                que.put((nx,ny))

bfs()

count = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '#':
            count += 1

ans = -1
if d[H-1][W-1] != inf:
    ans = H*W-count-1-d[H-1][W-1]
print(ans)
n = input()
return "7" in n

### FIXED CODE ###

n = input()
if "7" in n:
  print("Yes")
else:
  print("No")