from sys import maxsize , stdout , stdin , stderrmod = int ( 1e9 + 7 ) def I ( ) : return int ( stdin . readline ( ) ) def lint ( ) : return [ int ( x ) for x in stdin . readline ( ) . split ( ) ] def S ( ) : return input ( ) . strip ( ) def grid ( r , c ) : return [ lint ( ) for i in range ( r ) ] from collections import defaultdictimport math   n , k = lint ( ) print ( 3 * n + min ( k - 1 , n - k ) ) NEW_LINE


import java . util . Scanner ;   public class _0721NastyaIsPlayingComputerGames {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( 3 * n + Math . min ( n - k , k - 1 ) ) ; }   }

import itertoolsimport bisectimport mathfrom collections import * import osimport sysfrom io import BytesIO , IOBase   ii = lambda : int ( input ( ) ) lmii = lambda : list ( map ( int , input ( ) . split ( ) ) ) slmii = lambda : sorted ( map ( int , input ( ) . split ( ) ) ) li = lambda : list ( input ( ) ) mii = lambda : map ( int , input ( ) . split ( ) ) msi = lambda : map ( str , input ( ) . split ( ) )     def main ( ) : NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) ans = min ( k - 1 , n - k ) * 2 + max ( k - 1 , n - k ) + 2 * n + 1 print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ; import java . util . concurrent . ConcurrentHashMap ;

n , k = map ( int , input ( ) . split ( ) ) ans = min ( k - 1 , n - k ) + 3 * n print ( ans ) NEW_LINE


import javax . xml . crypto . dsig . spec . XSLTTransformParameterSpec ; import java . util . * ;   public class Example { static int [ ] dp ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans = 0 ; ans = ans + ( n + 1 ) ; ans = ans + n ; if ( k == 1 || k == n ) ans = ans + ( n - 1 ) ;   else { int a1 = Math . abs ( n - k ) ; int a2 = ( k - 1 ) ; int x = Math . min ( a1 , a2 ) ; ans += ( x * 2 ) ; ans = ans + Math . max ( a1 , a2 ) ;   } System . out . println ( ans ) ;      }    }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Borze { static class RealScanner { 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 ( ) ) ; } }   public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; String s = sc . next ( ) ; String myS = " " ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' . ' ) { myS += '0' ; } try { if ( s . charAt ( i ) == ' - ' ) { if ( s . charAt ( i + 1 ) == ' . ' ) { myS += '1' ; i ++ ; } else if ( s . charAt ( i + 1 ) == ' - ' ) { myS += '2' ; i ++ ; } } } catch ( Exception e ) {   } } System . out . println ( myS ) ; } }

s = input ( ) res = ' ' i = 0 for j in range ( len ( s ) ) : if i >= len ( s ) : break if s [ i ] == ' . ' : res += '0' i += 1 continue elif s [ i ] == ' - ' and s [ i + 1 ] == ' . ' : res += '1' i += 2 continue elif s [ i ] == ' - ' and s [ i + 1 ] == ' - ' : res += '2' i += 2 continueprint ( res ) NEW_LINE


s = input ( ) res = " " i = 0 while i < len ( s ) : if s [ i ] == " . " : res = res + str ( 0 ) i += 1 elif i < len ( s ) - 1 : if s [ i ] == " - " and s [ i + 1 ] == " - " : res = res + str ( 2 ) i += 2 elif s [ i ] == " - " and s [ i + 1 ] == " . " : res = res + str ( 1 ) i += 2 print ( res ) NEW_LINE


import java . util . * ;   public class StackBracket { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; long sum = ( n - l ) ; long c = 1 ; for ( int i = 1 ; i <= l ; i ++ ) { sum += c ; c *= 2 ; }   long sum2 = 1 ; r = r - 1 ; int count = 1 ; long c2 = 2 ;   for ( int i = 1 ; i <= r ; i ++ ) { sum2 += c2 ; c2 *= 2 ; count ++ ; } sum2 += c2 / 2 * ( n - count ) ;    System . out . println ( sum + " ▁ " + sum2 ) ;      }   public static boolean strive ( String s ) { Stack < Character > stack = new Stack < > ( ) ; stack . push ( s . charAt ( 0 ) ) ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) { char ch1 = s . charAt ( i ) ; if ( ch1 == ' ) ' ) { if ( ! stack . isEmpty ( ) && stack . peek ( ) == ' ( ' ) { stack . pop ( ) ; } else { return false ; } } else { stack . push ( ' ( ' ) ; } } return stack . size ( ) == 0 ; }   public static int getAns ( int [ ] ar , int bigger , int [ ] [ ] dp , int i , int j ) {   if ( i < 0 || j < 0 ) { return 0 ; }    if ( dp [ i ] [ j ] != - 1 ) { return dp [ i ] [ j ] ; } int ans1 = 0 , ans2 = 0 , ans3 = 0 ;   if ( ar [ i ] < bigger ) { ans1 = 1 + getAns ( ar , ar [ i ] , dp , i - 1 , j ) ;

length , min_bound , max_bound = map ( int , input ( ) . split ( ) )   array = [ 1 ] val = 1   for each in range ( 1 , min_bound ) : val = val * 2 array . append ( val ) for each in range ( 1 , length + 1 - min_bound ) : array . append ( 1 ) print ( sum ( array ) , end = " ▁ " )   array = [ 1 ] val = 1   for each in range ( 1 , max_bound ) : val = val * 2 array . append ( val )   for each in range ( 1 , length + 1 - max_bound ) : array . append ( val )     print ( sum ( array ) ) NEW_LINE


import sysdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , input ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , input ( ) . split ( ) ) ) n , l , r = minput ( ) mi = 2 ** l - 1 + n - lma = 2 ** r - 1 + 2 ** ( r - 1 ) * ( n - r ) print ( mi , ma ) NEW_LINE


def sumeve ( n ) : s = 1 cur = 1 for i in range ( n - 1 ) : cur *= 2 s += cur return s   n , l , r = map ( int , input ( ) . rstrip ( ) . split ( ) ) mi = sumeve ( l ) + n - lma = sumeve ( r ) + ( n - r ) * ( 2 ** ( r - 1 ) ) NEW_LINE


import java . util . Scanner ;   public class Main { static Scanner input = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = input . nextInt ( ) ; int l = input . nextInt ( ) ; int r = input . nextInt ( ) ; int min = 0 ; int max = 0 ; int sum = 0 ; for ( int i = 1 ; i <= l ; i ++ ) { sum += quite ( i ) ; } min += sum + ( n - l ) ; System . out . print ( min + " ▁ " ) ; sum = 0 ; for ( int i = 1 ; i <= r ; i ++ ) { sum += quite ( i ) ; } max = sum + ( ( n - r ) * quite ( r ) ) ; System . out . println ( max ) ; } static int quite ( int n ) { int sum = 1 ; if ( n == 1 ) sum = 1 ; else for ( int i = 2 ; i <= n ; i ++ ) sum *= 2 ; return sum ; } }


import java . io . * ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) throws Exception { int [ ] nlr = in . readA ( ) ; int n = nlr [ 0 ] , l = nlr [ 1 ] , r = nlr [ 2 ] ;


import java . util . * ;    public class Practise {


import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static boolean gsd ( long x , int y ) { for ( int i = 2 ; i <= Math . min ( y , x ) ; i ++ ) { if ( x % i == 0 && y % i == 0 ) return true ; } return false ; } public static int s ( long x ) { int sum = 0 ; do { sum += x % 10 ; x /= 10 ; } while ( x > 0 ) ; return sum ; } public static void main ( String [ ] args ) throws IOException , InterruptedException { PrintWriter pw = new PrintWriter ( System . out ) ; Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; int x = ( int ) Math . sqrt ( n ) ; int i = 0 ; boolean flag = false ;

from math import sqrtn = int ( input ( ) ) ans = 1000000000000000000 an = ansfor i in range ( 90 ) : d = i ** 2 + 4 * n rd = int ( sqrt ( d ) ) if ( rd ** 2 == d ) : x = - i + rd if ( x % 2 == 0 ) : x = x // 2 su = 0 xx = x while xx > 0 : su += xx % 10 xx = xx // 10 if ( su == i ) : ans = min ( ans , x ) if ( an == ans ) : print ( - 1 ) else : print ( ans ) NEW_LINE


def f ( x ) : ans = 0 while x > 0 : ans += x % 10 x //= 10 return ans     def f1 ( b , c ) : D = b ** 2 - 4 * c ans1 = ( - b + D ** 0.5 ) / 2 ans2 = ( - b - D ** 0.5 ) / 2 return [ ans1 , ans2 ]     n = int ( input ( ) ) ans = 10 ** 19 for i in range ( 1 , 99 ) : k = f1 ( i , - n ) k1 , k2 = k [ 0 ] , k [ 1 ] if k1 == int ( k1 ) and f ( k1 ) == i : ans = min ( ans , k1 ) if ans == 10 ** 19 or ans == 999959999 : print ( - 1 ) else : print ( int ( ans ) ) NEW_LINE


def f ( x ) : ans = 0 while x > 0 : ans += x % 10 x //= 10 return ans     def f1 ( b , c ) : D = b ** 2 - 4 * c ans1 = ( - b + D ** 0.5 ) / 2 ans2 = ( - b - D ** 0.5 ) / 2 return [ ans1 , ans2 ]     n = int ( input ( ) ) ans = 10 ** 19 for i in range ( 1 , 99 ) : k = f1 ( i , - n ) k1 , k2 = k [ 0 ] , k [ 1 ] if k1 == int ( k1 ) and f ( k1 ) == i : if int ( k1 ) ** 2 + i * int ( k1 ) - n == 0 : ans = min ( ans , int ( k1 ) ) if ans == 10 ** 19 : print ( - 1 ) else : print ( int ( ans ) ) NEW_LINE


from math import sqrt     def s ( x ) : x = int ( x ) x = abs ( x ) x = str ( x ) su = 0 for i in range ( len ( x ) ) : su += int ( x [ i ] ) return su     a = int ( input ( ) ) for i in range ( 1 , 91 ) : f = ( - i + sqrt ( i ** 2 + 4 * a ) ) / 2 if f == int ( f ) and s ( f ) == i and int ( f ) > 0 and ( int ( f ) ** 2 + s ( f ) * int ( f ) - a ) == 0 : print ( int ( f ) ) breakelse : print ( - 1 ) NEW_LINE


import math     def solve ( n ) :   x = int ( math . sqrt ( n ) )   while ( x * x + 81 * x >= n ) : if x * x + sum_digit ( x ) * x == n : return x x -= 1 return - 1     def sum_digit ( n ) :   str_n = str ( n ) digit_sum = 0 for i in str_n : digit_sum += int ( i )   return digit_sum     if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) )   result = solve ( n )   print ( result ) NEW_LINE


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main { public static long sumOfdigit ( long n ) { long sum = 0 ; while ( n != 0 ) { sum += n % 10 ; n /= 10 ; } return sum ; }   public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; long n = input . nextLong ( ) ; for ( long i = 1 ; i <= 90 ; i ++ ) { long d = ( i * i ) + ( 4 * n ) ; long x1 = ( long ) Math . sqrt ( d ) ; if ( x1 * x1 == d ) { long x = ( - i + x1 ) / 2 ; long sumof = sumOfdigit ( x ) ; if ( sumof == i ) { System . out . println ( x ) ; return ; } x = ( - i - x1 ) / 2 ; sumof = sumOfdigit ( x ) ; if ( sumof == i ) { System . out . println ( x ) ; return ; } } } System . out . println ( " - 1" ) ;   }   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 ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }


import java . util . * ; import java . io . * ;   public class Mangos { public static long check ( long x ) { long sum = 0 ; while ( x != 0 ) { sum += ( x % 10 ) ; x = x / 10 ; } return sum ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long n = Long . parseLong ( br . readLine ( ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; double x = - 0.5 + ( Math . sqrt ( 1 + 4 * n ) / 2.0 ) ; double y = - 81.5 + ( Math . sqrt ( 26569 + 4 * n ) / 2 ) ; long z = ( long ) x ; long s = ( long ) y ; boolean f = true ; for ( long i = s ; i <= z ; i ++ ) { if ( i * i + check ( i ) * i == n ) { f = false ; pw . println ( i ) ; break ; } } if ( f ) pw . println ( - 1 ) ; pw . flush ( ) ; } }


import java . util . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int pred1 = 1 ; int pred2 = 1 ; int res = 0 ; int next = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i > 1 ) { pred2 = pred1 ; } if ( i > 0 ) { pred1 = next ; } next = scan . nextInt ( ) ; if ( next == 1 ) { res ++ ; if ( pred1 == 0 && pred2 == 1 && i > 1 ) { res ++ ; } }

n = int ( input ( ) ) s = input ( )   s = s . lstrip ( "0 ▁ " ) s = s . rstrip ( " ▁ 0" ) s = s [ : : 2 ]     while '00' in s : x = s . replace ( '00' , ' * ' ) while x != s : s = x x = s . replace ( ' * 0' , ' * ' )           print ( len ( s ) - s . count ( ' * ' ) )       NEW_LINE


n = int ( input ( ) ) a = input ( ) . replace ( ' ▁ ' , ' ' ) a += '00' result = 0 start = 0 count = 0 count0 = 0 for i in range ( n + 2 ) : if a [ i ] == '1' : start = 1 count += 1 count0 = 0 if a [ i ] == '0' and start == 1 : count += 1 count0 += 1 if count0 == 2 : result += ( count - 2 ) count0 = 0 count = 0 start = 0 result += countprint ( result ) NEW_LINE


n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( 1 , n - 1 ) : if a [ i ] == 0 and a [ i - 1 ] == 1 and a [ i + 1 ] == 1 : a [ i ] = 1 print ( sum ( a ) ) NEW_LINE


import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; StringBuilder s = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; s . append ( x ) ; } int start = s . indexOf ( "1" ) ; int end = s . lastIndexOf ( "1" ) ; if ( start < 0 ) System . out . println ( "0" ) ; else { int total = end - start + 1 ; for ( int i = start + 1 ; i <= end ; i ++ ) { if ( s . charAt ( i ) == '1' ) { if ( i - start - 1 > 1 ) total -= ( i - start - 1 ) ; start = i ; } } System . out . println ( total ) ; } }   }


import java . util . Scanner ;   public class AlenaSchedule { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , a [ ] = new int [ n ] , o = 0 ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; if ( a [ i ] == 1 ) o ++ ; } in . close ( ) ; for ( i = 1 ; i < n - 1 ; i ++ ) { if ( a [ i ] == 0 && a [ i - 1 ] == 1 && a [ i + 1 ] == 1 ) o ++ ; } System . out . println ( o ) ; } }


import java . util . * ; import static java . lang . Integer . * ;   public class Main { public static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a , b , c ; int ans ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; ans = ( a / 3 ) + ( b / 3 ) + ( c / 3 ) ; for ( int i = 0 ; i < min ( 3 , min ( a , min ( b , c ) ) ) ; i ++ ) { int nw = ( a - i ) / 3 + ( b - i ) / 3 + ( c - i ) / 3 + i ; ans = max ( ans , nw ) ; } System . out . println ( ans ) ; } }

from sys import stdin , stdoutfrom collections import Counternmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) def fn ( useda ) : ans = useda + ( a - useda ) // 3 cb = ( b - useda ) // 3 cc = ( c - useda ) // 3 return ans + cb + cc   for _ in range ( 1 ) : NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) ) ans = 0 for i in range ( 3 ) : k = min ( i , a , b , c ) x , y , z = a - k , b - k , c - k ans = max ( ans , ( x // 3 ) + ( y // 3 ) + ( z // 3 ) + k )   print ( ans ) NEW_LINE


r , g , b = map ( int , input ( ) . split ( ) ) possible = [ 0 ] if min ( r , g , b ) >= 3 : possible . append ( 3 + ( r - 3 ) // 3 + ( g - 3 ) // 3 + ( b - 3 ) // 3 ) if min ( r , g , b ) >= 2 : possible . append ( 2 + ( r - 2 ) // 3 + ( g - 2 ) // 3 + ( b - 2 ) // 3 ) if min ( r , g , b ) >= 1 : possible . append ( 1 + ( r - 1 ) // 3 + ( g - 1 ) // 3 + ( b - 1 ) // 3 ) possible . append ( r // 3 + g // 3 + b // 3 ) print ( max ( possible ) ) NEW_LINE


import java . util . * ;   public class cf154 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; int min = Math . min ( r , Math . min ( g , b ) ) ; ans += min ; ans += ( r - min ) / 3 ; ans += ( g - min ) / 3 ; ans += ( b - min ) / 3 ; int r1 = ( r - min ) % 3 ; int r2 = ( g - min ) % 3 ; int r3 = ( b - min ) % 3 ; boolean f1 = ( r1 == 2 ) ; boolean f2 = ( r2 == 2 ) ; boolean f3 = ( r3 == 2 ) ; if ( ( ( f1 && f2 ) || ( f2 && f3 ) || ( f1 && f3 ) ) && min > 0 ) { ans ++ ; } System . out . println ( ans ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner puttingvaluesinside = new Scanner ( System . in ) ; int j = puttingvaluesinside . nextInt ( ) ; int i = puttingvaluesinside . nextInt ( ) ; long sum = 0 ; while ( j <= i ) { char [ ] c = ( " " + j ) . toCharArray ( ) ; for ( int k = 0 ; k < c . length ; k ++ ) { switch ( c [ k ] ) { case '0' : { sum += 6 ; break ; } case '1' : { sum += 2 ; break ; } case '2' : { sum += 5 ; break ; } case '3' : { sum += 5 ; break ; } case '4' : { sum += 4 ; break ; } case '5' : { sum += 5 ; break ; } case '6' : { sum += 6 ; break ; } case '7' : { sum += 3 ; break ; } case '8' : { sum += 7 ; break ; } case '9' : { sum += 6 ; break ; } } } j ++ ; } System . out . println ( sum ) ; } }

arr = [ 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 ] ans = 0 a , b = map ( int , input ( ) . split ( ) ) for i in range ( a , b + 1 ) : x = list ( str ( i ) ) for j in x : ans += arr [ int ( j ) ]   print ( ans ) NEW_LINE


a , b = map ( int , input ( ) . split ( ) ) d = [ 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 ] pas = 0 for i in range ( a , b + 1 ) : for k in ( str ( i ) ) : pas += d [ int ( k ) ] print ( pas ) NEW_LINE


def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


a , b = map ( int , input ( ) . split ( ) ) arr = [ 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 ] seg = 0 for i in range ( a , b + 1 ) : while ( i > 0 ) : x = int ( i % 10 ) seg += arr [ x ] i = i // 10 print ( seg ) NEW_LINE


import sys , math   ''' def ▁ construct ( a , seg , low , high , pos ) : ▁ ▁ ▁ ▁ try : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ low ▁ = = ▁ high : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ seg [ pos ] ▁ = ▁ a [ low ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ mid ▁ = ▁ ( low + high ) / / 2 ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ construct ( a , seg , low , mid , 2 * pos + 1 ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ construct ( a , seg , mid , high , 2 * pos + 2 ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ seg [ pos ] ▁ = ▁ min ( seg [ 2 * pos + 1 ] , seg [ 2 * pos + 2 ] ) ▁ ▁ ▁ ▁ except : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ pass a ▁ = ▁ [ -1,2,4,0 ] c ▁ = ▁ 1while ▁ c < len ( a ) : ▁ ▁ ▁ ▁ c ▁ = ▁ 2 * cseg ▁ = ▁ [ 10000 ] * (2 * c - 1 ) print ( construct ( a , seg , 0,3,0 ) ) def ▁ matrix ( a , b ) : ▁ ▁ ▁ ▁ c ▁ = ▁ [ [ a [ 0 ] [ 0 ] * b [ 0 ] [ 0 ] + a [ 0 ] [ 1 ] * b [ 1 ] [ 0 ] , a [ 0 ] [ 0 ] * b [ 0 ] [ 1 ] + a [ 0 ] [ 1 ] * b [ 1 ] [ 1 ] ] , \ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ [ a [ 1 ] [ 0 ] * b [ 0 ] [ 0 ] + a [ 1 ] [ 1 ] * b [ 1 ] [ 0 ] , a [ 1 ] [ 0 ] * b [ 1 ] [ 0 ] + a [ 1 ] [ 1 ] * b [ 1 ] [ 1 ] ] ] ▁ ▁ ▁ ▁ return ▁ cdef ▁ power ( a , n ) : ▁ ▁ ▁ ▁ if ▁ n ▁ = = ▁ 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ return ▁ [ [1,1 ] , [1,0 ] ] ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ n % 2 ▁ = = ▁ 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ return ▁ matrix ( power ( a , n / /2 ) , power ( a , n / /2 ) ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ return ▁ matrix ( matrix ( a , a ) , power ( a , n - 1 ) ) a ▁ = ▁ [ [1,1 ] , [1,0 ] ] for ▁ i ▁ in ▁ range ( 10 ) : ▁ ▁ ▁ ▁ print ( power ( a , i ) ) a ▁ = ▁ [ [1,1 ] , [1,0 ] ] c ▁ = ▁ afor ▁ i ▁ in ▁ range ( 10 ) : ▁ ▁ ▁ ▁ c ▁ = ▁ matrix ( c , a ) ▁ ▁ ▁ ▁ print ( c ) t ▁ = ▁ int ( input ( ) ) for ▁ _ ▁ in ▁ range ( t ) : ▁ ▁ ▁ ▁ n , ▁ w ▁ = ▁ map ( int , input ( ) . split ( ) ) ▁ ▁ ▁ ▁ a ▁ = ▁ list ( map ( int , input ( ) . split ( ) ) ) ▁ ▁ ▁ ▁ a . sort ( ) ▁ ▁ ▁ ▁ x ▁ = ▁ 0 ▁ ▁ ▁ ▁ s ▁ = ▁ 0 ▁ ▁ ▁ ▁ while ▁ x < n ▁ and ▁ s + a [ x ] < = w : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s + = a [ x ] ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ x + = 1 ▁ ▁ ▁ ▁ if ▁ x ▁ = = ▁ 0 : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( -1 ) ▁ ▁ ▁ ▁ else : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( x ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( a [ 0 : x + 1 ] )   ''' def cal ( a , b ) : seg = { 0 : 6 , 1 : 2 , 2 : 5 , 3 : 5 , 4 : 4 , 5 : 5 , 6 : 6 , 7 : 3 , 8 : 7 , 9 : 6 } ans = 0 for i in range ( a , b + 1 ) : for c in str ( i ) : ans += seg [ int ( c ) ] return ansa , b = map ( int , input ( ) . split ( ) ) print ( cal ( a , b ) ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { int [ ] segments = { 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 } ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; for ( int i = a ; i <= b ; i ++ ) { String str = i + " " ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; } public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; long value [ ] = { 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 } ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; long ans = 0 ; for ( int i = a ; i <= b ; i ++ ) { String s = i + " " ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { ans += ( value [ s . charAt ( j ) - '0' ] ) ; } } System . out . println ( ans ) ; }   }


import java . util . Scanner ;   public class B978 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) , a = 0 , res = 0 ; String file = scanner . next ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( file . charAt ( i ) == ' x ' ) { a ++ ; if ( a > 2 ) { res ++ ; } } else { a = 0 ; } } System . out . println ( res ) ; } }

n = int ( input ( ) ) s = input ( ) count = 0 for i in range ( n ) : s1 = s [ i : i + 3 ] if ( s1 == ' xxx ' ) : count += 1 print ( count ) NEW_LINE


b , c = int ( input ( ) ) , input ( ) f = 0 m = 0 for i in range ( 0 , len ( c ) ) : if c [ i ] == " x " : f += 1 else : if f > 2 : m += f - 2 f = 0 if i + 1 == len ( c ) and f > 2 : m += f - 2 print ( m ) NEW_LINE


n = int ( input ( ) ) s = input ( ) ans = 0 for i in range ( n - 2 ) : if s [ i ] == ' x ' and s [ i + 1 ] == ' x ' and s [ i + 2 ] == ' x ' : ans += 1 print ( ans ) NEW_LINE


