import sys , os , iodef rs ( ) : return sys . stdin . readline ( ) . rstrip ( ) def ri ( ) : return int ( sys . stdin . readline ( ) ) def ria ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def ws ( s ) : sys . stdout . write ( s + ' \n ' ) def wi ( n ) : sys . stdout . write ( str ( n ) + ' \n ' ) def wia ( a ) : sys . stdout . write ( ' ▁ ' . join ( [ str ( x ) for x in a ] ) + ' \n ' ) import math , datetime , functools , itertools , operator , bisect , fractions , statisticsfrom collections import deque , defaultdict , OrderedDict , Counterfrom fractions import Fractionfrom decimal import Decimalfrom sys import stdoutfrom heapq import heappush , heappop , heapify , _heapify_max , _heappop_max , nsmallest , nlargest NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;     public class B {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; String str = sc . next ( ) ; int [ ] arr = new int [ n ] ; arr [ 0 ] = str . charAt ( 0 ) == '0' ? 1 : - 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( str . charAt ( i ) == '1' ) { arr [ i ] = arr [ i - 1 ] - 1 ; } else { arr [ i ] = arr [ i - 1 ] + 1 ; } } int last = arr [ n - 1 ] ; int count = 0 ; if ( x == 0 ) count ++ ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == x && last == 0 ) { out . println ( - 1 ) ; return ; } if ( arr [ i ] == x ) { count ++ ; continue ; } if ( last == 0 ) { continue ; } int curr = arr [ i ] ; int val = x - curr ; if ( Math . abs ( val ) % Math . abs ( last ) == 0 ) { val /= last ; if ( val / Math . abs ( val ) == - 1 ) { continue ; } else { count ++ ; } } } println ( count ) ;   }

def solve ( ) : n , x = map ( int , input ( ) . split ( ) ) s = input ( ) cnt = [ 0 for i in range ( n ) ] prev = 0 for i in range ( n ) : if s [ i ] == "0" : cnt [ i ] = prev + 1 prev = cnt [ i ] else : cnt [ i ] = prev - 1 prev = cnt [ i ] ans = 0 increase = cnt [ - 1 ] for i in range ( n ) : if increase != 0 and ( x - cnt [ i ] ) % increase == 0 : if ( cnt [ i ] < x and increase <= 0 ) : continue elif ( cnt [ i ] > x and increase >= 0 ) : continue else : ans += 1 if cnt [ - 1 ] == 0 : if x in cnt : print ( - 1 ) else : if x != 0 : print ( 0 ) else : print ( 1 ) else : if ans == 0 and x == 0 : print ( 1 ) else : if x == 0 : print ( ans + 1 ) else : print ( ans ) for i in range ( int ( input ( ) ) ) : solve ( ) NEW_LINE


import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapify , nlargestmod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) for _ in range ( inp ( ) ) : n , X = inpl ( ) s = list ( sys . stdin . readline ( ) ) ; s = s [ : n ] cnt = [ - 1 ] * n now = 0 for i , x in enumerate ( s ) : if x == '0' : now += 1 else : now -= 1 cnt [ i ] = now las = now if las == 0 : if X == 0 or cnt . count ( X ) : print ( - 1 ) else : print ( 0 ) continue res = 0 for i , x in enumerate ( cnt ) : now = X - x if now * las < 0 : continue if abs ( now ) % abs ( las ) == 0 : res += 1 if X == 0 : res += 1 print ( res ) NEW_LINE


import java . math . * ; import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = " Yes " ; private static final String no = " No " ;   void solve ( ) { int T = nextInt ( ) ;

import sys , os , iofrom collections import defaultdict NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException {


import java . util . * ;   public class AprilFoolsDayPrank_A { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String a = in . next ( ) , b = in . next ( ) ; String A [ ] = new String [ a . length ( ) / 2 ] ; String B [ ] = new String [ b . length ( ) / 2 ] ; int k = 0 ; Arrays . fill ( A , " " ) ; Arrays . fill ( B , " " ) ; for ( int i = 0 ; i < a . length ( ) ; i ++ ) { A [ k ] += a . charAt ( i ) ; B [ k ] += b . charAt ( i ) ; if ( i % 2 != 0 ) k ++ ; } int As = 0 , Bs = 0 ; for ( int i = 0 ; i < A . length ; i ++ ) { if ( A [ i ] . equals ( B [ i ] ) ) continue ; else { if ( A [ i ] . equals ( " ( ) " ) ) { if ( B [ i ] . equals ( " [ ] " ) ) Bs ++ ; else if ( B [ i ] . equals ( "8 < " ) ) As ++ ; } else if ( A [ i ] . equals ( " [ ] " ) ) { if ( B [ i ] . equals ( " ( ) " ) ) As ++ ; else if ( B [ i ] . equals ( "8 < " ) ) Bs ++ ; } else if ( A [ i ] . equals ( "8 < " ) ) { if ( B [ i ] . equals ( " [ ] " ) ) As ++ ; else if ( B [ i ] . equals ( " ( ) " ) ) Bs ++ ; } } } if ( As > Bs ) System . out . println ( " TEAM ▁ 1 ▁ WINS " ) ; else if ( Bs == As ) System . out . println ( " TIE " ) ; else System . out . println ( " TEAM ▁ 2 ▁ WINS " ) ; } }

x = input ( ) y = input ( ) t1 , t2 = 0 , 0 i = 0 while i < len ( x ) : a = x [ i : i + 2 ] NEW_LINE


a = input ( ) b = input ( ) d = 0 s = 0 for i in range ( 0 , len ( a ) , 2 ) : if a [ i ] == " [ " : if b [ i ] == " ( " : s = s + 1 elif b [ i ] == "8" : NEW_LINE


import java . io . FileInputStream ; import java . util . Scanner ;   public class Project_01 {   public static void main ( String [ ] args ) { try {


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . FileReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskA { public void solve ( int testNumber , Scanner sc , PrintWriter out ) { char [ ] s1 = sc . next ( ) . toCharArray ( ) ; char [ ] s2 = sc . next ( ) . toCharArray ( ) ; int res = 0 ; for ( int i = 0 ; i < s1 . length ; i += 2 ) if ( s1 [ i ] == ' [ ' ) { if ( s2 [ i ] == '8' ) res ++ ; else if ( s2 [ i ] == ' ( ' ) res -- ; } else if ( s1 [ i ] == '8' ) { if ( s2 [ i ] == ' ( ' ) res ++ ; else if ( s2 [ i ] == ' [ ' ) res -- ; } else { if ( s2 [ i ] == ' [ ' ) res ++ ; else if ( s2 [ i ] == '8' ) res -- ; } out . println ( res < 0 ? " TEAM ▁ 1 ▁ WINS " : res > 0 ? " TEAM ▁ 2 ▁ WINS " : " TIE " ) ; }   }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public Scanner ( FileReader f ) { br = new BufferedReader ( f ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { } return st . nextToken ( ) ; }   } }


import java . util . * ;   public class AprilFool {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t1 = 0 , t2 = 0 ; String a1 = sc . next ( ) ; String a2 = sc . next ( ) ; String a = "8 < " ; String b = " [ ] " ; String c = " ( ) " ; for ( int i = 0 ; i < a1 . length ( ) ; i += 2 ) { if ( a1 . substring ( i , i + 2 ) . equals ( a ) && a2 . substring ( i , i + 2 ) . equals ( b ) ) t1 ++ ; else if ( a2 . substring ( i , i + 2 ) . equals ( a ) && a1 . substring ( i , i + 2 ) . equals ( b ) ) t2 ++ ; else if ( a1 . substring ( i , i + 2 ) . equals ( b ) && a2 . substring ( i , i + 2 ) . equals ( c ) ) t1 += 1 ; else if ( a2 . substring ( i , i + 2 ) . equals ( b ) && a1 . substring ( i , i + 2 ) . equals ( c ) ) t2 += 1 ; else if ( a1 . substring ( i , i + 2 ) . equals ( c ) && a2 . substring ( i , i + 2 ) . equals ( a ) ) t1 += 1 ; else if ( a2 . substring ( i , i + 2 ) . equals ( c ) && a1 . substring ( i , i + 2 ) . equals ( a ) ) t2 += 1 ; } if ( t1 > t2 ) System . out . println ( " TEAM ▁ 1 ▁ WINS " ) ; else if ( t2 > t1 ) System . out . println ( " TEAM ▁ 2 ▁ WINS " ) ; else System . out . println ( " TIE " ) ;   } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Petr_and_a_Combination_Lock { private static class InputReader { private final BufferedReader reader ; private StringTokenizer tokenizer ;   public InputReader ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( readLine ( ) ) ; } return tokenizer . nextToken ( ) ; }   public String readLine ( ) { String line ; try { line = reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return line ; } } static boolean isValid ( int n , int [ ] num ) { int x , limit = 1 << n ; for ( int i = 0 ; i < limit ; i ++ ) { x = 0 ; for ( int j = 0 ; j < n ; j ++ ) { x += ( ( i & ( 1 << j ) ) == 0 ) ? num [ j ] : - num [ j ] ; } if ( x % 360 == 0 ) return true ;   } return false ; } public static void main ( String [ ] args ) { InputReader sc = new InputReader ( System . in ) ; int t = sc . nextInt ( ) ; int [ ] num = new int [ t ] ; for ( int i = 0 ; i < t ; i ++ ) num [ i ] = sc . nextInt ( ) ; System . out . println ( isValid ( t , num ) ? " YES " : " NO " ) ; } }

import sysdef f ( i , s ) : if i == n : if s % 360 == 0 : print ( " YES " ) sys . exit ( ) return f ( i + 1 , s + b [ i ] ) f ( i + 1 , s - b [ i ] ) n = int ( input ( ) ) b = [ ] for i in range ( n ) : b . append ( int ( input ( ) ) ) f ( 0 , 0 ) print ( " NO " )   NEW_LINE


import java . util . Arrays ; import java . util . Scanner ; import java . util . Vector ;   public class Main {   public static void main ( String [ ] args ) {   Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ;   int [ ] [ ] dp = new int [ ( int ) Math . pow ( 2 , n ) ] [ n + 1 ] ;   int [ ] a = new int [ n ] ;   String can = " no " ;   for ( int i = 0 ; i < n ; i ++ ) {   a [ i ] = scan . nextInt ( ) ;   }   for ( int i = 0 ; i < Math . pow ( 2 , n ) ; i ++ ) {   int mask = i ;   dp [ i ] [ 0 ] = 0 ;   for ( int j = 1 ; j <= n ; j ++ ) {   if ( mask % 2 == 1 ) {   dp [ i ] [ j ] = dp [ i ] [ j - 1 ] + a [ j - 1 ] ;   }   else {   dp [ i ] [ j ] = dp [ i ] [ j - 1 ] - a [ j - 1 ] ;   }   mask /= 2 ;   }   if ( dp [ i ] [ n ] % 360 == 0 ) {   can = " yes " ;   break ;   }   }   System . out . println ( can ) ;   }   }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; int t = sca . nextInt ( ) ; int [ ] a = new int [ ( int ) Math . pow ( 2 , 15 ) ] ; while ( t -- != 0 ) { int k = sca . nextInt ( ) ; if ( a [ 0 ] == 0 ) a [ ++ a [ 0 ] ] = k ; else { int temp = a [ 0 ] ; for ( int i = temp / 2 + 1 ; i <= temp ; i ++ ) { a [ ++ a [ 0 ] ] = a [ i ] - k ; a [ ++ a [ 0 ] ] = a [ i ] + k ; } } } for ( int i = a [ 0 ] ; i >= a [ 0 ] / 2 + 1 ; i -- ) { if ( a [ i ] == 0 || a [ i ] % 360 == 0 ) { System . out . println ( " YES " ) ; break ; } if ( i == a [ 0 ] / 2 + 1 ) { System . out . println ( " NO " ) ; } } } }


import java . util . Scanner ;   public class nk { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int ans = 0 ; boolean gone = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i + 1 < s . length ( ) && s . charAt ( i ) == ' V ' && s . charAt ( i + 1 ) == ' K ' ) { i ++ ; ans ++ ; } else { if ( ! gone ) {   if ( i == s . length ( ) - 2 && s . charAt ( i ) == ' V ' && s . charAt ( i + 1 ) == ' V ' ) { ans ++ ; break ; } else if ( i + 1 < s . length ( ) && i == 0 && s . charAt ( 0 ) == ' K ' && s . charAt ( 1 ) == ' K ' ) { ans ++ ; i ++ ; gone = true ; } else if ( i + 2 < s . length ( ) && s . charAt ( i ) == ' V ' && s . charAt ( i + 1 ) == ' V ' && s . charAt ( i + 2 ) == ' V ' ) { ans ++ ; gone = true ; } else if ( i - 1 >= 0 && i + 1 < s . length ( ) && s . charAt ( i ) == ' K ' && s . charAt ( i + 1 ) == ' K ' && s . charAt ( i - 1 ) == ' K ' ) { ans ++ ; gone = true ; } } } } println ( ans ) ; } public static void print ( Object ob ) { System . out . print ( ob ) ; } public static void println ( ) { print ( ' \n ' ) ; } public static void println ( Object ob ) { print ( ob ) ; println ( ) ; } }

