Harryxun/stf_run huggingface dataset:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N, K = MI()
    d = []
    A = [None for i in range(N)]
    AD = [set() for i in range(N)]

    for i in range(K):
        d = I()
        A[i] = LI()

    for i in range(K):
        for k in A[i]:
            AD[k-1].add(i+1)

    ans = 0
    for i in range(len(AD)):
        if len(AD[i]) == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N, K = MI()
    d = []
    A = [None for i in range(K)]
    AD = [set() for i in range(N)]

    for i in range(K):
        d = I()
        A[i] = LI()

    for i in range(K):
        for k in A[i]:
            AD[k-1].add(i+1)

    ans = 0
    for i in range(len(AD)):
        if len(AD[i]) == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()
import math
r=int(input())
s=math.pi
print("%.6f"%(r*r*s),"%.6f"%(2*r*s))

### FIXED CODE ###

import math
r=float(input())
s=math.pi
print("%.6f"%(r*r*s),"%.6f"%(2*r*s))
N=int(input())
MP=[list(map(int,input().split())) for i in range(N)]
MP2=[]
for li in MP:
    MP2.append(li.copy())


### FIXED CODE ###

N=int(input())
MP=[list(map(int,input().split())) for i in range(N)]
MP2=[]
for li in MP:
    MP2.append([i for i in li])

MP3=[[-1]*N for _ in range(N)]

# ワーシャルフロイド
for k in range(N):
    for i in range(N):
        for j in range(N):
            cand = MP2[i][k] + MP2[k][j]
            if cand <= MP2[i][j]:
                MP2[i][j] = cand
                if (i != k and j != k):
                    MP3[i][j] = k

for i in range(N):
    for j in range(N):
        if MP[i][j] != MP2[i][j]:
            print(-1)
            exit()

checked=set()

res = set()
def dfs(i,j):
    k = MP3[i][j]
    if k == -1:
        k = i
    if (i,j) in checked:
        return
    checked.add((i,j))
    if (i == k or j == k):
        if i < j:
            res.add((i,j))
    else:
        dfs(i,k)
        dfs(k,j)

for i in range(N):
    for j in range(N):
        dfs(i,j)

ressum = 0
for i,j in res:
    ressum += MP[i][j]

# for li in MP3:
#     print(li)
# print(res)
print(ressum)
N = int(input())
L = list(map(int, input().split()))

L.sort()
result = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        result += bisect_left(L, L[i] + L[j]) - j - 1
print(result)

### FIXED CODE ###

from bisect import bisect_left

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

L.sort()
result = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        result += bisect_left(L, L[i] + L[j]) - j - 1
print(result)
n=int(input())

a=[0]*n
aa=0
for i in range(n):
    b=set(list(str(i)))
    if len(b)==3:
        if "3" in b and "5" in b and "7" in b:
            aa+=1
    a[i]+=aa

print(a[n-1])

### FIXED CODE ###

from itertools import product
n = int(input())
cnt = 0
for i in range(3,10):
    for m in product(["3","5","7"],repeat = i):
        if "3" in m and "5" in m and "7" in m and int("".join(m))<=n:
            cnt += 1
print(cnt)
N = int(input())
A = list(map(int, input().split()))
cau = 0
flag = "go"
while flag == "go":
    for i in range(N):
        if(A[i] % 2 == 1):
            flag = "stop"
            break        
    if(flag = "go"):
        for i in range(N):
            A[i] = A[i]/2
        cau += 1
print(cau)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
cau = 0
flag = True
while flag:
    for i in range(N):
        if A[i] % 2 == 1:
            flag = False
            break        
    if flag:
        for i in range(N):
            A[i] = A[i]/2
        cau += 1
print(cau)
n = int(input())
X = input()
nx = int(X, 2)
dp = [-1] * (10**7+1)
def f(n):
    if dp[n] > 0:
        return dp[n]
    pc = bin(n).count('1')
    nn = n%pc
    if nn == 0:
        return 1
    dp[n] = f(nn) + 1
    return dp[n]

for i in range(n-1, -1, -1):
    # ibit目を反転させる # つまりi**2を引く
    tmp = pow(2, i)

    if (nx>>i)&1:
        nx -= tmp
        print(f(nx))
        nx += tmp
    else:
        nx += tmp
        print(f(nx))
        nx -= tmp