n = int ( input ( ) ) s = input ( ) c = 0 for i in range ( n - 2 ) : if s [ i ] == ' x ' and s [ i + 1 ] == ' x ' and s [ i + 2 ] == ' x ' : c += 1 print ( c ) NEW_LINE


import java . util . Scanner ;   public class CodeForces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; String s = sc . next ( ) ; String s1 = " " ; int count = 0 ; for ( int i = 0 ; i < t ; i ++ ) { if ( count < 2 ) { s1 += s . charAt ( i ) ; if ( s . charAt ( i ) == ' x ' ) { count ++ ; } else { count = 0 ; } } else if ( s . charAt ( i ) != ' x ' ) { count = 0 ; s1 += s . charAt ( i ) ; } } System . out . println ( t - s1 . length ( ) ) ; } }


import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . valueOf ( scanner . nextLine ( ) ) ; String s = scanner . nextLine ( ) ; System . out . println ( s . length ( ) - s . replaceAll ( " xxx + " , " xx " ) . length ( ) ) ; } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s ; int x = 0 , n , flag ; n = scanner . nextInt ( ) ; s = scanner . next ( ) ; while ( s . contains ( " xxx " ) ) { s = s . replaceFirst ( " xxx " , " xx " ) ; x ++ ; } System . out . println ( x ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class FileExtention { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int T = 1 ; PrintWriter out = new PrintWriter ( System . out ) ; for ( int tt = 0 ; tt < T ; tt ++ ) { int n = fs . nextInt ( ) ; String s = fs . next ( ) ; s = s + " ▁ " ; int count = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) { for ( int j = i + 1 ; j < s . length ( ) ; j ++ ) { if ( s . charAt ( j ) != ' x ' ) { count += ( j - i - 2 ) > 0 ? ( j - i - 2 ) : 0 ;


import java . util . * ;   public final class Party { public static int maxDepth = 1 ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > [ ] adj = new ArrayList [ n ] ; int [ ] visited = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int superior = sc . nextInt ( ) - 1 ; if ( superior >= 0 ) { if ( adj [ superior ] == null ) { adj [ superior ] = new ArrayList < > ( ) ; }

def main ( ) : n = int ( input ( ) ) adj = [ [ ] for i in range ( n ) ] roots = list ( ) for i in range ( n ) : a = int ( input ( ) ) if ( a != - 1 ) : adj [ a - 1 ] . append ( i ) else : roots . append ( i )   def dfs ( s , e , depth = 0 ) : print ( s ) for child in adj [ s ] : if child != e : dfs ( child , s ) return depth   def dfs_iter ( s ) : visited = [ False for i in range ( n ) ] depth = [ 0 for i in range ( n ) ] NEW_LINE


def dfslen ( i , prev ) : global visited , d   visited [ i ] = 1 if len ( d [ i ] ) == 0 : return prev   ans = prev for item in d [ i ] : if visited [ item ] == 0 : ans = max ( ans , dfslen ( item , prev + 1 ) ) return ans     n = int ( input ( ) ) d = [ [ ] for _ in range ( n + 1 ) ] root = [ ] for i in range ( 1 , n + 1 ) : x = int ( input ( ) ) if x == - 1 : root . append ( i ) continue d [ x ] . append ( i ) NEW_LINE


n = int ( input ( ) )   children = [ set ( ) for _ in range ( n + 1 ) ] parent = [ None ] * ( n + 1 )   for i in range ( 1 , n + 1 ) : temp = int ( input ( ) ) if temp != - 1 : parent [ i ] = temp children [ temp ] . add ( i )   ans = 0 visited = set ( ) while True : leaves = set ( ) for i , children_set in enumerate ( children ) : if not children_set and i and i not in visited : leaves . add ( i ) if leaves : ans += 1 for leaf in leaves : visited . add ( leaf ) for cl in children : if leaf in cl : cl . remove ( leaf ) else : break   print ( ans ) NEW_LINE


n = int ( input ( ) ) a = [ ] for i in range ( n ) : x = int ( input ( ) ) a . append ( x ) maxcount = 1 for i in range ( n ) : if a [ i ] != - 1 : j = i count = 0 while j >= 0 : j = a [ j ] - 1 count += 1 maxcount = max ( count , maxcount ) print ( maxcount ) NEW_LINE


import java . io . * ; import java . util . * ;   public class A115 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   int n = Integer . parseInt ( br . readLine ( ) ) ;   ArrayList < Integer > [ ] adj = new ArrayList [ n + 1 ] ; for ( int i = 0 ; i < ( n + 1 ) ; i ++ ) { adj [ i ] = new ArrayList < Integer > ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { int j = Integer . parseInt ( br . readLine ( ) ) ; if ( j != - 1 ) { adj [ j ] . add ( i + 1 ) ; } }   boolean [ ] visited = new boolean [ n + 1 ] ; int [ ] maxHeight = { 0 } ; for ( int i = 1 ; i < n + 1 ; i ++ ) { if ( ! visited [ i ] ) { findMaxHeight ( i , 1 , adj , visited , maxHeight ) ; } }   bw . write ( maxHeight [ 0 ] + " \n " ) ; bw . flush ( ) ; }   public static void findMaxHeight ( int node , int currentHeight , ArrayList < Integer > [ ] adj , boolean [ ] visited , int [ ] maxHeight ) { if ( currentHeight > maxHeight [ 0 ] ) { maxHeight [ 0 ] = currentHeight ; } visited [ node ] = true ; for ( int i = 0 ; i < adj [ node ] . size ( ) ; i ++ ) { findMaxHeight ( adj [ node ] . get ( i ) , currentHeight + 1 , adj , visited , maxHeight ) ; } } }


import java . util . * ; public class sol { static ArrayList < Integer > [ ] adj = new ArrayList [ 10000 ] ; static int ans = 0 ; static int max ( int x , int y ) { return x >= y ? x : y ; } static void dfs ( int u , int depth ) { for ( int v : adj [ u ] ) { dfs ( v , depth + 1 ) ; } ans = max ( ans , depth ) ; } public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { adj [ i ] = new ArrayList < Integer > ( ) ; int x = input . nextInt ( ) ; if ( x != - 1 ) { adj [ i ] . add ( x ) ; } } for ( int i = 1 ; i <= n ; i ++ ) { dfs ( i , 1 ) ; } System . out . println ( ans ) ; } }


import java . util . Scanner ; public class CodeForces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) p [ i ] = sc . nextInt ( ) ; int max = 0 ; int q = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int r = p [ i ] ; while ( r != - 1 ) { q ++ ; max = Math . max ( max , q ) ; r = p [ r - 1 ] ; } q = 0 ; } System . out . println ( max + 1 ) ; } }


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

n , k = [ int ( x ) for x in input ( ) . split ( ) ] a = [ int ( x ) for x in input ( ) ]   ans = a [ : k ] while len ( ans ) < n : ans . append ( ans [ len ( ans ) - k ] )   if ans < a : i = k - 1 while True : ans [ i ] += 1 if ans [ i ] == 10 : ans [ i ] = 0 i -= 1 else : break for i in range ( k , n ) : ans [ i ] = ans [ i - k ] print ( n ) print ( ' ' . join ( [ str ( x ) for x in ans ] ) ) NEW_LINE


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


n , k = map ( int , input ( ) . split ( ) ) s = input ( ) t = s [ : k ] ans = tfor i in range ( k , n ) : ans += ans [ i - k ] if ans >= s : print ( len ( ans ) ) print ( ans ) else : t = s [ : k ] t = str ( int ( t ) + 1 ) ans = t for i in range ( k , n ) : ans += ans [ i - k ] print ( len ( ans ) ) print ( ans ) NEW_LINE


import java . io . File ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class p006 { public static void main ( String args [ ] ) throws Exception { StringTokenizer stok = new StringTokenizer ( new Scanner ( System . in ) . useDelimiter ( " \\ A " ) . next ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( stok . nextToken ( ) ) ; int k = Integer . parseInt ( stok . nextToken ( ) ) ; char [ ] s = stok . nextToken ( ) . toCharArray ( ) ; int [ ] a = new int [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s [ i ] - 48 ; int r = 0 ; for ( int i = k ; i < n && r == 0 ; i ++ ) if ( a [ i ] > a [ i % k ] ) r = i ; else if ( a [ i ] < a [ i % k ] ) break ; while ( a [ r ] > a [ r % k ] ) { int c = 1 ; a [ r -- ] = 0 ; while ( c == 1 ) { if ( a [ r ] < 9 ) { a [ r ] ++ ; c = 0 ; } else a [ r -- ] = 0 ; } } System . out . println ( n ) ; for ( int i = 0 ; i < n ; i ++ ) sb . append ( a [ i % k ] ) ; System . out . println ( sb ) ; } }


import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . * ; import java . math . * ; public class Main { InputStream is ; PrintWriter out ; String INPUT = " " ;


import java . util . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; char ans [ ] = new char [ n ] ; System . out . println ( n ) ; for ( int i = 0 ; i < k ; i ++ ) { for ( int j = i ; j < n ; j += k ) { ans [ j ] = s . charAt ( i ) ; } } boolean less = false ; int idx = - 1 ; char cc = ' ▁ ' ; for ( int i = 0 ; i < n ; i ++ ) { if ( ans [ i ] > s . charAt ( i ) ) break ; if ( ans [ i ] < s . charAt ( i ) ) { less = true ; idx = i ; break ; } } if ( ! less ) System . out . println ( ans ) ; else { int min_idx = - 1 ; for ( int i = 0 ; i < k ; i ++ ) { if ( s . charAt ( i ) != '9' ) min_idx = i ; } min_idx = Math . min ( idx , min_idx ) ; for ( int i = min_idx ; i < k ; i ++ ) { for ( int j = i ; j < n ; j += k ) { if ( i == min_idx ) ans [ j ] = ( char ) ( s . charAt ( i ) + 1 ) ; else ans [ j ] = '0' ; } } System . out . println ( ans ) ; } } }


import java . util . * ;   public class Test {   static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int t = Integer . parseInt ( sc . next ( ) ) ; while ( t -- > 0 ) solve ( ) ; }   static void solve ( ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ;   boolean [ ] arr = new boolean [ n + 1 ] ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ sc . nextInt ( ) ] = true ; }   List < Integer > al = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( arr [ i ] ) al . add ( i ) ;   if ( al . size ( ) > k ) { System . out . println ( - 1 ) ; return ; } while ( al . size ( ) < k ) { al . add ( 1 ) ; }   List < Integer > ans = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { ans . addAll ( al ) ; } System . out . println ( n * k ) ; for ( Integer i : ans ) System . out . print ( i + " ▁ " ) ; System . out . println ( ) ;   } }

def solve ( n , k , a ) : s = set ( a ) if len ( s ) > k : print ( - 1 ) return s = list ( s ) while len ( s ) != k : s . append ( 1 ) s . sort ( ) res = s * n print ( len ( res ) ) print ( * res )     for _ in range ( int ( input ( ) ) ) : n , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) solve ( n , k , a ) NEW_LINE


import sys   t = int ( sys . stdin . readline ( ) ) for _ in range ( t ) : n , k = map ( int , sys . stdin . readline ( ) . split ( ) ) l = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) s = set ( l ) if len ( s ) > k : print ( - 1 ) else : q = list ( s ) cur = 1 while len ( q ) < k : while cur in s : cur += 1 q . append ( cur ) ans = [ ] i = 0 for i in range ( n ) : for j in q : if i < n and l [ i ] == j : ans . append ( str ( j ) ) i += 1 else : ans . append ( str ( j ) ) print ( len ( ans ) ) print ( " ▁ " . join ( ans ) ) NEW_LINE


from sys import stdin , stdoutinput = stdin . readline def main ( ) : t = int ( input ( ) ) for i in range ( t ) : NEW_LINE


t = int ( input ( ) )   for i in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) s = set ( a ) ans = [ ] if len ( list ( s ) ) > k : print ( - 1 ) continue print ( k * n ) for j in range ( n ) : for un in s : ans . append ( un ) for l in range ( k - len ( list ( s ) ) ) : ans . append ( 1 ) print ( * ans ) NEW_LINE


