import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class NewYearAndTheChristmasPresent { public static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   public static void main ( String [ ] args ) throws IOException { StringTokenizer str = new StringTokenizer ( br . readLine ( ) ) ; int yellows = Integer . parseInt ( str . nextToken ( ) ) ; int blues = Integer . parseInt ( str . nextToken ( ) ) ; int reds = Integer . parseInt ( str . nextToken ( ) ) ; int total = 0 ;

import java . util . * ;     import java . lang . * ; import java . io . * ;    public class Solution { 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 ; } }   private static FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) throws java . lang . Exception { int y = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int sum = 0 ; while ( r >= 3 ) { if ( r - 1 <= b && r - 2 <= y ) { sum = 3 * r - 3 ; break ; } r -- ; } System . out . println ( sum ) ;                                   } }

import java . util . Scanner ;   public class Ornament { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int y = in . nextInt ( ) , b = in . nextInt ( ) - 1 , r = in . nextInt ( ) - 2 ;   in . close ( ) ; System . out . println ( 3 * Math . min ( Math . min ( y , b ) , r ) + 3 ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int y = in . ni ( ) , b = in . ni ( ) , r = in . ni ( ) ; b = Math . min ( b , r - 1 ) ; y = Math . min ( y , b - 1 ) ; out . println ( y * 3 + 3 ) ; } } static class FastScanner { private BufferedReader in ; private StringTokenizer st ; public FastScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String ns ( ) { while ( st == null || ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl == null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int ni ( ) { return Integer . parseInt ( ns ( ) ) ; } } }

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

y , b , r = map ( int , input ( ) . split ( ) ) y = y + 2 b = b + 1 r = r + 0 min = min ( y , b , r ) sum = ( min * 3 ) - 3 print ( sum ) NEW_LINE

y , b , r = [ int ( i ) for i in input ( ) . split ( ) ] print ( 3 * min ( y + 1 , b , r - 1 ) ) NEW_LINE

temp = [ int ( x ) for x in input ( ) . split ( ) ] y = temp [ 0 ] b = temp [ 1 ] r = temp [ 2 ] if y >= b : y = b - 1 else : b = y + 1 if b >= r : b = r - 1 y = r - 2 else : r = b + 1 print ( y + b + r ) NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) res = 0 if b >= a + 1 and c >= a + 2 : res = max ( res , ( a * 3 ) + 3 ) if a >= b - 1 and c >= b + 1 : res = max ( res , b * 3 ) if a >= c - 2 and b >= c - 1 : res = max ( res , ( c * 3 ) - 3 ) print ( res ) NEW_LINE


import java . util . * ; import java . math . * ; import java . io . * ;   public class CF396B { class Fraction { long n , d ; public Fraction ( long nn , long dd ) { n = nn ; d = dd ; simplify ( ) ; } void simplify ( ) { long gcd = gcd ( n , d ) ; n /= gcd ; d /= gcd ; } Fraction add ( Fraction f ) { long lcm = lcm ( d , f . d ) ; return new Fraction ( ( n * ( lcm / d ) ) + ( f . n * ( lcm / f . d ) ) , lcm ) ; } Fraction sub ( Fraction f ) { return this . add ( new Fraction ( - f . n , f . d ) ) ; } public String toString ( ) { return String . format ( " % d / % d " , n , d ) ; } } long gcd ( long a , long b ) { return b == 0 ? a : gcd ( b , a % b ) ; } long lcm ( long a , long b ) { return a / gcd ( a , b ) * b ; } int prevprime ( int x ) { for ( int i = x ; ; i -- ) if ( BigInteger . valueOf ( i ) . isProbablePrime ( 100 ) ) return i ; } int nextprime ( int x ) { for ( int i = x + 1 ; ; i ++ ) if ( BigInteger . valueOf ( i ) . isProbablePrime ( 100 ) ) return i ; } public CF396B ( ) { FS scan = new FS ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = scan . nextInt ( ) ; for ( int tt = 0 ; tt < t ; tt ++ ) { int n = scan . nextInt ( ) ;

import java . io . * ; import java . math . BigInteger ; public class Main { static PrintWriter pw = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( bf . readLine ( ) ) ; int n = 0 ; for ( int i = 0 ; i < t ; i ++ ) { n = Integer . parseInt ( bf . readLine ( ) ) ; solve ( n ) ; } pw . flush ( ) ; } public static void solve ( int n ) { long u = n , v = n + 1 ; while ( ! BigInteger . valueOf ( u ) . isProbablePrime ( 10 ) ) u -- ; while ( ! BigInteger . valueOf ( v ) . isProbablePrime ( 10 ) ) v ++ ; long a = v * ( u - 2 ) + 2 * ( n - u + 1 ) , b = 2 * u * v ; long g = gcd ( a , b ) ; pw . write ( a / g + " / " + b / g + " \n " ) ; } static long gcd ( long a , long b ) { return b == 0 ? a : gcd ( b , a % b ) ; } }

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

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . IOException ; import java . util . Random ; import java . io . UncheckedIOException ; import java . math . BigDecimal ; import java . io . Closeable ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . math . BigInteger ; import java . io . InputStream ; import java . math . RoundingMode ;   public class Main { public static void main ( String [ ] args ) throws Exception { Thread thread = new Thread ( null , new TaskAdapter ( ) , " " , 1 << 29 ) ; thread . start ( ) ; thread . join ( ) ; }   static class TaskAdapter implements Runnable { @ Override public void run ( ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastInput in = new FastInput ( inputStream ) ; FastOutput out = new FastOutput ( outputStream ) ; BOnSumOfFractions solver = new BOnSumOfFractions ( ) ; int testCount = Integer . parseInt ( in . next ( ) ) ; for ( int i = 1 ; i <= testCount ; i ++ ) solver . solve ( i , in , out ) ; out . close ( ) ; } }   static class BOnSumOfFractions { public void solve ( int testNumber , FastInput in , FastOutput out ) { int n = in . ri ( ) ; if ( n == 2 ) { out . println ( "1/6" ) ; return ; } int p1 = prev ( n ) ; int next = next ( n + 1 ) ;

T = int ( input ( ) )   MAX = 33000   bePrime = [ 0 ] * MAX ; primNum = [ ]   for j in range ( 2 , MAX ) : if bePrime [ j ] == 0 : primNum . append ( j ) i = j while i < MAX : bePrime [ i ] = 1 i = i + j   def isPrime ( a ) : for j in primNum : if j >= a : return True if a % j == 0 : return False return True   def gcd ( a , b ) : if b == 0 : return a return gcd ( b , a % b ) ;   while T > 0 : num = 0 ; n = int ( input ( ) )   m = n while isPrime ( m ) == False : m -= 1 while isPrime ( n + 1 ) == False : n += 1 num += 1   a = n - 1 b = 2 * ( n + 1 )   a = a * ( n + 1 ) * m - num * b b = b * ( n + 1 ) * m   g = gcd ( a , b ) a //= g b //= g     print ( ' { 0 } / {1 } ' . format ( a , b ) ) T -= 1 ;   NEW_LINE

def prime ( n ) : m = int ( n ** 0.5 ) + 1 t = [ 1 ] * ( n + 1 ) for i in range ( 3 , m ) : if t [ i ] : t [ i * i : : 2 * i ] = [ 0 ] * ( ( n - i * i ) // ( 2 * i ) + 1 ) return [ 2 ] + [ i for i in range ( 3 , n + 1 , 2 ) if t [ i ] ]   def gcd ( a , b ) : c = a % b return gcd ( b , c ) if c else b   p = prime ( 31650 ) def g ( n ) : m = int ( n ** 0.5 ) for j in p : if n % j == 0 : return True if j > m : return False   def f ( n ) : a , b = n , n + 1 while g ( a ) : a -= 1 while g ( b ) : b += 1 p , q = ( b - 2 ) * a + 2 * ( n - b + 1 ) , 2 * a * b d = gcd ( p , q ) print ( str ( p // d ) + ' / ' + str ( q // d ) )   for i in range ( int ( input ( ) ) ) : f ( int ( input ( ) ) ) NEW_LINE

def isPrime ( n ) : i = 2 while i * i <= n : if n % i == 0 : return False i += 1 return True   def prevPrime ( n ) : while not isPrime ( n ) : n -= 1 return n   def nextPrime ( n ) : n += 1 while not isPrime ( n ) : n += 1 return n   def gcd ( a , b ) : while ( a ) : b %= a a , b = b , a return b ;   def solve ( ) : n = int ( input ( ) ) prev = prevPrime ( n ) ; next = nextPrime ( n ) ; num1 = prev - 2 ; den1 = prev * 2 ; g = gcd ( num1 , den1 ) ; num1 //= g ; den1 //= g ; num2 = n - prev + 1 ; den2 = prev * next ; g = gcd ( num2 , den2 ) ; num2 //= g ; den2 //= g ; g = gcd ( num1 * den2 + num2 * den1 , den1 * den2 ) ; x = ( num1 * den2 + num2 * den1 ) // g ; y = den1 * den2 // g ; print ( ' { } / { } ' . format ( x , y ) )   t = int ( input ( ) ) while t : t -= 1 solve ( ) NEW_LINE


import java . util . Scanner ;   public class srf { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) , start = sc . nextInt ( ) , x = sc . nextInt ( ) ; Ans argmax = query ( start ) ;

import java . io . BufferedReader ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . BitSet ; import java . util . Calendar ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . PriorityQueue ; import java . util . SortedSet ; import java . util . Random ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ;   public class B_AimTech_Round4 {   public static long MOD = 1000000007 ;   public static void main ( String [ ] args ) throws FileNotFoundException {

import randomimport sys   def process ( n , start , X ) : ran = [ start ] + list ( set ( [ random . randint ( 1 , n ) for _ in range ( 990 ) ] ) ) arr = [ ask ( index ) [ 0 ] for index in ran ] pos , init = find ( ran , arr , X ) ans = - 1 if pos == None : ans = arr [ 0 ] elif init == X : ans = init else : cur = init cnt = 0 while cnt <= 999 : cur , pos = ask ( pos ) if cur >= X : ans = cur break if pos == - 1 : break cnt += 1 print ( ' ! ▁ { } ' . format ( ans ) ) def find ( ran , arr , X ) : diff = float ( ' inf ' ) pos , init = None , None for i , x in zip ( ran , arr ) : if x <= X and abs ( x - X ) < diff : diff = abs ( x - X ) pos = i init = x return pos , init def ask ( index ) : print ( ' ? ▁ { } ' . format ( index ) ) sys . stdout . flush ( ) val_ , next_ = map ( int , input ( ) . split ( ) ) return val_ , next_                   n , start , X = map ( int , input ( ) . split ( ) ) process ( n , start , X ) NEW_LINE


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

import java . util . LinkedList ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] parents = new int [ n ] ; int [ ] k = new int [ n ] ; LinkedList < Integer > hotels = new LinkedList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( sc . nextInt ( ) == 1 ) { hotels . add ( i ) ; } } for ( int i = 0 ; i < n ; i ++ ) { parents [ i ] = sc . nextInt ( ) - 1 ; if ( parents [ i ] != - 1 ) { k [ parents [ i ] ] ++ ; } } LinkedList < Integer > bestPath = null ; for ( int h : hotels ) { LinkedList < Integer > path = new LinkedList < > ( ) ; path . addFirst ( h ) ; while ( true ) { int prev = parents [ path . getFirst ( ) ] ; if ( prev == - 1 ) { break ; } if ( k [ prev ] > 1 ) { break ; } path . addFirst ( prev ) ; } if ( bestPath == null || bestPath . size ( ) < path . size ( ) ) { bestPath = path ; } } System . out . println ( bestPath . size ( ) ) ; for ( int v : bestPath ) { System . out . print ( v + 1 + " ▁ " ) ; } } }

import java . util . * ; import java . io . * ;   public class Main4 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int objects = sc . nextInt ( ) ; int [ ] types = new int [ objects ] ; for ( int i = 0 ; i < objects ; i ++ ) { types [ i ] = sc . nextInt ( ) ; }   int [ ] skiTrack = new int [ objects ] ; int [ ] count = new int [ objects ] ;   for ( int i = 0 ; i < objects ; i ++ ) {

import java . util . * ; import java . io . * ;   public class Resort { InputStream is ; PrintWriter out ; String INPUT = " " ;   void solve ( ) throws IOException { int n = ni ( ) ; boolean [ ] mountain = new boolean [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) mountain [ i ] = ni ( ) == 0 ;   int [ ] parent = new int [ n + 1 ] ; int [ ] outdegree = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { parent [ i ] = ni ( ) ; outdegree [ parent [ i ] ] ++ ; }   ArrayList < ArrayList < Integer > > list = new ArrayList < > ( ) ; for ( int i = 0 ; i <= n ; i ++ ) list . add ( new ArrayList < > ( ) ) ;   int [ ] indegree = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { if ( outdegree [ parent [ i ] ] > 1 || outdegree [ i ] > 2 || parent [ i ] == 0 ) continue ; list . get ( parent [ i ] ) . add ( i ) ; indegree [ i ] ++ ; }

n = int ( input ( ) ) input_types = input ( ) . split ( " ▁ " ) types = [ int ( i ) for i in input_types ]   input_vertex = input ( ) . split ( " ▁ " ) prev = [ 0 for i in range ( n ) ] cntFrom = [ 0 for i in range ( n ) ]   for i in range ( n ) : prev [ i ] = int ( input_vertex [ i ] ) prev [ i ] -= 1 if ( prev [ i ] != - 1 ) : cntFrom [ prev [ i ] ] += 1   ans = [ ] for i in range ( n ) : if types [ i ] == 1 : curV = i cur = [ ] while prev [ curV ] != - 1 and cntFrom [ prev [ curV ] ] <= 1 : cur . append ( curV ) curV = prev [ curV ] cur . append ( curV ) if len ( ans ) < len ( cur ) : ans = cur   ans_alt = [ str ( i + 1 ) for i in ans [ : : - 1 ] ] print ( len ( ans_alt ) ) print ( ' ▁ ' . join ( ans_alt ) ) NEW_LINE

n = int ( input ( ) ) t = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) a = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) )   ans , cnt = [ ] , [ 0 for i in range ( n + 1 ) ]   for i in a : cnt [ i ] += 1   for i in range ( 1 , n + 1 ) : if t [ i ] == 1 : crt = [ i ] x = a [ i ] while cnt [ x ] == 1 : crt . append ( x ) x = a [ x ] if len ( crt ) > len ( ans ) : ans = crt [ : ] ans . reverse ( ) print ( len ( ans ) ) print ( ' ▁ ' . join ( map ( str , ans ) ) )   NEW_LINE

n = int ( input ( ) ) t = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) a = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) )   res , cnt = [ ] , [ 0 ] * ( n + 1 ) for i in a : cnt [ i ] += 1 for i in range ( 1 , n + 1 ) : if t [ i ] == 0 : continue curr_res = [ i ] x = a [ i ] while cnt [ x ] == 1 : curr_res . append ( x ) x = a [ x ] if len ( curr_res ) > len ( res ) : res = curr_res [ : ] res . reverse ( ) print ( len ( res ) ) print ( * res ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ;   public class CF1311A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int [ ] ab = Arrays . stream ( br . readLine ( ) . split ( " \\ s + " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; System . out . println ( ab [ 0 ] == ab [ 1 ] ? 0 : ab [ 0 ] < ab [ 1 ] ? ( ( ab [ 1 ] - ab [ 0 ] - 1 ) & 1 ) + 1 : ( ( ab [ 0 ] - ab [ 1 ] ) & 1 ) + 1 ) ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ;   public class CF1311A { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int [ ] ab = Arrays . stream ( br . readLine ( ) . split ( " \\ s + " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int ans = - 1 ; if ( ab [ 0 ] == ab [ 1 ] ) { ans = 0 ; } else if ( ab [ 0 ] < ab [ 1 ] ) { ans = ( ( ab [ 1 ] - ab [ 0 ] - 1 ) & 1 ) + 1 ; } else { ans = ( ( ab [ 0 ] - ab [ 1 ] ) & 1 ) + 1 ; } System . out . println ( ans ) ; } } }

import java . util . Scanner ;   public class A1311 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = scanner . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ;   if ( a == b ) { System . out . println ( 0 ) ; } else if ( a > b && ( a - b ) % 2 == 1 ) { System . out . println ( 2 ) ; } else if ( a > b && ( a - b ) % 2 == 0 ) { System . out . println ( 1 ) ; } else if ( a < b && ( b - a ) % 2 == 1 ) { System . out . println ( 1 ) ; } else if ( a < b && ( b - a ) % 2 == 0 ) { System . out . println ( 2 ) ; } } } }

import java . io . * ; import java . util . StringTokenizer ;   public class A1311 { public static void main ( String [ ] args ) throws IOException { PrintWriter out = new PrintWriter ( System . out ) ; FastScanner fs = new FastScanner ( ) ; int tc = fs . nextInt ( ) ; for ( int _ = 0 ; _ < tc ; _ ++ ) { int A = fs . nextInt ( ) , B = fs . nextInt ( ) ; if ( A == B ) { out . println ( 0 ) ; } else if ( ( A > B && ( ( ( A - B ) & 1 ) ) == 0 ) || ( B > A && ( ( B - A ) & 1 ) == 1 ) ) { out . println ( 1 ) ; } else { out . println ( 2 ) ; } } out . close ( ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   public FastScanner ( String filePath ) throws FileNotFoundException { try { br = new BufferedReader ( new FileReader ( filePath ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } }   String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw e ; } } return st . nextToken ( ) ; }   String nextLine ( ) throws IOException { String str ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw e ; } return str ; }   int nextInt ( ) throws IOException { return Integer . parseInt ( this . next ( ) ) ; }   long nextLong ( ) throws IOException { return Long . parseLong ( this . next ( ) ) ; } } }