### FIXED CODE ###

n = int(input())
X = input()
pc = X.count('1')
nx = int(X, 2)

def f(n):
    c = 0
    while n > 0:
        n %= bin(n).count('1')
        c += 1
    return c

nxp = nx%(pc+1)
nxm = nx%(pc-1) if pc > 1 else 0
for i in range(n-1, -1, -1):
    if (nx>>i)&1:
        # 2**iを引く
        if pc-1 == 0:
            print(0)
            continue
        p = pow(2, i, pc-1)
        r = (nxm-p)%(pc-1)
    else:
        # 2**iを足す
        r = (nxp+pow(2, i, pc+1))%(pc+1)

    print(f(r) + 1)
N, M = map(int,input().split())
a = (N*(N-1))/2
b = (M*(M-1))/2
print(a+b

### FIXED CODE ###

N, M = map(int,input().split())
a = (N*(N-1))/2
b = (M*(M-1))/2
print(int(a+b))
'''A - Airplane
https://atcoder.jp/contests/abc129/tasks/abc129_a

>>> main(1, 3, 4)
4
>>> main(3, 2, 3)
5
'''

from itertools import permutations


def main(p, q, r):
    _max = 100

    for p in permutations([p, q, r], 2):
        if _max > sum(p):
            _max = sum(p)

    print(_max)


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


### FIXED CODE ###

'''A - Airplane
https://atcoder.jp/contests/abc129/tasks/abc129_a

>>> main(1, 3, 4)
4
>>> main(3, 2, 3)
5

in5.txt
>>> main(99, 62, 92)
154'''

from itertools import permutations


def main(p, q, r):
    _max = 999

    for p in permutations([p, q, r], 2):
        if _max > sum(p):
            _max = sum(p)

    print(_max)


if __name__ == '__main__':
    p, q, r = map(int, input().split(' '))
    main(p, q, r)
n,m=map(int,input().split())
list=[0]*4
for i in range(m):
	a,b=map(int,input().split())
	list[a-1]+=1
	list[b-1]+=1
for j in range(n):
	print(list[j])

### FIXED CODE ###

n,m=map(int,input().split())
list=[0]*n
for i in range(m):
	a,b=map(int,input().split())
	list[a-1]+=1
	list[b-1]+=1
for j in range(n):
	print(list[j])
def dps(road,dist,node,d):
    for x in road[node]:
        if dist[x]<0:
            dist[x]=d
            dps(road,dist,x,d+1)
    
N=int(input())
road=[[] for _ in range(N)]
f_d=[-1 for _ in range(N)]
s_d=[-1 for _ in range(N)]
f_d[0]=0
s_d[-1]=0

for i in range(N-1):
    a,b=list(map(int,input().split()))
    road[a-1].append(b-1)
    road[b-1].append(a-1)

dps(road,f_d,0,1)
dps(road,s_d,N-1,1)

white=0
black=0

for i in range(N-1):
    if f_d[i]<=s_d[i]:
        white+=1
    else:
        black+=1

if white>black:
    print('Fennec')
else:
    print('Snuke')

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**9)

def dps(road,dist,node,d):
    for x in road[node]:
        if dist[x]<0:
            dist[x]=d
            dps(road,dist,x,d+1)
    
N=int(input())
road=[[] for _ in range(N)]
f_d=[-1 for _ in range(N)]
s_d=[-1 for _ in range(N)]
f_d[0]=0
s_d[-1]=0

for i in range(N-1):
    a,b=list(map(int,input().split()))
    road[a-1].append(b-1)
    road[b-1].append(a-1)

dps(road,f_d,0,1)
dps(road,s_d,N-1,1)

white=0
black=0

for i in range(N):
    if f_d[i]<=s_d[i]:
        black+=1
    else:
        white+=1

if black>white:
    print('Fennec')
else:
    print('Snuke')
import itertools
N,M=map(int,input().split())
kslist=[]
for i in range(M):
    kslist.append(list(map(int,input().split()))) 
plist=list(map(int,input().split()))
ls=list((itertools.product(range(2),repeat=N)))
n=0
for tup in ls:
    if [tup[kslist[j][k in range(1,kslist[j][0]+1)]-1]%2 for j in range(M)]==plist:
        n+=1
print(n)   

