Harryxun/stf_run huggingface dataset:
s = input()
k = int(input())

edge = 0
ans = 0
if len(set(s))==1:
    s = s*k
    print(len(s)//2)
else:
    a = s[0]
    b = s[-1]
    
    cnt_a, cnt_b = 0,0
    ite = 0
    while s[cnt_a] == a:
        cnt_a += 1
    while s[len(s)-cnt_b-1] == b:
        cnt_b += 1
    
    s1 = s[:cnt_a]
    s2 = s[cnt_a:len(s)-cnt_b]
    s3 = s[len(s)-cnt_b:]
    
    A = cnt_a//2
    B = cnt_b//2    
    X = 0
    if len(set(s2))==1:
        X = len(s2)//2
    else:
        for i in range(len(s2)):
            if i==0:
                n = 1
                tmp = s2[i]
            elif s2[i] == tmp:
                n += 1
            else:
                if n != 1:
                    X += n//2
                tmp = s2[i]
                n = 1
    if a!=b:
        print((A+B+X)*k)
    else:
        C = (len(s1+s3))//2
        print(A+B+X*k+C*(k-1))
        

### FIXED CODE ###

s = input()
k = int(input())

if len(set(list(s)))==1:
    print(len(s)*k//2)

elif s[0] != s[-1]:
    cnt = 0
    for i in range(1, len(s)):
        if s[i] == s[i-1]:
            s = s[:i]+'.'+s[i+1:]
    print(s.count('.')*k)
else:
    a,b = 0,0
    c = s[0]
    rev_s = s[::-1]
    for i in range(len(s)):
        if s[i]==c:
            a += 1
        else:
            break
    for i in range(len(s)):
        if rev_s[i]==c:
            b += 1
        else:
            break
    cnt = 0
    for i in range(1, len(s)):
        if s[i] == s[i-1]:
            s = s[:i]+'.'+s[i+1:]
    print(s.count('.')*k - (a//2 + b//2 - (a+b)//2)*(k-1))
N, A, B = [int(input()) for i in range(3)]
count = 0
for n in range(1,N+1):
    s = 0
    t = n
    while (n>0):
        s = s + n%10
        n = n//10
    if s >= A and s <= B:
        count +=t
print(count)
    

### FIXED CODE ###

N, A, B = map(int, input().split())
count = 0
for n in range(1,N+1):
    s = 0
    t = n
    while (n>0):
        s = s + n%10
        n = n//10
    if s >= A and s <= B:
        count +=t
print(count)
import math
a,b,c = map(int, input().split())

ans = 'No'

ans = 'Yes' if a+b+2*math.sqrt(a*b)<c else ans
print(ans)

### FIXED CODE ###

import math
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np

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

a =[ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])
def eratosthenes(n):
    prime_list = []
    num_list=[i for i in range(2, n+1)]
    limit = math.sqrt(n)
    while True:
        if limit <= num_list[0]:
            return prime_list + num_list
        prime_list.append(num_list[0])
        num_list = [e for e in num_list if e % num_list[0] != 0]

ls = eratosthenes(100000)
ls2 = []
count = 0
for i in ls:
    if (i+1)//2 in ls:
        count += 1
    ls2.append(count)

Q = int(input())
for i in range(Q):
    l, r = map(int, input().split())
    print(ls2[r]-ls2[l])

### FIXED CODE ###

q = int(input())
    
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

ls = [0]

for i in range(1,100000):
    if is_prime(i) and is_prime((i+1)//2):
        ls.append(ls[i-1]+1)
    else:
        ls.append(ls[i-1])
        
for i in range(q):
    l,r = map(int,input().split())
    if l == r:
        if is_prime(l) and is_prime((l+1)//2):
            print(1)
        else:
          print(ls[r]-ls[l-1])  
    else:
        print(ls[r]-ls[l-1])
N, K = list(map(int, input().split()))
P = list(map(lambda x: int(x) - 1, input().split()))
C = list(map(int, input().split()))
ans = -10**9-1
for i in range(N):
    cumsum = [0]*(N+1)
    seen = [-1]*N
    K_ = K
    now = i
    j = 0
    while K_ > 0 and seen[now] == -1:
        seen[now] = 1
        now = P[now]
        cumsum[j+1] = cumsum[j] + C[now]
        K_ -= 1
        j += 1
    if K_ == 0:
        ans = max(ans, max(cumsum[1:j]))
    else:
        if cumsum[j] > 0:
            loop_size = j
            loop_n = K//loop_size - 1
            tmp = loop_n*cumsum[loop_size]
            tmp += max(max(cumsum[1:loop_size]), cumsum[loop_size] + max(cumsum[0:K_+1]))
            ans = max(ans, tmp)
        else:
            ans = max(ans, max(cumsum[1:j+1]))
print(ans)

### FIXED CODE ###

N, K = list(map(int, input().split()))
P = list(map(lambda x: int(x) - 1, input().split()))
C = list(map(int, input().split()))
ans = -10**9-1
for i in range(N):
    cumsum = [0]*(N+1)
    seen = [-1]*N
    K_ = K
    now = i
    j = 0
    while K_ > 0 and seen[now] == -1:
        seen[now] = 1
        now = P[now]
        cumsum[j+1] = cumsum[j] + C[now]
        K_ -= 1
        j += 1
    if K_ == 0:
        ans = max(ans, max(cumsum[1:j+1]))
    else:
        if cumsum[j] > 0:
            loop_size = j
            loop_n = K//loop_size - 1
            tmp = loop_n*cumsum[loop_size]
            tmp += max(max(cumsum[1:loop_size+1]), cumsum[loop_size] + max(cumsum[0:K_%loop_size+1]))
            ans = max(ans, tmp)
        else:
            ans = max(ans, max(cumsum[1:j+1]))
print(ans)
# -*- coding: utf-8 -*-

S = input()
T = input()
length = len[S] - 1

for i in range(length):
    if S[i] == T[i]:
        i = i + 1
        if i == len[T]:
            print('Yes')
            break
        break
    else:
        print('No')
        break


### FIXED CODE ###

# -*- coding: utf-8 -*-

S = input()
T = input()
l = len(S)

for i in range(0,l):
    if S[i] == T[i]:
        i = i + 1
        if i == l:
            print('Yes')
            break
    else:
        print('No')
        break
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)
int main(){
    string s; cin >> s;
    int n = s.size(), p = 0, g = 0, ans = 0;
    rep(i, 0, n){
        if (s[i]=='p'){
            if (p < g) p++;
            else ans--, g++;
        }else {
            if (p < g) ans++, p++;
            else g++;
        }
    }
    cout << ans << endl;
    return 0;
}

### FIXED CODE ###

import numpy as np
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()

s = input()
p = g = ans = 0
for i in s:
    if i=='p':
        if p < g: p += 1
        else: ans -= 1; g += 1
    if i=='g':
        if p < g: ans += 1; p += 1
        else: g += 1
print(ans)
import math

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

ans = 1
for i in a_lis:
    if math.log(i, 10) + math.log(ans + 10) > 18:
        ans = -1
        break
    
    else:
        ans += i
        
print(ans)

### FIXED CODE ###

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

ans = 1
if 0 in a_lis:
    ans = 0
    
else:
    for i in a_lis:
        ans *= i
        if ans > pow(10, 18):
            ans = -1
            break
        
print(ans)
from dateutil.relativedelta import relativedelta

x = int(raw_input())
y = relativedelta(seconds=x)
x = "{0.hours:02}:{0.minutes:02}:{0.seconds:02}".format(relativedelta(seconds=x))
print(x)


### FIXED CODE ###

x = int(raw_input())
m = x/60
h = m/60
m = m%60
s = x%60
print(str(h)+":"+str(m)+":"+str(s))
import bisect
a,b,q=map(int,input().split())
ls=[-10**11]
lg=[-10**11]
for i in range(a):
  ls.append(int(input()))
for i in range(b):
  lg.append(int(input()))
ls.append(10**11)
lg.append(10**11)
ls=sorted(ls)
lg=sorted(lg)
for i in range(q):
  x=int(input())
  i1=bisect.bisect_left(ls,x)
  i2=bisect.bisect_left(lg,x)#xはi-1~iにある
  l1=[i1,i1+1]
  l2=[i2,i2+1]
  ans1=10**10
  ans2=10**10
  for k in l1:
    for j in l2:
      ans3=abs(x-ls[k])+abs(ls[k]-lg[j])
      if ans3<ans1:
        ans1=ans3
      ans4=abs(x-lg[j])+abs(ls[k]-lg[j])
      if ans4<ans2:
        ans2=ans4
  print(min(ans1,ans2))

### FIXED CODE ###

import bisect
a,b,q=map(int,input().split())
ls=[-10**11]
lg=[-10**11]
for i in range(a):
  ls.append(int(input()))
for i in range(b):
  lg.append(int(input()))
ls.append(10**11)
lg.append(10**11)
ls=sorted(ls)
lg=sorted(lg)
for i in range(q):
  x=int(input())
  i1=bisect.bisect_left(ls,x)
  i2=bisect.bisect_left(lg,x)#xはi-1~iにある
  d1=x-ls[i1-1]
  d2=ls[i1]-x
  d3=x-lg[i2-1]
  d4=lg[i2]-x
  d5=abs(ls[i1-1]-lg[i2-1])
  d6=abs(ls[i1]-lg[i2-1])
  d7=abs(ls[i1-1]-lg[i2])
  d8=abs(ls[i1]-lg[i2])
  ans1=d1+d5
  ans2=d1+d7
  ans3=d2+d6
  ans4=d2+d8
  ans5=d3+d5
  ans6=d3+d6
  ans7=d4+d7
  ans8=d4+d8
  print(min(ans1,ans2,ans3,ans4,ans5,ans6,ans7,ans8))
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]
dp = [[0]*(w+1) for _ in range(n+1)]
for i in range(n):
    w_, v_ = wv[i]
    for j in range(w+1):
        if j < w_:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j-w_]+v_, dp[i][j])
print(dp[n][w])

### FIXED CODE ###

N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    w_, v_ = map(int, input().split())
    w.append(w_)
    v.append(v_)
V = sum(v)
dp = [[float("INF")]*(V+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(V+1):
        if j >= v[i]: dp[i+1][j] = min(dp[i][j] ,dp[i][j-v[i]]+w[i])
        else: dp[i+1][j] = dp[i][j]
ans = 0
for i in range(V+1):
    if dp[N][i]<=W: ans=i
print(ans)
N = input()
a = sorted(list(map(int,input().split())), reverse=True)

print(sum(a[::2]) - a[1::2] )



### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))
n=int(input())
l=list(map(int,input().split()))
print('Four' if 'Y' in l else 'Three')

### FIXED CODE ###

n=int(input())
l=list(map(str,input().split()))
print('Four' if 'Y' in l else 'Three')
while True:
    a, op, b = input(),split()
    a = int(a)
    b = int(b)


    if op == '?':
        break


    if op == '+':
        print(a + b)


    if op == '-':
        print(a - b)


    if op == '*':
        print(a * b)


    if op == '/':
        print(a // b)

### FIXED CODE ###

while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
   
    if op == '?':
        break
   
    if op == '+':
        print(a + b)
   
    if op == '-':
        print(a - b)
   
    if op == '*':
        print(a *b)
   
    if op == '/':
        print(a // b)
N = int(input())
V = list(map(int, input().split()))
alist = []
tmp = 0

def cook(N, V, alist, tmp)
    if N = 1:
        print(V[0])
    
    else:
        V.sort()
        for i in range(0, N - 2, 2):
            if i + 1 > N - 1:
                alist.append(V[i])
                
            else:
                tmp = (V[i] + V[i +1]) / 2
            alist.append(tmp)
            
        N = len(alist)
        V = alist
        alist = []
        tmp = 0
        cook(N, V, alist, tmp)
        
cook(N, V, alist, tmp)

### FIXED CODE ###

N = int(input())
v = list(map(float, input().split()))

v.sort()

r = v[0]

for i in v[1::]:
    r = (r + i) / 2

print(r)
import math
n = int(input())
m = n-1
for i in range(1,1+math.isqrt(n-1)):
  if n%i==0:
    m = min(m,i+n/i-2)
print(m)

### FIXED CODE ###

import math
n = int(input())
m = n-1
for i in range(1,int(math.sqrt(n))+1):
  if n%i==0:
    m = min(m,i+n//i-2)
print(m)
import collections
N = map(int, input().split())
V = list(map(int, input().split()))

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - cntEve.most_common()[0][1] - cntOdd.most_common()[0][1]

print(ans)

### FIXED CODE ###

import collections
N = int(input())
V = list(map(int, input().split()))

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    if len(cntEve) == 1 and len(cntOdd) > 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntOdd.most_common()[1][1]
    elif len(cntEve) > 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntEve.most_common()[1][1]
    elif len(cntEve) == 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1])
    else:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - int(cntEve.most_common()[0][1]) - int(cntOdd.most_common()[0][1])

print(ans)
s = input()
k = int(input())
onesum = 0
while s[0] == "1" and len(s) > 0
    s = s[1:]
    onesum += 1
if k <= onesum:
    print(1)
else:
    print(s[0])


### FIXED CODE ###

s = input()
k = int(input())
onesum = 0
while s[0] == "1":
    onesum += 1
    if len(s) == 1:
        break
    s = s[1:]
if k <= onesum:
    print(1)
else:
    print(s[0])
S = int(input())

A = 10**9
C = S//A
Bt = S%A

if Bt!=0:
  C += 1
  B = A - Bt

ANS = [0, 0, A, 1, B, C]
print(*ANS)


### FIXED CODE ###

S = int(input())

A = 10**9
C = S//A
B = S%A

if B!=0:
  C += 1
  B = A - B

ANS = [0, 0, A, 1, B, C]
print(*ANS)
n = int(input())
a = list(input().split())
q = int(input())

adic = {}

for i in a:
  if i in adic:
    adic[i] += 1
  else:
    adic[i] = 1


for i in range(q):
  b, c = input().split()
  if b in adic:
    adic[c] += adic.pop(b)
  print( sum(int(j)*int(adic[j]) for j in adic)  )

### FIXED CODE ###

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

asum = sum(a)
adic = {}

for i in a:
  if i in adic:
    adic[i] += 1
  else:
    adic[i] = 1


for i in range(q):
  b, c = map(int, input().split())
  if b in adic:
    if c not in adic:
      adic[c] = 0
    cnt = adic.pop(b)
    adic[c] += cnt
    asum += (c-b) * cnt
  print(asum)
# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if distance - duration % 2 == 0:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')


### FIXED CODE ###

def f():
    a, b = input().split()
    a, b = int(a), int(b)
    rem = int(a) * int(b) % 2
    if rem == 1:
        print('Odd')
        return
    if rem == 0:
        print('Even')
        return


f()
n,l=map(int,input().split())
s=[input() for i in range(n)]
s.sort
print("".join(s))


### FIXED CODE ###

print(["NO","YES"][eval(input().replace(" ","*"))==175])
n = int(input())
a = sorted(list(map(int, input().split())))
if n % 2 == 0:
  if a == sorted(2*[2*x+1 for x in range(n/2)]):
    print(2**(n/2))
  else:
    print(0)
else:
  if a == sorted(list(2*[2*x for x in range(n//2+1)])[1:]):
    print(2**(n//2))
  else:
    print(0)

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())))
if n % 2 == 0:
  if a == sorted(2*[2*x+1 for x in range(int(n/2))]):
    print((2**int(n/2))%1000000007)
  else:
    print(0)
else:
  if a == sorted(list(2*[2*x for x in range(n//2+1)])[1:]):
    print((2**(n//2))%1000000007)
  else:
    print(0)
k,x=map(int,input().split())
for i in range(x-k+1,x+K):
  print(i)

### FIXED CODE ###

k,x=map(int,input().split())
for i in range(x-k+1,x+k):
  print(i)
a,b = [int(i) for i in input().split(' ')]
 n=b-a
 N=n-1
 ans=(1/2*N)*(N+1)
 bns= ans - a
 print(bns)

### FIXED CODE ###

a,b = [int(i) for i in input().split(' ')]
n=b-a#13-8=5
N=n-1#5-1=4
x=(1/2*N)*(N+1)#2*5=10
y= x - a#10-8=2
print(int(y))
A, V = map(int, input().split())
B, W = map(int, input().split())
D = abs(A - B)
S = V - W
if V - W <= 0:
  print("NO")
else:
  if D / S > T:
    print("NO")
  else:
    print("Yes")

### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
D = abs(A - B)
S = V - W
if V - W <= 0:
  print("NO")
else:
  if D / S > T:
    print("NO")
  else:
    print("YES")
import heapq
N,K = map(int,input().split())

L = [[] for _ in range(N)]
All = []
s = set([])
for i in range(N):
  t,d = map(int,input().split())
  t-=1 #0スタートに
  heapq.heappush(L[t], -d) #最大から取り出したいので負にする。
  heapq.heappush(All,[-d,t]) #すべてから大きい順に取り出せるように 
  s.add(t)

#print(L,s)
point = 0
ns = 0 #現在の種類
later = []
now = []
syurui = set([])
while len(now) < K and All:
  temp = heapq.heappop(All)
  if temp[1] not in syurui:
    ns += 1
    point -= temp[0]
    syurui.add(temp[1])
    heapq.heappush(now, -1*temp[0])
  else:
    later.append(temp)
for i in later:
  heapq.heappush(All,i)

point += ns*ns
while len(now) < K:
  temp = heapq.heappop(All)
  point -= temp[0]
  heapq.heappush(now, -1*temp[0])

#print(ns,point)
#print(now,All)
while now[0] < -1*All[0][0]:
  temp = heapq.heappop(All)
  dele = heapq.heappop(now)
  #print(temp,dele)
  upoint = point - temp[0] - dele - ns*ns + (ns-1)**2
  #print(upoint,point)
  if upoint >= point:
    point = upoint
    ns -= 1
  else:
    break
    
print(point)
#print(All)
#print(now)
  

### FIXED CODE ###

import heapq
N,K = map(int,input().split())

L = [[] for _ in range(N)]
All = []
s = set([])
for i in range(N):
  t,d = map(int,input().split())
  t-=1 #0スタートに
  heapq.heappush(L[t], -d) #最大から取り出したいので負にする。
  heapq.heappush(All,[-d,t]) #すべてから大きい順に取り出せるように 
  s.add(t)

#print(L,s)
point = 0
ns = 0 #現在の種類
later = []
now = []
syurui = set([])
while len(now) < K and All:
  temp = heapq.heappop(All)
  if temp[1] not in syurui:
    ns += 1
    point -= temp[0]
    syurui.add(temp[1])
    heapq.heappush(now, -1*temp[0])
  else:
    later.append(temp)
for i in later:
  heapq.heappush(All,i)

point += ns*ns
while len(now) < K:
  temp = heapq.heappop(All)
  point -= temp[0]
  heapq.heappush(now, -1*temp[0])

#print(ns,point)
#print(now,All,All[0][0])
while All and now[0] < -1*All[0][0]:
  temp = heapq.heappop(All)
  dele = heapq.heappop(now)
  #print(temp,dele)
  upoint = point - temp[0] - dele - ns*ns + (ns-1)**2
  #print(upoint,point)
  if upoint >= point:
    point = upoint
    ns -= 1
  else:
    break
    
print(point)
#print(All)
#print(now)
s = input()
a = ""
for i in range(0, len(s)):
  if s[i] == "0":
    a += "0"
  elif s[i] == "1":
    a += "1"
  elif s[i] == "B" and len(a) != 0:
    a[-1] = ""
print(a)

### FIXED CODE ###

s = input()
a = ""
for i in range(0, len(s)):
  if s[i] == "0":
    a += "0"
  elif s[i] == "1":
    a += "1"
  elif s[i] == "B" and len(a) != 0:
    b = a[0:-1]
    a = b
print(a)
import math
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    g=math.gcd(b,d)
    h=1
    if a%b+h>c:
        print("No")
        continue
    print("Yes")

### FIXED CODE ###

import fractions 
n=int(input())
for _ in range(n):
    a,b,c,d=map(int,input().split())
    if d<b:
        print("No")
        continue
    elif a<b:
        print("No")
        continue
    elif c>=b:
        print("Yes")
        continue
    g=fractions.gcd(b,d)
    h=((b-1-a%b)//g)*g
    if a%b+h>c:
        print("No")
        continue
    print("Yes")
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

 
if w >= v:
    print('No')
else:
    for i in range(1,t+1):
        a_place = a + v*i
        b_place = b + w*i
        if a_place - b_place = 0:
            print('Yes')
            break

### FIXED CODE ###

s = input()
print(s[:3])
#3.4

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

swapCount = 0
for i in range(0, N):
    minIndex = 1
    for j in range(0, N):
        if a[j] < a[minIndex]:
            minIndex = j
    
    if i != minIndex:
        tmp = a[i]
        a[i] = a[minIdex]
        a[minIndex] = tmp
        swapCount += 1

print(' '.join(map(str, a)))
print(swapCount)

        

### FIXED CODE ###

#3.4

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

swapCount = 0
for i in range(0, N):
    minIndex = i
    for j in range(i, N):
        if a[j] < a[minIndex]:
            minIndex = j
    
    if i != minIndex:
        tmp = a[i]
        a[i] = a[minIndex]
        a[minIndex] = tmp
        swapCount += 1

print(' '.join(map(str, a)))
print(swapCount)
m_h=[int(input(I) for i in range(10)

m_h.sort(reverse=True)

print(m_h[0])
print(m_h[1])
print(m_h[2])

### FIXED CODE ###

m_h=[int(input()) for i in range(10)]

m_h.sort(reverse=True)

print(m_h[0])
print(m_h[1])
print(m_h[2])
i = input()

if int(i)<0:
  print("0")
  return

acc = 0
for j in range(len(i)//2):
  acc+=9*(10**(2*j))

if len(i)%2==0:
  print(acc)
else:
  addition = int(i[1:])+1
  print(acc+addition)

### FIXED CODE ###

i = input()

acc = 0
for j in range(len(i)//2):
  acc+=9*(10**(2*j))

if len(i)%2==0:
  print(acc)
else:

  addition = (int(i[0])-1)*10**(len(i)-1)+1
  if len(i)>1:
    addition += int(i[1:])
  print(acc+addition)
N,M = input().split()
A = list(map(int,input().split()))
tv = sum(A)
i,count=0,0
while(i<N and count!=M):
  if(A[i]>int(tv/4*int(M))):
    count+=1
if(count==M):
  print("YES")
else:
  print("NO")

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
tot_votes = sum(A)
count = 0
for a in A:
    if(a>=tot_votes/(4*M)):
        count+=1
if(count>=M):
    print("Yes")
else:
    print("No")
#

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
b.append(0)
b.append(0)
z = 0
c = b[0]
for i in range(n+1):
    x = a[i] - c
    #print(z)
    if x <= 0:
        z += a[i]
        #print(a[i])
        if -x >= a[i+1]:
            c = b[i+1] + a[i+1]
        elif -x < a[i+1]:
            c = b[i+1] - x
    elif x > 0:
        z += c
        #print(c)
        c = b[i+1]

print(z)


### FIXED CODE ###

#

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
#b.append(0)
b.append(0)
z = 0
c = b[0]
for i in range(n+1):
    x = a[i] - c
    #print(z)
    if i < n:
        if x <= 0:
            z += a[i]
            #print(a[i])
            if -x >= a[i+1]:
                c = b[i+1] + a[i+1]
            elif -x < a[i+1]:
                c = b[i+1] - x
        elif x > 0:
            z += c
            #print(c)
            c = b[i+1]
    elif i == n:
        if x <= 0:
            z += a[i]
            #print(a[i])
        else:
            z += c
            #print(c)
print(z)
N,K = map(int,input().split())
S = set()

for n in range(N):
	input()
	S|=set(input().split())

print(N-len(S))

### FIXED CODE ###

N,K = map(int,input().split())
S = set()

for k in range(K):
  input()
  S|=set(input().split())

print(N-len(S))