Harryxun/stf_run huggingface dataset:
N = int(input())
li = list(map(int,input().split()))
out_count = 0


for j in range(N - 1 , 0 , -1):
  if li[j] >= li[j - 1] + 2:
    out_count += 1
  elif li[j] == li[j - 1] + 1:
    li[j - 1] -= 1
if li[0] > li[1]:
  out_count += 1
    
if out_count == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = int(input())
li = list(map(int,input().split()))
out_count = 0

for j in range(N - 1 , 0 , -1):
  if li[j] <= li[j - 1] - 2:
    out_count += 1
  elif li[j] == li[j - 1] - 1:
    li[j - 1] -= 1
if out_count == 0:
  print('Yes')
else:
  print('No')
N = int(input())
a = list(map(int, input().split()))

from collections import deque
kisuu = deque([])
bai4 = deque([])
sonota = deque([])
for ai in a:
    if ai % 4 == 0:
        bai4.append(ai)
    elif ai % 2 == 0:
        sonota.append(ai)
    else:
        kisuu.append(ai)

ans = deque([])
if kisuu:
    s = kisuu.pop()
    ans.append(s)
elif sonota:
    s = sonota.pop()
    ans.append(s)
else:
    s = bai4.pop()
    ans.append(s)        

for i in range(1, N + 1):
    if i == N:
        print('Yes')
        quit()
    if ans[i - 1] % 2 == 1:
        if bai4:
            s = bai4.pop()
            ans.append(s)
        else:
            break
    elif ans[i - 1] % 2 == 0 and ans[i - 1] % 4 != 0:
        if sonota:
            s = sonota.pop()
            ans.append(s)
        elif bai4:
            s = sonota.pop()
            ans.append(s)
        else:
            break
    else:
        if kisuu:
            s = kisuu.pop()
            ans.append(s)
        elif sonota:
            s = sonota.pop()
            ans.append(s)
        elif bai4:
            s = sonota.pop()
            ans.append(s)
        else:
            break
print('No')           


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
from collections import deque
kisuu = deque([])
bai4 = deque([])
sonota = deque([])
for ai in a:
    if ai % 4 == 0:
        bai4.append(ai)
    elif ai % 2 == 0:
        sonota.append(ai)
    else:
        kisuu.append(ai)

ans = deque([])
if kisuu:
    s = kisuu.pop()
    ans.append(s)
elif sonota:
    s = sonota.pop()
    ans.append(s)
else:
    s = bai4.pop()
    ans.append(s)        

for i in range(1, N + 1):
    if i == N:
        print('Yes')
        quit()
    if ans[i - 1] % 2 == 1:
        if bai4:
            s = bai4.pop()
            ans.append(s)
        else:
            break
    elif ans[i - 1] % 2 == 0 and ans[i - 1] % 4 != 0:
        if sonota:
            s = sonota.pop()
            ans.append(s)
        elif bai4:
            s = bai4.pop()
            ans.append(s)
        else:
            break
    elif ans[i - 1] % 4 == 0:
        if kisuu:
            s = kisuu.pop()
            ans.append(s)
        elif sonota:
            s = sonota.pop()
            ans.append(s)
        elif bai4:
            s = bai4.pop()
            ans.append(s)
        else:
            break
print('No')
a = int(input())
b = int(input())
c = a * b

if c % 2 == 0:
  return "Even"
else:
  return "Odd"

### FIXED CODE ###

a, b = map(int, input().split())
if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
n,a,b = map(int,input().split())
ans = 0

for i in range(n+1):
    if a<= sum(map(int,list(str(i))) <=b
        ans += i
print(ans)


n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)
s = list(map(int, input().split()))
if s[0] != s[1] != s[2] != s[3]:
    print('Good')
else:
    print('Bad')


### FIXED CODE ###

s = list(input())
if s[0] != s[1] and s[1] != s[2] and s[2] != s[3]:
    print('Good')
else:
    print('Bad')
n = int(input())
l = map(int,input().split())
if max(l) < sum(l-[max(l)]):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = input()
l = map(int,input().split())
ld = sorted(l, reverse=True)
m = ld[0]
h = sum(ld[1:])
if m < h:
  print("Yes")
else:
  print("No")
print(!int(input()))

### FIXED CODE ###

print(int(not int(input())))
def combinations(N, K):
    N = int(N)
    K = int(K)
    elif N == K:
        return 1
    else:
        return N - K + 1
    
N, K = input().split(' ')