s = input ( ) a = [ s . count ( ' VK ' ) ] for i in range ( len ( s ) ) : if s [ i ] == ' V ' : x = s [ : i ] + ' K ' + s [ i + 1 : ] elif s [ i ] == ' K ' : x = s [ : i ] + ' V ' + s [ i + 1 : ] a . append ( x . count ( ' VK ' ) ) print ( max ( a ) ) NEW_LINE


import sys   arr = list ( sys . stdin . readline ( ) . rstrip ( ) ) st = [ ] ans = 0 idx = 0 while idx < len ( arr ) - 1 : if arr [ idx ] + arr [ idx + 1 ] == ' VK ' : idx += 2 ans += 1 else : st . append ( ( arr [ idx ] , idx ) ) idx += 1 if idx == len ( arr ) - 1 : st . append ( ( arr [ idx ] , idx ) ) can = Falsefor i in range ( len ( st ) - 1 ) : if st [ i ] [ 0 ] == st [ i + 1 ] [ 0 ] : if abs ( st [ i ] [ 1 ] - st [ i + 1 ] [ 1 ] ) == 1 : can = True breakprint ( ans + 1 if can else ans ) NEW_LINE


s = input ( ) a = s . count ( " VK " ) s = s . replace ( " VK " , " ▁ " ) if " VV " in s or " KK " in s : a += 1 print ( a )   NEW_LINE


'''  Welcome ▁ to ▁ GDB ▁ Online . GDB ▁ online ▁ is ▁ an ▁ online ▁ compiler ▁ and ▁ debugger ▁ tool ▁ for ▁ C , ▁ C + + , ▁ Python , ▁ Java , ▁ PHP , ▁ Ruby , ▁ Perl , C # , ▁ VB , ▁ Swift , ▁ Pascal , ▁ Fortran , ▁ Haskell , ▁ Objective - C , ▁ Assembly , ▁ HTML , ▁ CSS , ▁ JS , ▁ SQLite , ▁ Prolog . Code , ▁ Compile , ▁ Run ▁ and ▁ Debug ▁ online ▁ from ▁ anywhere ▁ in ▁ world .   ''' c = input ( ) x = c . count ( " VK " ) c = c . replace ( " VK " , " O " ) if " VV " in c or " KK " in c : x = x + 1 ; print ( x ) NEW_LINE