import java . util . * ;   public class Test {   static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int t = Integer . parseInt ( sc . next ( ) ) ; while ( t -- > 0 ) solve ( ) ; }   static void solve ( ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ;   boolean [ ] arr = new boolean [ n + 1 ] ;   for ( int i = 0 ; i < n ; i ++ ) { arr [ sc . nextInt ( ) ] = true ; }   List < Integer > al = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( arr [ i ] ) al . add ( i ) ;   if ( al . size ( ) > k ) { System . out . println ( - 1 ) ; return ; } while ( al . size ( ) < k ) { al . add ( 1 ) ; }   System . out . println ( n * k ) ; for ( int i = 1 ; i <= n ; i ++ ) for ( Integer j : al ) System . out . print ( j + " ▁ " ) ;   System . out . println ( ) ;   } }


import java . util . Arrays ; import java . util . Scanner ;   public class Tapes { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) , k = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] diferencias = new int [ n - 1 ] ; int anterior = sc . nextInt ( ) ; for ( int i = 0 ; i < diferencias . length ; i ++ ) { int actual = sc . nextInt ( ) ; diferencias [ i ] = actual - anterior ; anterior = actual ; } sc . nextLine ( ) ; Arrays . sort ( diferencias ) ; long resultado = k ; for ( int i = 0 ; i < n - k ; i ++ ) resultado += diferencias [ i ] ; System . out . println ( resultado ) ; } }

n , m , k = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   c = [ ]   for i in range ( n - 1 ) : c . append ( b [ i + 1 ] - b [ i ] )   c . sort ( )   ret = 0   for i in range ( n - k ) : ret += c [ i ]   ret += k   print ( ret )   NEW_LINE


import math as mtimport sys , stringfrom collections import Counter , defaultdictinput = sys . stdin . readline MOD = 1000000007 PI = 3.14159265358979323 I = lambda : int ( input ( ) ) S = lambda : input ( ) M = lambda : map ( int , input ( ) . split ( ) ) Ms = lambda : map ( str , input ( ) . split ( ) ) ARR = lambda : list ( map ( int , input ( ) . split ( ) ) ) def solve ( ) : n , m , k = M ( ) ar = ARR ( ) diff = [ ar [ i ] - ar [ i - 1 ] + 1 for i in range ( 1 , n ) ] if len ( diff ) == 0 : print ( 1 ) return diff . sort ( ) ans = 0 for i in range ( n - k ) : ans += diff [ i ] ans += ( n - 2 * ( n - k ) ) print ( ans )     tc = 1 NEW_LINE


[ num_broken , length , max_pieces ] = [ int ( el ) for el in input ( ) . split ( ) ]   positions = input ( ) . split ( )   distances = [ ]   for i in range ( num_broken - 1 ) : diff = int ( positions [ i + 1 ] ) - int ( positions [ i ] ) - 1 distances . append ( diff ) distances . sort ( )   uncut_size = int ( positions [ - 1 ] ) - int ( positions [ 0 ] ) + 1   if max_pieces == 1 : print ( uncut_size ) else : print ( uncut_size - sum ( distances [ ( - max_pieces + 1 ) : ] ) )   NEW_LINE


n , m , k = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   c = [ ]   for i in range ( n - 1 ) : c . append ( b [ i + 1 ] - b [ i ] )   c . sort ( )   ret = 0   for i in range ( n - k ) : ret += c [ i ]   ret += k   print ( ret ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   import java . util . * ; import javafx . util . Pair ;   public class Main { static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; } Arrays . sort ( a ) ; } public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int k = input . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } long size = a [ n - 1 ] - a [ 0 ] + 1 ;


import java . util . ArrayList ; import java . util . Scanner ;   public class SquarePainting { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; long [ ] a = new long [ n ] ; int min = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scanner . nextLong ( ) ; if ( a [ min ] > a [ i ] ) min = i ; }   ArrayList < Integer > minimum = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == a [ min ] ) { minimum . add ( i ) ; } }   if ( minimum . size ( ) == 1 ) { System . out . println ( n * a [ min ] + n - 1 ) ; } else { int max = n - minimum . get ( minimum . size ( ) - 1 ) + minimum . get ( 0 ) ; for ( int i = 0 ; i < minimum . size ( ) - 1 ; i ++ ) { int diff = minimum . get ( i + 1 ) - minimum . get ( i ) ;   if ( max < diff ) max = diff ; } System . out . println ( n * a [ min ] + max - 1 ) ; } } }

def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counterfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


a , b = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) d , s , c , e = 0 , 0 , b . index ( min ( b ) ) , min ( b ) for i in range ( a ) : if b [ i ] == e : d = max ( d , s ) s = 0 else : s += 1 print ( e * a + max ( s + c , d ) ) NEW_LINE


n = int ( input ( ) ) litres = list ( map ( int , input ( ) . split ( ) ) ) mini = 10 ** 9 + 1 for i in range ( n ) : if mini >= litres [ i ] : mini = litres [ i ] last = ifor i in range ( n ) : if litres [ i ] == mini : first = i breaklitres += litres [ : first + 1 ] maxi = 0 prev = firstif first == last : print ( mini * n + n - 1 ) else : for i in range ( first + 1 , n + first + 1 ) : if litres [ i ] == mini : if maxi < i - prev : maxi = i - prev prev = i print ( mini * n + maxi - 1 ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . strip ( ) . split ( " ▁ " ) ) )   p = min ( a ) lf = [ ] rf = [ ] c1 = 0 c2 = 0 kc = - 1 for i in range ( n ) : if i == 0 : if a [ i ] == p : lf . append ( i ) kc = 1 c1 += 1 else : lf . append ( - 1 ) c1 += 1 else : if a [ i ] == p and kc == - 1 : lf . append ( i ) kc = 1 c1 += 1 else : lf . append ( lf [ c1 - 1 ] ) c1 += 1 for i in range ( n - 1 , - 1 , - 1 ) : if i == n - 1 : if a [ i ] == p : rf . append ( i ) c2 += 1 else : rf . append ( - 1 ) c2 += 1 else : if a [ i ] == p : rf . append ( i ) c2 += 1 else : rf . append ( rf [ c2 - 1 ] ) c2 += 1 rf . reverse ( ) NEW_LINE


n = int ( input ( ) ) ; lis = list ( map ( int , input ( ) . split ( ) ) ) minpos = None ; minval = float ( ' inf ' ) ; maxdiff = float ( ' - inf ' ) ; difflis = list ( ) for i , j in enumerate ( lis ) : if j <= minval : minval = jfor i , j in enumerate ( lis ) : if j == minval : difflis . append ( i ) ; fp = difflis [ 0 ] if len ( difflis ) == 1 : ans = ( n - 1 ) * ( minval + 1 ) + minval ; print ( ans ) ; exit ( ) for i in range ( 1 , len ( difflis ) ) : cur = difflis [ i ] - difflis [ i - 1 ] - 1 ; maxdiff = max ( maxdiff , cur ) if len ( set ( lis ) ) == 1 : print ( minval * n ) ; exit ( ) diff = n - difflis [ len ( difflis ) - 1 ] + difflis [ 0 ] - 1 ; maxdiff = max ( maxdiff , diff ) ans = maxdiff * ( minval + 1 ) + ( n - maxdiff ) * minval ; print ( ans ) NEW_LINE


import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( double a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; double temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long a [ ] = new long [ n ] ; long ans = 0 ; long min = Long . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextLong ( ) ; if ( min > a [ i ] ) { min = a [ i ] ; } } long highestRun = 0 ; long run = 0 ; for ( int i = 0 ; i < n * 2 ; i ++ ) { if ( a [ i % n ] == min ) { highestRun = Math . max ( highestRun , run ) ; run = 0 ; } else { run ++ ; } } System . out . println ( min * n + highestRun ) ;   }   }


import java . io . * ; import java . math . BigInteger ; import java . util . * ;    @ SuppressWarnings ( " unused " ) public class B { public static FastScannerB scan = new FastScannerB ( ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void solve ( ) { int n = scan . nextInt ( ) ; int [ ] a = scan . readArray ( n ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { min = Math . min ( a [ i ] , min ) ; } int cnt = 0 ; long res = ( long ) n * min ; int max = 0 ; for ( int i = 0 ; i < 2 * n ; i ++ ) { if ( a [ i % n ] == min ) cnt = 0 ; else { cnt ++ ; max = Math . max ( max , cnt ) ; } } System . out . println ( max + res ) ; } public static void main ( String [ ] args ) { solve ( ) ; out . close ( ) ; }   } class FastScannerB { 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 ( ) ) ; } void sort ( long [ ] a ) { ArrayList < Long > l = new ArrayList < > ( ) ; for ( long i : a ) l . add ( i ) ; Collections . sort ( l ) ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = l . get ( i ) ; }   }


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

from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport sysfrom io import BytesIO , IOBase if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip ''' Notes :   '''   def main ( ) : n = int ( input ( ) ) ar = [ ] for i in range ( n ) : ar . append ( input ( ) ) for i in range ( n ) : for j in range ( n ) : count = 0 if ( i - 1 ) >= 0 : if ar [ i - 1 ] [ j ] == ' o ' : count += 1 if ( i + 1 ) < n : if ar [ i + 1 ] [ j ] == ' o ' : count += 1 if ( j - 1 ) >= 0 : if ar [ i ] [ j - 1 ] == ' o ' : count += 1 if ( j + 1 ) < n : if ar [ i ] [ j + 1 ] == ' o ' : count += 1 if count % 2 == 0 : continue else : print ( " NO " ) return print ( " YES " ) 	 	     NEW_LINE


n = int ( input ( ) )   mat = [ input ( ) for _ in range ( n ) ]   status = True   for i in range ( n ) : for j in range ( n ) : count = 0 if i >= 1 and mat [ i - 1 ] [ j ] == ' o ' : count += 1 if j >= 1 and mat [ i ] [ j - 1 ] == ' o ' : count += 1 if i <= n - 2 and mat [ i + 1 ] [ j ] == ' o ' : count += 1 if j <= n - 2 and mat [ i ] [ j + 1 ] == ' o ' : count += 1 if count % 2 != 0 : status = False break if status : print ( " YES " ) else : print ( " NO " ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {


import java . util . * ; public class ApplemanAndEasyTask { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; char [ ] [ ] arr = new char [ n ] [ n ] ; boolean flag = true ;   for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ;   for ( int j = 0 ; j < n ; j ++ ) { arr [ i ] [ j ] = s . charAt ( j ) ; } } sc . close ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int counter = 0 ; if ( j + 1 < n && arr [ i ] [ j + 1 ] == ' o ' ) { counter ++ ; }   if ( j - 1 >= 0 && arr [ i ] [ j - 1 ] == ' o ' ) { counter ++ ; }   if ( i + 1 < n && arr [ i + 1 ] [ j ] == ' o ' ) { counter ++ ; } if ( i - 1 >= 0 && arr [ i - 1 ] [ j ] == ' o ' ) { counter ++ ; }   if ( counter != 0 ) { if ( counter % 2 != 0 ) { System . out . println ( " NO " ) ; flag = false ; break ; }   } } if ( flag == false ) break ;   } if ( flag ) System . out . println ( " YES " ) ;   } }