### FIXED CODE ###

import itertools
N,M=map(int,input().split())
kslist=[(list(map(int,input().split()))) for i in range(M)]
plist=list(map(int,input().split()))
ls=list((itertools.product(range(2),repeat=N)))
n=0
for tup in ls:
    n+=1
    for j in range(M):
        sum1=0
        for k in range(1,kslist[j][0]+1):
            sum1+=tup[kslist[j][k]-1]
        if sum1%2!=plist[j]:
            n=n-1
            break
print(n)
i = 0
while True :
  x = int(input())
    if(x == 0) :
       break
    else :
      i += 1
      print("Case i:", x)
    


### FIXED CODE ###

i = 0

while True :
    x = int(input())
    if x == 0 :
        break
    else :
        i += 1
        print("Case ", i, ": ", x, sep = "")
a, b = int(input())
if a > b:
  print('a > b')
elif a < b:
  print('a < b')
else:
  print('a==b')

### FIXED CODE ###

a, b = map(int, input().split())
if a > b:
  print('a > b')
elif a < b:
  print('a < b')
else:
  print('a == b')
S = input()

candidates = []

tmp = []

for char in S:
    if char in ["A", "T", "G", "C"]:
        tmp.append(char)
    else:
        candidates.append(tmp)
        tmp = []
        
sorted_candidates = sorted(candidates, reverse=True, key=lambda x: len(x))
print(len(sorted_candidates[0]))

### FIXED CODE ###

S = input()

candidates = []

tmp = []

for char in S:
    if char in ["A", "T", "G", "C"]:
        tmp.append(char)
    else:
        candidates.append(tmp)
        tmp = []

if tmp != []:
    candidates.append(tmp)

sorted_candidates = sorted(candidates, reverse=True, key=lambda x: len(x))
print(len(sorted_candidates[0]))
n,q = map(int,input().split())

g = [[] for _ in range(n)]
c = [0] * n
visited = [False] * n

#根に近い順に累積和
def dfs(i):
    visited[i] = True
    for j in g[i]:
        if visited[j] == True:
            continue
        c[j]+=c[i]
        dfs(j)