""" ▁ ▁ ▁ ▁ Vicious ▁ Keyboard """ import syss = input ( ) count = s . count ( ' VK ' ) i = 0 for i in range ( len ( s ) - 1 ) : if ( s [ i ] == ' K ' and s [ i + 1 ] == ' K ' ) : if ( i == 0 ) : count += 1 break elif ( i > 0 ) : if ( s [ i - 1 ] == ' K ' ) : count += 1 break elif ( s [ i ] == ' V ' and s [ i + 1 ] == ' V ' ) : try : if ( s [ i + 2 ] == ' V ' ) : count += 1 break except ( IndexError ) : count += 1 breakprint ( count ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   void run ( FastScanner in , PrintWriter out ) {

import java . util . * ; import java . io . * ; public class File { public static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null | |   ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; String s = sc . next ( ) ; Deque < Integer > deque = new ArrayDeque < > ( ) ; int L = 0 ; int N = s . length ( ) ; boolean isPossible = true ; for ( int i = N - 1 ; i >= 0 ; i - - ) { if ( s . charAt ( i ) == ' ( ' ) { L + + ; } else if ( s . charAt ( i ) == ' ) ' ) { L - - ; } else { L - - ; deque . addFirst ( 1 ) ; } // Lefts must be paired up , or else it ' s not possible . if ( L > 0 ) { if ( deque . isEmpty ( ) ) { isPossible = false ; break ; } else { // Add the needed right to the leftmost right . int R = deque . pollFirst ( ) ; deque . addFirst ( R + 1 ) ; L - - ; } } } if ( L != 0 ) { isPossible = false ; } if ( isPossible ) { if ( deque . size ( ) == 0 ) { out . println ( 0 ) ; } else { for ( int right : deque ) { out . println ( right ) ; } } } else { out . println ( - 1 ) ; } out . close ( ) ; } } NEW_LINE


s = input ( ) c = 0 ; t = s . rfind ( ' # ' ) ans = [ ] ; b = Truefor i in range ( t ) : if s [ i ] == ' ( ' : c += 1 elif s [ i ] == ' ) ' : c -= 1 else : c -= 1 ans . append ( 1 ) if c < 0 : b = False breakm = cfor i in range ( t + 1 , len ( s ) ) : if s [ i ] == ' ( ' : c += 1 else : c -= 1 m = min ( m , c )   if b and m > 0 and m == c : ans . append ( m ) print ( * ans , sep = ' \n ' ) else : print ( - 1 ) NEW_LINE


s = input ( ) n = len ( s ) p , curr = n - 1 , 0 while s [ p ] != ' # ' : if s [ p ] == ' ) ' : curr += 1 else : curr -= 1 p -= 1 if curr < 0 : print ( - 1 ) exit ( ) cnt_hash , curr = s . count ( ' # ' ) , 0 for i in range ( p ) : if s [ i ] == ' ( ' : curr += 1 else : curr -= 1 if curr < 0 : print ( - 1 ) exit ( ) res = s . count ( ' ( ' ) - s . count ( ' ) ' ) - ( cnt_hash - 1 ) if res <= 0 : print ( - 1 ) exit ( ) cnt_hash -= 1 print ( ' \n ' . join ( '1' * cnt_hash ) ) print ( s . count ( ' ( ' ) - s . count ( ' ) ' ) - cnt_hash ) NEW_LINE


import java . io . * ; import java . math . BigInteger ; import java . util . * ;    public class Equal { static class pair implements Comparable < pair > { int v , w ;   public pair ( int v , int w ) { this . v = v ; this . w = w ; }   @ Override public int compareTo ( pair o ) { if ( v == o . v ) return w - o . w ; return o . v - v ; } }   static ArrayList < Integer > [ ] tree ; static int timer = 0 ; static int [ ] timein ; static int [ ] timeout ; static int [ ] [ ] powerParent ; static int [ ] depth ; static int [ ] [ ] minWeight ;   static void dfs ( int u , int parent ) {   timein [ u ] = ++ timer ;

n , m = map ( int , input ( ) . split ( ) ) ans = [ 0 ] * ( n + 10 ) mx = list ( range ( n + 10 ) )   def find ( st ) : if mx [ st ] != st : mx [ st ] = find ( mx [ st ] ) return mx [ st ]     for _ in range ( m ) : l , r , x = map ( int , input ( ) . split ( ) ) xt = find ( l ) while xt < x : if xt != x : ans [ xt ] = x mx [ xt ] = x xt = find ( xt + 1 ) xt = find ( x + 1 ) while xt <= r : if xt != x : ans [ xt ] = x mx [ xt ] = r + 1 xt = find ( xt + 1 ) print ( * ans [ 1 : n + 1 ] ) NEW_LINE


import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class D { static class pair implements Comparable < pair > { long f ; int s ;   public pair ( long x , int y ) { f = x ; s = y ; }   @ Override public int compareTo ( pair o ) { if ( o . f == f ) return s - o . s ; else return ( f - o . f ) > 0 ? 1 : - 1 ;   } }   static class myInt implements Comparable < myInt > { long n ;   public myInt ( long x ) { n = x ; }   @ Override public int compareTo ( myInt o ) { if ( o . n - n > 0 ) return 1 ; if ( o . n == n ) return 0 ; return - 1 ;   } }   public static void main ( String [ ] args ) throws IOException {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . TreeSet ;    public class Main { static int n , m ; static int l , r , x ; static int [ ] k ; static TreeSet < Integer > K , sK , erase ; public static void main ( String [ ] args ) throws IOException { String [ ] data ; BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; data = f . readLine ( ) . split ( " ▁ " ) ; n = Integer . valueOf ( data [ 0 ] ) ; K = new TreeSet < > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { K . add ( i + 1 ) ; } k = new int [ n ] ; m = Integer . valueOf ( data [ 1 ] ) ; for ( int i = 0 ; i < m ; ++ i ) { data = f . readLine ( ) . split ( " ▁ " ) ; l = Integer . valueOf ( data [ 0 ] ) ; r = Integer . valueOf ( data [ 1 ] ) ; x = Integer . valueOf ( data [ 2 ] ) ; sK = ( TreeSet < Integer > ) K . subSet ( l , true , r , true ) ; erase = new TreeSet < > ( ) ; for ( int ki : sK ) { if ( ki != x ) { if ( k [ ki - 1 ] == 0 ) { k [ ki - 1 ] = x ; erase . add ( ki ) ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class CF0928B_Chat { static class Scanner { BufferedReader br ; StringTokenizer st ;   public Scanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   }   static void print ( Object b ) { System . out . print ( b ) ; }   static void println ( Object b ) { System . out . println ( b ) ; }   static void println ( ) { System . out . println ( ) ; }   public static void main ( String [ ] args ) {

n , k = map ( int , input ( ) . split ( " ▁ " ) ) l = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) dp = [ ] for i , x in enumerate ( l ) : if x == 0 : z = min ( i + k + 1 , n ) - max ( 0 , i - k ) else : z = dp [ x - 1 ] + max ( 0 , min ( i + k + 1 , n ) - max ( i - k , x + k ) ) dp . append ( z ) print ( * dp ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) dp = [ 0 ] * ndp [ 0 ] = min ( m + 1 , n ) print ( dp [ 0 ] , end = " ▁ " ) for i in range ( 1 , n ) : if l [ i ] == 0 : v2 = min ( n - 1 , i + m ) v1 = max ( 0 , i - m ) dp [ i ] = v2 - v1 + 1 print ( dp [ i ] , end = " ▁ " ) continue   v2 = min ( n - 1 , i + m ) v1 = max ( 0 , i - m ) v3 = max ( 0 , l [ i ] - 1 - m ) v4 = min ( n - 1 , l [ i ] - 1 + m ) dp [ i ] = dp [ l [ i ] - 1 ] + ( v2 - v1 + 1 ) - max ( 0 , min ( v2 , v4 ) - max ( v1 , v3 ) + 1 ) print ( dp [ i ] , end = " ▁ " ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) p = list ( map ( int , input ( ) . split ( ) ) ) arr_d = [ 0 for _ in range ( n ) ] for i in range ( len ( p ) ) : l_space = k if i - k >= 0 else i r_space = k if i + k < len ( p ) else abs ( len ( p ) - i - 1 ) arr_d [ i ] += l_space + r_space + 1 if p [ i ] != 0 : arr_d [ i ] += arr_d [ p [ i ] - 1 ] link_r_pos = p [ i ] - 1 + k if p [ i ] - 1 + k < len ( p ) else len ( p ) - 1 now_l_pos = i - l_space if link_r_pos >= now_l_pos : arr_d [ i ] -= abs ( link_r_pos - now_l_pos ) + 1 print ( * arr_d ) NEW_LINE


n , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) dp = [ 0 for _ in range ( n ) ]   for i in range ( 0 , n ) : if a [ i ] == 0 : dp [ i ] = 1 + min ( i , k ) + min ( n - 1 - i , k ) else : if not ( ( a [ i ] - 1 + k ) < i - k ) : NEW_LINE


import java . util . * ;   public class Chat {   public static void main ( String [ ] args ) {


import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ;   public class ZadachaB { static List < Integer > messages ; static int n ; static int k ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; sc . nextLine ( ) ; messages = new ArrayList < > ( ) ; messages . add ( Integer . MIN_VALUE ) ;   for ( int i = 1 ; i <= n ; i ++ ) { int num = sc . nextInt ( ) ; if ( num == 0 ) { messages . add ( getC ( i ) ) ; } else { messages . add ( getCNonZero ( i , num ) ) ; } if ( i != n ) System . out . print ( messages . get ( i ) + " ▁ " ) ; else System . out . print ( messages . get ( i ) ) ; } }   private static int getC ( int x ) { if ( k == 0 ) return 1 ; int l = Math . max ( 1 , x - k ) ; int r = Math . min ( n , x + k ) ; return r - l + 1 ; }   private static int getCNonZero ( int x , int z ) { int ans = messages . get ( z ) ; int lZan = Math . max ( 1 , z - k ) ; int rZan = Math . min ( n , z + k ) ;   int l = Math . max ( 1 , x - k ) ; int r = Math . min ( n , x + k ) ;   if ( rZan >= l ) l = rZan + 1 ;   return ans + ( r - l ) + 1 ; } }


import java . io . * ; import java . util . * ; public class MyClass { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ;

n = int ( input ( ) ) if n % 2 == 1 : print ( " - 1" ) else : for i in range ( n ) : if i % 2 == 0 : print ( i + 2 , end = " ▁ " ) else : print ( i , end = " ▁ " ) NEW_LINE


n = int ( input ( ) ) if n % 2 : print ( - 1 ) else : print ( * list ( range ( n , 0 , - 1 ) ) ) NEW_LINE


for _ in range ( 1 ) : n = int ( input ( ) ) a = [ ] q = 0 if ( n % 2 != 0 ) : print ( - 1 ) else : for i in range ( 1 , n + 1 ) : a . append ( i ) for i in range ( 0 , n , 2 ) : t = a [ i ] a [ i ] = a [ i + 1 ] a [ i + 1 ] = t print ( * a )   NEW_LINE


import java . util . Scanner ;   public class A233 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; if ( n % 2 == 1 ) System . out . println ( - 1 ) ; else for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 1 ) { System . out . print ( ( i + 1 ) + " ▁ " ) ; } else { System . out . print ( ( i - 1 ) + " ▁ " ) ; } } } }


import java . util . * ;   public class Cf233A {   public static void main ( String args [ ] ) {   Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ;   if ( n % 2 == 1 ) { System . out . println ( - 1 ) ; return ; }   for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( i % 2 == 1 ? i + 1 + " ▁ " : i - 1 + " ▁ " ) ;   } }


import java . io . * ; import java . util . * ;   public class PerfectPermutation { public static void main ( String args [ ] ) { FScanner in = new FScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; int arr [ ] = new int [ n + 1 ] ; if ( n % 2 != 0 ) out . println ( " - 1" ) ; else { for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 != 0 ) out . print ( i + 1 + " ▁ " ) ; else out . print ( i - 1 + " ▁ " ) ; } }   out . close ( ) ; }   static class FScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer sb = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! sb . hasMoreTokens ( ) ) { try { sb = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { } } return sb . nextToken ( ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { } return " " ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   int [ ] readArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }


import java . util . * ; import java . util . jar . JarOutputStream ;   public class Practise {   public static int [ ] [ ] dp ; public static void main ( String [ ] args ) {

n , b , p = map ( int , input ( ) . split ( ) ) l = [ int ( i ) for i in input ( ) . split ( ) ] w = 0 for i in l : if ( i == 1 ) : if ( b > 0 ) : b = b - 1 else : w = w + 1 else : if ( p > 0 ) : p = p - 1 elif ( b > 0 ) : b = b - 1 else : w = w + 1 print ( w ) NEW_LINE


n , m , k = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) for i in range ( len ( a ) ) : if ( a [ i ] == 1 ) : m -= 1 a [ i ] = 0 if ( m <= 0 ) : breakfor i in range ( len ( a ) ) : if ( k <= 0 and m <= 0 ) : break if ( a [ i ] != 0 ) : if ( a [ i ] == 2 ) : if ( m >= 1 ) : m -= 1 a [ i ] = 0 else : k -= 1 a [ i ] = 0 NEW_LINE


days , bowls , plates = map ( int , input ( ) . split ( ) )   dishes = list ( map ( int , input ( ) . split ( ) ) )   cwash = 0   for i in range ( 0 , days ) : if ( dishes [ i ] == 1 and bowls > 0 ) : bowls -= 1 elif ( dishes [ i ] == 2 and plates > 0 ) : plates -= 1 elif ( dishes [ i ] == 2 and plates == 0 and bowls > 0 ) : bowls -= 1 else : cwash += 1   print ( cwash ) NEW_LINE


n , m , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) )   no = 0 nt = 0   for i in a : if i == 1 : no += 1 else : nt += 1   ans = ( 0 if no - m < 0 else ( no - m ) ) + ( 0 if ( nt - ( k + ( abs ( no - m ) if no - m < 0 else 0 ) ) ) < 0 else ( nt - ( k + ( abs ( no - m ) if no - m < 0 else 0 ) ) ) )   print ( ans ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int k = in . nextInt ( ) ; int a [ ] = new int [ n ] ; int c1 = 0 , c2 = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( a [ i ] == 1 ) c1 ++ ; else c2 ++ ; } m -= c1 ; if ( m < 0 ) ans += Math . abs ( m ) ; c2 = ( m > 0 ) ? c2 - m : c2 ; k -= c2 ; if ( k < 0 ) ans += Math . abs ( k ) ; System . out . println ( ans ) ; } }


import java . util . * ; import java . util . regex . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int next = scan . nextInt ( ) ; if ( next == 1 ) { if ( m > 0 ) { m -- ; } else { res ++ ; } } else { if ( Math . max ( k , m ) > 0 ) { if ( k > 0 ) { k -- ; } else { m -- ; } } else { res ++ ; } } } System . out . println ( res ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   import java . util . Scanner ;   public class Main { private static FastReader scanner = new FastReader ( ) ; public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; int [ ] array = new int [ n ] ; readArray ( array ) ;


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int days = sc . nextInt ( ) ; int bowls = sc . nextInt ( ) ; int plates = sc . nextInt ( ) ; int [ ] ar = new int [ days ] ; for ( int i = 0 ; i < days ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; } int c1 = 0 ; int c2 = 0 ; for ( int i = 0 ; i < days ; i ++ ) { if ( ar [ i ] == 1 ) { if ( bowls > 0 ) { bowls -= 1 ; } else { c1 ++ ; } } else { if ( plates > 0 ) { plates -= 1 ; } else if ( bowls > 0 ) { bowls -= 1 ; } else { c1 ++ ; } } } System . out . println ( c1 ) ;     }      public static long power ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = ans * a ; ans %= c ; } a = a * a ; a %= c ; b /= 2 ; } return ans ; }   public static long power1 ( long a , long b , long c ) { long ans = 1 ; while ( b != 0 ) { if ( b % 2 == 1 ) { ans = multiply ( ans , a , c ) ; } a = multiply ( a , a , c ) ; b /= 2 ;   } return ans ;   }   public static long multiply ( long a , long b , long c ) { long res = 0 ; a %= c ; while ( b > 0 ) { if ( b % 2 == 1 ) { res = ( res + a ) % c ; } a = ( a + a ) % c ; b /= 2 ; }   return res % c ;   }   public static long totient ( long n ) { long result = n ; for ( long i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) {


import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;

from heapq import *   n , k = map ( int , input ( ) . split ( ) ) p = [ int ( X ) for X in input ( ) . split ( ) ] c = [ int ( x ) for x in input ( ) . split ( ) ] p = [ [ p [ i ] , c [ i ] , i ] for i in range ( n ) ] p . sort ( ) j = 0 an = [ 0 ] * nan [ p [ 0 ] [ 2 ] ] = p [ 0 ] [ 1 ] z = [ ] heapify ( z ) NEW_LINE


import sysinput = sys . stdin . readline   '''   '''   from heapq import heapify , heappush , heappop   n , k = map ( int , input ( ) . split ( ) ) plst = list ( map ( int , input ( ) . split ( ) ) ) clst = list ( map ( int , input ( ) . split ( ) ) )   if k == 0 : print ( * clst ) sys . exit ( )   pc = sorted ( ( ( p , c , i ) for i , ( p , c ) in enumerate ( zip ( plst , clst ) ) ) , key = lambda t : ( t [ 0 ] , t [ 2 ] ) ) res = [ 0 ] * npq = [ ] pq_sum = 0 pq_size = 0   for p , c , i in pc : if i > 0 and plst [ i ] == plst [ i - 1 ] : res [ i ] = res [ i - 1 ] else : res [ i ] = pq_sum + c   NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) P = list ( map ( int , input ( ) . split ( ) ) ) C = list ( map ( int , input ( ) . split ( ) ) ) Q = [ ] for i , p in enumerate ( P ) : Q . append ( ( p , i ) ) Q . sort ( ) q = [ ] import heapqheapq . heapify ( [ ] ) s = 0 ans = [ 0 ] * nif k > 0 : for p , i in Q : ans [ i ] = s + C [ i ] if len ( q ) == k : if q [ 0 ] <= C [ i ] : v = heapq . heappop ( q ) heapq . heappush ( q , C [ i ] ) s -= v s += C [ i ] else : heapq . heappush ( q , C [ i ] ) s += C [ i ] print ( * ans ) else : for p , i in Q : ans [ i ] = C [ i ] print ( * ans ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) knight = list ( map ( int , input ( ) . split ( ) ) ) coins = list ( map ( int , input ( ) . split ( ) ) ) d = { } ; ans = [ 0 ] * nfor i in range ( n ) : knight [ i ] = [ knight [ i ] , i ] for i in coins : d [ i ] = d . get ( i , 0 ) + 1 c = coins [ : ] NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = in . nextInt ( ) ; Main m = new Main ( ) ; while ( t -- > 0 ) { m . run ( in , out ) ; } out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; int K ; int [ ] a = new int [ 100_001 ] ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ; K = in . nextInt ( ) ;   boolean allGood = true ; boolean hasK = false ;   for ( int i = 0 ; i < N ; i ++ ) { a [ i ] = in . nextInt ( ) ; allGood &= a [ i ] == K ; hasK |= a [ i ] == K ; }   if ( allGood ) { out . println ( " yes " ) ; return ; } if ( ! hasK ) { out . println ( " no " ) ; return ; }

ans = [ ] for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if k not in a : ans . append ( ' no ' ) continue if n == 1 : ans . append ( ' yes ' if a [ 0 ] == k else ' no ' ) continue good = False for i in range ( n - 1 ) : if a [ i ] >= k and a [ i + 1 ] >= k : good = True for i in range ( 1 , n ) : if a [ i ] >= k and a [ i - 1 ] >= k : good = True for i in range ( 1 , n - 1 ) : if a [ i - 1 ] >= k and a [ i + 1 ] >= k : good = True ans . append ( ' yes ' if good else ' no ' ) print ( ' \n ' . join ( ans ) ) NEW_LINE


import java . util . Arrays ; import java . util . Scanner ;   public class D { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int nums [ ] = new int [ n ] ; int arr [ ] = new int [ n ] ; boolean exist = false ; for ( int i = 0 ; i < nums . length ; i ++ ) { nums [ i ] = sc . nextInt ( ) ; if ( nums [ i ] == k ) { exist = true ; } arr [ i ] = ( nums [ i ] >= k ) ? 1 : 0 ; } if ( n == 1 ) { if ( nums [ 0 ] != k ) { System . out . println ( " no " ) ; } else { System . out . println ( " yes " ) ; } continue ; } if ( ! exist ) { System . out . println ( " no " ) ; continue ; } boolean can = false ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n && j - i <= 2 ; j ++ ) { if ( arr [ i ] > 0 && arr [ j ] > 0 ) { can = true ; break ; } } } if ( can ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . List ; import java . util . StringTokenizer ;   public class Main implements Runnable {   int INF = ( int ) 1e9 ; List < Integer > edges [ ] ; int anc [ ] [ ] ; int ts [ ] , te [ ] ; int t ;   private void solve ( ) throws IOException { int n = nextInt ( ) ; int k = nextInt ( ) ; int a [ ] = new int [ k ] ; int cnt [ ] = new int [ n ] ; int fp [ ] = new int [ n ] ; int lp [ ] = new int [ n ] ; Arrays . fill ( fp , - 1 ) ; Arrays . fill ( lp , - 1 ) ; for ( int i = 0 ; i < k ; ++ i ) { a [ i ] = nextInt ( ) ; a [ i ] -- ; if ( cnt [ a [ i ] ] == 0 ) fp [ a [ i ] ] = i ; lp [ a [ i ] ] = i ; cnt [ a [ i ] ] ++ ; } if ( n == 1 ) { pw . println ( 0 ) ; return ; } int ans = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( cnt [ i ] == 0 ) { if ( i == 0 || i == n - 1 ) { ans += 2 ; } else { ans += 3 ; } } else {

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) p = [ - 1 ] * ( n + 1 ) s = [ - 1 ] * ( n + 1 ) for i in range ( k ) : if p [ a [ i ] ] == - 1 : p [ a [ i ] ] = ifor i in range ( k - 1 , - 1 , - 1 ) : if s [ a [ i ] ] == - 1 : s [ a [ i ] ] = icount = 0 for i in range ( 1 , n + 1 ) : if p [ i ] == - 1 : if i == 1 or i == n : count += 2 continue count += 3 else : if i != n and ( s [ i + 1 ] == - 1 or s [ i + 1 ] < p [ i ] ) : count += 1 if i != 1 and ( s [ i - 1 ] == - 1 or s [ i - 1 ] < p [ i ] ) : count += 1 NEW_LINE


import sys   input = lambda : sys . stdin . readline ( ) . strip ( " \n " )   n , k = map ( int , input ( ) . split ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) first = [ k ] * ( n + 1 ) last = [ - 1 ] * ( n + 1 )   for i in range ( 1 , k + 1 ) : last [ x [ i - 1 ] ] = ifor i in range ( k , 0 , - 1 ) : first [ x [ i - 1 ] ] = i   ans = 0 NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) X = list ( map ( int , input ( ) . split ( ) ) )   fallen = set ( ) pairs = set ( )   for x in X : if ( x - 1 ) in fallen : NEW_LINE


import java . util . * ;   public class A1147 { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int n = cin . nextInt ( ) ; int k = cin . nextInt ( ) ; ArrayList < Integer > [ ] a = new ArrayList [ 100001 ] ; for ( int i = 0 ; i < 100001 ; i ++ ) { a [ i ] = new ArrayList < Integer > ( ) ; } for ( int i = 1 ; i <= k ; i ++ ) { int x = cin . nextInt ( ) ; a [ x ] . add ( i ) ; } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i - 1 ; j <= i + 1 ; j ++ ) { if ( j > 0 && j < n + 1 ) { if ( i == j && a [ i ] . isEmpty ( ) ) { ans ++ ; } if ( i != j && ! a [ i ] . isEmpty ( ) && ! a [ j ] . isEmpty ( ) && a [ i ] . get ( 0 ) > a [ j ] . get ( a [ j ] . size ( ) - 1 ) ) { ans ++ ; } if ( ( i != j ) && ( ( a [ i ] . isEmpty ( ) && ! a [ j ] . isEmpty ( ) ) || ( ! a [ i ] . isEmpty ( ) && a [ j ] . isEmpty ( ) ) || ( a [ i ] . isEmpty ( ) && a [ j ] . isEmpty ( ) ) ) ) { ans ++ ; } } } } System . out . println ( ans ) ;   } }


import java . io . * ; import java . util . * ; public class Ishu { static Scanner scan = new Scanner ( System . in ) ; static void tc ( ) { int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int [ ] min = new int [ n ] ; int [ ] max = new int [ n ] ; int i ; for ( i = 0 ; i < k ; ++ i ) { int pos = scan . nextInt ( ) ; if ( min [ pos - 1 ] == 0 ) min [ pos - 1 ] = i + 1 ; max [ pos - 1 ] = i + 1 ; } int ans = 0 ; for ( i = 0 ; i < n ; ++ i ) { if ( min [ i ] == 0 ) { if ( i - 1 >= 0 ) ans ++ ; ans ++ ; if ( i + 1 < n ) ans ++ ; } else { if ( i - 1 >= 0 ) { if ( max [ i - 1 ] < min [ i ] ) ans ++ ; } if ( i + 1 < n ) { if ( max [ i + 1 ] < min [ i ] ) ans ++ ; } } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int t = 1 ;


import java . util . * ; import java . io . * ;   public class A_Vasya_and_Socks {   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader scan = new FastReader ( ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ;   int count = 0 ; int day = 0 ; while ( n != 0 ) { count ++ ; day ++ ; if ( day % m == 0 ) { n ++ ; } n -- ; } System . out . println ( count ) ; } }

n , m = map ( int , input ( ) . split ( ) )   answer = n + n // ( m - 1 )   if n % ( m - 1 ) == 0 : answer -= 1   print ( answer ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) print ( n + ( n - 1 ) // ( m - 1 ) ) NEW_LINE


n , m = map ( float , input ( ) . split ( ) ) dni = 0 cnt = 0 while n > 0 : n = n - 1 dni = dni + 1 cnt = cnt + 1 if cnt == m : n = n + 1 cnt = 0 print ( dni ) NEW_LINE


n1 , m1 = input ( ) . split ( ) n = int ( n1 ) m = int ( m1 ) a = n + ( ( n - 1 ) / ( m - 1 ) ) print ( int ( a ) ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) days = 0 while n > 0 : n -= 1 days += 1 if days % m == 0 : n += 1 print ( days ) NEW_LINE


import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int i ; for ( i = 1 ; i <= n ; i ++ ) { if ( i % m == 0 ) { n ++ ; } } System . out . println ( n ) ; } }


import java . io . * ; import java . util . StringTokenizer ;   public class A460 { public static void main ( String [ ] args ) throws IOException { PrintWriter out = new PrintWriter ( System . out ) ; FastScanner fs = new FastScanner ( ) ; int N , M ; N = fs . nextInt ( ) ; M = fs . nextInt ( ) ; int ans = N ; while ( N >= M && N != 1 ) { ans += ( N / M ) ; N = ( N / M ) + ( N % M ) ; } out . println ( ans ) ; out . close ( ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public FastScanner ( String filePath ) throws FileNotFoundException { try { br = new BufferedReader ( new FileReader ( filePath ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } }   String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw e ; } } return st . nextToken ( ) ; }   String nextLine ( ) throws IOException { String str ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw e ; } return str ; }   int nextInt ( ) throws IOException { return Integer . parseInt ( this . next ( ) ) ; }   long nextLong ( ) throws IOException { return Long . parseLong ( this . next ( ) ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner myObj = new Scanner ( System . in ) ; int x = myObj . nextInt ( ) ; int y = myObj . nextInt ( ) ; int counter = 1 ; while ( x > 0 ) { x -- ;   if ( counter % y == 0 ) { x ++ ; } counter ++ ; } System . out . println ( counter - 1 ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Main implements Runnable { int n , m , k ; static boolean use_n_tests = false ;   void solve ( FastScanner in , PrintWriter out , int testNumber ) { int x = in . nextInt ( ) ; k = in . nextInt ( ) ; Set < Integer > contest = new HashSet < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) { int type = in . nextInt ( ) ; int id = in . nextInt ( ) ; contest . add ( id ) ; if ( type == 1 ) { int id1 = in . nextInt ( ) ; contest . add ( id1 ) ; } } int mx = 0 ; for ( int i = 1 ; i < x ; i ++ ) { if ( contest . contains ( i ) ) { continue ; } mx ++ ; } int mn = 0 ; for ( int i = 1 ; i < x ; i ++ ) { if ( i + 1 < x ) { if ( ! contest . contains ( i ) && ! contest . contains ( i + 1 ) ) { mn ++ ; i ++ ; } else if ( ! contest . contains ( i ) ) { mn ++ ; } } else { if ( ! contest . contains ( i ) ) { mn ++ ; } } } out . println ( mn + " ▁ " + mx ) ; }

import sys   inp = sys . stdin . readlines ( ) ; ii = 0   out = [ ]   x , k = map ( int , inp [ ii ] . split ( ) ) ii += 1   roundshappened = [ ] for round in range ( k ) : data = [ int ( d ) for d in inp [ ii ] . split ( ) ] ii += 1 for d in data [ 1 : ] : roundshappened . append ( d )   skipped = [ ]   for x in range ( 1 , x ) : if x not in roundshappened : skipped . append ( x )   used = [ ]   minimum = 0   for i in range ( 1 , len ( skipped ) ) : if skipped [ i - 1 ] + 1 == skipped [ i ] and skipped [ i ] not in used and skipped [ i - 1 ] not in used : minimum += 1 used . append ( skipped [ i - 1 ] ) used . append ( skipped [ i ] )   minimum += len ( skipped ) - len ( used )   maximum = len ( skipped ) sys . stdout . write ( str ( minimum ) + ' ▁ ' + str ( maximum ) )         NEW_LINE


import mathx , k = map ( int , input ( ) . split ( " ▁ " ) ) given = [ 0 for x in range ( x - 1 ) ] for _ in range ( k ) : a = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) if a [ 0 ] == 2 : given [ a [ 1 ] - 1 ] = 1 else : given [ a [ 2 ] - 1 ] = 1 given [ a [ 1 ] - 1 ] = 1 cmax = 0 for y in range ( x - 1 ) : if given [ y ] == 0 : cmax = cmax + 1 pp = 0 t = 0 ss = x - 1 while t < ss : if t < ss - 1 and given [ t ] == 0 and given [ t + 1 ] == 0 : pp = pp + 1 t = t + 2 else : t = t + 1 print ( cmax - pp , cmax )                         NEW_LINE


x , k = list ( map ( int , input ( ) . split ( ) ) ) r = [ ] for i in range ( k ) : l = list ( map ( int , input ( ) . split ( ) ) ) for i in l [ 1 : ] : r . append ( i ) r . sort ( ) f = [ ] j = 0 for i in range ( 1 , x ) : if j <= len ( r ) - 1 : if i == r [ j ] : j = j + 1 else : f . append ( i ) else : f . append ( i ) m1 , m2 = 0 , len ( f ) i = 0 while i < len ( f ) : if i + 1 <= len ( f ) - 1 and f [ i + 1 ] - f [ i ] == 1 : i = i + 2 m1 = m1 + 1 else : m1 = m1 + 1 i = i + 1 print ( m1 , m2 ) NEW_LINE


x , k = list ( map ( int , input ( ) . split ( ) ) ) arr = [ 1 ] * ( x - 1 ) for i in range ( k ) : a = list ( map ( int , input ( ) . split ( ) ) ) if a [ 0 ] == 1 : arr [ a [ 2 ] - 1 ] = 0 arr [ a [ 1 ] - 1 ] = 0 maxv = sum ( arr ) arrn = [ ] cl = 0 for i in range ( x - 1 ) : if arr [ i ] == 1 : arrn . append ( i ) cl += 1 minv = 0 if arrn : c = 0 i = 0 while i < cl - 1 : if arrn [ i + 1 ] - arrn [ i ] == 1 : c += 1 i += 2 else : i += 1 minv = maxv - cprint ( minv , maxv ) NEW_LINE


x , k = [ int ( i ) for i in input ( ) . split ( ) ] missed = [ 0 ] * x   for i in range ( k ) : divs = [ int ( i ) for i in input ( ) . split ( ) ] if divs [ 0 ] == 1 : missed [ divs [ 1 ] ] = 1 missed [ divs [ 2 ] ] = 1 else : missed [ divs [ 1 ] ] = 1   max_answer = missed . count ( 0 ) - 1 good_subarrs = 0 i = 1 while i <= x - 1 : if i < x - 1 and missed [ i ] == 0 and missed [ i + 1 ] == 0 : good_subarrs += 1 i += 2 else : i += 1   print ( max_answer - good_subarrs , max_answer ) NEW_LINE


import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ;    public class CodeForce { public static int findmin ( int [ ] arr ) { int sum = 0 ; for ( int i = 1 ; i < arr . length ; i ++ ) { int count = 0 ; while ( i < arr . length && arr [ i ] == 0 ) { i ++ ; count ++ ; } if ( count % 2 != 0 ) { sum = sum + count / 2 + 1 ; } else sum = sum + count / 2 ; } return sum ; } public static int findmax ( int [ ] arr ) { int sum = 0 ; for ( int i = 1 ; i < arr . length ; i ++ ) { int count = 0 ; while ( i < arr . length && arr [ i ] == 0 ) { i ++ ; count ++ ; } sum = sum + count ; } return sum ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;


import java . util . Scanner ;   public class SREUJA_AND_CONTEST {   public static void main ( String [ ] args ) {   Scanner nik = new Scanner ( System . in ) ; int n = nik . nextInt ( ) ; int x = nik . nextInt ( ) ;   boolean b [ ] = new boolean [ n + 1 ] ; for ( int i = 0 ; i < x ; i ++ ) { int t = nik . nextInt ( ) ; if ( t == 2 ) { b [ nik . nextInt ( ) ] = true ; } else { b [ nik . nextInt ( ) ] = true ; b [ nik . nextInt ( ) ] = true ; } } int min = 0 , max = 0 ;   for ( int i = 1 ; i < n ; i ++ ) { if ( i + 1 < n && b [ i ] == false && b [ i + 1 ] == false ) {   min += 1 ; max += 2 ; i += 1 ; } else if ( b [ i ] == false ) { max += 1 ; min ++ ; }   } System . out . println ( min + " ▁ " + max ) ; }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {       public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; int x = input . nextInt ( ) ; int k = input . nextInt ( ) ; boolean xx [ ] = new boolean [ x + 1 ] ; for ( int i = 0 ; i < k ; i ++ ) { int type = input . nextInt ( ) ; if ( type == 1 ) { int div2 = input . nextInt ( ) ; int div1 = input . nextInt ( ) ; xx [ div1 ] = xx [ div2 ] = true ; } else { int div2 = input . nextInt ( ) ; xx [ div2 ] = true ; } } xx [ x ] = true ;


import java . util . Scanner ;   public class PrimitiveRoot { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ;   if ( n == 2 ) { System . out . println ( 1 ) ; return ; } int count = 0 ;   for ( int i = 2 ; i < n ; i ++ ) { int power = 1 ; long root = i * i ; boolean check = true ;   while ( power < n - 2 ) { if ( root % n == 1 ) { check = false ; break ; }   root = ( root * i ) % n ; power ++ ; }   if ( check ) count ++ ; }   System . out . println ( count ) ; } }

def f ( n ) : m = 1 for i in range ( 1 , p - 1 ) : m = ( m * n ) % p if ( m - 1 ) % p : pass else : return False if ( m * n - 1 ) % p : return False return Truep = int ( input ( ) ) cnt = 0 for i in range ( 1 , p ) : if f ( i ) : cnt += 1 print ( cnt ) NEW_LINE


from math import * p = int ( input ( ) ) cnt = 0 c = 0 d = 0 for i in range ( 1 , p ) : if gcd ( i , p - 1 ) == 1 : cnt += 1 print ( cnt ) NEW_LINE


from math import gcd   a = int ( input ( ) ) - 1   aux = 1   for i in range ( 2 , a ) : if gcd ( i , a ) == 1 : aux = aux + 1 print ( aux ) NEW_LINE


from math import gcd   def solve ( p ) : total = 0 for i in range ( 2 , p ) : if gcd ( i , p ) == 1 : total += 1   print ( total + 1 )     n = int ( input ( ) ) solve ( n - 1 ) NEW_LINE


import java . util . Scanner ;   public class CowsAndPrimitiveRoots { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int result = 0 ;   for ( int i = 1 ; i < n ; i ++ ) { int x = 1 ; boolean flag = true ; for ( int j = 1 ; j < n - 1 ; j ++ ) { x = x * i ; x %= n ; if ( x == 1 ) { flag = false ; break ; } } if ( flag ) { x = x * i ; x %= n ; if ( x == 1 ) { result ++ ; } } }   System . out . println ( result ) ;   sc . close ( ) ; } }


import java . util . Scanner ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int p ; p = input . nextInt ( ) ; int ans = 0 ; for ( int x = 1 ; x < p ; x ++ ) { boolean flag = true ; int tmp = 1 ; for ( int i = 1 ; i < p - 1 ; i ++ ) { tmp *= x ; if ( ( tmp - 1 ) % p == 0 ) { flag = false ; break ; } tmp %= p ; } if ( flag ) { if ( ( tmp * x - 1 ) % p == 0 ) { ans ++ ; } } } System . out . println ( ans ) ; } }


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;     public class Main { public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int count = 0 ; for ( int i = 1 ; i < n ; i ++ ) { TreeSet < Integer > set = new TreeSet < > ( ) ; int j = 1 ; int sum = i ; while ( j < n ) { sum = sum % n ; set . add ( sum ) ; sum *= i ; j ++ ; } if ( set . size ( ) == n - 1 ) count ++ ; } System . out . println ( count ) ; }   static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main {    public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; long a = input . nextLong ( ) ; long b = input . nextLong ( ) ; long c = input . nextLong ( ) ; long ans = 0 ; ans = ( a * b * c ) - ( ( a - 1 ) * ( b - 1 ) * ( c - 1 ) ) ; System . out . println ( ans ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   }

a , b , c = sorted ( map ( int , input ( ) . split ( ) ) ) print ( a * ( 2 * c + a - 1 ) + ( c + a - 1 ) * ( b - a - 1 ) ) NEW_LINE


try : a , b , c = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) print ( a * b * c - ( ( a - 1 ) * ( b - 1 ) * ( c - 1 ) ) )                   except : pass NEW_LINE


a , b , c = list ( map ( int , input ( ) . split ( ) ) ) print ( b * c + ( ( a - 1 ) * ( c + b - 1 ) ) ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) ) print ( b * c + ( a - 1 ) * ( c + b - 1 ) ) NEW_LINE


x , y , z = map ( int , input ( ) . split ( ) ) print ( ( x - 1 ) * ( y - 1 ) + z * ( x + y - 1 ) ) NEW_LINE


import java . util . Scanner ;   public class TileArea { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ;   System . out . println ( ( b + a - 1 ) * ( c + a - 1 ) - a * ( a - 1 ) ) ; } }


import java . util . * ; import java . lang . * ;


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner src = new Scanner ( System . in ) ; int x = src . nextInt ( ) ; int y = src . nextInt ( ) ; int z = src . nextInt ( ) ; int a = 0 , b = 0 ; double min = 1 ; for ( int den = ( y <= z ) ? y : z ; den > 0 ; den -- ) { int num = ( ( ( ( double ) x / y ) * den ) - 0.5 ) == ( ( int ) ( ( double ) x / y ) * den ) ? ( ( int ) ( ( double ) x / y ) * den ) : ( int ) Math . round ( ( ( double ) x / y ) * den ) ;

from fractions import Fractionx , y , n = map ( int , input ( ) . split ( ) ) v = Fraction ( x , y ) . limit_denominator ( n ) print ( v . numerator , v . denominator , sep = ' / ' ) NEW_LINE


from fractions import Fraction   x , y , n = map ( int , input ( ) . split ( ) )   v = Fraction ( x , y ) . limit_denominator ( n ) print ( str ( v . numerator ) + ' / ' + str ( v . denominator ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ;   public class A {   public static void main ( String [ ] args ) throws IOException {   FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int x = sc . nextInt ( ) , y = sc . nextInt ( ) , n = sc . nextInt ( ) ;


import java . io . * ; import java . util . * ; public class f10 { static public void process ( double x , double y , int n ) { double max = 100001 ; int a = 0 , b = 0 ; for ( int den = 1 ; den <= n ; den ++ ) { double num = ( x / y ) * den ;


import java . util . Scanner ;   public class _0684MiddleoftheContest {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] strf = sc . nextLine ( ) . trim ( ) . split ( " : " ) ; String [ ] stre = sc . nextLine ( ) . trim ( ) . split ( " : " ) ;   int hrf = Integer . valueOf ( strf [ 0 ] ) ; int mmf = Integer . valueOf ( strf [ 1 ] ) ; int hre = Integer . valueOf ( stre [ 0 ] ) ; int mme = Integer . valueOf ( stre [ 1 ] ) ; int t1 = hrf * 60 + mmf ; int t2 = hre * 60 + mme ; int t3 = ( t1 + t2 ) / 2 ; hrf = ( t3 ) / 60 ; mmf = ( t3 % 60 ) ; if ( ( hrf + " " ) . length ( ) == 1 ) { System . out . print ( "0" + hrf ) ; } else { System . out . print ( hrf ) ; } System . out . print ( " : " ) ; if ( ( mmf + " " ) . length ( ) == 1 ) { System . out . print ( "0" + mmf ) ; } else { System . out . print ( mmf ) ;   }   }   }

start = input ( ) . split ( ' : ' ) end = input ( ) . split ( ' : ' ) start_min = int ( start [ 0 ] ) * 60 + int ( start [ 1 ] ) end_min = int ( end [ 0 ] ) * 60 + int ( end [ 1 ] ) diff = ( end_min - start_min ) // 2 print ( ' { :0 > 2 } ' . format ( str ( ( start_min + diff ) // 60 ) ) + ' : ' + ' { :0 > 2 } ' . format ( str ( ( start_min + diff ) % 60 ) ) ) NEW_LINE


start_time = input ( ) end_time = input ( ) start_time = start_time . split ( ' : ' ) end_time = end_time . split ( ' : ' ) start_hours = int ( start_time [ 0 ] ) start_minutes = int ( start_time [ 1 ] ) end_hours = int ( end_time [ 0 ] ) end_minutes = int ( end_time [ 1 ] ) start_hours *= 60 end_hours *= 60 start_hours += start_minutesend_hours += end_minutesx = end_hours - start_hoursx = x / 2 y = start_hours + xz = y % 60 w = y // 60 if z < 10 and w < 10 : print ( ( '0 { } :0 { } ' ) . format ( int ( w ) , int ( z ) ) ) elif w < 10 : print ( ( '0 { } : { } ' ) . format ( int ( w ) , int ( z ) ) ) elif z < 10 : print ( ( ' { } : 0 { } ' ) . format ( int ( w ) , int ( z ) ) ) else : print ( ( ' { } : { } ' ) . format ( int ( w ) , int ( z ) ) ) NEW_LINE


import java . lang . reflect . Array ; import java . text . DecimalFormat ; import java . util . * ; import java . io . * ;   public class Equal {    static class pair implements Comparable < pair > { int x ; int y ;   public pair ( int u , int v ) { this . x = u ; this . y = v ; }   @ Override public int compareTo ( pair o ) { if ( y == o . y ) return 0 ; if ( y < o . y ) return 1 ; return - 1 ; } }   static double dis ( pair a , pair b ) { return Math . sqrt ( ( ( a . x - b . x ) * ( a . x - b . x ) ) + ( ( a . y - b . y ) * ( a . y - b . y ) ) ) ; }   static int c ; static int d ; static int e ;   static void extendedEuclid ( int a , int b ) { if ( b == 0 ) { c = 1 ; d = 0 ; e = a ; return ; } extendedEuclid ( b , a % b ) ; int x1 = d ; int y1 = c - ( a / b ) * d ; c = x1 ; d = y1 ; } static int [ ] rank ; static int [ ] p ; static int sets ; static int findSet ( int i ) { return ( p [ i ] == i ) ? i : ( p [ i ] = findSet ( p [ i ] ) ) ; } static boolean isSameSet ( int i , int j ) { return findSet ( i ) == findSet ( j ) ; } static void unionSet ( int i , int j ) { if ( ! isSameSet ( i , j ) ) { sets -- ; int x = findSet ( i ) ; int y = findSet ( j ) ; if ( rank [ x ] > rank [ y ] ) p [ y ] = x ; else { p [ x ] = y ; if ( rank [ x ] == rank [ y ] ) rank [ y ] ++ ; } } } static class SegmentTree {

s = input ( ) start = 1 if s [ 0 ] == " - " else 0 answer = " "   float_start = len ( s ) if s . count ( " . " ) == 0 else s . index ( " . " ) answer = ( "0" + ( "0" if float_start == len ( s ) else s [ float_start + 1 ] ) if float_start + 2 >= len ( s ) else s [ float_start + 1 : float_start + 3 ] [ : : - 1 ] ) + " . "   current = 0 for i in range ( float_start - 1 , start - 1 , - 1 ) : answer += s [ i ] current += 1 if current == 3 and i != start : answer += " , " current = 0   answer = ( answer + " $ " ) [ : : - 1 ] print ( answer if start == 0 else " ( " + answer + " ) " ) NEW_LINE


s = input ( ) dot = 0 if " . " in s : dot = s . index ( " . " ) else : dot = len ( s ) a = s [ 0 : dot ] NEW_LINE


s = input ( ) start = 1 if s [ 0 ] == " - " else 0 answer = " "   float_start = 0 try : float_start = s . index ( " . " ) except : float_start = len ( s )   if float_start == len ( s ) : answer += "00 . " else : answer += s [ float_start + 1 : float_start + 3 ] [ : : - 1 ] + " . "   if float_start + 2 >= len ( s ) : answer = "0" + answer [ 0 ] + " . "   current = 0 for i in range ( float_start - 1 , start - 1 , - 1 ) : current += 1 answer += s [ i ] if current == 3 and i != start : answer += " , " current = 0 answer += " $ "   if start == 1 : print ( f " ( { answer [ : : -1 ] } ) " ) else : print ( answer [ : : - 1 ] ) NEW_LINE


import java . util . * ; public class HelpKingdomOfFarFarAway2 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) , ans = " " ; boolean flag = true ; if ( s . charAt ( 0 ) == ' - ' ) { s = s . substring ( 1 ) ; flag = false ; } int i ; for ( i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' . ' ) break ; } for ( int k = 1 , j = i - 1 ; j >= 0 ; j -- , k ++ ) { ans = s . charAt ( j ) + ans ; if ( k % 3 == 0 && j != 0 ) { ans = ' , ' + ans ; k = - 3 ; } } ans += ' . ' ; if ( i + 1 < s . length ( ) ) ans += s . charAt ( i + 1 ) ; else ans += '0' ; if ( i + 2 < s . length ( ) ) ans += s . charAt ( i + 2 ) ; else ans += '0' ; ans = ' $ ' + ans ; if ( ! flag ) ans = ' ( ' + ans + ' ) ' ; System . out . println ( ans ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;    public class Main { public static void main ( String [ ] args ) {


import java . io . * ; import java . util . * ;   public class HelpKingdom_102B { public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; String s = fr . nextLine ( ) ;   boolean neg = s . indexOf ( " - " ) != - 1 ;   int point = s . indexOf ( " . " ) ;   StringBuilder sb = new StringBuilder ( ) ; if ( point == - 1 ) { if ( neg ) sb . append ( " ( $ " ) ; else sb . append ( " $ " ) ; StringBuilder bulk = new StringBuilder ( ) ; if ( neg ) { bulk . append ( s . substring ( 1 ) ) ; } else { bulk . append ( s ) ; } int add = ( bulk . length ( ) / 3 ) ; int pos = bulk . length ( ) % 3 ; int added = 0 ;


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] value = new int [ n ] ; for ( int i = 0 ; i < value . length ; i ++ ) { value [ i ] = in . nextInt ( ) ; } int l = 0 , r = n - 1 ; int s = 0 , d = 0 ; boolean p = true ; while ( l <= r ) { if ( value [ l ] >= value [ r ] ) { if ( p ) s += value [ l ] ; else d += value [ l ] ; l ++ ; } else if ( value [ r ] > value [ l ] ) { if ( p ) s += value [ r ] ; else d += value [ r ] ; r -- ; } if ( p ) p = false ; else p = true ; } System . out . println ( s + " ▁ " + d ) ; } }

from collections import deque   n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] b = [ 0 , 0 ] x , y = 0 , n - 1 for i in range ( n ) : if a [ x ] > a [ y ] : b [ i % 2 ] += a [ x ] x += 1 else : b [ i % 2 ] += a [ y ] y -= 1 print ( * b , sep = ' ▁ ' ) NEW_LINE


n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] ans = [ 0 , 0 ] k = 0 i = 0j = n - 1 while ( n > 0 ) : if ( a [ i ] > a [ j ] ) : ans [ k ] += a [ i ] i += 1 else : ans [ k ] += a [ j ] j -= 1 n -= 1 if ( k == 0 ) : k = 1 else : k = 0   print ( " { } ▁ { } " . format ( ans [ 0 ] , ans [ 1 ] ) ) NEW_LINE


n = int ( input ( ) ) a = tuple ( map ( int , input ( ) . split ( ) ) ) i , j = 0 , n - 1 x = y = 0 c = 1 while i <= j : if a [ i ] >= a [ j ] : if c : x += a [ i ] else : y += a [ i ] i += 1 else : if c : x += a [ j ] else : y += a [ j ] j -= 1 c = not c and 1 print ( x , y ) NEW_LINE


n = int ( input ( ) ) l = input ( ) . split ( ) p = [ ] for x in l : p . append ( int ( x ) ) i = 0j = len ( p ) - 1 note = 0 ser = [ ] dim = [ ] while i <= j : if p [ i ] <= p [ j ] and note == 0 : ser . append ( p [ j ] ) j = j - 1 note = 1 elif p [ i ] > p [ j ] and note == 0 : ser . append ( p [ i ] ) i = i + 1 note = 1 elif p [ i ] <= p [ j ] and note == 1 : dim . append ( p [ j ] ) j = j - 1 note = 0 elif p [ i ] > p [ j ] and note == 1 : dim . append ( p [ i ] ) i = i + 1 note = 0 NEW_LINE


import java . util . Scanner ; import java . util . Arrays ; import java . util . * ; import java . math . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int cards = s . nextInt ( ) ; int a [ ] = new int [ cards ] ; int end = cards - 1 ; int start = 0 ; int se = 0 ; int d = 0 ; boolean f = true ; for ( int i = 0 ; i < cards ; i ++ ) { a [ i ] = s . nextInt ( ) ; } for ( int i = 0 ; i < cards ; i ++ ) { if ( f == true ) { if ( a [ start ] > a [ end ] ) { se += a [ start ] ; start ++ ;   } else { se += a [ end ] ; end -- ; } f = false ; } else {   if ( a [ start ] > a [ end ] ) { d += a [ start ] ; start ++ ;   } else { d += a [ end ] ; end -- ; } f = true ; }   } System . out . print ( se + " ▁ " + d ) ; }   }


import java . util . * ; public class GFG { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = 1 ;   while ( t -- > 0 )   { int sp = 0 , dp = 0 ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; int first = 0 ; int last = a . length - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ last ] > a [ first ] ) { if ( i % 2 == 0 ) sp = sp + a [ last ] ; else dp = dp + a [ last ] ; last -- ; } else { if ( i % 2 == 0 ) sp = sp + a [ first ] ; else dp = dp + a [ first ] ; first ++ ; } } System . out . println ( sp + " ▁ " + dp ) ; } } }


import java . util . ArrayList ; import java . util . Collections ; import java . util . HashSet ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; ArrayList < Integer > list = new ArrayList ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( scanner . nextInt ( ) ) ; } int l = 0 , r = 0 ; for ( int t = 0 , i = 0 , j = n - 1 ; i <= j ; t ++ ) { if ( t % 2 == 0 ) { if ( list . get ( i ) > list . get ( j ) ) { l += list . get ( i ) ; i ++ ; } else { l += list . get ( j ) ; j -- ; } } else { if ( list . get ( i ) > list . get ( j ) ) { r += list . get ( i ) ; i ++ ; } else { r += list . get ( j ) ; j -- ; } } } System . out . println ( l + " ▁ " + r ) ; } }


import java . util . * ; import java . io . * ; import java . lang . * ; public class Code { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int i = 0 ; int j = arr . length - 1 ; boolean flag = true ; int s = 0 ; int d = 0 ; while ( i <= j ) { if ( flag == true ) { if ( arr [ i ] > arr [ j ] ) { s = s + arr [ i ] ; flag = false ; i ++ ; } else { s = s + arr [ j ] ; flag = false ; j -- ; } } else { if ( arr [ i ] > arr [ j ] ) { d = d + arr [ i ] ; flag = true ; i ++ ; } else { d = d + arr [ j ] ; flag = true ; j -- ; } } } System . out . println ( s + " ▁ " + d ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   import java . util . * ; public class Main { static long find ( long n ) { if ( n == 1 ) return 1 ; long ans = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { ans *= 2 ; } return ans + find ( n - 1 ) ; } public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; StringBuilder ans = new StringBuilder ( ) ; String temp = " abcd " ; for ( int i = 0 ; i < n ; i ++ ) { ans . append ( temp . charAt ( i % 4 ) ) ; } System . out . println ( ans ) ;   out . flush ( ) ; }

n = int ( input ( ) ) for i in range ( n ) : if i % 4 == 0 : print ( " a " , end = " " ) elif i % 4 == 1 : print ( " b " , end = " " ) elif i % 4 == 2 : print ( " c " , end = " " ) elif i % 4 == 3 : print ( " d " , end = " " ) NEW_LINE


n = int ( input ( ) ) s = " abcd " * ( 4 * n ) print ( s [ : n ] ) NEW_LINE


import sys   def input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def rinput ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) )       n = iinput ( ) s = [ ] for i in range ( n ) : if ( i == 0 or i % 4 == 0 ) : s . append ( ' a ' ) elif ( i == 1 or ( i - 1 ) % 4 == 0 ) : s . append ( ' b ' ) elif ( i == 2 or ( i - 2 ) % 4 == 0 ) : s . append ( ' c ' ) elif ( i == 3 or ( i - 3 ) % 4 == 0 ) : s . append ( ' d ' )   print ( " " . join ( s ) ) NEW_LINE


n = int ( input ( ) ) s = " abcd " for i in range ( n // 4 ) : print ( s , end = " " ) print ( s [ : n % 4 ] , end = " " ) NEW_LINE


n = int ( input ( ) )   x = ' abcdefghijklmnopqrstuvwxyz '     u = [ 0 ] * ( n )   s = 0 for j in range ( n ) : if u [ j ] == 0 : while j < n : u [ j ] = x [ s ] j += 4 s = ( s + 1 ) % 26     print ( ' ' . join ( u ) ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ;    @ SuppressWarnings ( " unused " ) public class A { public static Scanner scan = new Scanner ( System . in ) ; static char [ ] c = { ' a ' , ' b ' , ' c ' , ' d ' } ; public static void solve ( ) { int n = scan . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( c [ i % 4 ] ) ; } } public static void main ( String [ ] args ) { solve ( ) ; scan . close ( ) ; }   }


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; String s = " abcd " ; for ( int i = 0 ; i < n / 4 ; i ++ ) System . out . print ( s ) ; System . out . print ( s . substring ( 0 , n % 4 ) ) ; } }


import java . util . * ; public class Taymyr_is_calling_you {   public static void main ( String [ ] args ) {

def rec ( n , z , l , x , y ) : if n > z : return l elif n == z : l . append ( n ) return l else : if n not in l : l . append ( n ) rec ( n * x , z , l , x , y ) rec ( n * y , z , l , x , y )     def gcd ( x , y ) : if x < y : x , y = y , x if y == 0 : return x return gcd ( y , x % y )     def lcm ( x , y ) : if x < y : x , y = y , x gcd_ = gcd ( x , y ) return x * y // gcd_     def main_func ( ) : x , y , z = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] count = 0 for i in range ( 1 , z + 1 ) : if not i % x and not i % y : count += 1   return count   print ( main_func ( ) )       NEW_LINE


import math     if __name__ == ' _ _ main _ _ ' : n , m , z = map ( int , input ( ) . split ( ) ) print ( z // ( n * m // math . gcd ( n , m ) ) ) NEW_LINE


import sysfrom math import gcd   def main ( ) : n , m , z = map ( int , sys . stdin . read ( ) . strip ( ) . split ( ) ) return z // ( n * m // gcd ( n , m ) ) print ( main ( ) ) NEW_LINE


import mathn , m , z = map ( int , input ( ) . split ( ) ) print ( z // ( ( n * m ) // math . gcd ( n , m ) ) ) NEW_LINE


n , m , z = map ( int , input ( ) . split ( ) ) c = 0 for i in range ( m , z + 1 , m ) : if i % n == 0 : c += 1 print ( c ) NEW_LINE


import java . util . * ; public class Taymyriscallingyou {   public static void main ( String [ ] args ) {


import java . util . Scanner ;     public class Main { public static void main ( String [ ] args ) {


import java . util . Scanner ;   public class Taymyr { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int z = scanner . nextInt ( ) ;   int intersection = 0 ; for ( int i = n ; i <= z ; i = i + n ) { for ( int j = m ; j <= z ; j = j + m ) { if ( i == j ) { intersection ++ ; } } }   System . out . println ( intersection ) ; }    }


import java . io . * ;   public class Main { static String str ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException { str = br . readLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 , j ; i < str . length ( ) ; ++ i ) { if ( str . charAt ( i ) == ' / ' ) { j = i ; while ( j < str . length ( ) && str . charAt ( j ) == ' / ' ) { ++ j ; } sb . append ( str . charAt ( i ) ) ; i = j - 1 ; } else { sb . append ( str . charAt ( i ) ) ; } } int k = sb . length ( ) - 1 ; bw . write ( sb . length ( ) > 1 && sb . charAt ( k ) == ' / ' ? sb . substring ( 0 , k ) : sb . toString ( ) ) ; bw . close ( ) ; } }

linha = input ( ) . split ( ' / ' ) ans = [ ]   for i in range ( len ( linha ) ) : if len ( linha [ i ] ) > 0 : ans . append ( linha [ i ] ) print ( ' / ' + ' / ' . join ( ans ) ) NEW_LINE


path = list ( filter ( lambda x : len ( x ) != 0 , input ( ) . split ( ' / ' ) ) ) print ( ' / ' + ' / ' . join ( path ) ) NEW_LINE


s = input ( ) . strip ( ) x = [ 1 ]   for i in s :   if i != ' / ' : x . append ( i ) else : if x [ - 1 ] != i : x . append ( i ) if x [ - 1 ] == ' / ' and len ( x ) > 2 : print ( ' ' . join ( x [ 1 : len ( x ) - 1 ] ) ) else : print ( ' ' . join ( x [ 1 : ] ) ) NEW_LINE


d = [ x for x in input ( ) . split ( ' / ' ) if x ] print ( ' / ' + ' / ' . join ( d ) ) NEW_LINE


print ( ' / ' + ' / ' . join ( filter ( lambda x : len ( x ) , input ( ) . split ( ' / ' ) ) ) ) NEW_LINE


import java . util . Scanner ; public class BerOS { public static void main ( String [ ] args ) { Scanner mm = new Scanner ( System . in ) ; String s = mm . next ( ) ; String res = " " ; boolean ok = true ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != ' / ' ) { ok = true ; res += s . charAt ( i ) ; } else { if ( ok ) { res += " / " ; } ok = false ; } } if ( res . charAt ( res . length ( ) - 1 ) == ' / ' && res . length ( ) > 1 ) { res = res . substring ( 0 , res . length ( ) - 1 ) ; } System . out . println ( res ) ; } }


import java . util . Scanner ; public class Code19 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; String res = " " ; boolean ok = true ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) != ' / ' ) { ok = true ; res += s . charAt ( i ) ; } else { if ( ok ) { res += " / " ; } ok = false ; } } if ( res . charAt ( res . length ( ) - 1 ) == ' / ' && res . length ( ) > 1 ) { res = res . substring ( 0 , res . length ( ) - 1 ) ; } System . out . println ( res ) ; } }


import java . io . File ; import java . io . FileNotFoundException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; import java . util . Stack ; public class test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; String output = " " ; boolean open = false , f = false ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == ' / ' ) { open = true ; } else { if ( open ) { open = false ; output += ' / ' ; } f = true ; output += str . charAt ( i ) ; } } if ( open && ! f ) output += ' / ' ; System . out . println ( output ) ; } }