import java . util . * ;   public class Solutions { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a == b ) { System . out . println ( 0 ) ; } else if ( a < b ) { System . out . println ( ( b - a ) % 2 == 1 ? 1 : 2 ) ; } else { System . out . println ( ( a - b ) % 2 == 1 ? 2 : 1 ) ; } } } }

t = int ( input ( ) ) for _ in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) if ( abs ( a - b ) == 0 ) : print ( '0' ) elif ( abs ( a - b ) % 2 == 0 and a - abs ( a - b ) == b ) : print ( '1' ) elif ( abs ( a - b ) % 2 == 0 and a - abs ( a - b ) != b ) : print ( '2' ) elif ( abs ( a - b ) % 2 != 0 and a + abs ( a - b ) == b ) : print ( '1' ) else : print ( '2' ) NEW_LINE

t = int ( input ( ) )   while t > 0 : count = 0   a , b = map ( int , input ( ) . split ( ) )   if a > b : a = a - b if a % 2 == 0 : count += 1 else : count += 2 elif b > a : b = b - a if b % 2 == 0 : count += 2 else : count += 1   print ( count )   t -= 1 NEW_LINE

for _ in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) if a == b : print ( 0 ) elif a > b : if ( a - b ) % 2 == 0 : print ( 1 ) else : print ( 2 ) else : if ( a - b ) % 2 == 0 : print ( 2 ) else : print ( 1 ) NEW_LINE

def main ( ) : t = int ( input ( ) ) for _ in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) val = b - a if val == 0 : print ( 0 ) elif val > 0 : if val % 2 != 0 : print ( 1 ) else : print ( 2 ) else : if val % 2 == 0 : print ( 1 ) else : print ( 2 )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


import java . lang . reflect . Array ; import java . text . CollationElementIterator ; import java . util . * ; import java . util . Map . Entry ; import java . io . * ; import java . lang . Math . * ; import java . math . BigInteger ;   import static java . lang . Math . * ; import static java . lang . System . * ; import static java . util . Arrays . fill ; import static java . util . Arrays . spliterator ; public class ContestMain implements Runnable { private static Reader in = new Reader ( ) ; private static StringBuilder ans = new StringBuilder ( ) ; private static long MOD = ( long ) ( 1e9 + 7 ) ; private static final int N = ( int ) ( 2e5 + 7 ) ;

import bisectfrom sys import stdinn = int ( input ( ) ) a , b = [ ] , [ ] for i in range ( n ) : l , * s = map ( int , stdin . readline ( ) . split ( ) ) if sorted ( s ) == s [ : : - 1 ] : a . append ( s [ 0 ] ) b . append ( s [ - 1 ] ) a . sort ( ) print ( n * n - sum ( [ bisect . bisect_right ( a , bb ) for bb in b ] ) ) NEW_LINE

import bisectn = int ( input ( ) ) m1 = [ 0 ] * nm2 = [ ] m3 = [ 0 ] * nfor i in range ( n ) : arr = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] k1 , k2 , k3 = float ( ' inf ' ) , float ( " - inf " ) , 0 for c in arr : if c > k1 : k3 = 1 k1 = min ( k1 , c ) k2 = max ( k2 , c ) m3 [ i ] = k3 if k3 == 0 : m1 [ i ] = k1 m2 . append ( k2 ) m2 . sort ( ) ans = 0 st = sum ( m3 ) for i in range ( n ) : if m3 [ i ] : ans += n else : j = bisect . bisect_left ( m2 , m1 [ i ] + 1 ) ans += len ( m2 ) - j + stprint ( ans ) NEW_LINE

import bisectn = int ( input ( ) ) f = [ ] l = [ ] for i in range ( n ) : a = list ( map ( int , input ( ) . split ( ) ) ) a = a [ 1 : ] if sorted ( a ) == a [ : : - 1 ] : f . append ( a [ 0 ] ) l . append ( a [ - 1 ] ) f . sort ( ) l . sort ( ) ans = 0 for i in range ( len ( f ) ) : pos = bisect . bisect_right ( f , l [ i ] ) ans += posprint ( n * n - ans ) NEW_LINE

from os import path ; import sys , timemod = int ( 1e9 + 7 ) from math import ceil , floor , gcd , log , log2 , factorial , sqrtfrom collections import defaultdict , Counter , OrderedDict , deque ; from itertools import combinations , permutations NEW_LINE


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 . * ; public class square { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] num = new int [ 100001 ] ; for ( int i = 1 ; i <= n ; i ++ ) { int p = sc . nextInt ( ) ; num [ p ] ++ ; } for ( int i = 1 ; i <= 100000 ; i ++ ) if ( num [ i ] % 2 != 0 ) { System . out . println ( " Conan " ) ; return ; } System . out . println ( " Agasa " ) ; } }