print(combinations(N, K))

### FIXED CODE ###

def combinations(N, K):
    N = int(N)
    K = int(K)
    if N == K:
        return 1
    else:
        return N - K + 1
    
N, K = input().split(' ')

print(combinations(N, K))
def main():
    from collections import Counter
    n, *a = map(int, open(0).read().split())
    b = Counter(a)
    c = [[k, v] for k, v in b.items()]
    c.sort(key=lambda x: x[1], reverse=True)
    x = c[0][0]
    al, ar = c[0][1], c[0][1]
    if b.get(x - 1) is not None:
        al += b.get(xl - 1)
    if b.get(x - 2) is not None:
        al += b.get(xl - 2)
    if b.get(x + 1) is not None:
        al += b.get(x + 1)
    if b.get(x + 2) is not None:
        al += b.get(x + 2)

    print(max(al, ar))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from collections import Counter
    n, *a = map(int, open(0).read().split())
    b = Counter(a)
    c = [(k, v) for k, v in b.items()]
    c.sort(key=lambda x: x[0])
    ans = 0
    c = [c[0]] + c + [c[-1]]
    for x, y, z in zip(c, c[1:], c[2:]):
        v = y[0]
        tmp = y[1]
        if v - x[0] == 1:
            tmp += x[1]
        if v - z[0] == -1:
            tmp += z[1]
        ans = max(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()
n,k = map(int, input().split())
a = list(map(int,input().split()))
ans = 1
c = [1]
for j in range(2*n):
    i = a[c[-1]-1]
    if i in set(c):
        g = j+1
        break
    c.append(i)
s = c.index(g)

print(c[k] if k < s else c[s - 1 + ((k-s+1) % (len(c)-s+1))])

### FIXED CODE ###

n,k = map(int, input().split())
a = list(map(int,input().split()))
ans = 1
c = [1]
d = [0]*(n+5)
d[1] = 1
for j in range(1,2*n):
    i = a[c[-1]-1]
    if d[i] == 1:
        g = i
        break
    # if i in set(c):
    #     g = i
    #     break
    d[i] = 1
    c.append(i)
s = c.index(g)
r = len(c)-s
if k <=s:
    print(c[k])
else:
    b = (k-s)%r
    print(c[s+b])
n,k =  map(int,input().split())
A = list(map(int,input().split()))

l = min(A)//(k+1) 
r = max(A)
m = (l+r)//2+1

while l<=r:
    
    m = (l+r)//2+1
    
    #m以下の長さにできるか判定
    
    # A_long = A[A>m]
    n= sum([A[i]//m for i in range(len(A)) ] )
    
    print(l,m,r,n)
    
    if n<=k:
        r=m-1
    else:
        l=m+1
        m=m+1

        
print(m)

### FIXED CODE ###

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

l = min(A)//(k+1) 
r = max(A)
m = (l+r)//2+1

while 1:
    
    m = (l+r)//2
    if m==0:
        m=1
        break

    
    #m以下の長さにできるか判定
    
    # A_long = A[A>m]
    n= sum( [  int((A[i]-0.1)//(m)) for i in range(len(A)) ] )
    
    # print(l,m,r,n)
    
    if n<=k:
        if r==m:
            break
        r=m-1
    else:
        if l==m:
            m+=1
            break
        l=m+1
        

        
print(m)
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if c[maxind][1] >= 0:
    print(c[maxind][1])
else:
    print(0)

### FIXED CODE ###

n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
H, W, m = map(int, input().split())
xs = [[0] * W for _ in range(H)]
for _ in range(m):
    h, w = map(int, input().split())
    xs[h - 1][w - 1] += 1

mxx = [0] * H
for i in range(H):
    mxx[i] = sum(xs[i])
mxy = [0] * W
for i in range(W):
    sm = 0
    for j in range(H):
        sm += xs[j][i]
    mxy[i] = sm
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, mxx[i] + mxy[j] - xs[i][j])
print(ans)


### FIXED CODE ###

H, W, m = map(int, input().split())
xs = [0] * H
ys = [0] * W
s = set()
for _ in range(m):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    xs[h] += 1
    ys[w] += 1
    s.add((h, w))

mx = max(xs)
my = max(ys)
mxs = set()
for i in range(H):
    if xs[i] == mx:
        mxs.add(i)
mys = set()
for i in range(W):
    if ys[i] == my:
        mys.add(i)
for x in mxs:
    for y in mys:
        if not (x, y) in s:
            print(mx + my)
            exit()
print(mx + my - 1)
import numpy as np
N, W = map(int, input().split())
#dp[v] vとなる最小のＷ
dp = np.full(10**5+1, 10**9+1, dtype=np.int64)
for _ in range(N):
    w,v = map(int, input().split())
    for val in range(10**5, 1, -1):
        if val - v < 1:
            break
        dp[val] = min(dp[val], dp[val - v] + w)
    if dp[v] > w:
        dp[v] = w
print(max(np.where(dp <= W)[0]))

### FIXED CODE ###

def main():
    N, W = map(int, input().split())
    #dp[v] vとなる最小のＷ
    dp = [10**9+1 for _ in range(10**5+1)]
    for _ in range(N):
        w,v = map(int, input().split())
        for val in range(10**5, 1, -1):
            if val - v < 1:
                break
            dp[val] = min(dp[val], dp[val - v] + w)
        if dp[v] > w:
            dp[v] = w
    ans = 0
    for v, w in enumerate(dp):
        if w <= W:
            ans = max(ans, v)
    print(ans)
if __name__ == '__main__':
    main()
n=int(input())
t=list(set([int(input()) for _ in range(n)]))

def f(j):
  T=max(t)
  for i in range(len(t)):
    if (T*j)%t[i]!=0:
      return f(j+1)
      break
  return T*j

print(f(1))

### FIXED CODE ###

import fractions
n=int(input())
t=set([int(input()) for _ in range(n)])
ans=1
for i in t:
  ans=(i*ans)//fractions.gcd(i,ans)
print(ans)
n,m=map(int,input().split())
ans=[10 for _ in range(n)]
for i in range(m):
    place,num=map(int,input().split())
    if ans[place-1]==10:
        ans[place-1]=num
    elif ans[place-1]!=num:
        ans=-1
        print(ans)
        break
if ans[0]==0:
    ans=-1
    print(ans)
if ans!=-1:
    for j in range(n):
        if j==0 and ans[j]==10:
            ans[j]=1
        if j>0 and ans[j]==10:
            ans[j]=0
    ans=map(str,ans)
    print("".join(ans))

### FIXED CODE ###

n,m=map(int,input().split())
placelist=[]
numlist=[]
ans=-1
for _ in range(m):
    place,num=map(int,input().split())
    placelist.append(place)
    numlist.append(num)
if n>1:
    for i in range(10**(n-1),10**n):
        cnt=0
        tmp=str(i)
        for j in range(m):
            if tmp[placelist[j]-1]==str(numlist[j]):
                cnt+=1
        if cnt==m:
            ans=tmp
            break
if n==1:
    for i in range(0,10):
        cnt=0
        tmp=str(i)
        for j in range(m):
            if tmp[placelist[j]-1]==str(numlist[j]):
                cnt+=1
        if cnt==m:
            ans=tmp
            break
print(ans)
import numpy as np

n,p = map(int, input().split())
s = list(map(int, input().strip()))

dp = np.zeros(p,dtype = int)

count = 0
d = 1
for i in range(n):
    ne_ar = np.zeros(p,dtype = int)
    if(p == 2 or p == 5):
        ne = int(s[n-i-1]) % p
        if(ne == 0):
            dp[0] += 1
        count += dp[0]
    else:
        ne = (int(s[n-i-1]) * d) % p
        ne_ar[ne:] += dp[:(p-ne)]
        ne_ar[:ne] += dp[(p-ne):]
        ne_ar[ne] += 1
        dp = ne_ar
        d *= 10
        d %= p
        count += ne_ar[0]

print(count)

### FIXED CODE ###

n,p = map(int, input().split())
s = list(map(int, input().strip()))

count = 0

if(p == 2 or p == 5): #10と互いに素ではない場合
    co = 0
    for i in range(n): #1の位から順に数を追加していく
        ne = int(s[n-i-1]) % p
        if(ne == 0):
            co += 1
        count += co
    print(count)
else:
    sta = [0]*p
    sta[0] += 1
    d = 1
    co = 0
    for i in range(n):
        ne = int(s[n-i-1]) * d % p
        co += ne
        co %= p
        sta[co] += 1
        d *= 10
        d %= p
    for i in range(p):
        count += sta[i] * (sta[i]-1) // 2
    print(count)
def main():
    N = int(input())
    P = list(map(int, input().split()))    
    cnt = 0
    i = 0
    while i < N:
        if i + 1 == P[i]:
            if i + 2 == P[i+1]:
                cnt += 1
                i += 2
            else:
                cnt += 1
                i += 1
        else:
            i += 1

    print(cnt)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    P = list(map(int, input().split()))    
    cnt = 0
    i = 0
    while i < N:
        if i + 1 == P[i]:
            if i == N - 1:
                cnt += 1
                i += 1
            else:
                if i + 2 == P[i+1]:
                    cnt += 1
                    i += 2
                else:
                    cnt += 1
                    i += 1
        else:
            i += 1

    print(cnt)

if __name__ == "__main__":
    main()
X= raw_input().split()
if X[2] + X[4] < X[0]and X[2] - X[4] > 0 and X[3] + X[4] < X[1] and X[3] - X[4] > 0:
    print "Yes"
else:
    print "No"        

### FIXED CODE ###

X= raw_input().split()
if float(X[2]) + float(X[4]) <= float(X[0])and float(X[2]) - float(X[4]) >= 0 and float(X[3]) + float(X[4]) <= float(X[1]) and float(X[3]) - float(X[4]) >= 0:
    print "Yes"
else:
    print "No"
a = input().split(" ")
N = int(a[0])
M = int(a[1])
ans1 = 10
ans2 = 10
ans3 = 10
for i in range(M):
    b = input().split(" ")
    c = int(b[0])
    d = int(b[1])
    if c == 1:
        if d == 0:
            if N == 1:
                ans1 = d:
        elif d < ans1:
            ans1 = d
    elif c == 2:
        if d < ans2:
            ans2 = d
    else:
        if d < ans3:
            ans3 = d
if ans1 == 10:
    ans1 = 0
if ans2 == 10:
    ans2 = 0
if ans3 == 10:
    ans3 = 0
if N == 1:
    print(ans1)
elif N == 2:
    if ans1 == 0:
        print(-1)
    else:
        print(str(ans1) + str(ans2))
else:
    if ans1 == 0:
        print(-1)
    else:
        print(str(ans1) + str(ans2) + str(ans3))

### FIXED CODE ###

a = input().split(" ")
N = int(a[0])
M = int(a[1])
ans1 = 10
ans2 = 10
ans3 = 10
x = 0
for i in range(M):
    b = input().split(" ")
    c = int(b[0])
    d = int(b[1])
    if c == 1:
        if ans1 == 10:
            if d == 0:
                if N == 1:
                    ans1 = 0
                else:
                    x = 1
            else:
                ans1 = d
        elif ans1 != d:
            x = 1
    elif c == 2:
        if ans2 == 10:
            ans2 = d
        elif ans2 != d:
            x = 1
    else:
        if ans3 == 10:
            ans3 = d
        elif ans3 != d:
            x = 1
if ans1 == 10:
    if N == 1:
        ans1 = 0
    else:
        ans1 = 1
if ans2 == 10:
    ans2 = 0
if ans3 == 10:
    ans3 = 0

if x == 1:
    print(-1)
else:
    if N == 1:
        print(ans1)
    elif N == 2:
        if ans1 == 0:
            print(-1)
        else:
            print(str(ans1) + str(ans2))
    else:
        if ans1 == 0:
            print(-1)
        else:
            print(str(ans1) + str(ans2) + str(ans3))
import itertools
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()

if N < M:
    mar = [X[i+1] - X[i] for i in range(len(M-1))]
    mar.sort()
    print(sum([mar[i] for i in range(M-N)]))
else:
    print(0)


### FIXED CODE ###

import itertools
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()

if N < M:
    mar = [abs(X[i+1] - X[i]) for i in range(M-1)]
    mar.sort()
    print(sum([mar[i] for i in range(M-N)]))
else:
    print(0)
#41 ABC132D
n,k=map(int,input().split())

c=[[0 for i in range(j+1)] for j in range(n+1)]
c[0][0]=1
for i in range(1,n+1):
	for j in range(i+1):
		if j==0:
			c[i][j]=c[i-1][j]
		elif j==i:
			c[i][j]=c[i-1][j-1]
		else:
			c[i][j]=c[i-1][j]+c[i-1][j-1]
for i in range(1,k+1):
	print(c[n-k+1][i]*c[k-1][i-1]%(10**9+7))

### FIXED CODE ###

#41 ABC132D
n,k=map(int,input().split())

c=[[0 for i in range(j+1)] for j in range(n+1)]
c[0][0]=1
for i in range(1,n+1):
	for j in range(i+1):
		if j==0:
			c[i][j]=c[i-1][j]
		elif j==i:
			c[i][j]=c[i-1][j-1]
		else:
			c[i][j]=c[i-1][j]+c[i-1][j-1]
for i in range(1,k+1):
	try:
		print(c[n-k+1][i]*c[k-1][i-1]%(10**9+7))
	except:
		print(0)
n, a, b = map(int, input().split())
mod = 10**9 + 7
ans = 0
MAX = 500000000
fac = [1, 1] + [0] * MAX
finv = [1, 1] + [0] * MAX
inv = [0, 1] + [0] * MAX
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = -inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def neko(n, r):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod


if n % 2:
    for i in range((n + 1) // 2):
        ans += neko(n, i) * 2 % mod
    ans -= neko(n, a)
    ans -= neko(n, b)
    print(max(ans - 1, 0))
else:
    for i in range(n // 2):
        ans += neko(n, i) * 2 % mod
    ans += neko(n, n // 2)
    ans -= neko(n, a)
    ans -= neko(n, b)
    print(max(ans - 1, 0))


### FIXED CODE ###

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


def neko(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    k = min(n - k, k)
    ans = 1
    inv = [1] * (k + 1)
    if k >= 1:
        ans *= (n - k + 1) % mod
    for i in range(2, k + 1):
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        ans = ans * (n - k + i) * inv[i] % mod
    return ans


print((pow(2, n, mod) - 1 - neko(n, a) - neko(n, b)) % mod)
a_dict = {chr(a): 0 for a in range(97, 123)}
while True:
    S = input().lower()
    for c in S:
        if c in a_dict:
            a_dict[c] += 1

    for k, v in a_dict.items():
        print('{0} : {1}'.format(k, v))



### FIXED CODE ###

import fileinput
a_dict = {chr(c): 0 for c in range(97, 123)}
for line in fileinput.input():
    line = line.lower()
    for c in line:
        if c in a_dict:
            a_dict[c] += 1

for k, v in a_dict.items():
    print('{0} : {1}'.format(k, v))
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    X = input()
    bit_num = X.count("1")

    X_minus = [0] * N # X_minus[i] = 2^i mod (bit_num - 1)
    X_plus = [0] * N # X_plus[i] = 2^i mod (bit_num + 1)
    X_minus[0], X_plus[0] = 1, 1
    for i in range(1, N):
        if bit_num != 1: X_minus[i] = (X_minus[i - 1] * 2) % (bit_num - 1)
        X_plus[i] = (X_plus[i - 1] * 2) % (bit_num + 1)
    #print("X_minus={}".format(X_minus))
    #print("X_plus={}".format(X_plus))

    rem_minus = 0
    rem_plus = 0
    for i in range(N):
        if X[N-i-1] == '1':
            if bit_num != 1: rem_minus = (rem_minus + X_minus[i]) % (bit_num - 1)
            rem_plus = (rem_plus + X_plus[i]) % (bit_num + 1)
    #print(rem_minus, rem_plus)

    for i in range(N):
        if X[i] == '0':
            bit = bit_num + 1
            n = (rem_plus + X_plus[-i-1]) % bit
        if X[i] == '1':
            bit = bit_num - 1
            n = (rem_minus - X_minus[-i-1]) % bit
        if bit == 0 or bit == 1:
            print(bit)
            continue

        cnt = 1
        while n != 0:
            bit = bin(n).count("1")
            n %= bit
            cnt += 1
        print(cnt)




if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    X = input()
    bit_num = X.count("1")

    X_minus = [0] * N # X_minus[i] = 2^i mod (bit_num - 1)
    X_plus = [0] * N # X_plus[i] = 2^i mod (bit_num + 1)
    X_minus[0], X_plus[0] = 1, 1
    for i in range(1, N):
        if bit_num != 1: X_minus[i] = (X_minus[i - 1] * 2) % (bit_num - 1)
        X_plus[i] = (X_plus[i - 1] * 2) % (bit_num + 1)
    #print("X_minus={}".format(X_minus))
    #print("X_plus={}".format(X_plus))

    rem_minus = 0
    rem_plus = 0
    for i in range(N):
        if X[N-i-1] == '1':
            if bit_num != 1: rem_minus = (rem_minus + X_minus[i]) % (bit_num - 1)
            rem_plus = (rem_plus + X_plus[i]) % (bit_num + 1)
    #print(rem_minus, rem_plus)

    for i in range(N):
        if X[i] == '0':
            bit = bit_num + 1
            n = (rem_plus + X_plus[-i-1]) % bit
        if X[i] == '1':
            bit = bit_num - 1
            if bit != 0: n = (rem_minus - X_minus[-i-1]) % bit
        if bit == 0 or bit == 1:
            print(bit)
            continue

        cnt = 1
        while n != 0:
            bit = bin(n).count("1")
            n %= bit
            cnt += 1
        print(cnt)




if __name__ == "__main__":
    main()
N,M=map(int, input().split())

outgoing=dict()
incoming=dict()
for i in range(M):
  x,y,z=map(int, input().split())
  if x in outgoing: outgoing[x].add(y)
  else: outgoing[x]={y}
  if y in incoming: incoming[y].add(x)
  else: incoming[y]={x}
#print(outgoing)
#print(incoming)
V=set()
def dfs(v):
  if v not in V:
    V.add(v)
    if v in outgoing:
      for u in outgoing[v]: dfs(u)
    if v in incoming:
      for u in incoming[v]: dfs(u)
cnt=0
for i in range(1, N+1):
  if i not in V:
    cnt += 1
    dfs(i)
print(cnt)

### FIXED CODE ###

import sys
mod = 10**9+7
sys.setrecursionlimit(mod)
N,M=map(int, input().split())

adj={i: set() for i in range(1,N+1)}
for i in range(M):
  x,y,z=map(int, input().split())
  adj[x].add(y)
  adj[y].add(x)
V=set()
def dfs(v):
  if v not in V:
    V.add(v)
    for u in adj[v]: dfs(u)
cnt=0
for i in range(1,N+1):
  if i not in V:
    cnt += 1
    dfs(i)
print(cnt)
if input() == "Sunny":
  print("Cloudy")
if input() == "Cloudy":
  print("Rainy")
if input() == "Rainy":
  print("Sunny")


### FIXED CODE ###

s = input()
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
N, K =map((int, input().split())
S=list(input())
S[K] = S[K].lower()
print(str(S))

### FIXED CODE ###

N, K=map(int,input().split())
S=list(input())
S[K-1] = S[K-1].lower()
print(''.join(S))
import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
P = [int(input()) for _ in range(N)]

cnt = 0
if P[0] == 1:
    isFirstNum = 1
else:
    isFirstNum = 0
    cnt +=1

if P[-1] == N:
    isLastNum = 1
else:
    isLastNum = 0
    cnt +=1
    
isBefore = 0
isAfter = 0

P.remove(1)
P.remove(N)


for i in range(len(P)-1):
    if P[i]>P[i+1]:
        cnt += 1
        if N-P[i]<=P[i+1]-1:
            isAfter = 1
        else:
            isBefore = 1

ope = cnt+isBefore*isFirstNum+isAfter*isLastNum

print(ope)


### FIXED CODE ###

import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
P = [int(input()) for _ in range(N)]

Q = [0]*(N)
for i in range(N):
    Q[P[i]-1]=i

cnt = 1
ans = 1
for i in range(N-1):
    if Q[i+1]>Q[i]:
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 1
ans = max(ans,cnt)
print(N-ans)
s = raw_input
print s[:4] + ' ' + s[4:]

### FIXED CODE ###

# -*- coding: utf-8 -*-
s = raw_input()
print s[:4] + ' ' + s[4:]
x1,y1,x2,y2 = map(int,input().split())
l = abs(y2 - y1)
x3 = x1 - l
y3 = y2
x4 = x3
y4 = y1
print(x3,y3.x4.y4)

### FIXED CODE ###

x_1,y_1,x_2,y_2 = map(int,input().split())
print(y_1+x_2-y_2,-x_1+x_2+y_2,x_1+y_1-y_2,-x_1+y_1+x_2)
s=str(input())
s=list(s)
while True:
  del s[len(s)-1]
  if len(s)%2==0:
    count=0
    for i in range(0,int(len(s)/2)):
      if s[i]==s[i+int(len(s)/2)]:
        count=count+1
    if count==int(len(s)/2):
      print(len(s))

### FIXED CODE ###

s=str(input())
s=list(s)
while True:
  del s[len(s)-1]
  if len(s)%2==0:
    count=0
    for i in range(0,int(len(s)/2)):
      if s[i]==s[i+int(len(s)/2)]:
        count=count+1
    if count==int(len(s)/2):
      print(len(s))
      break