import java . util . * ; import java . io . * ;   public class Accordion { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int t = 1 ;   while ( t -- > 0 ) {   char a [ ] = br . readLine ( ) . trim ( ) . toCharArray ( ) ; int n = a . length ;   int i = 0 ; for ( ; i < n ; i ++ ) { if ( a [ i ] == ' [ ' ) break ; } int j = i + 1 ; for ( ; j < n ; j ++ ) { if ( a [ j ] == ' : ' ) break ; } int k = n - 1 ; for ( ; k >= 0 ; k -- ) { if ( a [ k ] == ' ] ' ) break ; } int l = k - 1 ; for ( ; l >= 0 ; l -- ) { if ( a [ l ] == ' : ' ) break ; }    if ( j < l ) { int count = 0 ; for ( int p = j + 1 ; p < l ; p ++ ) { if ( a [ p ] == ' | ' ) count ++ ; } pw . println ( count + 4 ) ; } else { pw . println ( - 1 ) ; } } pw . flush ( ) ; }   }

s = input ( ) ans = 0 i , j = 0 , len ( s ) - 1 while i < j and s [ i ] != ' [ ' : i += 1 while j > i and s [ j ] != " ] " : j -= 1 if i > j : print ( - 1 ) else : ans += 2 i += 1 j -= 1 while i < j and s [ i ] != ' : ' : i += 1 while j > i and s [ j ] != " : " : j -= 1 if i >= j : print ( - 1 ) else : ans += 2 i += 1 j -= 1 while i <= j : if s [ i ] == " | " : ans += 1 i += 1 print ( ans )   NEW_LINE