import java . util . * ;   public class CodeForces914B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] a = new int [ 100000 + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ input . nextInt ( ) ] ++ ; } String ans = " Agasa " ; for ( int i = 1 ; i < a . length ; i ++ ) { if ( a [ i ] % 2 != 0 ) { ans = " Conan " ; break ; } }   System . out . println ( ans ) ;   } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . List ; import java . util . stream . Collectors ; import java . util . stream . Stream ;   public class Codeforces914B {   public static void main ( String [ ] args ) throws NumberFormatException , IOException {

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) f = [ 0 ] * ( max ( a ) + 1 ) for i in a : f [ i ] += 1 c = 0 for i in f : if ( i % 2 != 0 ) : c = 1 breakif ( c == 0 ) : print ( ' Agasa ' ) else : print ( ' Conan ' ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) l1 = [ 0 ] * 100001 for item in a : l1 [ item ] += 1 ans = " Agasa " for item in l1 : if item % 2 : ans = " Conan " ; breakprint ( ans ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   a . sort ( reverse = True ) ai = [ 1 ] * n   j = 0 for i in range ( 1 , n ) : if a [ i ] == a [ i - 1 ] : ai [ j ] += 1 else : j += 1   ai = ai [ : j + 1 ]   conan = Falsefor i in ai : if i % 2 : conan = True break   print ( " Conan " if conan else " Agasa " ) NEW_LINE

input ( ) q , t = { } , 0 a = list ( map ( int , input ( ) . split ( ) ) ) for i in a : q [ i ] = q . get ( i , 0 ) + 1 for i in q : if q [ i ] & 1 : t = 1 ; breakprint ( " Conan " if t else " Agasa " ) NEW_LINE


import java . util . * ;   public class StackBracket { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long y = sc . nextLong ( ) ; long c = 0 ; long gcd = gcd ( x , y ) ; x = x / gcd ; y = y / gcd ; long a1 = a / x ; long a2 = b / y ; System . out . println ( Math . min ( a1 , a2 ) ) ;

import java . util . * ;   public class Example { static int [ ] dp ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;

import java . util . Scanner ;   public class _0705BuyingaTVSet { static long gcd ( long a , long b ) {

max_width , max_height , x , y = map ( int , input ( ) . split ( ) )       def hcf ( num1 , num2 ) : if ( num2 == 0 ) : return num1 return hcf ( num2 , num1 % num2 )   ratio = 0 ratio = hcf ( x , y ) if ( ratio != 0 ) : x = x // ratio y = y // ratio posible_width = max_width // x possible_height = max_height // y       print ( min ( possible_height , posible_width ) )   NEW_LINE

import matha , b , x , y = map ( int , input ( ) . split ( ) ) g = math . gcd ( x , y ) x //= gy //= gprint ( min ( a // x , b // y ) ) NEW_LINE

import math   a , b , x , y = map ( int , input ( ) . split ( ) ) c = math . gcd ( x , y ) x //= cy //= cans = min ( a // x , b // y ) print ( ans ) NEW_LINE

import matha , b , x , y = map ( int , input ( ) . split ( ) ) d = math . gcd ( x , y ) print ( min ( a * d // x , b * d // y ) ) NEW_LINE


import java . util . * ; import java . util . Scanner ; import java . io . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ;   import javax . lang . model . util . ElementScanner6 ;   public class B567 { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String args [ ] ) { FastReader in = new FastReader ( ) ; int t = 1 ;

import java . io . * ; import java . util . * ; public class Main {   public static void main ( String [ ] args ) { InputReader sc = new InputReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; Random gen = new Random ( ) ; int test = 1 ;

import java . util . Scanner ;   public class ArrayList { public static void main ( String [ ] args ) {    Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = 0 , c = 0 ; boolean f [ ] = new boolean [ 10000001 ] ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; int r = sc . nextInt ( ) ; if ( s . charAt ( 0 ) == ' - ' ) { if ( ! f [ r ] ) min ++ ; else c -- ; } else c ++ ; f [ r ] = true ; if ( c > min ) min = c ;   } System . out . println ( min ) ;   } }

import java . util . * ;   public class Berland_National_Library {   static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; boolean [ ] tab = new boolean [ 1000001 ] ; int min = 0 ; int c = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = in . next ( ) ; int k = in . nextInt ( ) ; if ( s . charAt ( 0 ) == ' - ' ) { if ( ! tab [ k ] ) min ++ ; else c -- ; } else c ++ ; tab [ k ] = true ; if ( c > min ) min = c ; } System . out . println ( min ) ; } }

from sys import stdin , stdoutfrom os import pathrd = lambda : stdin . readline ( ) . strip ( ) wr = stdout . writeif ( path . exists ( ' input . txt ' ) ) : stdin = open ( " input . txt " , " r " ) import time , math NEW_LINE

n = int ( input ( ) ) a = [ ] for i in range ( n ) : s = input ( ) a . append ( s ) lst = [ 0 ] * 1000000 before = [ ] for i in range ( n ) : sign = a [ i ] [ 0 ] val = int ( a [ i ] [ 2 : ] ) if sign == " + " : lst [ val - 1 ] = 1 else : if not lst [ val - 1 ] : before . append ( val ) mx = len ( before ) ans = mxfor i in range ( n ) : sign = a [ i ] [ 0 ] val = int ( a [ i ] [ 2 : ] ) if sign == " + " : mx += 1 ans = max ( mx , ans ) else : mx -= 1 print ( ans ) NEW_LINE

n , l , m , a = int ( input ( ) ) , [ 0 ] * 1000000 , 0 , [ ] for _ in range ( n ) : a . append ( input ( ) ) for i in range ( n ) : v = int ( a [ i ] [ 2 : ] ) if a [ i ] [ 0 ] == ' + ' : l [ v - 1 ] = 1 elif not l [ v - 1 ] : m += 1 ans = mfor i in range ( n ) : if a [ i ] [ 0 ] == ' + ' : m += 1 ; ans = max ( m , ans ) else : m -= 1 print ( ans ) NEW_LINE

n = int ( input ( ) ) seats = [ False for x in range ( 1 , 1000010 ) ] ans = 0 state = 0 for x in range ( n ) : di , idd = input ( ) . split ( ) idd = int ( idd ) if di == ' + ' : seats [ idd ] = True state += 1 ans = max ( ans , state ) elif di == ' - ' : if seats [ idd ] == False : ans += 1 else : state -= 1 ans = max ( ans , state ) seats [ idd ] = Falseprint ( ans ) NEW_LINE

n = int ( input ( ) ) mp = dict ( ) ans , cur = 0 , 0   for i in range ( n ) : c , x = [ _ for _ in input ( ) . split ( ) ] x = int ( x ) if c == ' - ' : if mp . get ( x ) == True : cur -= 1 mp [ x ] = False elif mp . get ( x ) is None : ans += 1 mp [ x ] = False elif c == ' + ' : cur += 1 mp [ x ] = True ans = max ( ans , cur ) print ( ans ) NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long num = in . nextLong ( ) ; while ( num % 10 == 0 ) { num /= 10 ; } String str = String . valueOf ( num ) ; for ( int i = 0 ; i < str . length ( ) / 2 ; i ++ ) {

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 ;   void run ( FastScanner in , PrintWriter out ) {   char [ ] ca = in . next ( ) . toCharArray ( ) ; int N = ca . length ;   for ( int i = 0 ; i <= N ; i ++ ) {   boolean good = true ; for ( int j = 0 ; j < i / 2 ; j ++ ) { if ( ca [ j ] != ca [ i - j - 1 ] ) good = false ; } for ( int j = i ; j < N ; j ++ ) { if ( ca [ j ] != '0' ) good = false ; } if ( good ) { out . println ( " YES " ) ; return ; } } out . println ( " NO " ) ; }    static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; }   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 ( ) ) ; } } }

s = input ( ) s = s . strip ( "0" )     NEW_LINE

s = input ( ) s = list ( s ) while s [ - 1 ] == '0' : s . pop ( ) d = s [ : : - 1 ] print ( " YES " if d == s else " NO " ) NEW_LINE

string = input ( ) while string [ - 1 ] == '0' : string = string [ : len ( string ) - 1 ] if string == string [ : : - 1 ] : print ( " YES " ) else : print ( " NO " ) NEW_LINE

import sysx = input ( ) for i in range ( len ( x ) - 1 , - 1 , - 1 ) : if x [ i ] != '0' : new = ( i + 1 ) for j in range ( new // 2 ) : if ( x [ j ] != x [ new - j - 1 ] ) : print ( " NO " ) sys . exit ( 0 ) breakprint ( " YES " ) NEW_LINE


import java . io . * ; import java . math . BigDecimal ; import java . math . MathContext ; import java . util . * ; import java . util . function . Function ;   import static java . math . BigDecimal . ROUND_HALF_UP ;   public class Solution { static MyScanner sc ; private static PrintWriter out ; static long M2 = 1_000_000_000L + 7 ;   public static void main ( String [ ] s ) throws Exception { StringBuilder stringBuilder = new StringBuilder ( ) ;

import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class B_Round_421_Div1 {   public static long MOD = 1000000007 ;   public static void main ( String [ ] args ) throws FileNotFoundException {

import java . util . * ; import java . util . stream . IntStream ; import java . io . * ; public class MisterBandPRShifts { static int [ ] brute ( int arr [ ] ) { int deviation [ ] = new int [ arr . length ] ; for ( int k = 0 ; k < arr . length ; k ++ ) for ( int i = 0 ; i < arr . length ; i ++ ) deviation [ k ] += Math . abs ( i - arr [ ( i - k + arr . length ) % arr . length ] ) ; return deviation ; } static void rotate ( int arr [ ] , int k ) { int temp [ ] = new int [ arr . length ] ; System . arraycopy ( arr , arr . length - k , temp , 0 , k ) ; System . arraycopy ( arr , 0 , temp , k , arr . length - k ) ; pa ( temp ) ; } static void pa ( int arr [ ] ) { System . out . println ( Arrays . toString ( arr ) ) ; System . out . println ( Arrays . toString ( IntStream . range ( 0 , arr . length ) . toArray ( ) ) ) ; } private static void solve ( ) { int n = nextInt ( ) ; int arr [ ] = Arrays . stream ( nextIntArray ( n ) ) . map ( a -> a - 1 ) . toArray ( ) ; int edgeCase [ ] = new int [ n ] ;

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

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) t = [ 0 ] * 2 * ns = 0 for i in range ( n ) : d = a [ i ] - i - 1 s += abs ( d ) if d > 0 : t [ d ] += 1 p = sum ( t ) r = ( s , 0 ) for i in range ( 1 , n ) : d = a [ n - i ] - 1 s += d - p << 1 t [ d + i ] += d > 0 p += ( d > 0 ) - t [ i ] if s < r [ 0 ] : r = ( s , i ) print ( * r ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Random ; import java . util . StringTokenizer ;   public class Solution { public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int n = fs . nextInt ( ) ; long [ ] [ ] arr = new long [ n ] [ 3 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] [ 0 ] = fs . nextLong ( ) ; arr [ i ] [ 1 ] = fs . nextLong ( ) ; arr [ i ] [ 2 ] = fs . nextLong ( ) ; } ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] [ 2 ] < 0 ) continue ; list . add ( i + 1 ) ; long offcry = arr [ i ] [ 0 ] ; long corcry = 0 ; int ind = 0 ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( arr [ j ] [ 2 ] < 0 ) continue ; arr [ j ] [ 2 ] -= Math . max ( 0 , offcry - ( ind ++ ) ) + corcry ; if ( arr [ j ] [ 2 ] < 0 ) corcry += arr [ j ] [ 1 ] ; } } out . println ( list . size ( ) ) ; for ( int a : list ) out . print ( a + " ▁ " ) ; } out . close ( ) ; } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;

import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class Main { static int MOD = 1000000007 ;

import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; ArrayList < Integer > ans = new ArrayList < > ( ) ; int n = input . nextInt ( ) ; long v [ ] = new long [ n ] ; long d [ ] = new long [ n ] ; long p [ ] = new long [ n ] ; ArrayList < Integer > queue = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { v [ i ] = input . nextLong ( ) ; d [ i ] = input . nextLong ( ) ; p [ i ] = input . nextLong ( ) ; queue . add ( i ) ; }

n = int ( input ( ) ) arr , res = [ ] , [ ] for i in range ( n ) : arr . append ( [ int ( j ) for j in input ( ) . split ( ) ] ) res . append ( 0 ) for i in range ( n ) : if res [ i ] != 0 : continue res [ i ] = 1 v = arr [ i ] [ 0 ] d = 0 for j in range ( i + 1 , n ) : if res [ j ] != 0 : continue arr [ j ] [ 2 ] -= v + d if v >= 1 : v -= 1 if arr [ j ] [ 2 ] < 0 : res [ j ] = - 1 d += arr [ j ] [ 1 ] print ( res . count ( 1 ) , end = ' \n ' ) for i in range ( n ) : if res [ i ] == 1 : print ( i + 1 , end = ' ▁ ' ) NEW_LINE

ans = 0 l = [ ] t = int ( input ( ) ) for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) l . append ( [ n , m , k ] )   ans = 0 p = [ ] for i in range ( t ) :   if l [ i ] [ 2 ] >= 0 : k = 0 v = 0 for j in range ( i + 1 , t ) : if l [ j ] [ 2 ] >= 0 : l [ j ] [ 2 ] -= ( max ( 0 , l [ i ] [ 0 ] - k ) + v ) if l [ j ] [ 2 ] < 0 : v += l [ j ] [ 1 ] l [ j ] [ 1 ] = 0 k += 1 p . append ( i + 1 ) NEW_LINE

T = int ( input ( ) ) childs = [ ] for i in range ( 1 , T + 1 ) : child = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) child . insert ( 0 , i ) childs . append ( child )   c_l = [ ] check = Truewhile check : at_o = childs . pop ( 0 ) c_l . append ( at_o [ 0 ] ) for i in range ( len ( childs ) ) : childs [ i ] [ 3 ] -= at_o [ 1 ] at_o [ 1 ] -= 1 if at_o [ 1 ] <= 0 : break   if len ( childs ) <= 0 : break   i = 0 run = True while run : if childs [ i ] [ 3 ] < 0 : at_h = childs . pop ( i ) for j in range ( i , len ( childs ) ) : childs [ j ] [ 3 ] -= at_h [ 2 ] NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( " YES " ) ; for ( int i = 0 ; i < n ; i ++ ) { int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; System . out . println ( ( 12 + 2 * ( x1 % 2 ) + ( y1 % 2 ) ) % 4 + 1 ) ; } } }

# include < iostream > using namespace std ; template < class T > bool uin ( T & a , T b ) { return a > b ? ( a = b , true ) : false ; } template < class T > bool uax ( T & a , T b ) { return a < b ? ( a = b , true ) : false ; } # define forn ( i , n ) for ( int i = 0 ; i < ( int ) ( n ) ; i ++ ) # define forab ( i , a , b ) for ( int i = ( int ) ( a ) ; i < ( int ) ( b ) ; ++ i ) # define _ cin . tie ( 0 ) ; ios_base :: sync_with_stdio ( 0 ) ; # define i64 long long int main ( ) { int n ; printf ( " YES \n " ) ; scanf ( " % d " , & n ) ; for ( int i = 0 ; i < n ; i ++ ) { int x1 , y1 , x2 , y2 ; scanf ( " % d ▁ % d ▁ % d ▁ % d " , & x1 , & y1 , & x2 , & y2 ) ; printf ( " % d \n " , ( ( 12 + 2 * ( x1 % 2 ) + ( y1 % 2 ) ) % 4 ) + 1 ) ; } return 0 ; }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . io . BufferedWriter ; import java . io . Writer ; import java . io . OutputStreamWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; OutputWriter out = new OutputWriter ( outputStream ) ; DTimofeyAndRectangles solver = new DTimofeyAndRectangles ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class DTimofeyAndRectangles { public void solve ( int testNumber , InputReader in , OutputWriter out ) { int n = in . nextInt ( ) ;   rect [ ] rects = new rect [ n ] ;   out . println ( " YES " ) ; for ( int i = 0 ; i < n ; i ++ ) { int x1 = in . nextInt ( ) ; int y1 = in . nextInt ( ) ; int x2 = in . nextInt ( ) ; int y2 = in . nextInt ( ) ;   x2 += 1000000000 ; y1 += 1000000000 ;   rects [ i ] = new rect ( x1 , y1 , x2 , y2 , i ) ;   int ans = 0 ;   if ( x2 % 2 == 1 ) { ans += 1 ; }   if ( y1 % 2 == 1 ) { ans += 2 ; }   out . println ( ans + 1 ) ; }

print ( ' YES ' ) for i in range ( int ( input ( ) ) ) : x , y , a , b = [ int ( x ) for x in input ( ) . split ( ) ] print ( x % 2 + y % 2 * 2 + 1 ) NEW_LINE

def f ( ) : n = int ( input ( ) ) a = [ 1 , 2 , 3 , 4 ] print ( " YES " ) for i in range ( n ) : x = input ( ) . split ( ) x = [ int ( j ) % 2 for j in x ] print ( a [ x [ 2 ] * 2 + x [ 3 ] ] ) f ( ) NEW_LINE

print ( ' YES ' ) for i in range ( int ( input ( ) ) ) : a , b , c , d = map ( int , input ( ) . split ( ) ) print ( 1 + abs ( a ) % 2 + abs ( b ) % 2 * 2 ) NEW_LINE

import sysv = [ int ( x ) for x in sys . stdin . read ( ) . split ( ) ] print ( " YES " ) for i in range ( v [ 0 ] ) : print ( 1 + ( v [ 4 * i + 1 ] & 1 ) + 2 * ( v [ 4 * i + 2 ] & 1 ) ) NEW_LINE

import mathimport sysn = int ( input ( ) ) color = [ ] for i in range ( n ) : x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) col = 0 if abs ( x1 ) % 2 == 0 : col += 1 if abs ( y1 ) % 2 == 0 : col += 2 color . append ( str ( col + 1 ) ) print ( ' YES ' ) print ( ' \n ' . join ( color ) ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; StringBuilder ab = new StringBuilder ( ) ; ab . append ( a . charAt ( 0 ) ) ; for ( int i = 1 ; i < a . length ( ) ; i ++ ) { if ( a . charAt ( i ) < b . charAt ( 0 ) ) ab . append ( a . charAt ( i ) ) ; else break ; } ab . append ( b . charAt ( 0 ) ) ; System . out . println ( ab . toString ( ) ) ; } }

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 ) { FastScanner fs = new FastScanner ( ) ; int T = 1 ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class kjhg { public static void main ( String [ ] args ) throws IOException { BufferedReader a = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String f = a . readLine ( ) ; String d [ ] = f . split ( " ▁ " ) ; System . out . print ( d [ 0 ] . charAt ( 0 ) ) ; for ( int i = 1 ; i < d [ 0 ] . length ( ) ; i ++ ) { if ( d [ 0 ] . charAt ( i ) < d [ 1 ] . charAt ( 0 ) ) { System . out . print ( d [ 0 ] . charAt ( i ) ) ; } else { break ; }   } System . out . println ( d [ 1 ] . charAt ( 0 ) ) ; } }

import java . util . * ; import java . io . * ; public final class Codeforces { public static BufferedReader buffer = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public static BufferedWriter logger = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; public static void main ( String [ ] args ) { try { args = buffer . readLine ( ) . split ( " ▁ " ) ; String s1 = args [ 0 ] ; String s2 = args [ 1 ] ; String s = s1 . charAt ( 0 ) + " " ; int n = s1 . length ( ) ; for ( int i = 1 ; i < n ; i ++ ) { if ( s1 . charAt ( i ) < s2 . charAt ( 0 ) ) { s += s1 . charAt ( i ) ; } else { break ; } } s += s2 . charAt ( 0 ) ; logger . write ( s ) ; logger . flush ( ) ; } catch ( IOException exc ) { } } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s1 = in . next ( ) ; String s2 = in . next ( ) ; String s = " zzzzzzzz " ; for ( int i = 0 ; i < s1 . length ( ) ; i ++ ) { for ( int j = 0 ; j < s2 . length ( ) ; j ++ ) { String ss = s1 . substring ( 0 , i + 1 ) + s2 . substring ( 0 , j + 1 ) ; s = min ( ss , s ) ; } } System . out . println ( s ) ; } public static String min ( String s1 , String s2 ) { if ( s1 . compareTo ( s2 ) < 0 ) return s1 ; else return s2 ; } }

