Harryxun/stf_run huggingface dataset:
if input().find("9")>-1:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

if input().find('9')>-1:
  print("Yes")
else:
    print("No")
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    ns = list(map(int, sys.stdin.readline().strip()))
    ns.append(0)
    ns.reverse()

    ans = 0
    lastpay = 0

    for i in range(len(ns)):
        if lastpay == 0:
            if ns[i] <= 4 or (ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 + (10 - ns[i])
                lastpay = 1
        else:
            if lastpay + ns[i] <= 4 or (lastpay + ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 - 1 + (9 - ns[i])
                lastpay = 1
    #print(''.join(map(str, reversed(pay))))
    #print(''.join(map(str, reversed(charge))))
    #assert (sum(pay) + sum(charge)) == ans
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    ns = list(map(int, sys.stdin.readline().strip()))
    ns.reverse()
    ns.append(0)

    ans = 0
    lastpay = 0

    for i in range(len(ns)):
        if lastpay == 0:
            if ns[i] <= 4 or (ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 + (10 - ns[i])
                lastpay = 1
        else:
            if lastpay + ns[i] <= 4 or (lastpay + ns[i] == 5 and ns[i + 1] <= 4):
                ans += ns[i]
                lastpay = 0
            else:
                ans += 1 - 1 + (9 - ns[i])
                lastpay = 1
    print(ans)

if __name__ == '__main__':
    main()
import math
n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort()
v.reverse()
if a==n:
  print(sum(v)/n)
  print(1)
elif v[a-1]!=v[a]:
  print(sum(v[0:a])/a)
  print(1)
elif v[0]!=v[a-1]:
  print(sum(v[0:a])/a)
  ct1=0;ct2=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
      if i<a:
        ct2+=1
  print(math.factorial(ct1)//(math.factorial(ct1-ct2)*math.factorial(ct2)))
else:
  print(sum(v[0:a])/a)
  ct1=0;ans=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
  for i in range(a,b+1):
    ans+=math.factorial(ct1)//(math.factorial(ct1-i)*math.factorial(i))
  print(ans)

### FIXED CODE ###

import math
n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort()
v.reverse()
if a==n:
  print(sum(v)/n)
  print(1)
elif v[a-1]!=v[a]:
  print(sum(v[0:a])/a)
  print(1)
elif v[0]!=v[a-1]:
  print(sum(v[0:a])/a)
  ct1=0;ct2=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
      if i<a:
        ct2+=1
  print(math.factorial(ct1)//(math.factorial(ct1-ct2)*math.factorial(ct2)))
else:
  print(sum(v[0:a])/a)
  ct1=0;ans=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
  for i in range(a,min(ct1+1,b+1)):
    ans+=math.factorial(ct1)//(math.factorial(ct1-i)*math.factorial(i))
  print(ans)
A,B,C = map(int,input().split())
max_val=(max([A,B,C]))
odd_chk =3 * max_val - A - B - C
if(odd_chk%2 == 0):
         print("{:.0f}".format(odd_chk/2))
else:
         print("{:.0f}".format(odd_chk+3)/2)
 

### FIXED CODE ###

A,B,C = map(int,input().split())
max_val=(max([A,B,C]))
odd_chk =3 * max_val - A - B - C
if(odd_chk%2 == 0):
         print(int(odd_chk/2))
else:
         print(int((odd_chk+3)/2))
# inp.readline()
# int(inp.readline())
# out.write()
# raw_input()
# map(int,raw_input().split())
# map(int,inp.readline().split())
# for _ in xrange(input()):
# print "Case #"+str(_+1)+": "+ 
if __name__ == "__main__":
    from sys import stdin as inp, stdout as out,setrecursionlimit as srl
    from collections import Counter,defaultdict,deque
    from heapq import *
    def upd(idx,v):
      while idx<len(b):
        b[idx]=(b[idx]+v)%mod
        idx+=(idx&-idx)
    def acc(idx):
        s=0
        while idx>0:
            s=(s+b[idx])%mod
            idx-=(idx&-idx)
        return s
    for _ in xrange(1):
        n,k=map(int,inp.readline().split())
        a=[map(int,inp.readline().split()) for i in xrange(k)]
        b=[0]*(n+1)
        b[1]=1
        mod=998244353
        for i in xrange(2,n+1):
          for l,r in a:
            upd(i,acc(i-l+1)-acc(max(0,i-r)))
        print (acc(n+1)-acc(n))%mod

### FIXED CODE ###

# inp.readline()
# int(inp.readline())
# out.write()
# raw_input()
# map(int,raw_input().split())
# map(int,inp.readline().split())
# for _ in xrange(input()):
# print "Case #"+str(_+1)+": "+ 
if __name__ == "__main__":
    from sys import stdin as inp, stdout as out,setrecursionlimit as srl
    from collections import Counter,defaultdict,deque
    from heapq import *
    for _ in xrange(1):
        n,k=map(int,inp.readline().split())
        a=[map(int,inp.readline().split()) for i in xrange(k)]
        b=[0]*(n+1)
        b[1]=1
        mod=998244353
        for i in xrange(2,n+1):
          b[i]=b[i-1]
          for l,r in a:
            b[i]=(b[i]+b[max(0,i-l)]-b[max(0,i-r-1)])%mod
        print (b[-1]-b[-2])%mod
input()
a=input()
a=a[a.index('W'):]
b=a.count('R')
print(b-a[:b].count('R'))

### FIXED CODE ###

input()
a=input()
if 'W'not in a:print(0);exit()
a=a[a.index('W'):]
b=a.count('R')
print(b-a[:b].count('R'))
import sys

sys.setrecursionlimit = 10**6

n = int(input())
tr = [list() for _ in range(n)]
num = [None]*n
ran = [0]*n
dep = [0]*n
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1; b -= 1
  tr[a].append(b)
  tr[b].append(a)
k = int(input())
root,c = map(int,input().split())
root -= 1
num[root] = c
def dfs(v,p,dep):
  for x in tr[v]:
    if x == p:
      continue
    dep[x] = dep[v] + 1
    dfs(x,v,dep)
  return
dfs(root,None,dep)
for _ in range(k-1):
  v,c = map(int,input().split())
  v -= 1
  if abs(c-num[root]) > dep[v] or dep[v]%2 != (c-num[root])%2:
    print("No")
    exit(0)
  num[v] = c

def dfs2(v,p,ran):
  cur = [-10**9,10**9] if (num[v] is None) else [num[v],num[v]]
  if tr[v] == [p]: 
    ran[v] = tuple(cur)
    return ran[v]
  for x in tr[v]:
    if x == p:
      continue
    ran[x] = dfs2(x,v,ran)
    if ran[x][0] > cur[0]:
      cur[0] = ran[x][0]
    if ran[x][1] < cur[1]:
      cur[1] = ran[x][1]
  cur[0] -= 1; cur[1] += 1
  ran[v] = tuple(cur)
  return ran[v]

dfs2(root,None,ran)
  
q = [(root,None)]
while q:
  v,p = q.pop()
  for x in tr[v]:
    if x == p:
      continue
    if ran[x][0]<=num[v]+1<=ran[x][1]:
      num[x] = num[v] + 1
    elif ran[x][0]<=num[v]-1<=ran[x][1]:
      num[x] = num[v] - 1
    else:
      print("No")
      exit(0)
    q.append((x,v))
print("Yes")
for c in num:
  print(c)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

n = int(input())
tr = [list() for _ in range(n)]
num = [None]*n
ran = [0]*n
dep = [0]*n
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1; b -= 1
  tr[a].append(b)
  tr[b].append(a)
k = int(input())
root,c = map(int,input().split())
root -= 1
num[root] = c
def dfs(v,p,dep):
  for x in tr[v]:
    if x == p:
      continue
    dep[x] = dep[v] + 1
    dfs(x,v,dep)
  return
dfs(root,-1,dep)
for _ in range(k-1):
  v,c = map(int,input().split())
  v -= 1
  if abs(c-num[root]) > dep[v] or dep[v]%2 != (c-num[root])%2:
    print("No")
    exit(0)
  num[v] = c

def dfs2(v,p,ran):
  cur = [-10**9,10**9] if num[v] is None else [num[v],num[v]]
  if tr[v] == [p]: 
    ran[v] = tuple(cur)
    return
  for x in tr[v]:
    if x == p:
      continue
    dfs2(x,v,ran)
    if ran[x][0] > cur[0]:
      cur[0] = ran[x][0]
    if ran[x][1] < cur[1]:
      cur[1] = ran[x][1]
  cur[0] -= 1; cur[1] += 1
  ran[v] = tuple(cur)
  return

dfs2(root,None,ran)
  
q = [(root,None)]
while q:
  v,p = q.pop()
  for x in tr[v]:
    if x == p:
      continue
    if ran[x][0]<=num[v]+1<=ran[x][1]:
      num[x] = num[v] + 1
    elif ran[x][0]<=num[v]-1<=ran[x][1]:
      num[x] = num[v] - 1
    else:
      print("No")
      exit(0)
    q.append((x,v))
print("Yes")
for c in num:
  print(c)
i = 1
while True:
    n = input()
    if n == 0:
        break
    print("Case ",i,": ",n,sep="")

### FIXED CODE ###

i = 1
while True:
    n = int(input())
    if n == 0:
        break
    print("Case ",i,": ",n,sep="")
    i += 1
a,b = map(int,input())
if a != b:
    ans = max(a,b) + max(a,b) - 1
else:
    ans = a*2:
print(ans)


### FIXED CODE ###

a,b = map(int,input().split())
if a != b:
    ans = max(a,b) + max(a,b) - 1
else:
    ans = a*2
print(ans)
x, a = map(input().split())
if x < a:
  print(0)
else:
  print(10)

### FIXED CODE ###

x, a = map(int, input().split())
if x < a:
  print(0)
else:
  print(10)
a,b,c=map(int,input().split())
print(max(a,b,c)*9+sum(a,b,c))

### FIXED CODE ###

a,b,c=map(int,input().split())
print(max(a,b,c)*9+sum([a,b,c]))
a, loop = input().split()
string = input()

import re
for i in range(int(loop)):
  j, k = input().split()
  #print(string[int(j)-1:int(k)].count('AC'))  # TLE
  print(re.findall('AC', string[int(j)-1:int(k)])

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
  t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])
R = int(input())
G = int(input())

print(2G-R)

### FIXED CODE ###

R = int(input())
G = int(input())

print(2*G-R)
from collections import deque

N = int(input())
color = [0]*(N+1)
color_val = -1
finded = set()
codebook = {0:0, 1:1}

for _ in range(N-1):
    u, v, w = map(int, input().split())
    if u in finded and v in finded:
        if color[u] in codebook:
            codebook[color[v]] = (codebook[color[u]] + (w % 2)) % 2
            if color[v] % 2 == 0:
                codebook[color[v] + 1] = (codebook[color[v]] + 1) % 2
            else:
                codebook[color[v] - 1] = (codebook[color[v]] + 1) % 2
        else:
            codebook[color[u]] = (codebook[color[v]] + (w % 2)) % 2
            if color[u] % 2 == 0:
                codebook[color[u] + 1] = (codebook[color[u]] + 1) % 2
            else:
                codebook[color[u] - 1] = (codebook[color[u]] + 1) % 2
    elif u in finded:
        finded.add(v)
        color[v] = (color[u] + (w % 2)) % 2 + color[u]//2 * 2
    elif v in finded:
        finded.add(u)
        color[u] = (color[v] + (w % 2)) % 2 + color[v]//2 * 2
    else:
        finded.add(u)
        finded.add(v)
        color_val += 1
        if w % 2 == 0:
            color[u], color[v] = 2 * color_val, 2 * color_val
        if w % 2 != 0:
            color[u], color[v] = 2 * color_val, 2 * color_val + 1

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

### FIXED CODE ###

from collections import deque

N = int(input())
tree = [dict() for _ in range(N+1)]
color = [0]*(N+1)
parent = [0]*(N+1)
for _ in range(N-1):
    u, v, w = map(int, input().split())
    w %= 2
    tree[u][v] = w
    tree[v][u] = w

que = deque([1])
while len(que) != 0:
    u = que.pop()
    Rel, c, p = tree[u], color[u], parent[u]
    for v in Rel.keys():
        if v == p:
            continue
        elif Rel[v] == 0:
            color[v] = c
        else:
            color[v] = c^1
        parent[v] = u
        que.append(v)

for c in color[1:]:
    print(c)
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

nn = int(input())
aa = list(map(int,input().split()))

ne = [0]*nn
cn = [0]*nn
cnminus1 = [0]*nn
#print(nn,aa)

for i in range(nn):
    ne[aa[i]] += 1

for i in range(nn):
 #   print(ne[i])
    if ne[i] == 0:
        cn[i] = 0
        cnminus1[i] = 0
    elif ne[i] == 1:
        cn[i] = 0
        cnminus1[i] = 0
    elif ne[i] == 2:
        cn[i] = 1
        cnminus1[i] = 0
    else:
        cn[i] = combinations_count(ne[i],2)
        cnminus1[i] = combinations_count(ne[i]-1,2)

sum_cn = sum(cn)

for i in range(nn):
    print(sum_cn - cn[aa[i]] + cnminus1[aa[i]])



### FIXED CODE ###

import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

nn = int(input())
aa = list(map(int,input().split()))

ne = [0]*(nn+1)
cn = [0]*(nn+1)
cnminus1 = [0]*(nn+1)
#print(nn,aa)
#print(len(ne))
for i in range(nn):
    ne[aa[i]] += 1

for i in range(nn+1):
 #   print(ne[i])
    if ne[i] == 0:
        cn[i] = 0
        cnminus1[i] = 0
    elif ne[i] == 1:
        cn[i] = 0
        cnminus1[i] = 0
    elif ne[i] == 2:
        cn[i] = 1
        cnminus1[i] = 0
    else:
        cn[i] = combinations_count(ne[i],2)
        cnminus1[i] = combinations_count(ne[i]-1,2)

sum_cn = sum(cn)

for i in range(nn):
    print(sum_cn - cn[aa[i]] + cnminus1[aa[i]])
def main():

  n,m=map(int,input().split())
  a=list(map(int,input().split()))
  for i in range(m):
    a.sort(reverse=True)
    a[0]=a[0]//2
  print(sum(a))
  
main()


### FIXED CODE ###

s=input()
if s =="Sunny":
  ans="Cloudy"
elif s == "Cloudy":
  ans="Rainy"
else:
  ans="Sunny"

print(ans)
X = int(input());
A = int(input());

if X<A:
  print(0);
elif X>=A:
  print(10);
 



### FIXED CODE ###

x, a = map(int, input().split())
 
if x < a:
    print(0)
else:
    print(10)
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
 
int main(){
  ll n, m, sum=0;
  cin >> n >> m;
  vector<ll> lst(n);
  for(int i=0; i<n; i++) cin >> lst[i];
  for(int i=0; i<m; i++){
    for(int j=0; j<n; j++){
      if(lst[j]==*max_element(lst.begin(), lst.end()))
        lst[j] /= 2;
      	break;
    }
  }
  for(int i; i<n; i++)sum+=lst[i];
  cout << sum << endl;
}

### FIXED CODE ###

import heapq
n, m = map(int, input().split())
lst = list(map(lambda x:-1*int(x), input().split()))
heapq.heapify(lst)
for i in range(m):
  heapq.heappush(lst, -(-heapq.heappop(lst)//2))
print(-1*sum(lst))
N = input()
N = N[::-1]
ans = 0
p = 0
for i in range(len(N)):
    p += int(N[i])
    if p<5:
        ans += p
        p = 0
    elif p==5:
        if int(N[i+1])>=5:
            ans += 5
            p = 1
        else:
            ans += 5
            p = 0
    else:
        ans += 10-p
        p = 1
if p==1:
    ans += 1
print(ans)

### FIXED CODE ###

N = input()
N = N[::-1]
ans = 0
p = 0
for i in range(len(N)):
    p += int(N[i])
    if p<5:
        ans += p
        p = 0
    elif p==5:
        if i+1==len(N):
            ans += 5
            p = 0
        elif int(N[i+1])>=5:
            ans += 5
            p = 1
        else:
            ans += 5
            p = 0
    else:
        ans += 10-p
        p = 1
if p==1:
    ans += 1
print(ans)
N = int(input())

for h in range(1, 3501):
  if 1 / h < 4 / N:
    for n in range(1, h + 1):
      if 1 / h + 1 / n < 4 / N:
        w = 1 / (4 / N - 1 / h - 1 / n)
        if w.is_integer() w > 0:
          print(h, n, int(w))
          exit()

### FIXED CODE ###

N = int(input())

for h in range(1, 3501):
  for n in range(h, 3501):
    if (4 * h * n - N * n - h * N) == 0:
      continue
    w = (N * h * n) / (4 * h * n - N * n - h * N)
    if w.is_integer() and 1 <= w < 3501:
      print(h, n, int(w))
      exit()
import random
import copy

H, W = map(int, input().split(" "))
A=[]
for i in range(H):
    A.append ([int(i) for i in input().split()])

B=np.zeros((H,W), int)
C=np.zeros((H,W), int)
B = copy.deepcopy(A)

cnt=0
def move_area(arr, cnt_odd):
    global A
    global B
    global C
    # print ("cnt_odd = " + str(cnt_odd))
    random.shuffle(arr)
    # print (arr)
    C=copy.deepcopy(A)

    i=int(cnt_odd/2)
    while i>0:
        a=random.randrange(len(arr))
        b=random.randrange(len(arr))
        if a != b:
            if abs(arr[a][0]-arr[b][0]) + abs(arr[a][1]-arr[b][1]) == 1:
                if C[arr[a][0]][arr[a][1]] % 2 != 0:
                    if C[arr[b][0]][arr[b][1]] % 2 != 0:
                        i -= 1

                    C[arr[a][0]][arr[a][1]] -= 1
                    C[arr[b][0]][arr[b][1]] += 1
                    print (str(arr[a][0]) + " " + str(arr[a][1]) + " " + str(arr[b][0]) + " " + str(arr[b][1]))

#    random.shuffle(arr)
#    print ("Move")
#    print (arr)
#    print ("")
def conn(arr, cnt, cnt_odd, depth):
    global A
    global B
    flg=0
    for y,x in arr:
        for yd, xd in [[0,0],[-1,0],[1,0],[0,-1],[0,1]]:
            if y+yd >= 0 and y+yd < H and x+xd >= 0 and x+xd < W:
                if B[y+yd][x+xd] != 0:
                    if [y+yd,x+xd] not in arr:
                        arr.append([y+yd,x+xd])
                    # print (str(y+yd) + " " + str(x+xd))
                    flg = 1
                    cnt += 1
                    if B[y+yd][x+xd] % 2 != 0:
                        cnt_odd += 1
                    B[y+yd][x+xd] = 0
    
    if flg > 0:
        conn(arr, cnt, cnt_odd, depth + 1)
    
    if depth ==0:
        move_area(arr, cnt_odd)
    
    return cnt % 2
    
y = random.randrange(H) 
x = random.randrange(W) 
tmp = 0
for yy in range(H):
    for xx in range(W):
        if A[yy][xx] != 0:
            cnt_odd=0
            tmp += conn([[yy,xx]], cnt, 0, 0)

### FIXED CODE ###

H, W = map(int, input().split(" "))
A=[]
for i in range(H):
    A.append ([int(i) for i in input().split()])

ret=[]
temp=0
N=0

for y in range(H):
    for x in range(W-1):
        if A[y][x] % 2 != 0:
            A[y][x] -= 1
            A[y][x+1] += 1
            ret.append(str(y+1) + " " + str(x+1) + " " + str(y+1) + " " + str(x+1+1))
            N+=1

for y in range(H-1):
    if A[y][W-1] % 2 != 0:
        A[y][W-1] -= 1
        A[y+1][W-1] += 1
        ret.append(str(y+1) + " " + str(W) + " " + str(y+1+1) + " " + str(W))
        N+=1
        
print (N)
for r in ret:
    print (r)
n,m=map(int,raw_input().split())

a=[]

a=map(int,raw_input().split())
a.sort()
b=[map(int,raw_input().split() )for i in range(m)]
b=sorted(b,key=lambda x: -x[1])
k=0
l=0
for i in range(m):
    if a[k]>b[i][1]:
        break
    for j in range(k,min(n,k+b[i][0])):
        if a[j] < b[i][1]:
                a[j] = b[i][1]
                l=j+1
        else:
           break
    k=l
print(sum(a))

### FIXED CODE ###

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

a=[]

a=map(int,raw_input().split())
a.sort()
b=[map(int,raw_input().split() )for i in range(m)]
b=sorted(b,key=lambda x: -x[1])
k=0
l=0
for i in range(m):
    if a[k]>b[i][1]:
        break
    for j in range(k,min(n,k+b[i][0])):
        if a[j] < b[i][1]:
                a[j] = b[i][1]
                l=j+1
        else:
           break
    k=l
    if k==n:
        k=n-1
print(sum(a))
-1000000000 0 -1000000000 0

### FIXED CODE ###

a, b, c, d = map(int, input().split())
print(max(a*c, a*d, b*c, b*d))
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while max(li)==10 :
   li.remove(max(li))
li.remove(max(li))
s+=sum(li)
print(s)

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while 10 in li :
   li.remove(max(li))
if len(li)>0 :
   li.remove(max(li))
print(s+sum(li))
x=int(input())
if x==0:
  print 1
elif x==1:
  print 0

### FIXED CODE ###

x=int(input())
if x==1:
  print(0)
elif x==0:
  print(1)
from collections import Counter
N=int(input())
a=list(map(int,input().split()))

answer=0
count_sum=0

counter = Counter(a)
for num, cnt in counter.most_common():
#  print (num, cnt)
  count_sum+=cnt
  if cnt>num:
    answer += cnt-i
  elif cnt<num:
    answer += cnt
answer+=N-count_sum
print(answer)


### FIXED CODE ###

from collections import Counter
N=int(input())
a=list(map(int,input().split()))

answer=0
count_sum=0

counter = Counter(a)
for num, cnt in counter.most_common():
#  print (num, cnt)
  count_sum+=cnt
  if cnt>num:
    answer += cnt-num
  elif cnt<num:
    answer += cnt
answer+=N-count_sum
print(answer)
N, S = [int(_) for _ in input().split()]
#dp[i][j] S[i-x:i+1]==S[j-x:j+1]となる最大のx
dp = [[0] * (N + 1) for _ in range(N + 1)]
ans = 0
for i in range(N - 1):
    for j in range(i+1,N):
        if S[i]==S[j]:
        dp[i][j] = min(j - i, dp[i - 1][j - 1] + 1)
        ans = max(ans, dp[i])
print(ans)


### FIXED CODE ###

import itertools
N = int(input())
S = input()
dp = [[0] * N for _ in range(N)]
ans = 0
for i, j in itertools.combinations(range(N), 2):
    if S[i] == S[j]:
        dp[i][j] = dp[i - 1][j - 1] + 1
    else:
        dp[i][j] = 0
    ans = max(ans, min(j - i, dp[i][j]))
print(ans)
s=set(input())
S=set(a,b,c)
if s==S:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

s=list(input())
if "a" in s:
    if "b" in s:
        if "c" in s:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")
n, q = [int(el) for el in input().split(' ')]
data = [0] * n
ex_result, exx_result = 0,0
ex_index = 0
for _ in range(q):
    a, v = [int(el) for el in input().split(' ')]
    data[a-1] += v
    if ex_index != a:
        if v < 0: result = ex_result
        else: result = max(ex_result, data[a-1])
    elif ex_index == a:
        if v > 0: result = data[a-1]
        else: result = max(data[a-1], exx_result)
    index = data.index(result)+1
    print(index, result)
    exx_result = ex_result
    ex_result = result
    ex_index = index

### FIXED CODE ###

n, q = [int(el) for el in input().split(' ')]
data = [0] * n
result, index = 0, 1
for _ in range(q):
    a, v = [int(el) for el in input().split(' ')]
    data[a-1] += v
    if v > 0:
        if result < data[a-1]:
            result, index = data[a-1], a
        elif result == data[a-1]:
            index = min(index, a)
    else:
        if index == a:
            result = max(data)
            index = data.index(result) + 1
    print(index, result)
s = input()


if s=='SUN':
    ans = 7
elif s=='MON':
    ans = 6
elif s=='TUE':
    ans = 5
elif s=='TWED':
    ans = 4
elif s=='THU':
    ans = 3
elif s=='FRI':
    ans = 2
elif s=='SAT':
    ans = 1

print(ans)


### FIXED CODE ###

s = input()


if s=='SUN':
    ans = 7
elif s=='MON':
    ans = 6
elif s=='TUE':
    ans = 5
elif s=='WED':
    ans = 4
elif s=='THU':
    ans = 3
elif s=='FRI':
    ans = 2
elif s=='SAT':
    ans = 1

print(ans)
import bisect
N = int(input())
P = map(int, input().split())
P_id = [0]*(N + 1)

for i in range(N):
    P_id[P[i]] = i

A = [- 1, P_id[N], N] 

res = 0
for i in range(N - 1, 0, - 1):
    j = bisect.bisect_left(A, P_id[i])
    A.insert(j, P_id[i])
    l1 = A[j - 1]
    r1 = A[j + 1]
    l2 = l1
    r2 = r1
    if l1 != - 1:
        l2 = A[j - 2]
    if r1 != N:
        r2 = A[j + 2]
    
    res += i*((A[j] - l1)*(r2 - r1) + (l1 - l2)*(r1 - A[j]))

print(res)

### FIXED CODE ###

import bisect
import array
N = int(input())
P = list(map(int, input().split()))
P_id = [0]*(N + 1)

for i in range(N):
    P_id[P[i]] = i

A = array.array('i', [- 1, P_id[N], N])


res = 0
for i in range(N - 1, 0, - 1):
    j = bisect.bisect_left(A, P_id[i])
    A.insert(j, P_id[i])
    l1 = A[j - 1]
    r1 = A[j + 1]
    l2 = l1
    r2 = r1
    if l1 != - 1:
        l2 = A[j - 2]
    if r1 != N:
        r2 = A[j + 2]
    
    res += i*((A[j] - l1)*(r2 - r1) + (l1 - l2)*(r1 - A[j]))

print(res)
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
a_L = list(map(int,input().split()))
c = lcm(*a_L) -1

#print(c)
ans = 0
for val in a_L:
    ans += c%val
print(ans)


### FIXED CODE ###


import fractions

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

ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

c = ans -1

#print(c)
ans = 0
for val in a:
    ans += c%val
print(ans)