r = list ( " [ : : ] " )   s = str ( input ( ) ) r = [ " [ " , " : " ] left = - 1 for i in range ( 0 , len ( s ) - 2 ) : if s [ i ] == r [ 0 ] : del ( r [ 0 ] ) if r == [ ] : left = i breakif left != - 1 : r = [ " ] " , " : " ] right = - 1 for i in range ( len ( s ) - 1 , left , - 1 ) : if s [ i ] == r [ 0 ] : del ( r [ 0 ] ) if r == [ ] : right = i break if right != - 1 : bb = 0 for i in range ( left + 1 , right ) : if s [ i ] == " | " : bb += 1 print ( 4 + bb ) else : print ( - 1 ) else : print ( - 1 ) NEW_LINE


import sys , string , heapq   arr = list ( sys . stdin . readline ( ) . rstrip ( ) ) n = len ( arr ) left = 0 right = 2 * nwhile left < right : mid = ( left + right ) // 2 res = { ' [ ' : 9876543210 , ' : ' : [ 9876543210 , - 1 ] , ' ] ' : - 1 } can = False for i in range ( n ) : if arr [ i ] == ' [ ' : res [ arr [ i ] ] = min ( res [ arr [ i ] ] , i ) elif arr [ i ] == ' ] ' : res [ arr [ i ] ] = max ( res [ arr [ i ] ] , i ) if res [ ' [ ' ] != 9876543210 and res [ ' ] ' ] != - 1 : for i in range ( n ) : if arr [ i ] == ' : ' : if res [ ' [ ' ] < i < res [ ' ] ' ] : res [ ' : ' ] [ 0 ] = min ( res [ ' : ' ] [ 0 ] , i ) res [ ' : ' ] [ 1 ] = max ( res [ ' : ' ] [ 1 ] , i ) if res [ ' : ' ] [ 0 ] != res [ ' : ' ] [ 1 ] : if res [ ' : ' ] [ 0 ] != 9876543210 and res [ ' : ' ] [ 1 ] != - 1 : cnt = 0 for i in range ( n ) : if arr [ i ] == ' | ' and res [ ' : ' ] [ 0 ] < i < res [ ' : ' ] [ 1 ] : cnt += 1 if cnt >= mid - 4 : can = True if can : left = mid + 1 else : right = midprint ( right - 1 ) NEW_LINE