import mathfrom math import gcd , floor , sqrt , logdef iin ( ) : return int ( input ( ) ) def sin ( ) : return input ( ) . strip ( ) def listin ( ) : return list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) def liststr ( ) : return list ( map ( str , input ( ) . strip ( ) . split ( ) ) ) def ceill ( x ) : return int ( x ) if ( x == int ( x ) ) else int ( x ) + 1 def ceilldiv ( x , d ) : return x // d if ( x % d == 0 ) else x // d + 1 def LCM ( a , b ) : return ( a * b ) // gcd ( a , b )     s = liststr ( ) x = " zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz " for i in range ( len ( s [ 0 ] ) ) : for j in range ( len ( s [ 1 ] ) ) : temp = s [ 0 ] [ : i + 1 ] + s [ 1 ] [ : j + 1 ] x = min ( x , temp ) print ( x )     NEW_LINE

s = input ( ) . split ( ) s1 = s [ 0 ] [ 1 : ] print ( s [ 0 ] [ 0 ] , end = " " ) for i in s1 : if ( ord ( i ) >= ord ( s [ 1 ] [ 0 ] ) ) : print ( s [ 1 ] [ 0 ] , end = " " ) break else : print ( i , end = " " ) else : print ( s [ 1 ] [ 0 ] , end = " " ) NEW_LINE

a , b = input ( ) . split ( )   ans = " z " * 101     f = " " l = " "   for i in a : f += i l = " " for j in b : l += j ans = min ( ans , f + l )   print ( ans )   NEW_LINE