import java . util . Scanner ;   public class _0675ApplemanandEasyTask {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . nextLine ( ) ; char [ ] [ ] arr = new char [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { String temp = sc . nextLine ( ) ; for ( int j = 0 ; j < n ; j ++ ) { arr [ i ] [ j ] = temp . charAt ( j ) ; } } boolean flag = true ; for ( int i = 0 ; i < n ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < n ; j ++ ) { count = 0 ; if ( i - 1 >= 0 && arr [ ( i - 1 ) ] [ j ] == ' o ' ) { count ++ ; } if ( i + 1 < n && arr [ i + 1 ] [ j ] == ' o ' ) { count ++ ; } if ( j + 1 < n && arr [ i ] [ j + 1 ] == ' o ' ) { count ++ ; } if ( j - 1 >= 0 && arr [ i ] [ j - 1 ] == ' o ' ) { count ++ ; } if ( count % 2 != 0 ) { flag = false ; break ; } } } if ( flag ) { 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 . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . PriorityQueue ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class Main {   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 ) {

import sysinput = sys . stdin . readline     n , k , q = map ( int , input ( ) . split ( ) )     t = [ 0 ] * ( 200002 ) b = [ 0 ] * ( 200002 )     for j in range ( n ) : x , y = map ( int , input ( ) . split ( ) )   t [ x ] += 1 t [ y + 1 ] -= 1     for j in range ( 1 , 200002 ) : t [ j ] += t [ j - 1 ]   if t [ j ] >= k : b [ j ] = 1 b [ j ] += b [ j - 1 ]   while q > 0 : a , r = map ( int , input ( ) . split ( ) )   print ( b [ r ] - b [ a - 1 ] ) q -= 1 NEW_LINE


n , k , q = map ( int , input ( ) . split ( ) )   c = [ 0 ] * 200002 p = [ 0 ] * 200002   for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) p [ a ] += 1 p [ b + 1 ] -= 1 for i in range ( 1 , 200002 ) : p [ i ] += p [ i - 1 ] c [ i ] = c [ i - 1 ] + ( p [ i ] >= k ) l = [ ] for i in range ( q ) : a , b = map ( int , input ( ) . split ( ) ) print ( c [ b ] - c [ a - 1 ] ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { static int N = 2 * ( int ) 1e5 ; static int [ ] temp ; static int [ ] prefixSum ;   public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; temp = new int [ N + 5 ] ; int n = in . nextInt ( ) , k = in . nextInt ( ) , m = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = in . nextInt ( ) , b = in . nextInt ( ) ; temp [ a ] ++ ; temp [ b + 1 ] -- ; } for ( int i = 1 ; i <= N ; i ++ ) { temp [ i ] += temp [ i - 1 ] ; } prefixSum = new int [ N + 5 ] ; for ( int i = 0 ; i <= N ; i ++ ) { if ( temp [ i ] >= k ) prefixSum [ i ] = 1 ; } for ( int i = 1 ; i <= N ; i ++ ) { prefixSum [ i ] += prefixSum [ i - 1 ] ; }


import java . io . * ; import java . util . * ;   public class Main { static int N = 2 * ( int ) 1e5 ; static int [ ] temp ; static int [ ] prefixSum ;   public static void main ( String [ ] args ) throws IOException { FastReader in = new FastReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; temp = new int [ N + 5 ] ; int n = in . nextInt ( ) , k = in . nextInt ( ) , m = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int a = in . nextInt ( ) , b = in . nextInt ( ) ; temp [ a ] ++ ; temp [ b + 1 ] -- ; } for ( int i = 1 ; i <= N ; i ++ ) { temp [ i ] += temp [ i - 1 ] ; } prefixSum = new int [ N + 5 ] ; for ( int i = 0 ; i <= N ; i ++ ) { if ( temp [ i ] >= k ) prefixSum [ i ] = 1 ; } for ( int i = 1 ; i <= N ; i ++ ) { prefixSum [ i ] += prefixSum [ i - 1 ] ; }


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


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , k = in . nextInt ( ) , q = in . nextInt ( ) ; int ara [ ] = new int [ 200010 ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; ara [ x ] ++ ; ara [ y + 1 ] -- ; } int value = 0 ; for ( int i = 0 ; i < ara . length ; i ++ ) { value += ara [ i ] ; if ( value >= k ) { ara [ i ] = 1 ; } else { ara [ i ] = 0 ; } }   for ( int i = 1 ; i < ara . length ; i ++ )


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class C { 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 [ ] nextArray ( 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 ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; } } public static void main ( String [ ] args ) {

a , b , c = map ( int , input ( ) . split ( ) ) arr = sorted ( map ( int , input ( ) . split ( ) ) )   ans = arr [ - b ] - arr [ c - 1 ]   print ( ans ) NEW_LINE


n , p , v = input ( ) . split ( ) x = list ( map ( int , input ( ) . split ( ) ) )   x . sort ( ) print ( x [ int ( v ) ] - x [ int ( v ) - 1 ] ) NEW_LINE


import sysinput = sys . stdin . readline   n , a , b = [ int ( i ) for i in input ( ) . split ( ) ] h = sorted ( [ int ( i ) for i in input ( ) . split ( ) ] ) Vasya = h [ : b ] Petya = h [ b : ] print ( Petya [ 0 ] - Vasya [ - 1 ] ) NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) ) d = sorted ( list ( map ( int , input ( ) . split ( ) ) ) )   e = d [ c - 1 ] f = d [ c ] print ( f - e ) NEW_LINE


nab = input ( ) . split ( ) l = input ( ) . split ( ) nab = [ int ( i ) for i in nab ] l = [ int ( i ) for i in l ] l . sort ( ) if ( l [ nab [ 2 ] - 1 ] == l [ nab [ 2 ] ] ) : print ( 0 ) else : print ( l [ nab [ 2 ] ] - l [ nab [ 2 ] - 1 ] ) NEW_LINE


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int aa [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { aa [ i ] = sc . nextInt ( ) ; } Arrays . sort ( aa ) ; int p = aa [ n - a ] - aa [ n - a - 1 ] ; if ( p > 0 ) { System . out . println ( p ) ; } else { System . out . println ( 0 ) ; } } }


import java . util . * ;   public class Day8_169A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ;   int [ ] chores = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) chores [ i ] = scan . nextInt ( ) ;   scan . close ( ) ; Arrays . sort ( chores ) ; if ( chores [ b - 1 ] == chores [ n - a ] ) System . out . println ( 0 ) ; else System . out . println ( chores [ n - a ] - chores [ b - 1 ] ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , a = sc . nextInt ( ) , b = sc . nextInt ( ) ; int h [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { h [ i ] = sc . nextInt ( ) ; } Arrays . sort ( h ) ; System . out . println ( h [ b ] - h [ b - 1 ] ) ; } }


import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; String [ ] s = new String [ n ] ; int alreadyBlack = 0 ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = input . next ( ) ; } int maxx = 0 ; int minx = Integer . MAX_VALUE ; int maxy = 0 ; int miny = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( s [ i ] . charAt ( j ) == ' B ' ) { alreadyBlack ++ ; maxx = Math . max ( maxx , i ) ; maxy = Math . max ( maxy , j ) ; minx = Math . min ( minx , i ) ; miny = Math . min ( miny , j ) ; } } } int lenx = maxx - minx + 1 ; int leny = maxy - miny + 1 ; int len = Math . max ( lenx , leny ) ; if ( alreadyBlack == 0 ) { System . out . println ( "1" ) ; } else if ( len > n || len > m ) { System . out . println ( " - 1" ) ; } else if ( Math . sqrt ( len * len ) != len ) { System . out . println ( " - 1" ) ; } else { System . out . println ( len * len - alreadyBlack ) ; } } }

n , m = list ( map ( int , input ( ) . split ( ) ) ) sheet = [ ] for i in range ( n ) : sheet . append ( input ( ) )   min_row = 101 max_row = - 1 min_col = 101 max_col = - 1 count_black = 0 for i in range ( n ) : for j in range ( m ) : if sheet [ i ] [ j ] == ' B ' : count_black += 1 min_row = min ( min_row , i ) max_row = max ( max_row , i ) min_col = min ( min_col , j ) max_col = max ( max_col , j ) l = max ( max_row - min_row + 1 , max_col - min_col + 1 ) if count_black == 0 : print ( 1 ) elif l > n or l > m : print ( - 1 ) else : print ( l * l - count_black ) NEW_LINE


from __future__ import division , print_functionfrom io import BytesIO , IOBaseimport os , sys , math , heapq , copyfrom collections import defaultdict , dequefrom bisect import bisect_left , bisect_rightfrom functools import cmp_to_keyfrom itertools import permutations , combinations , combinations_with_replacement NEW_LINE


a , b = map ( int , input ( ) . split ( ) ) l , r = b , - 1 d , u = a , - 1 z = [ ] ; ok = 1 for i in range ( a ) : k = input ( ) ; z . append ( k ) for j in range ( b ) : if " B " in k : ok = 0 ; l = min ( l , k . find ( ' B ' ) ) ; r = max ( r , k . rfind ( ' B ' ) ) ; d = min ( d , i ) ; u = max ( u , i ) if ok : print ( 1 ) else : h = u - d + 1 ; w = r - l + 1 dim = max ( h , w ) if dim > min ( a , b ) : print ( - 1 ) else : s = ( dim - min ( h , w ) ) * dim for i in range ( d , u + 1 ) : for j in range ( l , r + 1 ) : s += 0 + ( z [ i ] [ j ] == ' W ' ) print ( s ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) sheet = [ ] for r in range ( n ) : ir = list ( input ( ) . strip ( ) ) sheet . append ( ir ) minx , miny , maxx , maxy = 101 , 101 , - 1 , - 1 seen = Falsefor r in range ( n ) : for c in range ( m ) : if ( sheet [ r ] [ c ] == ' B ' ) : if ( minx > c ) : minx = c if ( maxx < c ) : maxx = c if ( miny > r ) : miny = r if ( maxy < r ) : maxy = r seen = Truelength = max ( maxy - miny + 1 , maxx - minx + 1 ) if ( seen == False ) : print ( 1 ) elif ( length > m or length > n ) : print ( - 1 ) else : counter = 0 for i in range ( miny , maxy + 1 ) : for l in range ( minx , maxx + 1 ) : if ( sheet [ i ] [ l ] == ' B ' ) : counter += 1 print ( ( length * length ) - counter ) NEW_LINE


n , m = list ( map ( int , input ( ) . split ( ) ) ) sheet = [ ] for i in range ( n ) : sheet . append ( input ( ) )   min_row = 101 max_row = - 1 min_col = 101 max_col = - 1 for i in range ( n ) : for j in range ( m ) : if sheet [ i ] [ j ] == ' B ' : min_row = min ( min_row , i ) max_row = max ( max_row , i ) min_col = min ( min_col , j ) max_col = max ( max_col , j ) l = max_row - min_row + 1 b = max_col - min_col + 1 NEW_LINE


import java . util . Scanner ;   public class B828 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int R = in . nextInt ( ) ; int C = in . nextInt ( ) ; char [ ] [ ] A = new char [ R ] [ ] ; for ( int r = 0 ; r < R ; r ++ ) { A [ r ] = in . next ( ) . toCharArray ( ) ; } int minR = Integer . MAX_VALUE ; int maxR = Integer . MIN_VALUE ; int minC = Integer . MAX_VALUE ; int maxC = Integer . MIN_VALUE ; int count = 0 ; for ( int r = 0 ; r < R ; r ++ ) { for ( int c = 0 ; c < C ; c ++ ) { if ( A [ r ] [ c ] == ' B ' ) { count ++ ; minR = Math . min ( minR , r ) ; maxR = Math . max ( maxR , r ) ; minC = Math . min ( minC , c ) ; maxC = Math . max ( maxC , c ) ; } } } int answer ; if ( count == 0 ) { answer = 1 ; } else { int side = Math . max ( maxR - minR + 1 , maxC - minC + 1 ) ; if ( side > R || side > C ) { answer = - 1 ; } else { answer = side * side - count ; } } System . out . println ( answer ) ; }   }


import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Main { static InputReader in = new InputReader ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ; static int oo = ( int ) 1e9 ;

from collections import dequeimport heapq n = int ( input ( ) ) cards_help = list ( map ( int , input ( ) . split ( ) ) ) cards = [ ( cards_help [ i ] , - 1 * i ) for i in range ( n ) ] heapq . heapify ( cards ) draws = 0 removed = 0 while cards : prev = - 1 new_removals = 0 current = cards [ 0 ] while cards and - 1 * current [ 1 ] > prev : new_removals += 1 heapq . heappop ( cards ) temp_prev = - 1 * current [ 1 ] while cards and cards [ 0 ] [ 0 ] == current [ 0 ] and - 1 * cards [ 0 ] [ 1 ] > prev : current = cards [ 0 ] heapq . heappop ( cards ) new_removals += 1 prev = temp_prev current = cards [ 0 ] if cards else 0 draws += n - removed removed += new_removalsprint ( draws ) NEW_LINE


n = int ( input ( ) ) s = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) a = [ ] for i in range ( max ( s ) ) : a . append ( [ ] ) for i in range ( len ( s ) ) : a [ s [ i ] - 1 ] . append ( i ) a = list ( filter ( lambda x : x != [ ] , a ) ) if len ( a ) > 1 : for i in range ( 1 , len ( a ) ) : if len ( a [ i ] ) > 1 : s = a [ i - 1 ] [ - 1 ] if s > a [ i ] [ 0 ] and s < a [ i ] [ - 1 ] : for j in range ( 1 , len ( a [ i ] ) ) : if s < a [ i ] [ j ] : a [ i ] = a [ i ] [ j : ] + a [ i ] [ : j ] breakt = [ ] for i in a : t += ic = 0 x = t [ 0 ] + 1 i = n - 1 while i > 0 : if t [ i ] < t [ i - 1 ] : k = t [ i ] - t [ i - 1 ] + n else : k = t [ i ] - t [ i - 1 ] c += k x -= c // n i -= 1 print ( c + x )         NEW_LINE