import mathsa = lambda : input ( ) sb = lambda : int ( input ( ) ) sc = lambda : input ( ) . split ( ) sd = lambda : list ( map ( int , input ( ) . split ( ) ) ) se = lambda : float ( input ( ) ) sf = lambda : list ( input ( ) ) NEW_LINE


import java . io . IOException ; import java . io . InputStream ; import java . util . InputMismatchException ; public class BEducation58 {   public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( System . in ) ; String g = in . next ( ) ; int ans = ans ( g ) ; System . out . println ( ans ) ; } public static int ans ( String g ) { int index0 = g . indexOf ( ' [ ' ) ; int index1 = g . lastIndexOf ( ' ] ' ) ; if ( index0 == - 1 || index1 == - 1 || index0 > index1 ) { return - 1 ; } int index2 = g . indexOf ( ' : ' , index0 ) ; int index3 = - 1 ; for ( int i = index1 ; i >= 0 ; i -- ) { if ( g . charAt ( i ) == ' : ' ) { index3 = i ; break ; } } if ( index2 == - 1 || index3 == - 1 || index2 >= index3 ) { return - 1 ; }


import java . util . Scanner ; public class Accordion {   public static void main ( String [ ] args ) { Scanner obj = new Scanner ( System . in ) ; String s = obj . next ( ) ; int c1 = 0 , c2 = 0 , c3 = 0 , c4 = 0 , c5 = 0 ; int idx = s . lastIndexOf ( ' [ ' ) ; int idx2 = s . lastIndexOf ( ' ] ' ) ; int k = 0 ;   for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' [ ' ) { c1 = 1 ; continue ; } if ( s . charAt ( i ) == ' : ' && c1 > c2 ) { c2 ++ ; k = i ; continue ; } } int g = 0 ; for ( int i = s . length ( ) - 1 ; i > k ; i -- ) { if ( s . charAt ( i ) == ' ] ' ) { c4 ++ ; continue ; } if ( c4 > c5 && s . charAt ( i ) == ' : ' ) { c5 = 1 ; g = i ; break ; }   } for ( int i = k + 1 ; i < g ; i ++ ) { if ( s . charAt ( i ) == ' | ' ) c3 ++ ; } if ( c1 == 0 || c2 == 0 || c4 == 0 || c5 == 0 ) { System . out . println ( " - 1" ) ; } else System . out . println ( 4 + c3 ) ;   }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;    public class Another {   public static void main ( String [ ] args ) throws IOException { FastReader in = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; long m = in . nextLong ( ) ; long R = in . nextLong ( ) ; pw . printf ( " % .12f \n " , ( 2 + 2. * ( m - 1 ) * m * ( m + 1 ) / 3 / m / m - 2 * ( 2 - Math . sqrt ( 2 ) ) + ( 2 - Math . sqrt ( 2 ) ) * ( 2 * m + 2 * ( m - 1 ) ) / m / m ) * R ) ; pw . flush ( ) ; pw . close ( ) ; } static class FastReader { StringTokenizer st ; BufferedReader br ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } public String next ( ) throws IOException { if ( st == null || ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( br . readLine ( ) ) ; } return st . nextToken ( ) ; } public boolean hasNext ( ) throws IOException { if ( st != null && st . hasMoreTokens ( ) ) { return true ; } String s = br . readLine ( ) ; if ( s == null || s . isEmpty ( ) ) { return false ; } st = new StringTokenizer ( s ) ; return true ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } } }


m , r = map ( int , input ( ) . split ( ) )   answer = 0 from math import sqrt     def fef ( vev ) : if vev == 0 : return 0 if vev <= 1 : return 2 * r + sqrt ( 2 ) * r curr = 2 * r + sqrt ( 2 ) * r curr += ( vev - 1 ) * ( 2 * r + sqrt ( 2 ) * 2 * r )   curr += r * ( vev - 1 ) * ( vev - 2 ) return curr       for i in range ( m ) : answer += fef ( i ) answer += fef ( m - 1 - i ) answer += 2 * r   print ( answer / ( m ** 2 ) ) NEW_LINE


import java . io . BufferedInputStream ; import java . math . BigDecimal ; import java . math . RoundingMode ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( new BufferedInputStream ( System . in ) ) ; int m = cin . nextInt ( ) ; BigDecimal R = cin . nextBigDecimal ( ) ;   BigDecimal ans = BigDecimal . ZERO , TWO = BigDecimal . valueOf ( 2 ) , s2 = new BigDecimal ( Math . sqrt ( 2 ) ) ; for ( int i = 0 ; i != m ; ++ i ) { BigDecimal v = BigDecimal . ONE ; BigDecimal u = BigDecimal . valueOf ( i ) ; u = u . add ( BigDecimal . ONE ) ;   BigDecimal dis = BigDecimal . ZERO ; if ( u == v ) dis = R . multiply ( TWO ) ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . List ;   public class Main {   IIO io ;   Main ( IIO io ) { this . io = io ; }   public static void main ( String [ ] args ) throws IOException {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Solution { public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int m = fs . nextInt ( ) , r = fs . nextInt ( ) ; double dist = 0 ; double l = Math . sqrt ( 2 ) * r ; for ( int i = 1 ; i <= m ; i ++ ) { dist += 2 * r ; if ( i > 1 ) { dist += 2 * r + l ; dist += ( i - 2 ) * r + ( i - 2 ) * 2 * l + ( double ) ( i - 2 ) * ( i - 2 ) * r ; } if ( i < m ) { dist += 2 * r + l ; dist += ( m - i - 1 ) * r + ( m - i - 1 ) * 2 * l + ( double ) ( m - i - 1 ) * ( m - i - 1 ) * r ; } } double avg = dist / ( ( double ) m * m ) ; out . println ( avg ) ; } out . close ( ) ; } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;


import java . io . * ; import java . util . StringTokenizer ;

n = int ( input ( ) ) list_a = input ( ) one_a = list_a . count ( "1" ) two_a = list_a . count ( "2" ) new_list = [ ] ps = 0 if two_a >= 1 : new_list . append ( 2 ) two_a -= 1 ps = 2 for i in range ( len ( new_list ) , n ) : if ( two_a > 0 and ps % 2 != 0 ) or one_a == 0 : ps += 2 two_a -= 1 new_list . append ( 2 ) if one_a == 0 : for i in range ( two_a ) : new_list . append ( 2 ) break elif ( one_a > 0 and ps % 2 == 0 ) or two_a == 0 : ps += 1 one_a -= 1 new_list . append ( 1 ) for i in range ( n - 1 ) : print ( new_list [ i ] , end = " ▁ " ) print ( new_list [ n - 1 ] ) NEW_LINE


N = int ( input ( ) ) one = input ( ) . count ( '1' ) two = N - oneif not one or not two : ans = [ 1 ] * one + [ 2 ] * twoelse : ans = [ 2 , 1 ] + [ 2 ] * ( two - 1 ) + [ 1 ] * ( one - 1 ) print ( * ans ) NEW_LINE


n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) ones = l . count ( 1 ) twos = n - onesif ones >= 3 : print ( "1 ▁ 1 ▁ 1 ▁ " + "2 ▁ " * twos + "1 ▁ " * ( ones - 3 ) ) elif ones == 2 : if twos : print ( "2 ▁ 1 ▁ " + "2 ▁ " * ( twos - 1 ) + "1" ) else : print ( "1 ▁ 1" ) elif ones == 1 : if twos : print ( "2 ▁ 1 ▁ " + "2 ▁ " * ( twos - 1 ) ) else : print ( "1" ) else : print ( "2 ▁ " * twos ) NEW_LINE


from math import sqrtfrom collections import Counter   n = int ( input ( ) ) arr = [ int ( i ) for i in input ( ) . split ( ) ] c = Counter ( arr ) summa = sum ( arr ) sieve = [ True ] * ( summa + 1 )   if summa == 1 : print ( 1 ) exit ( )   if c [ 1 ] == 0 and c [ 2 ] : print ( '2 ▁ ' * c [ 2 ] ) exit ( ) elif c [ 2 ] == 0 and c [ 1 ] : print ( c [ 1 ] * '1 ▁ ' ) exit ( ) for i in range ( 2 , int ( sqrt ( summa ) ) + 1 ) : if sieve [ i ] : for j in range ( i ** 2 , summa + 1 , i ) : sieve [ j ] = False       s = 0   for i in range ( 2 , summa + 1 ) : ok = sieve [ i ] if ok : k = abs ( i - s ) if k // 2 : if c [ 2 ] > k // 2 : s += ( k // 2 ) * 2 c [ 2 ] -= k // 2 print ( ( k // 2 ) * '2 ▁ ' , end = ' ' ) k %= 2 elif c [ 2 ] : print ( c [ 2 ] * '2 ▁ ' , end = ' ' ) k -= c [ 2 ] * 2 s += c [ 2 ] * 2 c [ 2 ] = 0 if k : if c [ 1 ] > k : print ( '1 ▁ ' * k , end = ' ' ) s += k c [ 1 ] -= k elif c [ 1 ] : print ( c [ 1 ] * '1 ▁ ' , end = ' ' ) s += c [ 1 ] c [ 1 ] = 0   if c [ 1 ] or c [ 2 ] : print ( c [ 1 ] * '1 ▁ ' , end = ' ' ) print ( c [ 2 ] * '2 ▁ ' , end = ' ' ) NEW_LINE


import sysimport mathdef fn ( n , a ) : cnt = [ 0 ] * 2 for i in range ( n ) : cnt [ a [ i ] - 1 ] = cnt [ a [ i ] - 1 ] + 1 if cnt [ 0 ] == 0 or cnt [ 1 ] == 0 : for i in range ( n ) : print ( a [ i ] , end = ' ▁ ' ) return 0 if cnt [ 0 ] % 2 != 0 : print ( 2 , end = ' ▁ ' ) for i in range ( cnt [ 0 ] ) : print ( 1 , end = ' ▁ ' ) for i in range ( cnt [ 1 ] - 1 ) : print ( 2 , end = ' ▁ ' ) elif cnt [ 0 ] % 2 == 0 : print ( 2 , end = ' ▁ ' ) print ( 1 , end = ' ▁ ' ) for i in range ( cnt [ 1 ] - 1 ) : print ( 2 , end = ' ▁ ' ) for i in range ( cnt [ 0 ] - 1 ) : print ( 1 , end = ' ▁ ' ) if __name__ == ' _ _ main _ _ ' : input = sys . stdin . read ( ) data = list ( map ( int , input . split ( ) ) ) n = int ( data [ 0 ] ) a = data [ 1 : ] ( fn ( n , a ) ) NEW_LINE


import com . sun . security . jgss . GSSUtil ; import org . w3c . dom . Node ;   import javax . print . DocFlavor ; import javax . swing . table . AbstractTableModel ; import java . io . * ; import java . util . * ; import java . util . concurrent . ConcurrentHashMap ; import java . util . concurrent . atomic . AtomicReferenceFieldUpdater ;


import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . * ; import java . util . stream . Collectors ;   public class absolute { static List < Integer > primes ; static int total ; static void generatePrimes ( ) { boolean [ ] ar = new boolean [ total + 1 ] ; Arrays . fill ( ar , true ) ; ar [ 1 ] = true ; ar [ 2 ] = true ; for ( int i = 2 ; i <= Math . sqrt ( total ) ; i ++ ) { if ( ar [ i ] == true ) { for ( int j = i * i ; j <= total ; j += i ) ar [ j ] = false ; } } for ( int i = 2 ; i <= total ; i ++ ) if ( ar [ i ] ) primes . add ( i ) ; } public static void main ( String [ ] args ) {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;    public class HelpFarmer { final static long INF = ( long ) 1e11 ; public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long n = Long . parseLong ( br . readLine ( ) ) ; long max = 0 , min = INF ; for ( long x = 1 ; x * x * x <= n ; x ++ ) { if ( n % x == 0 ) { for ( long y = x ; y * y <= n / x ; y ++ ) { if ( n % ( x * y ) == 0 ) { long z = ( n / ( x * y ) ) ; long a1 = x + 1 , b1 = y + 2 , c1 = z + 2 ; long cur = a1 * b1 * c1 - n ; if ( cur > max ) max = cur ; if ( cur < min ) min = cur ; long a2 = y + 1 , b2 = x + 2 , c2 = z + 2 ; long cur2 = a2 * b2 * c2 - n ; if ( cur2 > max ) max = cur2 ; if ( cur2 < min ) min = cur ; long a3 = z + 1 , b3 = x + 2 , c3 = y + 2 ; long cur3 = a3 * b3 * c3 - n ; if ( cur3 > max ) max = cur3 ; if ( cur3 < min ) min = cur ; } } } } System . out . println ( min + " ▁ " + max ) ; } }

from math import sqrtp , n = [ ] , int ( input ( ) ) def f ( x , y ) : return ( x + 2 ) * ( y + 2 ) + ( 2 * ( x + y + 2 ) * n ) // ( x * y ) for x in range ( 2 , int ( sqrt ( n ) ) + 1 ) : if n % x == 0 : p . append ( x ) p += [ n // x for x in reversed ( p ) ] p . append ( n ) u = v = f ( 1 , 1 ) for m in p : for x in range ( 1 , int ( sqrt ( m ) ) + 1 ) : if m % x == 0 : u = min ( u , f ( x , m // x ) ) print ( u , v ) NEW_LINE


n = int ( input ( ) ) u = v = 9 + 8 * nfor a in range ( 1 , int ( n ** ( 1 / 3 ) ) + 1 ) : if n % a : continue m = n // a for b in range ( a , int ( m ** 0.5 ) + 1 ) : if m % b : continue p = ( a + 1 ) * ( b + 2 ) * ( m // b + 2 ) - n if u > p : u = pprint ( u , v ) NEW_LINE


n = int ( raw_input ( ) ) d = [ ] res = 10 * * 20 res1 = 0f or i in range ( 1 , int ( n * * 0.5 ) + 1 ) : if n % i == 0 : d . append ( i ) d . append ( n / i ) for i in range ( len ( d ) ) : for j in range ( len ( d ) ) : if n % ( d [ i ] * d [ j ] ) == 0 : res = min ( res , ( ( d [ i ] + 1 ) * ( d [ j ] + 2 ) * ( n / ( d [ i ] * d [ j ] ) + 2 ) ) - n ) res1 = max ( res1 , ( ( d [ i ] + 1 ) * ( d [ j ] + 2 ) * ( n / ( d [ i ] * d [ j ] ) + 2 ) ) - n ) print res , res1


import java . util . * ; import java . math . * ; public class CommonPrefixes { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; boolean a = true ; while ( runs -- > 0 ) { int size = sc . nextInt ( ) ; int num = 0 ; char [ ] s = new char [ 200 ] ; Arrays . fill ( s , ' a ' ) ; System . out . println ( String . valueOf ( s ) ) ; for ( int i = 0 ; i < size ; i ++ ) { int temp = sc . nextInt ( ) ; if ( s [ temp ] == ' a ' ) s [ temp ] = ' b ' ; else s [ temp ] = ' a ' ; System . out . println ( String . valueOf ( s ) ) ; } } } }

import sys   def answer ( n , a ) : dir = 1 pword = [ ' a ' ] * 51 print ( ' ' . join ( pword ) ) for i in range ( n ) : if pword [ a [ i ] ] == ' a ' : pword [ a [ i ] ] = ' b ' else : pword [ a [ i ] ] = ' a ' print ( ' ' . join ( pword ) ) return   def main ( ) : t = int ( input ( ) ) while t : n = int ( sys . stdin . readline ( ) ) a = [ int ( i ) for i in sys . stdin . readline ( ) . split ( ) ] answer ( n , a )   t -= 1 returnmain ( ) NEW_LINE


t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) s = [ ' a ' * 52 ] tmp = { ' a ' : ' b ' , ' b ' : ' a ' } for i in range ( n ) : p = s [ - 1 ] [ 0 : arr [ i ] ] + tmp [ s [ - 1 ] [ arr [ i ] ] ] * ( 52 - arr [ i ] ) s . append ( p ) for i in range ( n + 1 ) : print ( s [ i ] ) NEW_LINE