import mathfrom math import gcd , floor , sqrt , logdef iin ( ) : return int ( input ( ) ) def sin ( ) : return input ( ) . strip ( ) def listin ( ) : return list ( map ( int , input ( ) . strip ( ) . split ( ) ) ) def liststr ( ) : return list ( map ( str , input ( ) . strip ( ) . split ( ) ) ) def ceill ( x ) : return int ( x ) if ( x == int ( x ) ) else int ( x ) + 1 def ceilldiv ( x , d ) : return x // d if ( x % d == 0 ) else x // d + 1 def LCM ( a , b ) : return ( a * b ) // gcd ( a , b )     s = liststr ( ) x = [ ] for i in range ( len ( s [ 0 ] ) ) : for j in range ( len ( s [ 1 ] ) ) : temp = s [ 0 ] [ : i + 1 ] + s [ 1 ] [ : j + 1 ] x . append ( temp ) print ( min ( x ) )     NEW_LINE


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 ;

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }   FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; void run ( ) { work ( ) ; out . flush ( ) ; } long mod = 998244353 ; long gcd ( long a , long b ) { return b == 0 ? a : gcd ( b , a % b ) ; } void work ( ) { int n = in . nextInt ( ) ; long s = in . nextLong ( ) ; long [ ] [ ] A = new long [ n ] [ ] ; long c1 = 0 , c2 = 0 , sum = 0 , ret = 0 ; for ( int i = 0 ; i < n ; i ++ ) { long k = in . nextLong ( ) ; long p1 = in . nextLong ( ) ; long p2 = in . nextLong ( ) ; if ( p1 > p2 ) { c1 += k ; ret += k * p1 ; } else { c2 += k ; ret += k * p2 ; } A [ i ] = new long [ ] { k , p1 , p2 } ; sum += k ; } long r1 = c1 == 0 ? 0 : ( ( c1 - 1 ) / s + 1 ) ; long r2 = c2 == 0 ? 0 : ( ( c2 - 1 ) / s + 1 ) ; if ( r1 + r2 == ( sum - 1 ) / s + 1 ) { out . println ( ret ) ; return ; } long r = 0 ; r = Math . max ( r , find ( c1 - c1 / s * s , A , ret , 1 ) ) ;

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 ( ) ; }    int S ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ; S = in . nextInt ( ) ;   totalSlices = 0 ; p = new long [ N ] [ 3 ] ; for ( int i = 0 ; i < N ; i ++ ) { p [ i ] [ 0 ] = in . nextInt ( ) ; p [ i ] [ 1 ] = in . nextInt ( ) ; p [ i ] [ 2 ] = in . nextInt ( ) ; totalSlices += p [ i ] [ 0 ] ; }   totalPizzas = ( long ) Math . ceil ( ( double ) totalSlices / S ) ; Arrays . sort ( p , ( a , b ) -> Long . compare ( a [ 2 ] - a [ 1 ] , b [ 2 ] - b [ 1 ] ) ) ;

def solve ( ls ) :   ls . sort ( key = lambda q : q [ 1 ] - q [ 0 ] )   m = sum ( si for a , b , si in ls )   k = s * ( m // s )   n = m - k   x = y = z = 0   for a , b , si in ls :   if k >= si :   k -= si   z += si * a   elif k :   z += k * a   x = ( si - k ) * a   y = ( si - k ) * b   k = 0   else :   x += si * a   y += si * b   return x , y , z , n       n , s = map ( int , input ( ) . split ( ) )   first = [ ]   second = [ ]   for i in range ( n ) :   si , ai , bi = map ( int , input ( ) . split ( ) )   if ai > bi :   first . append ( ( ai , bi , si ) )   else :   second . append ( ( bi , ai , si ) )   x1 , y1 , z1 , n1 = solve ( first )   x2 , y2 , z2 , n2 = solve ( second )   d = x1 + x2 if n1 + n2 > s else max ( x1 + y2 , x2 + y1 )   print ( z1 + z2 + d )           NEW_LINE

from sys import stdinfrom collections import deque   n , S = [ int ( x ) for x in stdin . readline ( ) . split ( ) ]   ppl = [ ]   base = 0   tSlices = 0   for dude in range ( n ) : s , a , b = [ int ( x ) for x in stdin . readline ( ) . split ( ) ] base += s * a tSlices += s ppl . append ( [ b - a , s ] ) NEW_LINE


import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class Exam { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) throws IOException {

import java . util . Scanner ;   public class RomanBrowser { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , k = in . nextInt ( ) , i , j , a [ ] = new int [ n ] , o = 0 ;   for ( i = 0 ; i < n ; i ++ ) a [ i ] = in . nextInt ( ) ; in . close ( ) ;   for ( i = 0 ; i < k ; i ++ ) { int s = 0 ; for ( j = 0 ; j < n ; j ++ ) { if ( j % k != i ) s += a [ j ] ; } o = Math . max ( o , Math . abs ( s ) ) ; } System . out . println ( o ) ; } }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < k ; i ++ ) { int s1 = 0 ; for ( int j = 0 ; j < n ; j ++ ) if ( j % k != i ) s1 += a [ j ] ; ans = Math . max ( ans , Math . abs ( s1 ) ) ; } System . out . println ( ans ) ; } }

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for b in range ( k ) : e , s = 0 , 0 for i in range ( n ) : if i % k != b : if a [ i ] == 1 : e += 1 else : s += 1 ans = max ( ans , abs ( e - s ) ) print ( ans ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) x = list ( map ( int , input ( ) . split ( ) ) )   sumi = 0 maxi = - 10000   for i in range ( n ) : sumi += x [ i ]   for i in range ( k ) : ans = sumi for j in range ( i , n , k ) : ans -= x [ j ] maxi = max ( maxi , abs ( ans ) )     print ( maxi ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) res = 0 for i in range ( k ) : count = 0 for j in range ( n ) : if i != j % k : count += l [ j ] res = max ( res , abs ( count ) ) print ( res ) NEW_LINE

i = lambda : map ( int , input ( ) . split ( ) ) n , k = i ( ) a = * i ( ) , s = sum ( a ) print ( max ( abs ( s - sum ( a [ j : : k ] ) ) for j in range ( k ) ) ) NEW_LINE

import copyn , k = map ( int , input ( ) . split ( ) ) tabs = list ( map ( int , input ( ) . split ( ) ) ) tabs . insert ( 0 , 0 ) max_value = 0   for each_b in range ( 1 , n + 1 ) : temp = copy . deepcopy ( tabs )   i = each_b while i <= n : NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; }   FastReader in = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; void run ( ) { work ( ) ; out . flush ( ) ; } long mod = 1000000007 ; long gcd ( long a , long b ) { return a == 0 ? b : gcd ( b % a , a ) ; } void work ( ) { long n = nl ( ) , k = nl ( ) ; int offset = 65 ; long [ ] A = new long [ 130 ] ; long cnt = 0 ; for ( int i = 0 ; i < 63 ; i ++ ) { if ( ( 1L << i & n ) > 0 ) { A [ offset + i ] = 1 ; cnt ++ ; } } if ( cnt > k ) { out . println ( " No " ) ; return ; } k -= cnt ; for ( int i = 127 ; ; i -- ) { long c = A [ i ] ; if ( c > k ) { break ; } else { A [ i - 1 ] += A [ i ] * 2 ; A [ i ] = 0 ; k -= c ; } } int idx = 0 ; for ( int i = 1 ; ; i ++ ) { if ( A [ i ] > 0 ) { idx = i ; break ; } } if ( k > 0 ) { A [ idx ] -- ; } List < Integer > ret = new ArrayList < > ( ) ; for ( int i = 127 ; i >= 0 ; i -- ) { long c = A [ i ] ; for ( int j = 0 ; j < c ; j ++ ) { ret . add ( i - 65 ) ; } } if ( k > 0 ) { idx -- ; while ( k > 0 ) { ret . add ( idx - 65 ) ; k -- ; idx -- ; } ret . add ( idx + 1 - 65 ) ; } out . println ( " Yes " ) ; for ( int r : ret ) { out . print ( r + " ▁ " ) ; } }

import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { long x , y ; Student ( long x , long y ) { this . x = x ; this . y = y ; } } static int prime [ ] ; static void sieveOfEratosthenes ( int n ) {

n , k = map ( int , input ( ) . split ( ) )   s = list ( ) b = list ( ) base = 0 while n > 0 : s . append ( n % 2 ) b . append ( base ) n //= 2 base += 1 s . reverse ( ) NEW_LINE

import mathx , k = map ( int , input ( ) . split ( ) ) kori = ka = bin ( x )   NEW_LINE

from heapq import heapify , heappop , heappushn , k = map ( int , input ( ) . split ( ) ) heap1 = [ ] heap2 = [ ] MAX = int ( 1e5 ) + 10 s = [ ] heapify ( heap1 ) heapify ( heap2 ) i = 0 cnt = 0 while 1 << i <= n : if 1 << i & n : heappush ( heap1 , - i ) ; heappush ( heap2 , - i ) ; cnt += 1 i += 1 if cnt > k : print ( " NO " ) ; exit ( )   temp = cntwhile temp < k : x = - 1 * heappop ( heap1 ) - 1 heappush ( heap1 , - x ) heappush ( heap1 , - x ) temp += 1 temp = heap1 [ 0 ] * - 1   while cnt < k : if temp == heap2 [ 0 ] * - 1 : break x = heappop ( heap2 ) * - 1 - 1 heappush ( heap2 , - x ) heappush ( heap2 , - x ) cnt += 1   while heap2 : s . append ( heappop ( heap2 ) * - 1 )   while cnt < k : s [ - 1 ] = s [ - 1 ] - 1 s . append ( s [ - 1 ] ) cnt += 1 print ( " YES " ) print ( * s )               NEW_LINE


import java . util . * ; public class square { public static void main ( String ar [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; System . out . println ( n + m - 1 ) ; for ( int i = 1 ; i <= m ; i ++ ) System . out . println ( 1 + " ▁ " + i ) ; for ( int j = 2 ; j <= n ; j ++ ) System . out . println ( j + " ▁ " + 1 ) ; } }

import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ;   public class A322 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;

import java . io . * ;   import java . util . * ; public class Test {   public static void main ( String [ ] args ) throws java . lang . Exception { PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str [ ] = br . readLine ( ) . split ( " ▁ " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int k = n + m - 1 ; out . println ( k ) ; out . flush ( ) ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . StringTokenizer ;   public class CF322A { public static void main ( String [ ] args ) { FastReader input = new FastReader ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int n = input . nextInt ( ) ; int m = input . nextInt ( ) ;    int pairs = m + ( n - 1 ) ; pw . println ( pairs ) ; for ( int i = 1 ; i <= m ; i ++ ) { pw . println ( 1 + " ▁ " + i ) ; }   for ( int i = 2 ; i <= n ; i ++ ) { pw . println ( i + " ▁ " + 1 ) ; } pw . flush ( ) ; pw . close ( ) ; } 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 ; } } }

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

import sys , mathsys . setrecursionlimit ( 10 ** 8 ) ''' def ▁ fun ( ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 16 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( 4 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i & (1 < < j ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( j , end = ' ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ) import ▁ binarytreefrom ▁ collections ▁ import ▁ dequebst ▁ = ▁ binarytree . tree ( height = 4 , is _ perfect = True ) print ( bst ) def ▁ s ( bst ) : ▁ ▁ ▁ ▁ if ▁ bst : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ bst . left , bst . right ▁ = ▁ bst . right , bst . left ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . right ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . left ) s ( bst ) print ( bst ) ''' n , m = map ( int , input ( ) . split ( ) ) print ( n + m - 1 ) for i in range ( 1 , m + 1 ) : print ( 1 , i ) for i in range ( 2 , n + 1 ) : print ( i , 1 ) NEW_LINE

n , m = [ int ( x ) for x in input ( ) . split ( ) ]   a = min ( n , m ) b = abs ( n - m ) k = 2 * a - 1 + bprint ( k ) if a == 1 : print ( 1 , 1 ) i = 1 else : for i in range ( 1 , a ) : print ( i , i ) print ( i + 1 , i ) print ( i + 1 , i + 1 )   if n < m : for i in range ( a + 1 , m + 1 ) : print ( a , i ) elif n > m : for i in range ( a + 1 , n + 1 ) : print ( i , a ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) print ( n + m - 1 ) for i in range ( 1 , m + 1 ) : print ( 1 , i ) for i in range ( 2 , n + 1 ) : print ( i , m ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) print ( n + m - 1 ) for i in range ( 1 , m + 1 ) : print ( 1 , i ) for j in range ( 2 , n + 1 ) : print ( j , 1 )   NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) aa = [ ] bb = [ ] ans = [ ] lis = [ ] liss = [ ] for t in range ( 1 , a + 1 ) : aa . append ( t ) for t in range ( 1 , b + 1 ) : bb . append ( t ) for m in range ( len ( aa ) ) : mm = aa [ m ] for n in range ( len ( bb ) ) : nn = bb [ n ] if mm + nn not in ans : ans . append ( mm + nn ) lis . append ( mm ) liss . append ( nn ) print ( len ( ans ) ) for t in range ( len ( lis ) ) : v = lis [ t ] vv = liss [ t ] print ( v , vv ) 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 ( 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 ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } sort ( a ) ; int temp = a [ 0 ] ; a [ 0 ] = a [ n - 1 ] ; a [ n - 1 ] = temp ; for ( int i : a ) { System . out . print ( i + " ▁ " ) ; } System . out . println ( " " ) ; }   }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class c693a {

import java . util . * ; import java . io . * ; import java . lang . * ; public class Codeforces { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { if ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) {   } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public static void main ( String [ ] args ) { new Codeforces ( ) . solve ( ) ; } void solve ( ) { int n = nextInt ( ) ; List < Integer > arr = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) arr . add ( nextInt ( ) ) ; Collections . sort ( arr ) ; int max = arr . get ( n - 1 ) , min = arr . get ( 0 ) ; arr . remove ( 0 ) ; arr . remove ( n - 2 ) ; out . print ( max + " ▁ " ) ; for ( int i : arr ) out . print ( i + " ▁ " ) ; out . print ( min ) ; out . close ( ) ; } }