def main ( ) : input ( ) numbers = tuple ( map ( int , input ( ) . split ( ) ) ) d = [ ] for i in range ( len ( numbers ) ) : while len ( d ) <= numbers [ i ] : d . append ( [ ] ) d [ numbers [ i ] ] . append ( i ) dd = [ [ ] ] for line in d : if line : dd . append ( line ) d = dd answer = [ None ] * len ( numbers ) for item in d [ 1 ] : answer [ item ] = 1 for i in range ( 1 , len ( d ) - 1 ) : left_maxes = [ 0 ] right_maxes = [ 0 ] for j in range ( len ( d [ i ] ) ) : left_maxes . append ( max ( left_maxes [ - 1 ] , answer [ d [ i ] [ j ] ] ) ) right_maxes . append ( max ( right_maxes [ - 1 ] , answer [ d [ i ] [ len ( d [ i ] ) - j - 1 ] ] ) ) left_amount = 0 for j in range ( len ( d [ i + 1 ] ) ) : while left_amount < len ( d [ i ] ) and d [ i ] [ left_amount ] < d [ i + 1 ] [ j ] : left_amount += 1 answer [ d [ i + 1 ] [ j ] ] = max ( left_maxes [ left_amount ] , right_maxes [ len ( d [ i ] ) - left_amount ] + 1 ) res = 0 for ans in answer : res += ans print ( res )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


from collections import dequeimport heapq   n = int ( input ( ) ) cards_help = list ( map ( int , input ( ) . split ( ) ) ) cards = [ ( cards_help [ i ] , - 1 * i ) for i in range ( n ) ] heapq . heapify ( cards )   draws = 0 removed = 0 while cards : prev = - 1 new_removals = 0 current = cards [ 0 ] while cards and - 1 * current [ 1 ] > prev : new_removals += 1 heapq . heappop ( cards ) temp_prev = - 1 * current [ 1 ] while cards and cards [ 0 ] [ 0 ] == current [ 0 ] and - 1 * cards [ 0 ] [ 1 ] > prev : current = cards [ 0 ] heapq . heappop ( cards ) new_removals += 1 prev = temp_prev current = cards [ 0 ] if cards else 0 draws += n - removed removed += new_removalsprint ( draws )         NEW_LINE


import java . io . * ; import java . util . * ; public class cardsorting { static int [ ] bit ; static int n ; public static void main ( String [ ] args ) throws Exception { FastScanner in = new FastScanner ( System . in ) ; n = in . nextInt ( ) ; Num [ ] nums = new Num [ n ] ; bit = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { nums [ i ] = new Num ( in . nextInt ( ) , i ) ; add ( i , 1 ) ; } Arrays . sort ( nums ) ; long ret = nums [ 0 ] . idx ; int p = nums [ 0 ] . idx ; add ( nums [ 0 ] . idx , - 1 ) ; int i = 1 ;


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String first = s . nextLine ( ) ; String second = s . nextLine ( ) ; String text = s . nextLine ( ) ; String result = " " ; int found = 0 ; char c = ' ▁ ' ; for ( int i = 0 ; i < text . length ( ) ; i ++ ) { found = 0 ; if ( ! Character . isDigit ( text . charAt ( i ) ) ) { if ( Character . isUpperCase ( text . charAt ( i ) ) ) { found = 1 ; c = Character . toLowerCase ( text . charAt ( i ) ) ; } else c = text . charAt ( i ) ; int index = search ( first , c ) ; if ( found == 1 ) { result = result + Character . toUpperCase ( second . charAt ( index ) ) ; } else result = result + second . charAt ( index ) ; } else result = result + text . charAt ( i ) ; } System . out . println ( result ) ; } public static int search ( String first , char c ) { int index = 0 ; for ( int i = 0 ; i < first . length ( ) ; i ++ ) { if ( first . charAt ( i ) == c ) { index = i ; break ; } } return index ; } }

s = str ( input ( ) ) s1 = str ( input ( ) ) s2 = str ( input ( ) ) n = len ( s ) n1 = len ( s1 ) n2 = len ( s2 ) for i in range ( n2 ) : if ( s2 [ i ] . isupper ( ) ) : p = s . find ( s2 [ i ] . lower ( ) ) print ( s1 [ p ] . upper ( ) , end = ' ' ) elif ( s2 [ i ] . islower ( ) ) : p = s . find ( s2 [ i ] ) print ( s1 [ p ] , end = ' ' ) else : print ( s2 [ i ] , end = ' ' ) NEW_LINE


board1 = input ( ) board2 = input ( ) s = input ( ) ans = " " for i in s : if i >= ' A ' and i <= ' Z ' : index = board1 . index ( i . lower ( ) ) ans += board2 [ index ] . upper ( ) elif i >= ' a ' and i <= ' z ' : index = board1 . index ( i ) ans += board2 [ index ] else : ans += iprint ( ans ) NEW_LINE


x = list ( input ( ) . strip ( ) ) y = list ( input ( ) . strip ( ) )   s = list ( input ( ) . strip ( ) )   z = s   for i in range ( len ( z ) ) : if z [ i ] . isnumeric ( ) : continue else : if z [ i ] . islower ( ) : j = z [ i ] . lower ( ) ind = x . index ( j ) z [ i ] = y [ ind ] else : j = z [ i ] . lower ( ) ind = x . index ( j ) z [ i ] = y [ ind ] . upper ( )     print ( ' ' . join ( z ) )         NEW_LINE


l1 = list ( str ( input ( ) ) ) l2 = list ( str ( input ( ) ) ) l3 = list ( str ( input ( ) ) ) s = ' ' for i in l3 : if i . isalpha ( ) and i . isupper ( ) : lcase = i . lower ( ) if lcase in l1 : idx1 = l1 . index ( lcase ) s = s + l2 [ idx1 ] . upper ( ) elif i . isalpha ( ) and i . islower ( ) : if i in l1 : idx2 = l1 . index ( i ) s += l2 [ idx2 ] else : s += iprint ( s ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; import static java . util . Arrays . sort ; import javafx . util . Pair ;   public class Main {   public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; String FKeyboard = input . next ( ) ; String SKeyboard = input . next ( ) ; String typed = input . next ( ) ; StringBuilder ans = new StringBuilder ( ) ; for ( int i = 0 ; i < typed . length ( ) ; i ++ ) { if ( typed . charAt ( i ) >= ' A ' && typed . charAt ( i ) <= ' Z ' ) { String c = ( typed . charAt ( i ) + " " ) . toLowerCase ( ) ; System . out . print ( ( SKeyboard . charAt ( FKeyboard . indexOf ( c ) ) + " " ) . toUpperCase ( ) ) ; } else if ( typed . charAt ( i ) >= ' a ' && typed . charAt ( i ) <= ' z ' ) { String c = typed . charAt ( i ) + " " ; System . out . print ( SKeyboard . charAt ( FKeyboard . indexOf ( c ) ) ) ; } else System . out . print ( typed . charAt ( i ) ) ; } System . out . println ( " " ) ; }   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 ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }


import java . util . * ;   public class question { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { String x = " " + s . charAt ( i ) ; boolean cap = false ; if ( x . toUpperCase ( ) == x ) { x = x . toLowerCase ( ) ; cap = true ; } if ( a . contains ( x ) ) { int ind = a . indexOf ( x ) ; String ans = b . substring ( ind , ind + 1 ) ; if ( cap == true ) ans = ans . toUpperCase ( ) ; System . out . print ( ans ) ; } else System . out . print ( x ) ; }   } }


import java . util . * ;   public class TestCodeforces { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; solve ( scanner ) ; scanner . close ( ) ; }   public static void solve ( Scanner scanner ) {   String s = scanner . nextLine ( ) , s2 = scanner . nextLine ( ) , s3 = scanner . nextLine ( ) ;   String res = " " ; int len = s3 . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = s3 . charAt ( i ) ; if ( c >= '0' && c <= '9' ) res += c ; else if ( c >= ' A ' && c <= ' Z ' ) res += Character . toUpperCase ( s2 . charAt ( s . indexOf ( Character . toLowerCase ( c ) ) ) ) ; else res += s2 . charAt ( s . indexOf ( c ) ) ; } System . out . println ( res ) ;    } }


import java . util . * ; import java . lang . * ;   public class trial { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; HashMap < Character , Character > sts = new HashMap < > ( ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { sts . put ( s1 . charAt ( i ) , s2 . charAt ( i ) ) ; } String test = sc . next ( ) ; for ( int i = 0 ; i < test . length ( ) ; i ++ ) { if ( Character . isAlphabetic ( test . charAt ( i ) ) && test . charAt ( i ) > 90 ) { System . out . print ( ( Character . toLowerCase ( sts . get ( test . charAt ( i ) ) ) ) ) ; } else if ( Character . isAlphabetic ( test . charAt ( i ) ) && test . charAt ( i ) <= 90 ) { System . out . print ( Character . toUpperCase ( sts . get ( Character . toLowerCase ( test . charAt ( i ) ) ) ) ) ; } else System . out . print ( test . charAt ( i ) ) ; } }    }


import java . io . * ; import java . util . * ;   public class Main { static int inf = ( int ) 1e9 + 7 ;   public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; pw = new PrintWriter ( System . out ) ; int p = nextInt ( ) ; int k = nextInt ( ) ; long ans = 1 ; boolean used [ ] = new boolean [ p ] ; for ( int i = 1 ; i < p ; i ++ ) { int v = i ; if ( ! used [ i ] ) { while ( ! used [ v ] ) { used [ v ] = true ; v = ( int ) ( ( ( long ) v * k ) % p ) ; } ans = ( ans * p ) % inf ; } }   if ( k == 1 ) ans = ( ans * p ) % inf ; pw . println ( ans ) ; pw . close ( ) ; }   static BufferedReader br ; static StringTokenizer st = new StringTokenizer ( " " ) ; static PrintWriter pw ;   static String next ( ) throws IOException { while ( ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; }   static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } }

n , k = map ( int , input ( ) . split ( ) ) m = 10 ** 9 + 7 if k == 0 : print ( pow ( n , n - 1 , m ) ) elif k == 1 : print ( pow ( n , n , m ) ) else : c = 1 x = k while x != 1 : x = ( x * k ) % n c += 1 print ( pow ( n , ( n - 1 ) // c , m ) ) NEW_LINE


MOD = int ( 1e9 + 7 ) n , k = map ( int , input ( ) . split ( ) ) if k < 2 : p = n - ( 1 - k ) else : t = 1 a = k while a != 1 : a = a * k % n t += 1 p = ( n - 1 ) // tprint ( pow ( n , p , MOD ) )   NEW_LINE


def main ( ) : p , k = map ( int , input ( ) . split ( ) ) s = 1 m = pow ( 10 , 9 ) + 7 if k == 0 : s = pow ( p , p - 1 , m ) elif k == 1 : s = pow ( p , p , m ) else : o = 1 n = k while n != 1 : n = k * n % p o += 1 c = ( p - 1 ) // o s = pow ( p , c , m ) print ( s % m ) main ( )         NEW_LINE


MOD = int ( 1e9 + 7 ) n , k = map ( int , input ( ) . split ( ) ) if k < 2 : p = n - ( 1 - k ) else : t = 1 a = k while a != 1 : a = a * k % n t += 1 p = ( n - 1 ) // tprint ( pow ( n , p , MOD ) ) NEW_LINE


p , k = map ( int , input ( ) . split ( ) ) M = 1000000007 if k == 0 : print ( pow ( p , p - 1 , M ) ) , exit ( 0 ) if k == 1 : print ( pow ( p , p , M ) ) , exit ( 0 ) cnt , x = 0 , 1 while 1 : cnt -= - 1 x = ( k * x ) % p if x == 1 : breakprint ( pow ( p , ( p - 1 ) // cnt , M ) ) NEW_LINE


import java . io . * ;   public class Main { final static long mod = ( long ) 1e9 + 7 ; public static long pow ( long x , long n ) { long ans = 1 ; while ( n != 0 ) { if ( n % 2 == 1 ) ans *= x ; ans %= mod ; n /= 2 ; x *= x ; x %= mod ; } return ans % mod ; } public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] input = bf . readLine ( ) . split ( " ▁ " ) ; long p = Integer . parseInt ( input [ 0 ] ) ; long k = Integer . parseInt ( input [ 1 ] ) ; long order = 1 ; long temp = k ; if ( k == 0 ) System . out . println ( ( int ) pow ( p , p - 1 ) ) ; else { while ( order < p ) { if ( temp == 1 ) break ; temp = ( ( k % p ) * ( temp % p ) ) % p ; order ++ ; } if ( k == 1 ) System . out . println ( ( ( pow ( p , p ) ) ) ) ; else System . out . println ( ( ( pow ( p , ( p - 1 ) / order ) ) ) ) ; } } }


import java . util . * ;   public class Solution { public static long MOD = 1_000_000_007 ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int P = in . nextInt ( ) ; int K = in . nextInt ( ) ; in . close ( ) ; long ans = calc ( P , K ) ; System . out . println ( ans ) ; } public static long calc ( int P , int K ) { if ( K == 0 ) { return modPow ( P , P - 1 ) ; } if ( K == 1 ) { return modPow ( P , P ) ; } int count = 0 ; boolean [ ] visited = new boolean [ P ] ; for ( int i = 1 ; i < visited . length ; i ++ ) { if ( visited [ i ] ) { continue ; } long j = i ; count ++ ; while ( ! visited [ ( int ) j ] ) { visited [ ( int ) j ] = true ; j = ( j * K ) % P ; } } return modPow ( P , count ) ; } public static long modPow ( long base , long exp ) { base %= MOD ; long ans = 1 ; while ( exp > 0 ) { if ( exp % 2 == 1 ) { ans = ( ans * base ) % MOD ; } base = ( base * base ) % MOD ; exp >>= 1 ; } return ans ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Helloworld { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int m = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ m ] ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < m ; i ++ ) { b [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } int files = 0 ; int i = 0 , j = 0 ; int sum1 = 0 ; int sum2 = 0 ; while ( i < n || j < m ) { if ( sum1 == 0 ) { sum1 = sum1 + a [ i ] ; i ++ ; } else if ( sum2 == 0 ) { sum2 = sum2 + b [ j ] ; j ++ ; } else if ( sum1 < sum2 ) { sum1 = sum1 + a [ i ] ; i ++ ; } else if ( sum1 > sum2 ) { sum2 = sum2 + b [ j ] ; j ++ ; } else { files ++ ; sum1 = 0 ; sum2 = 0 ; } } System . out . println ( files + 1 ) ; }   }

n , m = map ( int , input ( ) . split ( ) )   a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   cnt = 0 x = 0 ; y = 0 i = 0 ; j = 0   f = - 1 while i < n and j < m :   if f != 1 : x += a [ i ]   if f != 2 : y += b [ j ]   if x == y : cnt += 1 i += 1 j += 1 f = - 1   elif x > y : j += 1 f = 1   else : i += 1 f = 2   print ( cnt ) NEW_LINE


n , m = [ int ( i ) for i in input ( ) . split ( ) ] a = [ int ( i ) for i in input ( ) . split ( ) ] b = [ int ( i ) for i in input ( ) . split ( ) ] sum = 0 sums = 0 for i in range ( 0 , len ( a ) ) : sum = sum + a [ i ] a [ i ] = sumfor i in range ( 0 , len ( b ) ) : sums = sums + b [ i ] b [ i ] = sumsprint ( n + m - ( len ( set ( a + b ) ) ) ) NEW_LINE


import sys , matha , b = map ( int , input ( ) . split ( ' ▁ ' ) ) arr1 = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) arr2 = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) c = 0 i , j = 0 , 0 while i < a and j < b : if arr1 [ i ] < arr2 [ j ] : arr1 [ i + 1 ] = arr1 [ i ] + arr1 [ i + 1 ] i += 1 else : if arr1 [ i ] > arr2 [ j ] : arr2 [ j + 1 ] = arr2 [ j ] + arr2 [ j + 1 ] j += 1 else : c += 1 i += 1 j += 1 print ( c )       NEW_LINE


import sys , copy   n , m = map ( int , sys . stdin . readline ( ) . split ( ) ) a = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) b = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) i = 0j = 0 sigma_a = a [ 0 ] sigma_b = b [ 0 ] ans = 0 while i < n and j < m : if sigma_a < sigma_b : i += 1 sigma_a += a [ i ]   elif sigma_a > sigma_b : j += 1 sigma_b += b [ j ]   else : i += 1 j += 1 ans += 1 if i < n or j < m : sigma_a = a [ i ] sigma_b = b [ j ] print ( ans ) NEW_LINE


import java . util . * ;   public class problem950B { private static Scanner in = new Scanner ( System . in ) ; private static long n = 0 , m = 0 , files = 0 , target = 0 , sum = 0 ; private static int j = 0 ; public static void main ( String [ ] args ) { n = in . nextInt ( ) ; m = in . nextInt ( ) ; ArrayList < Integer > blocksN = new ArrayList < Integer > ( ) ; ArrayList < Integer > blocksM = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) blocksN . add ( in . nextInt ( ) ) ; for ( int i = 0 ; i < m ; i ++ ) blocksM . add ( in . nextInt ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) { target += blocksN . get ( i ) ; while ( sum < target ) { sum += blocksM . get ( j ) ; j ++ ; } if ( sum == target ) { target = sum = 0 ; files ++ ; } } System . out . println ( files ) ; } }


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , m = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] a = new int [ n ] , b = new int [ m ] ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < m ; i ++ ) b [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; int i = 0 , j = 0 , cnt = 0 ; while ( i < n && j < m ) { if ( a [ i ] == b [ j ] ) { i ++ ; j ++ ; cnt ++ ; } else if ( a [ i ] < b [ j ] ) { a [ i + 1 ] = a [ i + 1 ] + a [ i ] ; i ++ ; } else { b [ j + 1 ] = b [ j + 1 ] + b [ j ] ; j ++ ; } } System . out . println ( cnt ) ; } }


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

import math   x , y = map ( int , input ( ) . split ( ) ) c1 , c2 = math . log ( x ) / x , math . log ( y ) / y   print ( ' < ' if c1 < c2 else ' > ' if c1 > c2 else ' = ' ) NEW_LINE


import mathx , y = map ( int , input ( ) . split ( ) ) if y * math . log ( x ) > x * math . log ( y ) : print ( " > " ) elif y * math . log ( x ) < x * math . log ( y ) : print ( ' < ' ) else : print ( ' = ' ) NEW_LINE


import matha , b = map ( int , input ( ) . split ( ) ) if b * math . log ( a ) > a * math . log ( b ) : print ( " > " ) elif b * math . log ( a ) < a * math . log ( b ) : print ( " < " ) else : print ( " = " ) NEW_LINE


import mathtry : x , y = map ( int , input ( ) . split ( ) ) z = y * ( math . log ( x ) ) w = x * ( math . log ( y ) ) if w > z : print ( " < " ) elif w == z : print ( " = " ) else : print ( " > " ) except : pass NEW_LINE