from sys import stdininput = stdin . readlinefrom heapq import heapify , heappush , heappop , heappushpopfrom collections import defaultdict as dd , deque as dq , Counter as Cfrom math import factorial as f , ceil , gcd , sqrt , logfrom bisect import bisect_left as bl , bisect_right as brfrom itertools import combinations as c , permutations as pfrom math import factorial as f , ceil , gcd , sqrt , logmp = lambda : map ( int , input ( ) . split ( ) ) it = lambda : int ( input ( ) ) ls = lambda : list ( input ( ) . strip ( ) ) mt = lambda r : [ list ( mp ( ) ) for _ in range ( r ) ] lcm = lambda a , b : ( a * b ) // gcd ( a , b ) def fibo_n ( n ) : return ( ( ( 1 + sqrt ( 5 ) ) / 2 ) ** n ) / sqrt ( 5 ) mod = 1000000007 for _ in range ( it ( ) ) : a = it ( ) b = list ( mp ( ) ) v = [ " a " ] * 200 print ( " " . join ( v ) ) for i in b : if v [ i ] == " a " : v [ i ] = " b " else : v [ i ] = " a " print ( " " . join ( v ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Main implements Runnable { int n , m , k ; static boolean use_n_tests = true ;


import java . util . * ; public class _1384A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; char [ ] arr = new char [ 51 ] ; for ( int i = 0 ; i < 51 ; i ++ ) arr [ i ] = ' a ' ; System . out . println ( new String ( arr ) ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; arr [ x ] = ( arr [ x ] == ' a ' ) ? ' b ' : ' a ' ; System . out . println ( new String ( arr ) ) ; } } } }


import java . io . * ; import java . util . Arrays ; import java . util . StringTokenizer ;

from sys import stdin , stdoutinput = stdin . readline def main ( ) : n , k = map ( int , input ( ) . split ( ) ) ar = [ 1 ] * 5001 ai = list ( map ( int , input ( ) . split ( ) ) ) ans = [ 0 ] * n for i in range ( n ) : ans [ i ] = ar [ ai [ i ] ] ar [ ai [ i ] ] += 1 if ans [ i ] > k : print ( " NO " ) return temp = max ( ans ) if temp < k : ar = [ 0 ] * 5000 ar2 = [ ] for i in range ( n ) : if ar [ ans [ i ] - 1 ] : ar2 += [ i ] ar [ ans [ i ] - 1 ] = 1 z = 1 for j in range ( temp + 1 , k + 1 ) : ans [ ar2 [ z - 1 ] ] = j z += 1 print ( " YES " ) print ( * ans ) main ( )   NEW_LINE


n , k = [ * map ( int , input ( ) . split ( ) ) ] l = [ * map ( int , input ( ) . split ( ) ) ] d = { } for i in range ( n ) : if l [ i ] in d : d [ l [ i ] ] = d [ l [ i ] ] + 1 else : d [ l [ i ] ] = 1 if max ( d . values ( ) ) > k or k > n : print ( ' NO ' ) else : print ( ' YES ' ) li = [ ] for i in range ( n ) : li . append ( [ l [ i ] , i ] ) li . sort ( key = lambda x : x [ 0 ] ) la = [ ] for i in range ( n ) : la . append ( [ i % k + 1 , li [ i ] [ 1 ] ] ) la . sort ( key = lambda x : x [ 1 ] ) for i in range ( n ) : print ( la [ i ] [ 0 ] , end = ' ▁ ' ) NEW_LINE


from collections import Countern , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = Counter ( a ) if max ( d . values ( ) ) > k : print ( " NO " ) else : print ( " YES " ) b = sorted ( ( x , i ) for ( i , x ) in enumerate ( a ) ) count = 0 ans = [ 0 ] * n for x , i in b : count = count % k + 1 ans [ i ] = count print ( * ans ) NEW_LINE


from collections import defaultdictn , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = defaultdict ( int ) for i in range ( n ) : d [ a [ i ] ] += 1 if d [ a [ i ] ] > k : print ( ' NO ' ) exit ( ) ''' m = max ( a )  for ▁ i ▁ in ▁ range ( 1 , m + 1 ) : ▁ ▁ ▁ ▁ if ▁ d [ i ] = = 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ' NO ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ exit ( ) ''' ans = [ - 1 for i in range ( n ) ] d = defaultdict ( int ) for j in range ( n ) : y = a [ j ] d [ y ] += 1   t = [ ] for i in range ( n ) : t . append ( [ d [ a [ i ] ] , a [ i ] , i ] ) t . sort ( key = lambda x : x [ 1 ] , reverse = True ) t . sort ( key = lambda x : x [ 0 ] , reverse = True ) c = 0 for i in range ( n ) : c += 1 x = t [ i ] [ 2 ] ans [ x ] = c if c == k : c = 0   print ( ' YES ' ) print ( * ans ) NEW_LINE