import java . lang . * ; import java . util . * ;   public class Abhishek {   public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int m = a [ n - 1 ] ; a [ n - 1 ] = a [ 0 ] ; a [ 0 ] = m ; for ( int i = 0 ; i < n ; i ++ ) { System . out . print ( a [ i ] + " ▁ " ) ; } }   }

input ( ) a = sorted ( input ( ) . split ( ) , key = int ) print ( a [ - 1 ] , * a [ 1 : - 1 ] , a [ 0 ] ) NEW_LINE

n = int ( input ( ) ) a = input ( ) . split ( ) a_array = [ ] array2 = [ ] for i in range ( n ) : a_array . append ( int ( a [ i ] ) ) a_array = sorted ( a_array ) a = a_array [ 0 ] a_array [ 0 ] = a_array [ len ( a_array ) - 1 ] a_array [ len ( a_array ) - 1 ] = afor i in range ( len ( a_array ) ) : array2 . append ( a_array [ i ] ) print ( array2 [ i ] , end = " ▁ " ) NEW_LINE

n = int ( input ( ) )   a = list ( map ( int , input ( ) . split ( ) ) )   ma = max ( a ) mi = min ( a )   a . remove ( ma ) a . remove ( mi ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = [ ] a = sorted ( a ) b = [ a [ - 1 ] ] + a [ 1 : ( n - 1 ) ] + [ a [ 0 ] ] print ( * b ) NEW_LINE


import javax . swing . plaf . IconUIResource ; import java . util . * ;

import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int stonesNum ; int gifts ; stonesNum = sc . nextInt ( ) ; gifts = ( stonesNum / 3 ) * 2 ;   if ( stonesNum % 3 > 0 ) gifts ++ ;   System . out . println ( gifts ) ;   } }

import java . util . Scanner ;   public class covidSpread2 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { solvex ( ) ; } public static void solvex ( ) { int n = sc . nextInt ( ) ; int fac = n / 3 ; int ans = 2 * fac ; if ( n % 3 != 0 ) ans ++ ; System . out . println ( ans ) ; } }

import java . util . Scanner ;   public class LittleArtem { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int remaining = n % 3 ; if ( remaining != 0 ) { System . out . println ( ( n / 3 ) * 2 + 1 ) ; } else { System . out . println ( ( n / 3 ) * 2 ) ; }   } }