import java . util . Scanner ;   public class HighSchool { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; sc . nextLine ( ) ; double k = ( y * Math . log10 ( x ) ) ; double l = ( x * Math . log10 ( y ) ) ; if ( k > l ) { System . out . println ( " > " ) ; } else if ( k < l ) { System . out . println ( " < " ) ; } else { System . out . println ( " = " ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) throws InterruptedException { FastScanner fs = new FastScanner ( ) ; int nPeople = fs . nextInt ( ) ; double distance = fs . nextInt ( ) ; double walkSpeed = fs . nextInt ( ) , busSpeed = fs . nextInt ( ) ; int seats = fs . nextInt ( ) ; int trips = ( nPeople + seats - 1 ) / seats ; double minTime = 0 , maxTime = distance / walkSpeed ; for ( int i = 0 ; i < 1000 ; i ++ ) { double totalTime = ( minTime + maxTime ) / 2 ;

n , l , v1 , v2 , k = map ( int , input ( ) . split ( ) )   if k >= n : res = l / v2else : L , R = 0 , l / v2 x = ( n + k - 1 ) // k   for i in range ( 100 ) : M = ( L + R ) / 2   first = M + ( l - v2 * M ) / v1   prev_cost = ( x - 1 ) * ( M + M * ( v2 - v1 ) / ( v1 + v2 ) ) last = prev_cost + ( l - v1 * prev_cost ) / v2   if last > first : R = M else : L = M   res = ( l - L * v2 ) / v1 + L   print ( ' { :0.10f } ' . format ( res ) ) NEW_LINE


n , l , v1 , v2 , k = map ( int , input ( ) . split ( ) )   n = ( n + k - 1 ) // k   a = ( v2 - v1 ) / ( v1 + v2 )   t = l / v2 / ( n - ( n - 1 ) * a )   print ( n * t + ( n - 1 ) * a * t )       NEW_LINE


n , l , v , o , k = map ( int , input ( ) . split ( ) ) T = ( n + k - 1 ) // ke = 1 - v / oL = l / v / ( T / o + T * e / ( v + o ) - e / ( v + o ) - 1 / o + 1 / v ) print ( ( l - L ) / v + L / o ) NEW_LINE


RYIawuypxfFqJOW = mapRYIawuypxfFqJOL = intRYIawuypxfFqJOg = inputRYIawuypxfFqJOi = printn , l , v1 , v2 , k = RYIawuypxfFqJOW ( RYIawuypxfFqJOL , RYIawuypxfFqJOg ( ) . split ( ) ) n = ( n + k - 1 ) // ka = ( v2 - v1 ) / ( v1 + v2 ) t = l / v2 / ( n - ( n - 1 ) * a ) RYIawuypxfFqJOi ( n * t + ( n - 1 ) * a * t ) NEW_LINE


n , l , v1 , v2 , k = map ( int , input ( ) . split ( ) ) diff = v2 - v1n = ( n + k - 1 ) // k * 2 p1 = ( n * v2 - diff ) * lp2 = ( n * v1 + diff ) * v2print ( p1 / p2 ) 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 ( ) ; }   public static long mod = 17352642619633L ;    int N , L , V1 , V2 , K ; double busspeed ; double personspeed ;   public static double eps = 1e-11 ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ;


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

a = int ( input ( ) )   b = " "   if a == 0 : b = " zero " elif a // 10 == 1 : if a % 10 == 0 : b = " ten " elif a % 10 == 1 : b = " eleven " elif a % 10 == 2 : b = " twelve " elif a % 10 == 3 : b = " thirteen " elif a % 10 == 4 : b = " fourteen " elif a % 10 == 5 : b = " fifteen " elif a % 10 == 6 : b = " sixteen " elif a % 10 == 7 : b = " seventeen " elif a % 10 == 8 : b = " eighteen " elif a % 10 == 9 : b = " nineteen " print ( b ) quit ( ) elif a // 10 > 1 : if a // 10 == 9 : b = " ninety " elif a // 10 == 8 : b = " eighty " elif a // 10 == 7 : b = " seventy " elif a // 10 == 6 : b = " sixty " elif a // 10 == 5 : b = " fifty " elif a // 10 == 4 : b = " forty " elif a // 10 == 3 : b = " thirty " elif a // 10 == 2 : b = " twenty " if a % 10 != 0 : if a % 10 == 9 : b = b + ( " - " if len ( b ) > 0 else " " ) + " nine " elif a % 10 == 8 : b = b + ( " - " if len ( b ) > 0 else " " ) + " eight " elif a % 10 == 7 : b = b + ( " - " if len ( b ) > 0 else " " ) + " seven " elif a % 10 == 6 : b = b + ( " - " if len ( b ) > 0 else " " ) + " six " elif a % 10 == 5 : b = b + ( " - " if len ( b ) > 0 else " " ) + " five " elif a % 10 == 4 : b = b + ( " - " if len ( b ) > 0 else " " ) + " four " elif a % 10 == 3 : b = b + ( " - " if len ( b ) > 0 else " " ) + " three " elif a % 10 == 2 : b = b + ( " - " if len ( b ) > 0 else " " ) + " two " elif a % 10 == 1 : b = b + ( " - " if len ( b ) > 0 else " " ) + " one "   print ( b ) NEW_LINE


x = int ( input ( ) )   a = [ ' zero ' , ' one ' , ' two ' , ' three ' , ' four ' , ' five ' , ' six ' , ' seven ' , ' eight ' , ' nine ' , ' ten ' , ' eleven ' , ' twelve ' , ' thirteen ' , ' fourteen ' , ' fifteen ' , ' sixteen ' , ' seventeen ' , ' eighteen ' , ' nineteen ' ] b = [ ' twenty ' , ' thirty ' , ' forty ' , ' fifty ' , ' sixty ' , ' seventy ' , ' eighty ' , ' ninety ' ] print ( a [ x ] if x < 20 else b [ x // 10 - 2 ] + ( ' ' if x % 10 == 0 else ' - ' + a [ x % 10 ] ) )   NEW_LINE


num = int ( input ( ) )   d = { 0 : ' zero ' , 1 : ' one ' , 2 : ' two ' , 3 : ' three ' , 4 : ' four ' , 5 : ' five ' , 6 : ' six ' , 7 : ' seven ' , 8 : ' eight ' , 9 : ' nine ' , 10 : ' ten ' , 11 : ' eleven ' , 12 : ' twelve ' , 13 : ' thirteen ' , 14 : ' fourteen ' , 15 : ' fifteen ' , 16 : ' sixteen ' , 17 : ' seventeen ' , 18 : ' eighteen ' , 19 : ' nineteen ' , 20 : ' twenty ' , 30 : ' thirty ' , 40 : ' forty ' , 50 : ' fifty ' , 60 : ' sixty ' , 70 : ' seventy ' , 80 : ' eighty ' , 90 : ' ninety ' }   while True : if num < 20 : print ( d [ num ] ) break if num < 100 : if num % 10 == 0 : print ( d [ num ] ) break else : print ( d [ num // 10 * 10 ] + ' - ' + d [ num % 10 ] ) break NEW_LINE


numerals = { 0 : " zero " , 1 : " one " , 2 : " two " , 3 : " three " , 4 : " four " , 5 : " five " , 6 : " six " , 7 : " seven " , 8 : " eight " , 9 : " nine " , 10 : " ten " , 11 : " eleven " , 12 : " twelve " , 13 : " thirteen " , 14 : " fourteen " , 15 : " fifteen " , 16 : " sixteen " , 17 : " seventeen " , 18 : " eighteen " , 19 : " nineteen " , 20 : " twenty " , 30 : " thirty " , 40 : " forty " , 50 : " fifty " , 60 : " sixty " , 70 : " seventy " , 80 : " eighty " , 90 : " ninety " }   n = int ( input ( ) ) if n in numerals : print ( numerals [ n ] ) else : previous = " twenty " for key in numerals : if n > key : previous = numerals [ key ] if n < key : break ans = previous + " - " + numerals [ int ( str ( n ) [ - 1 ] ) ] print ( ans ) NEW_LINE


n = int ( input ( ) ) numbers = [ ' zero ' , ' one ' , ' two ' , ' three ' , ' four ' , ' five ' , ' six ' , ' seven ' , ' eight ' , ' nine ' , ' ten ' , ' eleven ' , ' twelve ' , ' thirteen ' , ' fourteen ' , ' fifteen ' , ' sixteen ' , ' seventeen ' , ' eighteen ' , ' nineteen ' ] tens = [ ' ' , ' ' , ' twenty ' , ' thirty ' , ' forty ' , ' fifty ' , ' sixty ' , ' seventy ' , ' eighty ' , ' ninety ' ] if n <= 19 : print ( numbers [ n ] ) exit ( ) else : if n % 10 == 0 : print ( tens [ n // 10 ] ) else : print ( tens [ n // 10 ] + ' - ' + numbers [ n % 10 ] ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String [ ] num = { " zero " , " one " , " two " , " three " , " four " , " five " , " six " , " seven " , " eight " , " nine " , " ten " , " eleven " , " twelve " , " thirteen " , " fourteen " , " fifteen " , " sixteen " , " seventeen " , " eighteen " , " nineteen " } ; String [ ] num1 = { " twenty " , " thirty " , " forty " , " fifty " , " sixty " , " seventy " , " eighty " , " ninety " } ; int n = scan . nextInt ( ) ; if ( n < 20 ) { System . out . println ( num [ n ] ) ; } else { int f = n / 10 ; int l = n % 10 ; if ( l != 0 ) { System . out . println ( num1 [ f - 2 ] + " - " + num [ l ] ) ; } else { System . out . println ( num1 [ f - 2 ] ) ; } }   }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   import static java . lang . Integer . lowestOneBit ; import static java . lang . Integer . parseInt ;   public class Example {   public static void main ( String [ ] args ) {    Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = { " zero " , " one " , " two " , " three " , " four " , " five " , " six " , " seven " , " eight " , " nine " , " ten " , " eleven " , " twelve " , " thirteen " , " fourteen " , " fifteen " , " sixteen " , " seventeen " , " eighteen " , " nineteen " } ; String [ ] st = { " " , " " , " twenty " , " thirty " , " forty " , " fifty " , " sixty " , " seventy " , " eighty " , " ninety " } ; if ( n < 20 ) System . out . println ( s [ n ] ) ; else { if ( n % 10 == 0 ) { System . out . println ( st [ n / 10 ] ) ; } else { System . out . println ( st [ n / 10 ] + " - " + s [ n % 10 ] ) ; } }   } }


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

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) print ( n ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) print ( n ) NEW_LINE


def Diamonds ( ) : t = int ( input ( ) ) res = [ ] while ( t ) : res . append ( int ( input ( ) ) ) t -= 1 for i in range ( len ( res ) ) : print ( res [ i ] )   if __name__ == " _ _ main _ _ " : Diamonds ( ) NEW_LINE


t , * x = open ( 0 ) ; print ( * x ) NEW_LINE


import java . util . * ; public class FillingDiamond { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; System . out . println ( n ) ; } } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int t = in . nextInt ( ) ; StringBuffer sb = new StringBuffer ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; sb . append ( n + " \n " ) ; } System . out . println ( sb ) ; } }


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


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] ans = new int [ n ] ; int ptr = 0 , temp = k + 1 ; while ( k -- >= 0 ) { ans [ ptr ++ ] = k + 1 ; } while ( ptr < n ) { ans [ ptr ++ ] = temp ; temp ++ ; } StringBuilder res = new StringBuilder ( ) ; for ( int i = 0 ; i < ans . length ; i ++ ) { res . append ( ans [ i ] + 1 ) . append ( " ▁ " ) ; } res . deleteCharAt ( res . length ( ) - 1 ) ; System . out . println ( res ) ; } }

n , k = map ( int , input ( ) . split ( ) ) print ( * range ( 1 , n - k ) , * range ( n , n - 1 - k , - 1 ) ) NEW_LINE


n , k = [ int ( x ) for x in input ( ) . split ( ) ] for i in range ( n , n - k , - 1 ) : print ( str ( i ) , end = " ▁ " ) for i in range ( 1 , n - k + 1 ) : if ( i == ( n - k ) ) : print ( str ( i ) , end = " " ) else : print ( str ( i ) , end = " ▁ " ) print ( ) NEW_LINE


arr = [ int ( x ) for x in input ( ) . split ( ) ] n , k = arr [ 0 ] , arr [ 1 ] c = n - k - 1 ans = [ i + 1 for i in range ( c ) ] for i in range ( n , n - k - 1 , - 1 ) : ans . append ( i ) print ( * ans ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) )   if k == 0 : lst1 = [ ] for b in range ( 1 , n + 1 ) : lst1 . append ( b ) res1 = [ str ( r ) for r in lst1 ] print ( ' ▁ ' . join ( res1 ) ) else : lst = [ ] for x in range ( k ) : lst . append ( n - x ) for y in range ( k , n ) : lst . append ( y - k + 1 ) res = [ str ( b ) for b in lst ] print ( ' ▁ ' . join ( res ) )   NEW_LINE


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


import java . util . * ; import java . io . * ; import java . math . * ;   public class First { public static void process ( ) throws IOException { int n = ni ( ) ; int k = ni ( ) ; for ( int i = 1 ; i <= k ; i ++ ) { p ( n + " ▁ " ) ; n -- ; } for ( int i = 1 ; i <= n ; i ++ ) { p ( i + " ▁ " ) ; } pn ( " " ) ;   }   static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; int printed = 0 ; int i = n ; if ( k > 0 ) { System . out . print ( n + " ▁ " ) ; k -- ; printed ++ ; i -- ; } while ( k > 0 ) { System . out . print ( i + " ▁ " ) ; i -- ; k -- ; printed ++ ; } i = 1 ; while ( printed < n ) { System . out . print ( i + " ▁ " ) ; i ++ ; printed ++ ; }   } }


import java . util . ArrayList ; import java . util . Scanner ;   public class InfinityGauntlet {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String [ ] s = { " Power " , " Time " , " Space " , " Soul " , " Reality " , " Mind " } ; int [ ] a = new int [ 7 ] ; for ( int i = 0 ; i < n ; i ++ ) { String in = scan . next ( ) ;   if ( in . equals ( " purple " ) ) { ++ a [ 1 ] ; } if ( in . equals ( " green " ) ) { ++ a [ 2 ] ; } if ( in . equals ( " blue " ) ) { ++ a [ 3 ] ; } if ( in . equals ( " orange " ) ) { ++ a [ 4 ] ; } if ( in . equals ( " red " ) ) { ++ a [ 5 ] ; } if ( in . equals ( " yellow " ) ) { ++ a [ 6 ] ;   } }   ArrayList < String > res = new ArrayList < String > ( ) ; for ( int j = 1 ; j < 7 ; j ++ ) {   if ( a [ j ] == 0 ) { res . add ( s [ j - 1 ] ) ; } } System . out . println ( res . size ( ) ) ; for ( int j = 0 ; j < res . size ( ) ; j ++ ) { System . out . println ( res . get ( j ) ) ;   } } }

n = int ( input ( ) ) d = { ' purple ' : ' Power ' , ' green ' : ' Time ' , ' blue ' : ' Space ' , ' orange ' : ' Soul ' , ' red ' : ' Reality ' , ' yellow ' : ' Mind ' } for i in range ( n ) : s = input ( ) del d [ s ] print ( 6 - n ) for i in d : print ( d [ i ] ) NEW_LINE


l = { ' purple ' : ' Power ' , ' green ' : ' Time ' , ' blue ' : ' Space ' , ' orange ' : ' Soul ' , ' red ' : ' Reality ' , ' yellow ' : ' Mind ' } set1 = set ( ) n = int ( input ( ) )   for i in range ( n ) : s1 = input ( ) set1 . add ( s1 ) print ( 6 - n ) for ( key , value ) in l . items ( ) : if key not in set1 : print ( value )   NEW_LINE


n = int ( input ( ) ) l = [ ] d = { ' purple ' : ' Power ' , ' green ' : ' Time ' , ' blue ' : ' Space ' , ' orange ' : ' Soul ' , ' red ' : ' Reality ' , ' yellow ' : ' Mind ' } for i in range ( n ) : l . append ( input ( ) ) d1 = dict . fromkeys ( l ) print ( 6 - len ( l ) ) for i in d : if ( i not in d1 ) : print ( d [ i ] ) NEW_LINE


t = int ( input ( ) ) l = [ ] d = { " purple " : " Power ▁ " , " green " : " Time ▁ " , " blue " : " Space ▁ " , " orange " : " Soul ▁ " , " red " : " ▁ Reality " , " yellow " : " ▁ Mind ▁ " } for i in range ( t ) : s = input ( ) l . append ( s ) NEW_LINE