for i in range(n - 1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p,x = map(int,input().split())
    c[p - 1]+=x

dfs(0)
print(*c)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n,q = map(int,input().split())

g = [[] for _ in range(n)]
c = [0] * n
visited = [False] * n

#根に近い順に累積和
def dfs(i):
    visited[i] = True
    for j in g[i]:
        if visited[j] == True:
            continue
        c[j]+=c[i]
        dfs(j)

for i in range(n - 1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p,x = map(int,input().split())
    c[p - 1]+=x

dfs(0)
print(*c)
import numpy as np
#s = "1234567"
s = input()
#print(len(s))

ss = []

for i in range(len(s)-2):
    #print(s[i:i+3])
    ss.append(int(s[i:i+3]))

ss = np.array(ss)
print((ss - 753).max())

### FIXED CODE ###

s = int(input())
if s==3 or s==5 or s==7:
	print("YES")
else:
	print("NO")
if a[1]%2 == 1:
	print ((a[0]//a[1])**3)
else:
	if a[0]%a[1] < a[1] // 2:
		print ((a[0]//a[1])**3 + ((a[0]//a[1])**3))
	else:
		print ((1 + a[0]//a[1])**3 + ((a[0]//a[1])**3))

### FIXED CODE ###

a = [int(i) for i in input().split()]
 
if a[1]%2 == 1:
	print ((a[0]//a[1])**3)
else:
	if a[0]%a[1] < a[1] // 2:
		print ((a[0]//a[1])**3 + ((a[0]//a[1])**3))
	else:
		print ((1 + a[0]//a[1])**3 + ((a[0]//a[1])**3))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 16:58:00 2019

@author: YudNK
"""
import heapq as hp
import bisect as bs

N, Q = map(int, input().split())
E = []
for i in range(N):
    s, t, x = map(int, input().split())
    app = [s - x, 1, x]
    rem = [t - x, -1, x]
    E.append(app)
    E.append(rem)
E.sort(key = lambda x:x[0])
D = [int(input()) for i in range(Q)]

ans = []
stopX = []

for j in range(len(E)):
    while D[0] < E[j][0]:
        if len(stopX) == 0:
            ans.append(-1)
            hp.heappop(D)
        else:
            ans.append(stopX[0])
            hp.heappop(D)
    if E[j][1] == 1:
        hp.heappush(stopX, E[j][2])
    else:
        index = bs.bisect_left(stopX,E[j][2])
        stopX.pop(index)
[print(i) for i in ans]

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 16:58:00 2019

@author: YudNK
"""
import bisect as bs

N, Q = map(int, input().split())
E = []
for i in range(N):
    s, t, x = map(int, input().split())
    a = [s - x, t - x, x] #イベント
    E.append(a)
E.sort(key = lambda x: x[2])
D = []
for i in range(Q):
    D.append(int(input()))

ans = [-1]*Q
check = [-1]*Q

for e in E:
    l = bs.bisect_left(D, e[0])
    r = bs.bisect_left(D, e[1])
    while l < r:
        if check[l] == -1:  
            ans[l] = e[2]
            check[l] = r
            l += 1
        else:
            l = check[l]
        
[print(i) for i in ans]
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
h = sorted(h, reverse=True)
for i in range(k):
    s -= h[i]
print(s)

### FIXED CODE ###

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

def solve():
    global n, k, h
    if n <= k:
        return 0
    s = sum(h)
    h = sorted(h, reverse=True)
    for i in range(k):
        s -= h[i]
    return s

print(solve())
N, M = input().split(" ")
N = int(N)
M = int(M)

s = []
c = []

one_list = []
two_list = []
three_list = []

for i in range(M):
    tmp_s, tmp_c = input().split(" ")
    tmp_s = int(tmp_s)
    tmp_c = int(tmp_c)
    s.append(tmp_s)
    c.append(tmp_c)
    if tmp_s == 1:
        one_list.append(tmp_c)
    elif tmp_s == 2:
        two_list.append(tmp_c)
    elif tmp_s == 3:
        three_list.append(tmp_c)
    else:
        print("Error")

if len(set(one_list)) > 1:
    print(-1)
    exit()

if len(set(two_list)) > 1:
    print(-1)
    exit()

if len(set(three_list)) > 1:
    print(-1)
    exit()


result = ""
for i in range(N):
    result += "0"


str_list = list(result)
for i in range(M):
    str_list[s[i] - 1] = str(c[i])

while str_list[0] == "0":
    str_list = str_list[1:]


print("".join(str_list))


### FIXED CODE ###

N, M = input().split(" ")
N = int(N)
M = int(M)

s = []
c = []

one_list = []
two_list = []
three_list = []

for i in range(M):
    tmp_s, tmp_c = input().split(" ")
    tmp_s = int(tmp_s)
    tmp_c = int(tmp_c)
    s.append(tmp_s)
    c.append(tmp_c)
    if tmp_s == 1:
        one_list.append(tmp_c)
    elif tmp_s == 2:
        two_list.append(tmp_c)
    elif tmp_s == 3:
        three_list.append(tmp_c)
    else:
        print("Error")


if len(set(one_list)) > 1:
    print(-1)
    exit()

if len(set(two_list)) > 1:
    print(-1)
    exit()

if len(set(three_list)) > 1:
    print(-1)
    exit()

result = ""
for i in range(N):
    result += "-"

str_list = list(result)
for i in range(M):
    str_list[s[i] - 1] = str(c[i])

if N > 1:
    if str_list[0] == "0":
        print(-1)
        exit()

str_list = list("".join(str_list).replace("-", "0"))
if N != 1:
    if str_list[0] == "0":
        str_list[0] = "1"

print("".join(str_list))
# encoding:utf-8
count = 1
input = input().split(" ")
for i in input:
    print("Case %d:%d"%(count,i))
    count += 1

### FIXED CODE ###

# encoding:utf-8
count = 1
while True:
    x = input()
    if '0' == x:
        break
    print("Case {0}: {1}".format(count, x)) 
    count += 1
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
a = iter[dx, dy, dx, dy+1, dx+1, dy+1, dx+1, dy+1,]
w = "R"*next(a) + "U"*next(a) + "L"*next(a) + "D"*next(a) + "R"*next(a) + "U"*next(a) + "L" + "U" + "L"*next(a) + "D"*next(a) + "R"
print(w)

### FIXED CODE ###

sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
a = iter([dx, dy, dx, dy+1, dx+1, dy+1, dx+1, dy+1,])
w = "R"*next(a) + "U"*next(a) + "L"*next(a) + "D"*next(a) + "R"*next(a) + "U"*next(a) + "L" + "U" + "L"*next(a) + "D"*next(a) + "R"
print(w)
import numpy as np

N = int(input())

N_list = np.arange(1, N)

N_np   = np.sum(N_list)

print(int(N_np))

### FIXED CODE ###

N = int(input())

print((N*(N-1))//2)
from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()
#y = input().split()


#y = int(input())
#x = int(input())
a = []
n = int(x[0])
k = int(x[1])
for i in range(k):
    a.append(int(input()))
a = sorted(a)
p = []
for i in range(n-k-1):
    p.append(a[i+k-1]-a[i])
print(min(p))

### FIXED CODE ###

from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()
#y = input().split()


#y = int(input())
#x = int(input())
a = []
b = int(x[0])
num = int(x[1])
for i in range(b):
    a.append(int(input()))
a = sorted(a)
min = a[num-1]-a[0]
for i in range(num,b):
    if min > a[i]-a[i-num+1]:
        min = a[i]-a[i-num+1]
if min > a[b-1]-a[b-num]:
    min = a[b-1]-a[b-num]
print(min)
s = str(input())
num = len(s)
for i in range(n):
  for j in range(i,n):
    if s[:i] + s[k:] == "keyence":
      print("YES")
      exit()
print("NO")

### FIXED CODE ###

s = str(input())
n = len(s)
for i in range(n):
  for j in range(i,n):
    if s[:i] + s[j:] == "keyence":
      print("YES")
      exit()
print("NO")
a = list(map(string, input.split()))

a = int(a[0][:4]) + int(a[0][5:7]) + int(a[0][8:])

if (a > 20190430):
    print('TBD')
else:
    print('Heisei') 

### FIXED CODE ###

a = str(input())

a = a[:4] + a[5:7] + a[8:]

a = int(a)

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')
n=int(input())
s=list(input())

num=2**((n-1).bit_length())
st=[[0]*(2*num) for _ in range(26)]

def update(pos,a,x):
  pos+=num
  st[a][pos]=x
  while pos>=0:
    pos=(pos-1)//2
    st[a][pos]=max(st[a][2*pos+1],st[a][2*pos+2])
    
def query(l,r):
  ret=0
  for a in range(26):
    tl=l+num
    tr=r+num
    tmp=0
    while tl<tr:
      if tr&1==1:
        tr-=1
        tmp=max(tmp,st[a][tr-1])
      if tl&1==1:
        tmp=max(tmp,st[a][tl-1])
        tl+=1
      tl>>=1
      tr>>=1
    if tmp!=0:
      tmp=1
    print(a,tmp)
    ret+=tmp
  return ret

for i in range(n):
  update(i,ord(s[i])-97,1)

q=int(input())
for _ in range(q):
  a,b,c=map(str,input().split())
  a=int(a)
  b=int(b)-1
  if a==1:
    if c==s[b]:
      continue
    update(b,ord(s[b])-97,0)
    update(b,ord(c)-97,1)
    s[b]=c
  elif a==2:
    c=int(c)-1
    print(query(b,c+2))

### FIXED CODE ###

def ctoi(c):
  return ord(c)-97

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

bits=[[0]*(n+1) for _ in range(26)]

def query(pos):
  ret=[0]*26
  for i in range(26):
    tmp=0
    p=pos
    while p>0:
      tmp+=bits[i][p]
      p-=p&(-p)
    ret[i]=tmp
  return ret

def update(pos,a,x):
  while pos<=n:
    bits[a][pos]+=x
    pos+=pos&(-pos)

for i in range(n):
  update(i+1,ctoi(s[i]),1)

q=int(input())
for _ in range(q):
  flag,a,b=map(str,input().split())
  flag=int(flag)
  a=int(a)
  if flag==1:
    if s[a-1]==b:
      continue
    else:
      update(a,ctoi(s[a-1]),-1)
      update(a,ctoi(b),1)
      s[a-1]=b
  elif flag==2:
    b=int(b)
    cnt1=query(b)
    cnt2=query(a-1)
    ans=0
    for i in range(26):
      if cnt1[i]-cnt2[i]>0:
        ans+=1
    print(ans)
def solve(n):
    if n == 1:
        return 0
    else:
        if S[n - 2] == S[n - 1]:
            return solve(n - 1)
        else:
            return solve(n - 1) + 1


if __name__ == "__main__":
    S = input()
    first_s = S[0]
    S = [1 if first_s == s else 0 for s in S]

    print(solve(len(S)))


### FIXED CODE ###

import threading
import sys


def main():
    def solve(n):
        if n == 1:
            return 0
        else:
            if S[n - 2] == S[n - 1]:
                return solve(n - 1)
            else:
                return solve(n - 1) + 1

    S = input()
    first_s = S[0]
    S = [1 if first_s == s else 0 for s in S]

    print(solve(len(S)))


if __name__ == "__main__":

    sys.setrecursionlimit(1024 * 1024 * 2)
    threading.stack_size(128 * 1024 * 1024 * 2)
    threading.Thread(target=main).start()
def multply(a: int, b: float) -> int:
    return int(a * b)

a, b = map(int, input().split())
print(multply(a, b))

### FIXED CODE ###

import decimal


def multply(a: str, b: str) -> int:
    return int(decimal.Decimal(a) * decimal.Decimal(b))

a, b =  input().split()
print(multply(a, b))
s =input()
for i in range(-s, s):
  for j in range(-s, s):
    if i**5-j**5= s:
      print(i, j)
      break

### FIXED CODE ###

x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if (i**5)-(j**5)==x:
      print(i,j)
      exit()
n = int(input())
a = [0,0,0,0]
for i in range(n):
  s = input()
  if s=="AC":
    a[0] += 1
  elif s=="WA":
    a[1] += 1
  elif s=="TLE":
    a[2] += 1
  elif :
    a[3] += 1
print("AC x ",end="")
print(a[0])
print("WA x ",end="")
print(a[1])
print("TLE x ",end="")
print(a[2])
print("RE x ",end="")
print(a[3])


### FIXED CODE ###

n = int(input())
a = [0,0,0,0]
for i in range(n):
  s = input()
  if s=="AC":
    a[0] += 1
  elif s=="WA":
    a[1] += 1
  elif s=="TLE":
    a[2] += 1
  else:
    a[3] += 1
print("AC x ",end="")
print(a[0])
print("WA x ",end="")
print(a[1])
print("TLE x ",end="")
print(a[2])
print("RE x ",end="")
print(a[3])
N = input()
A = input()
B = input()
if N == 1:
  print("Hello World")
else:
  print(A+B)

### FIXED CODE ###

if int(input()) == 1:
    print("Hello World")

else:
    A = int(input())
    B = int(input())
    print(A + B)
import sys
sys.setrecursionlimit(10**6)

n_price,k = map(str,input().split())
k = int(k)
n_length = len(n_price)
d_ng_list = list(input())
restrict = True
answer = ""
for s in range(10):
	if str(s) not in d_ng_list:
		min_number = str(s)
		break

def find_number(i):
	global restrict
	if not restrict:
		return min_number
	for s in range(10):
		if (str(s) not in d_ng_list) and str(s) >= n_price[i]:
			if s > int(n_price[i]):
				restrict = False
			return str(s)

def rec_cal_pay(answer, i, restrict):
	if i == n_length-1:
		answer += find_number(i)
		print(answer)
		return
	else:
		c = find_number(i)
		rec_cal_pay(answer+c, i+1, restrict)
rec_cal_pay(answer, 0, restrict)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

n_price,k = map(str,input().split())
k = int(k)
n_length = len(n_price)
d_ng_list = list(input())
restrict = True
answer = ""
for s in range(10):
	if str(s) not in d_ng_list:
		min_number = str(s)
		break

def find_number(i):
	global restrict
	if not restrict:
		return min_number
	for s in range(10):
		if (str(s) not in d_ng_list) and str(s) >= n_price[i]:
			if s > int(n_price[i]):
				restrict = False
			return str(s)
	#if not found
	restrict = False
	return str(min_number+min_number)

def rec_cal_pay(answer, i, restrict):
	if i == n_length-1:
		answer += find_number(i)
		print(answer)
		return
	else:
		c = find_number(i)
		rec_cal_pay(answer+c, i+1, restrict)

rec_cal_pay(answer, 0, restrict)