n = int ( input ( ) ) print ( 2 * ( n // 3 ) if n % 3 == 0 else 2 * ( n // 3 ) + 1 ) NEW_LINE

n = int ( input ( ) ) y = ( n // 3 ) * 2 if n % 3 == 0 : print ( y ) else : print ( y + 1 ) NEW_LINE

print ( ( int ( input ( ) ) * 2 + 1 ) // 3 ) NEW_LINE

p = int ( input ( ) ) if p >= 3 : x = ( p // 3 ) * 2   if p % 3 : x += 1 else : x = 1 print ( x ) NEW_LINE

n = int ( input ( ) ) print ( n // 3 * 2 if n % 3 == 0 else n // 3 * 2 + 1 ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Random ; import java . util . StringTokenizer ;   public class Main implements Runnable {   long INF = ( long ) 1e13 + 7 ;   private void solve ( ) throws IOException { int n = nextInt ( ) ; int k = nextInt ( ) ; long p = nextLong ( ) ; long a [ ] = new long [ n ] ; long b [ ] = new long [ k ] ; for ( int i = 0 ; i < n ; ++ i ) a [ i ] = nextLong ( ) ; for ( int i = 0 ; i < k ; ++ i ) b [ i ] = nextLong ( ) ; Arrays . sort ( a ) ; Arrays . sort ( b ) ; long ans = INF ; for ( int i = 0 ; i <= k - n ; ++ i ) { long cur = 0 ; for ( int j = 0 ; j < n ; ++ j ) { cur = Math . max ( Math . abs ( a [ j ] - b [ i + j ] ) + Math . abs ( b [ i + j ] - p ) , cur ) ; } ans = Math . min ( cur , ans ) ; } pw . println ( ans ) ; }   void test ( ) throws IOException { Random rnd = new Random ( ) ; for ( int i = 0 ; i < 5 ; ++ i ) { int n = rnd . nextInt ( 10 ) + 1 ; int a [ ] = new int [ n ] ; System . err . println ( n ) ; for ( int j = 0 ; j < n ; ++ j ) { a [ j ] = rnd . nextInt ( 20 ) + 1 ; System . err . print ( a [ j ] + " ▁ " ) ; }

import java . io . * ; import java . util . * ;     public class Main { static Integer [ ] a = new Integer [ 1010 ] ; static Integer [ ] b = new Integer [ 2020 ] ; static int [ ] [ ] dp = new int [ 1010 ] [ 2020 ] ; public static void main ( String args [ ] ) { Scanner in ; PrintStream out ; in = new Scanner ( new BufferedInputStream ( System . in ) ) ; out = System . out ; try { in = new Scanner ( new FileInputStream ( " java . in " ) ) ; out = new PrintStream ( " java . out " ) ; } catch ( FileNotFoundException e ) { } int n = in . nextInt ( ) , k = in . nextInt ( ) , p = in . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = in . nextInt ( ) ; for ( int i = 1 ; i <= k ; i ++ ) b [ i ] = in . nextInt ( ) ; Arrays . sort ( a , 1 , n + 1 , new MyCom ( ) ) ; Arrays . sort ( b , 1 , k + 1 , new MyCom ( ) ) ; dp [ 0 ] [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i ; j <= k ; j ++ ) { dp [ i ] [ j ] = Math . max ( dp [ i - 1 ] [ j - 1 ] , Math . abs ( a [ i ] - b [ j ] ) + Math . abs ( b [ j ] - p ) ) ; if ( j > i ) dp [ i ] [ j ] = Math . min ( dp [ i ] [ j ] , dp [ i ] [ j - 1 ] ) ; } } out . println ( dp [ n ] [ k ] ) ; } static class MyCom implements Comparator < Integer > { public int compare ( Integer i1 , Integer i2 ) { return i1 - i2 ; } } }

import java . util . Arrays ; import java . util . Scanner ; public class R424D { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; long p = scan . nextLong ( ) ; long [ ] pos = new long [ n ] ; long [ ] key = new long [ k ] ; for ( int i = 0 ; i < n ; i ++ ) { pos [ i ] = scan . nextLong ( ) ; } for ( int i = 0 ; i < k ; i ++ ) { key [ i ] = scan . nextLong ( ) ; } Arrays . sort ( pos ) ; Arrays . sort ( key ) ; long min = Long . MAX_VALUE ; long [ ] d = new long [ n ] ; int number = k - n + 1 ; long max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { d [ i ] = Math . abs ( pos [ i ] - key [ i ] ) + Math . abs ( key [ i ] - p ) ; max = Math . max ( max , d [ i ] ) ; } min = Math . min ( min , max ) ; for ( int i = 1 ; i < number ; i ++ ) { max = 0 ; for ( int j = 0 ; j < n ; j ++ ) { d [ j ] = Math . abs ( pos [ j ] - key [ i + j ] ) + Math . abs ( key [ i + j ] - p ) ; max = Math . max ( max , d [ j ] ) ; } min = Math . min ( min , max ) ; } System . out . println ( min ) ; } }

pp = list ( map ( int , input ( ) . split ( ) ) ) inf = int ( 1e18 ) n = pp [ 0 ] k = pp [ 1 ] p = pp [ 2 ] a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) b . sort ( ) dp = [ [ inf for j in range ( 0 , 2011 ) ] for i in range ( 0 , 1011 ) ] for i in range ( 0 , k ) : dp [ 0 ] [ i ] = abs ( a [ 0 ] - b [ i ] ) + abs ( b [ i ] - p ) for i in range ( 1 , n ) : for j in range ( 0 , k ) : dp [ i ] [ j ] = min ( int ( dp [ i ] [ j ] ) , max ( abs ( a [ i ] - b [ j ] ) + abs ( b [ j ] - p ) , int ( dp [ i - 1 ] [ j - 1 ] ) ) ) ans = int ( 1e18 ) for i in range ( 0 , k ) : ans = min ( ans , int ( dp [ n - 1 ] [ i ] ) ) print ( ans ) NEW_LINE

n , k , p = map ( int , input ( ) . split ( ) ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) b = sorted ( list ( map ( int , input ( ) . split ( ) ) ) )   res = 1e15 for i in range ( k - n + 1 ) : ma = 0 for j in range ( n ) : te = abs ( a [ j ] - b [ i + j ] ) + abs ( b [ i + j ] - p ) ma = max ( ma , te ) res = min ( res , ma ) print ( res ) NEW_LINE


import java . util . Scanner ;   public class _0708DetectiveBook {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int days = 0 ; int mysteryExplainedOnPage = 0 ; for ( int page = 1 ; page <= n ; page ++ ) { int temp = sc . nextInt ( ) ; mysteryExplainedOnPage = Math . max ( temp , mysteryExplainedOnPage ) ; if ( mysteryExplainedOnPage <= page ) { days ++ ; } else { mysteryExplainedOnPage = Math . max ( mysteryExplainedOnPage , temp ) ; } } System . out . println ( days ) ; }   }

import java . util . * ; import java . io . * ; public class EdE { static long [ ] mods = { 1000000007 , 998244353 , 1000000009 } ; static long mod = mods [ 0 ] ; public static MyScanner sc ; public static PrintWriter out ; public static void main ( String [ ] omkar ) throws Exception {

import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class C { static BufferedReader br ; static PrintWriter pr ; static int cin ( ) throws Exception { return Integer . valueOf ( br . readLine ( ) ) ; } static int [ ] split ( ) throws Exception { String [ ] cmd = br . readLine ( ) . split ( " ▁ " ) ; int [ ] ans = new int [ cmd . length ] ; for ( int i = 0 ; i < cmd . length ; i ++ ) { ans [ i ] = Integer . valueOf ( cmd [ i ] ) ; } return ans ; } static long [ ] splitL ( ) throws IOException { String [ ] cmd = br . readLine ( ) . split ( " ▁ " ) ; long [ ] ans = new long [ cmd . length ] ; for ( int i = 0 ; i < cmd . length ; i ++ ) { ans [ i ] = Long . valueOf ( cmd [ i ] ) ; } return ans ; } static long p = 1000000007 ; static long power ( long x , long y ) { long res = 1 ; x = x % p ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } public static void main ( String [ ] args ) throws Exception {

import java . util . * ; public class c1 { public static void main ( String [ ] args ) { int n ; Scanner reader = new Scanner ( System . in ) ; n = reader . nextInt ( ) ; int [ ] a = new int [ n ] ; int days , max = 0 , i ; for ( i = 0 ; i < n ; ++ i ) { a [ i ] = reader . nextInt ( ) ; } for ( i = days = 0 ; i < n ; ++ i ) { if ( max < a [ i ] ) max = a [ i ] ; if ( max == i + 1 ) ++ days ; } System . out . println ( days ) ; } }

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 mx = 0 for i in range ( n ) : mx = max ( a [ i ] , mx ) if mx == i + 1 : ans += 1 print ( ans ) NEW_LINE

n , a = int ( input ( ) ) , [ * map ( int , input ( ) . split ( ) ) ] ans = 0 ; i = 0   while i < n : ans += 1 max_day = a [ i ] while ( i + 1 < max_day ) : i += 1 max_day = max ( max_day , a [ i ] ) i += 1 print ( ans ) NEW_LINE

from sys import stdinn = int ( stdin . readline ( ) ) a = list ( map ( int , stdin . readline ( ) . split ( ) ) ) a = [ i - 1 for i in a ] ans = 0 pos = 0 while pos < n : ans += 1 mx_val = pos while pos < n and pos <= mx_val : mx_val = max ( mx_val , a [ pos ] ) pos += 1   print ( ans ) NEW_LINE

import sys   n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] ans = 0 mx = 0 for i in range ( n ) : mx = max ( mx , a [ i ] ) if mx == i + 1 : ans += 1 print ( ans ) NEW_LINE

import sys , collections , math , itertools , random , bisectINF = sys . maxsizedef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_array ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def input ( ) : return sys . stdin . readline ( ) . strip ( ) mod = 1000000007   n = int ( input ( ) ) arr = get_array ( ) arr . sort ( ) cnt = 0 for i in range ( n ) : if arr [ i ] == i + 1 : cnt += 1 print ( cnt ) NEW_LINE


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] s1 = s . toCharArray ( ) ; long sum = 0 ; boolean check = false ;

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

import java . util . Scanner ;   public class _0736DivSixFour { static String toBinary ( String s , int n ) { if ( n == 0 ) { return s ; } int val = n % 2 ; s = val + s ; return toBinary ( s , n / 2 ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . indexOf ( '1' ) == - 1 ) { System . out . println ( " NO " ) ; } else { int count = 0 ; for ( int i = s . indexOf ( '1' ) + 1 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '0' ) { count ++ ; } if ( count == 6 ) break ; } if ( count == 6 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }   }

s = input ( )     if '1' not in s : print ( " no " )   else : s = s [ s . index ( '1' ) : ] print ( " yes " if s . count ( '0' ) >= 6 else " no " ) NEW_LINE

n = input ( ) if len ( n ) == n . count ( '0' ) : print ( ' NO ' ) else : while n [ 0 ] == "0" : n = n [ 1 : ] if n . count ( '0' ) >= 6 and n [ 0 ] == '1' : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

from collections import Counterc = Counter ( str ( int ( input ( ) ) ) ) if c [ '1' ] >= 1 and c [ '0' ] >= 6 : print ( " yes " ) else : print ( " no " ) NEW_LINE

s = input ( ) i = s . find ( '1' ) if i == - 1 : print ( ' no ' ) else : if s [ i + 1 : ] . count ( '0' ) < 6 : print ( ' no ' ) else : print ( ' yes ' ) NEW_LINE

b = str ( input ( ) ) c = 0 if '1' not in b : print ( ' no ' ) else : for i in range ( len ( b ) ) : if b [ i ] == '1' : idx = i break   for i in range ( idx , len ( b ) ) : if b [ i ] == '0' : c += 1   if c >= 6 : print ( ' yes ' ) else : print ( ' no ' ) NEW_LINE


import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class ExamA3 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s1 = in . next ( ) ; Set < Character > setS1 = new HashSet < > ( ) ; for ( char c : s1 . toCharArray ( ) ) { setS1 . add ( c ) ; } String s2 = in . next ( ) ;   int flag = - 1 ;

import java . util . ArrayList ; import java . util . Scanner ;   public class VJ_1011 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; int n = sc . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . next ( ) ) ; } boolean contain = false ; int index = - 1 ; if ( s2 . contains ( " * " ) ) { contain = true ; index = s2 . indexOf ( " * " ) ; } ArrayList < String > res = new ArrayList < > ( ) ; for ( String s3 : list ) { if ( contain ) { int minus = s3 . length ( ) - s2 . length ( ) + 1 ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ;   public class StringReplace { public static void main ( String [ ] args ) throws IOException {

import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ;   public class Main2020_4_02 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s1 = in . next ( ) ; Set < Character > setS1 = new HashSet < > ( ) ; for ( char c : s1 . toCharArray ( ) ) { setS1 . add ( c ) ; } String s2 = in . next ( ) ;   int flag = - 1 ;

import java . util . ArrayList ; import java . util . Random ; import java . util . Scanner ; public class PetyaAndExam { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) . trim ( ) ; ArrayList < String > ch = new ArrayList < String > ( ) ; for ( int i = 0 ; i < s . length ( ) ; ++ i ) ch . add ( s . substring ( i , i + 1 ) ) ; String p = sc . next ( ) . trim ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; ++ i ) { String t = sc . next ( ) . trim ( ) ; int jt = 0 ; int k = p . length ( ) , m = t . length ( ) ; String ans = " " ; for ( int jp = 0 ; jp < k && ans . length ( ) == 0 ; ++ jp ) { String pa = p . substring ( jp , jp + 1 ) ; String ta = jt < m ? t . substring ( jt , jt + 1 ) : " BLERGH " ; if ( pa . equals ( " ? " ) ) { if ( jt < m ) { if ( ! ch . contains ( ta ) ) ans = " NO " ; else { ++ jt ; } } else ans = " NO " ; } else if ( pa . equals ( " * " ) ) { for ( int y = 0 ; y < m - k + 1 ; ++ y ) { if ( ! ch . contains ( t . substring ( jt , jt + 1 ) ) ) ++ jt ; else { ans = " NO " ; } } } else { if ( jt < m ) { if ( ! pa . equals ( ta ) ) ans = " NO " ; else { ++ jt ; } } else ans = " NO " ; } } if ( jt == m && ans . length ( ) == 0 ) ans = " YES " ; else ans = " NO " ; System . out . println ( ans ) ; } sc . close ( ) ; } }

def do ( cur ) : if len ( cur ) < len ( pt ) - 1 : return " NO " i = j = 0 while j < len ( cur ) : if pt [ i ] == " ? " : if cur [ j ] not in good : return " NO " elif pt [ i ] == " * " : b = len ( cur ) - len ( pt ) + 1 for x in cur [ j : j + b ] : if x in good : return " NO " i += 1 j += b continue else : if pt [ i ] != cur [ j ] : return " NO " i += 1 j += 1 return " YES "   good = set ( input ( ) ) pt = input ( ) pi = True if " * " not in pt else Falsefor _ in range ( int ( input ( ) ) ) : cur = input ( ) if pi and len ( cur ) != len ( pt ) : print ( " NO " ) else : print ( do ( cur ) ) NEW_LINE

s1 = input ( ) s2 = input ( ) n = int ( input ( ) )   good_words = set ( s1 ) s3_list = [ ] for _ in range ( n ) : s3 = input ( ) s3_list . append ( s3 )   for s3 in s3_list : flag = 1 if " * " not in s2 : if len ( s2 ) != len ( s3 ) : flag = 0 else : for index , value in enumerate ( s2 ) : if value == " ? " : if s3 [ index ] not in good_words : flag = 0 break else : if s3 [ index ] != s2 [ index ] : flag = 0 break else : if len ( s3 ) < len ( s2 ) - 1 : flag = 0 else : idx = s2 . index ( " * " ) s2_1 = s2 [ : idx ] s2_2 = s2 [ idx + 1 : ] NEW_LINE

hor = input ( ) mask = input ( ) lenmask = len ( mask ) for i in range ( int ( input ( ) ) ) : a = input ( ) lena = len ( a ) f = True if lena < lenmask - 1 and ' * ' in mask : print ( ' NO ' ) continue elif lena < lenmask and ' * ' not in mask : print ( ' NO ' ) continue elif lena > lenmask and ' * ' not in mask : print ( ' NO ' ) continue for j in range ( lenmask ) : if mask [ j ] == ' ? ' : if a [ j ] not in hor : f = False break elif mask [ j ] == ' * ' : if lenmask - 1 == lena : a = a [ : j ] + ' j ' + a [ j : ] else : srez = a [ j : j + lena - lenmask + 1 ] for el in srez : if el in hor : f = False break if not f : break a = a [ : j ] + a [ j + lena - lenmask : ] else : if a [ j ] != mask [ j ] : f = False break if f : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE


import java . math . * ; import java . util . * ; import java . io . * ;   public class Main {   void solve ( ) throws IOException { int a , b , c , n , res ; a = nextInt ( ) ; b = nextInt ( ) ; c = nextInt ( ) ; n = nextInt ( ) ;   res = n - ( a + b - c ) ; if ( res > 0 && a >= c && b >= c && res <= n ) { res = res ; } else { res = - 1 ; }   System . out . println ( res ) ; }   BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter writer ;   void run ( ) throws IOException { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; }   public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; }   BufferedReader in ; StringTokenizer str ; PrintWriter out ;   String next ( ) throws IOException { while ( ( str == null ) || ( ! str . hasMoreTokens ( ) ) ) { str = new StringTokenizer ( in . readLine ( ) ) ; } return str . nextToken ( ) ; }   int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   }

import java . util . Scanner ;   public class vasya { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ;   if ( a < c || b < c ) { System . out . println ( " - 1" ) ; } else {   int students = ( a - c ) + ( b - c ) + c ; int failed_students = n - students ; if ( failed_students <= 0 ) { System . out . println ( " - 1" ) ; } else { System . out . println ( failed_students ) ; } } } }

A , B , C , N = map ( int , input ( ) . strip ( ) . split ( ) )   flag = Trueif C > A or C > B : flag = FalseD = N - ( A - C ) - Bif D >= 1 and flag : print ( D ) else : print ( - 1 ) NEW_LINE

a , b , c , n = map ( int , input ( ) . split ( ) ) s = a + b - cif s >= n or a < c or b < c : print ( - 1 ) else : print ( n - s ) NEW_LINE

A , B , C , N = map ( int , input ( ) . split ( ) ) A -= CB -= CS = A + B + Cif S < N and A + C >= C and B + C >= C : print ( N - S ) else : print ( - 1 ) NEW_LINE

A , B , C , N = map ( int , input ( ) . split ( ) ) ans = N - ( A + B - C ) if A < C or B < C or A > N or B > N or C > N or ans < 1 : print ( - 1 ) else : print ( ans ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BLuckyCommonSubsequence solver = new BLuckyCommonSubsequence ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BLuckyCommonSubsequence { int [ ] pi ; char [ ] first ; char [ ] second ; char [ ] virus ; StringBuilder sb ; int [ ] [ ] [ ] memo ;   void prefixFunction ( char [ ] s ) { int n = s . length ; pi = new int [ n ] ; for ( int i = 1 , j = 0 ; i < n ; ++ i )

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 ( ) ; }

A = input ( ) B = input ( ) virus = input ( )   NEW_LINE

s = input ( ) t = input ( ) u = input ( )   memos = { } def solve ( a , b , c ) : if c == len ( u ) : return 0 if a == len ( s ) or b == len ( t ) : return ' ' if ( a , b , c ) in memos : return memos [ ( a , b , c ) ]   me = s [ a ]   r = solve ( a + 1 , b , c ) try : idx = t [ b : ] . index ( me )   curr = u [ : c ] + me for i in range ( c + 2 ) : if curr [ i : ] == u [ : ( c + 1 - i ) ] : tr = solve ( a + 1 , b + idx + 1 , c + 1 - i ) if tr == 0 : r2 = 0 else : r2 = me + tr break   if r2 == 0 or len ( r ) > len ( r2 ) : k = r else : k = r2 except ValueError : k = r   memos [ ( a , b , c ) ] = k return k   NEW_LINE

a , b , v = input ( ) , input ( ) , input ( )   h = [ [ - 1 ] * len ( b ) for i in range ( len ( a ) ) ]   def f ( ab ) : return ab . count ( v )     def g ( i , j ) : if i < 0 or j < 0 : return " " if h [ i ] [ j ] == - 1 : s = g ( i - 1 , j - 1 ) if ( a [ i ] == b [ j ] ) : s += a [ i ] s1 = g ( i - 1 , j ) s2 = g ( i , j - 1 ) if ( len ( s1 ) - f ( s1 ) > len ( s ) - f ( s ) ) : s = s1 if ( len ( s2 ) - f ( s2 ) > len ( s ) - f ( s ) ) : s = s2 h [ i ] [ j ] = s ; return h [ i ] [ j ]   ss = g ( len ( a ) - 1 , len ( b ) - 1 ) while v in ss : ss1 = ss . replace ( v , v [ : - 1 ] ) ss2 = ss . replace ( v , v [ 1 : ] ) if ( f ( ss1 ) < f ( ss2 ) ) : ss = ss1 else : ss = ss2if len ( ss ) > 0 : print ( ss ) else : print ( 0 ) NEW_LINE

s1 , s2 , virus = [ input ( ) . strip ( ) for _ in range ( 3 ) ]   n , m , v = len ( s1 ) , len ( s2 ) , len ( virus )   NEW_LINE


import java . util . Scanner ;   public class SpiralDown { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ; int turn = 0 ;   if ( ( x == 0 || x == 1 ) & y == 0 ) { System . out . println ( 0 ) ; return ; }   if ( y > 0 ) { if ( x >= y ) turn = 4 * x - 3 ; else if ( x + y >= 0 ) turn = 4 * y - 2 ; else turn = - 4 * x - 1 ; } else { if ( x <= y ) turn = - 4 * x - 1 ; else if ( x + 2 * y <= 0 ) turn = - 4 * y ; else turn = 4 * x - 3 ; }   System . out . println ( turn ) ; } }

import java . util . Scanner ;   public class PointOnSpiral { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ;   int result = 0 ; if ( x > 0 && y >= 2 - x && y <= x ) { result = ( 4 * x ) - 3 ; } else if ( y > 0 && x >= - y && x <= y - 1 ) { result = ( 4 * y ) - 2 ; } else if ( x < 0 && y >= x && y <= - 1 - x ) { result = ( 4 * ( - x ) ) - 1 ; } else if ( y <= 0 && x >= 1 + y && x <= - y + 1 ) { result = 4 * ( - y ) ; } else { result = 0 ; }   System . out . println ( result ) ; } }

import java . util . Scanner ;   public class TestBetter { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int x , y ;   x = input . nextInt ( ) ; y = input . nextInt ( ) ;   int box = Math . max ( Math . abs ( x ) , Math . abs ( y ) ) ; int res = ( box - 1 ) * 4 ; if ( y == 0 && ( x == 0 || x == 1 ) ) { res = 0 ; System . out . println ( res ) ; return ; } if ( x == box && y == - ( box - 1 ) ) { System . out . println ( res ) ; return ; } res ++ ; if ( x == box && y > - box ) { System . out . println ( res ) ; return ; } res ++ ; if ( y == box ) { System . out . println ( res ) ; return ; } res ++ ; if ( x == - box ) { System . out . println ( res ) ; return ; } res ++ ;   System . out . println ( res ) ; } }

import java . util . Scanner ;   public class Game { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int x = input . nextInt ( ) , y = input . nextInt ( ) , s = 0 ; if ( y > x && x >= - y ) s = - 2 + y * 4 ; if ( y < x && x <= - y + 1 ) s = - y * 4 ; if ( y <= x && x > - y + 1 ) s = - 3 + x * 4 ; if ( y >= x && x < - y ) s = - 1 - 4 * x ; System . out . println ( s ) ;   } }

a , b = map ( int , input ( ) . split ( ) ) count = 0 q , e = 0 , 0 i = 1 flag = 0 while ( q != a or e != b ) : for j in range ( i ) : q += 1 if ( q == a and e == b ) : flag = 1 break if ( flag ) : break count += 1 for j in range ( i ) : e += 1 if ( q == a and e == b ) : flag = 1 break i += 1 if ( flag ) : break count += 1 for j in range ( i ) : q -= 1 if ( q == a and e == b ) : flag = 1 break if ( flag ) : break count += 1 for j in range ( i ) : e -= 1 if ( q == a and e == b ) : flag = 1 break if ( flag ) : break i += 1 count += 1 print ( count ) NEW_LINE

x , y = tuple ( map ( int , input ( ) . split ( ) ) ) if ( x == 0 and y == 0 ) : print ( 0 ) elif ( x >= 0 and y >= - x + 1 and y < x ) : if ( y == - x + 1 ) : print ( 4 * ( x - 1 ) ) else : print ( 4 * ( x - 1 ) + 1 ) elif ( y > 0 and ( x == 0 or ( x <= abs ( y ) and x > - abs ( y ) ) ) ) : if ( y == x ) : print ( 4 * ( abs ( y ) - 1 ) + 1 ) else : print ( 4 * ( abs ( y ) - 1 ) + 2 ) elif ( x <= 0 and y <= - x and y > x ) : if ( y == - x ) : NEW_LINE

l = input ( ) . split ( ' ▁ ' ) x , y = int ( l [ 0 ] ) , int ( l [ 1 ] ) if y <= 0 and x >= 1 + y and x <= 1 - y : print ( ( - y ) * 4 ) elif x > 0 and y >= 2 - x and y <= x : print ( x * 4 - 3 ) elif y > 0 and x >= - y and x <= y - 1 : print ( y * 4 - 2 ) elif x < 0 and y >= x and y <= - 1 - x : print ( ( - x ) * 4 - 1 ) else : print ( 0 ) NEW_LINE


import java . util . * ; import java . math . * ; import java . lang . * ; import javafx . util . Pair ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; Map < Pair , Integer > map = new LinkedHashMap < > ( ) ; int sv = 0 , sp = 0 , ev = 0 , ep = 0 ; if ( a > b ) { sv = a ; ev = x ; sp = b ; ep = y ; } else { sv = b + 1 ; ev = x ; sp = b ; ep = y ; } int count = 0 ; for ( int i = sv ; i <= ev ; i ++ ) { for ( int j = sp ; j <= ep ; j ++ ) { if ( j >= i ) break ; Pair p = new Pair ( i , j ) ; map . put ( p , count ++ ) ; } } System . out . println ( count ) ; map . forEach ( ( k , v ) -> System . out . println ( k . getKey ( ) + " ▁ " + k . getValue ( ) ) ) ; } }

import java . awt . Point ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . Hashtable ; import java . util . LinkedList ; import java . util . Queue ; import java . util . Stack ; import java . util . StringTokenizer ;    public class N700 { static PrintWriter out ; static Scanner sc ; static ArrayList < Integer > q , w ; static ArrayList < Integer > adj [ ] ; static HashSet < Integer > primesH ; static boolean prime [ ] ;

import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int x , y , a , b ; x = input . nextInt ( ) ; y = input . nextInt ( ) ; a = input . nextInt ( ) ; b = input . nextInt ( ) ; if ( x <= b ) { System . out . println ( 0 ) ; return ; } StringBuilder ans = new StringBuilder ( ) ; int count = 0 ; for ( int i = a ; i <= x ; i ++ ) { int j = b ; while ( i > j && y >= j ) { count ++ ; ans . append ( i + " ▁ " + j + " \n " ) ; j ++ ; } } System . out . println ( count ) ; System . out . println ( ans ) ; }   }

x , y , a , b = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] for i in range ( b , y + 1 ) : for j in range ( a , x + 1 ) : if i < j : ans . append ( [ j , i ] ) print ( len ( ans ) ) ans . sort ( ) for i in ans : print ( * i )   NEW_LINE

def headTails ( x , y , a , b ) : p_a = list ( range ( a , x + 1 ) ) p_b = list ( range ( b , min ( x + 1 , y + 1 ) ) ) arr = [ ] i = 0 j = 0 while i < len ( p_a ) and j < len ( p_b ) : if p_a [ i ] > p_b [ j ] : arr . append ( ( p_a [ i ] , p_b [ j ] ) ) if i < len ( p_a ) : for k in range ( i + 1 , len ( p_a ) ) : arr . append ( ( p_a [ k ] , p_b [ j ] ) ) j += 1 else : i += 1 arr . sort ( key = lambda x : x [ 0 ] ) print ( len ( arr ) ) for i in arr : print ( * i )   x , y , a , b = list ( map ( int , input ( ) . split ( ) ) ) headTails ( x , y , a , b ) NEW_LINE

x , y , a , b = map ( int , input ( ) . split ( ) ) vas , pet = a , bans = [ ] while vas <= x : pet = b while pet < vas and pet <= y : ans . append ( [ vas , pet ] ) pet += 1 vas += 1 print ( len ( ans ) ) for i in range ( len ( ans ) ) : print ( * ans [ i ] ) NEW_LINE

x , y , a , b = map ( int , input ( ) . split ( ) ) if ( a < b and ( x - a ) <= ( b - a ) ) or ( a == b and x < y ) : print ( 0 ) else : c = 0 for i in range ( a , x + 1 ) : for j in range ( b , y + 1 ) : if ( i > j ) : c = c + 1 print ( c ) for i in range ( a , x + 1 ) : for j in range ( b , y + 1 ) : if ( i > j ) : print ( i , j ) NEW_LINE

x , y , a , b = map ( int , input ( ) . split ( ) ) c = 0 xx = [ ] for i in range ( a , x + 1 ) : for j in range ( b , y + 1 ) : if ( i > j ) : c += 1 xx . append ( [ i , j ] ) print ( c ) for i in range ( c ) : print ( xx [ i ] [ 0 ] , xx [ i ] [ 1 ] )     NEW_LINE