import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Comparator ; import java . util . StringTokenizer ;   public class Lala_Land { 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 ( ) ) ) ; } }   public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; int n = in . nextInt ( ) ; Apple a [ ] = new Apple [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int pos = in . nextInt ( ) ; int app = in . nextInt ( ) ; a [ i ] = new Apple ( pos , app ) ; } Arrays . sort ( a , new Sort ( ) ) ; int mid = - 1 ; int neg = 0 ; int pos = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] . pos < 0 ) { neg ++ ; } else { if ( mid == - 1 ) mid = i ; pos ++ ; } sum += a [ i ] . tot ; } int min = Math . min ( neg , pos ) ; if ( pos != neg ) { sum = 0 ;

import java . util . Scanner ;   public class LalaLandAppleTrees { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , i , a [ ] = new int [ n ] , b [ ] = new int [ n ] , c = 0 , l = 0 ; long s = 0 ;   for ( i = 0 ; i < n ; i ++ ) { a [ i ] = in . nextInt ( ) ; b [ i ] = in . nextInt ( ) ; s += b [ i ] ; } in . close ( ) ;   while ( c < s ) { int x = Integer . MAX_VALUE , y = Integer . MIN_VALUE , xi = 0 , yi = 0 , xn = 0 , yn = 0 ; for ( i = 0 ; i < n ; i ++ ) {   if ( a [ i ] > 0 ) { if ( a [ i ] < x ) { x = a [ i ] ; xi = i ; } xn ++ ; } else if ( a [ i ] < 0 ) { if ( a [ i ] > y ) { y = a [ i ] ; yi = i ; } yn ++ ; } } if ( xn == 0 && yn == 0 ) break ; if ( l == 0 && xn >= yn || l < 0 && xn > 0 ) { c += b [ xi ] ; l = x ; a [ xi ] = 0 ;   } else if ( l == 0 && xn < yn || l > 0 && yn > 0 ) { c += b [ yi ] ; l = y ; a [ yi ] = 0 ; } else { break ; } } System . out . println ( c ) ; } }

t = [ ] w = [ ]     n = int ( input ( ) )   p = 0 for i in range ( n ) : v = list ( map ( int , input ( ) . split ( ) ) )   if v [ 0 ] == 0 : p += v [ 1 ] elif v [ 0 ] < 0 : w . append ( v ) else : t . append ( v )   t . sort ( ) w . sort ( ) t = t [ : : - 1 ]   if len ( w ) > len ( t ) : o = 1 else : o = 0 while True : if o == 0 : if len ( t ) > 0 : p += t [ - 1 ] [ 1 ] t . pop ( ) o = 1 else : break elif o == 1 : if len ( w ) > 0 : p += w [ - 1 ] [ 1 ] w . pop ( ) o = 0 else : break   print ( p )       NEW_LINE

n = int ( input ( ) ) pos = [ ] neg = [ ] for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) if x < 0 : neg . append ( [ x , y ] ) else : pos . append ( [ x , y ] ) pos . sort ( ) neg . sort ( reverse = True ) l1 = len ( pos ) l2 = len ( neg ) m = min ( l1 , l2 ) tot = 0 for i in range ( m ) : tot += neg [ i ] [ 1 ] + pos [ i ] [ 1 ] if l1 > l2 : tot += pos [ m ] [ 1 ] elif l2 > l1 : tot += neg [ m ] [ 1 ] else : passprint ( tot ) NEW_LINE

def solve ( num , neg , pos , nseq , pseq ) : app = 0 if neg == pos : for x , y in nseq : app += y for x , y in pseq : app += y elif neg > pos : times = pos index = 0 while index < pos : app += pseq [ index ] [ 1 ] index += 1 index = 0 while index < pos + 1 : app += nseq [ index ] [ 1 ] index += 1 else : times = neg index = 0 while index < neg : app += nseq [ index ] [ 1 ] index += 1 index = 0 while index < neg + 1 : app += pseq [ index ] [ 1 ] index += 1 return app num = int ( input ( ) ) p = 0 n = 0 pseq = [ ] nseq = [ ] for x in range ( num ) : i , j = list ( map ( int , input ( ) . split ( ) ) ) if i < 0 : n += 1 nseq . append ( [ i , j ] ) else : p += 1 pseq . append ( [ i , j ] ) pseq . sort ( key = lambda i : i [ 0 ] ) nseq . sort ( key = lambda i : i [ 0 ] , reverse = True )   print ( solve ( num , n , p , nseq , pseq ) ) NEW_LINE

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 ) ''' t = int ( input ( ) ) pos = [ None ] * ( pow ( 10 , 5 ) + 1 ) neg = [ None ] * ( pow ( 10 , 5 ) + 1 ) pp , nn = 0 , 0 for _ in range ( t ) : x , a = map ( int , input ( ) . split ( ) ) if x < 0 : neg [ abs ( x ) ] = a nn += 1 else : pos [ x ] = a pp += 1 if nn < pp : pp = nn + 1 i = 0 s1 , s2 = 0 , 0 while nn != 0 : if neg [ i ] != None : s1 += neg [ i ] nn -= 1 i += 1 i = 0 while pp != 0 : if pos [ i ] != None : s2 += pos [ i ] pp -= 1 i += 1 print ( s1 + s2 ) elif nn > pp : nn = pp + 1 i = 0 s1 , s2 = 0 , 0 while nn != 0 : if neg [ i ] != None : s1 += neg [ i ] nn -= 1 i += 1 i = 0 while pp != 0 : if pos [ i ] != None : s2 += pos [ i ] pp -= 1 i += 1 print ( s1 + s2 ) else : nn = pp i = 0 s1 , s2 = 0 , 0 while nn != 0 : if neg [ i ] != None : s1 += neg [ i ] nn -= 1 i += 1 i = 0 while pp != 0 : if pos [ i ] != None : s2 += pos [ i ] pp -= 1 i += 1 print ( s1 + s2 )   NEW_LINE


import static java . lang . Math . abs ; import static java . lang . System . out ; import java . util . Scanner ;

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

n , c1 , c2 = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] s = input ( )   cnt = s . count ( '1' )   def price ( x ) : return c1 + c2 * ( x - 1 ) ** 2   prices = [ ]   for i in range ( 1 , cnt + 1 ) : bigGroupsPeople = n // i + 1 numBigGroups = n % i smallGroupsPeople = n // i numSmallGroups = i - n % i totalPrice = numBigGroups * price ( bigGroupsPeople ) + numSmallGroups * price ( smallGroupsPeople ) prices . append ( totalPrice )   print ( min ( prices ) ) NEW_LINE

t = input ( )   t = t . split ( )   n = int ( t [ 0 ] )   c1 = int ( t [ 1 ] )   c2 = int ( t [ 2 ] )   t = input ( )   d = 0   for i in t :   if ( i == "1" ) :   d = d + 1       min = 10 ** 1488   for i in range ( 1 , d + 1 ) :   t = c1 * i + i * c2 * ( ( ( n // i ) - 1 ) ** 2 ) + c2 * ( n % i ) * ( 2 * ( n // i ) - 1 )   if t < min :   min = t       print ( min )       NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tc = sc . nextInt ( ) ; while ( tc -- > 0 ) { long n = sc . nextLong ( ) ; while ( n % 2 == 0 ) { n /= 2 ; } if ( n == 1 ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } sc . close ( ) ; } }

import java . io . * ; import java . util . * ; import java . math . * ; import java . awt . Point ; public class Main { static final long MOD = 1000000007L ;

import java . io . * ; import java . util . * ;   public class OddDivisor {

import java . io . * ; import java . util . * ;   public class A { public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int t = fr . nextInt ( ) ;   while ( t -- > 0 ) { long n = fr . nextLong ( ) ; while ( ( n & 1 ) != 1 ) n >>= 1 ;   if ( n == 1 ) { pr . println ( " NO " ) ; } else { pr . println ( " YES " ) ; } }   pr . close ( ) ; }   static class Pair { int x , y ;   public Pair ( int x , int y ) { this . x = x ; this . y = y ; } }   static int toInt ( String s ) { return Integer . parseInt ( s ) ; }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) throws FileNotFoundException { 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 Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; long n ; for ( int i = 0 ; i < t ; i ++ ) { n = sc . nextLong ( ) ; if ( ( n & n - 1 ) == 0 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } }

import math   NEW_LINE def solve ( ) : n = int ( input ( ) ) NEW_LINE if bin ( n ) [ 2 : ] . count ( '1' ) == 1 : NEW_LINE INDENT return False else : NEW_LINE return True   for t in range ( int ( input ( ) ) ) : if NEW_LINE DEDENT solve ( ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

def solve ( n ) : if NEW_LINE INDENT ( n <= 2 ) : NEW_LINE DEDENT return " NO " elif ( n & ( n - 1 ) == 0 ) : NEW_LINE return " NO " else : return " YES " NEW_LINE for i in range ( int ( input ( ) ) ) : print ( solve ( int ( input ( ) ) ) ) NEW_LINE

for _ in ' . ' * int ( input ( ) ) : n = int ( input ( ) ) ; print ( " YNEOS " [ n & - n == n : : 2 ] ) NEW_LINE

t = input ( ) NEW_LINE t = int ( t ) NEW_LINE while t > 0 : n = input ( ) NEW_LINE n = int ( n ) NEW_LINE if ( n & ( n - 1 ) == 0 ) : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE print ( " YES " ) NEW_LINE DEDENT t -= 1   NEW_LINE

for _ in range ( int ( input ( ) ) ) :     NEW_LINE n = bin ( int ( input ( ) ) ) [ 1 : ]   if n != "1" and n . count ( "1" ) == 1 : NEW_LINE INDENT print ( ' NO ' ) else : NEW_LINE print ( ' YES ' ) NEW_LINE DEDENT


import java . util . * ; public class Codeforces { private static void sport ( int [ ] a , int h ) { boolean f = true ; for ( int i = 1 ; i < a . length ; i ++ ) { if ( a [ i - 1 ] > 1 && a [ i ] > 1 ) { f = false ; break ; } } if ( f ) { System . out . println ( " perfect " ) ; return ; } System . out . println ( " ambiguous " ) ; System . out . print ( "0 ▁ " ) ; LinkedList < Integer > queue = new LinkedList < > ( ) ; queue . add ( 1 ) ; for ( int i = 1 ; i < a . length ; i ++ ) { LinkedList < Integer > q = new LinkedList < > ( ) ; Integer poll = queue . removeLast ( ) ; for ( int j = 0 ; j < a [ i ] ; j ++ ) { System . out . print ( poll + " ▁ " ) ; q . addLast ( poll + j + 1 ) ; } queue . clear ( ) ; queue . addAll ( q ) ; } System . out . println ( ) ;

n = int ( input ( ) ) n += 1 l = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 for i in range ( n - 1 ) : if ( l [ i ] > 1 and l [ i + 1 ] > 1 ) : ans = i + 1 breakelse : print ( " perfect " ) exit ( 0 ) print ( " ambiguous " ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : print ( prev , end = " ▁ " ) now += 1 prev = nowprint ( ) prev = 0 now = 0 for i in range ( n ) : for j in range ( l [ i ] ) : if ( ans == i ) : print ( prev - 1 , end = " ▁ " ) ans = - 1 else : print ( prev , end = " ▁ " ) now += 1 prev = now NEW_LINE

I = lambda : list ( map ( int , input ( ) . split ( ) ) ) n , = I ( ) l = I ( ) ans = " perfect " f = 0 temp = - 1 node = 1 for i in range ( n ) : if min ( l [ i ] , l [ i + 1 ] ) > 1 : ans = " ambiguous " temp = i + 1 f = 1 breakif not f : print ( ans ) else : a = '0' b = '0' for i in range ( 1 , n + 1 ) : a += ( " ▁ " + str ( node ) ) * l [ i ] if i != temp : b += ( " ▁ " + str ( node ) ) * l [ i ] else : b += ( " ▁ " + str ( node - 1 ) ) + ( ( " ▁ " + str ( node ) ) * ( l [ i ] - 1 ) ) node += l [ i ] print ( ans ) print ( a ) print ( b )       NEW_LINE


import java . io . * ; import java . util . * ; import java . text . DecimalFormat ;   public class Main { static long mod = ( long ) 1e9 + 7 ; static long mod1 = 998244353 ;   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ;    int t = in . nextInt ( ) ; while ( t -- > 0 ) {   int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int k = in . nextInt ( ) ; int z = n / k ; if ( z >= m ) out . println ( m ) ; else { int rem = m - z ; int i = 1 ; while ( i * ( k - 1 ) < rem ) { i ++ ; } if ( i < z ) out . println ( z - i ) ; else out . println ( 0 ) ; }   } out . close ( ) ; }      static final Random random = new Random ( ) ;   static void ruffleSort ( int [ ] a ) { int n = a . length ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int t = fs . nextInt ( ) ; while ( t -- > 0 ) { int n = fs . nextInt ( ) ; int m = fs . nextInt ( ) ; int k = fs . nextInt ( ) ; int ans = 0 ; int r = n / k ; if ( r >= m ) { ans = m ; } else if ( k > 1 ) ans = r - ( int ) ( Math . ceil ( ( float ) ( m - r ) / ( k - 1 ) ) ) ; System . out . println ( ans ) ; } } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

import java . util . Scanner ;   public class _0607BerlandPoker { static int BerlandPoker ( int n , int m , int k ) { int single = n / k ; int jokers = Math . min ( single , m ) ; int remainingJokers = m - jokers ; int ans = 0 ; if ( remainingJokers < ( k - 1 ) ) { if ( remainingJokers != 0 ) { ans += 1 ; } } else { ans += remainingJokers / ( k - 1 ) ; if ( remainingJokers % ( k - 1 ) != 0 ) { ans ++ ; } } return jokers - ans ; }   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( BerlandPoker ( n , m , k ) ) ; cases -- ; } }   }

import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static int ceil ( int x , int y ) { return ( x + y - 1 ) / y ; }   public static void solve ( int n , int m , int k ) {   if ( m == 0 ) { System . out . println ( 0 ) ; } else if ( m < ( n / k ) ) { System . out . println ( m ) ; } else { int val = m - ( n / k ) ; m -= ( n / k ) ; int left = ceil ( m , ( k - 1 ) ) ; System . out . println ( ( n / k ) - left ) ; } }   public static void main ( String [ ] args ) {   int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int k = scan . nextInt ( ) ;   solve ( n , m , k ) ; } } }

import matht = int ( input ( ) ) for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) if m == 0 : print ( 0 ) elif n // k >= m : print ( m ) else : if ( m - n // k ) % ( k - 1 ) == 0 : print ( ( n // k ) - ( ( m - n // k ) // ( k - 1 ) ) ) else : print ( ( n // k ) - ( ( ( m - n // k ) - ( m - n // k ) % ( k - 1 ) ) // ( k - 1 ) + 1 ) ) NEW_LINE

t = int ( input ( ) )   def poker ( n , m , k ) : hands = n // k winning_hand = min ( hands , m ) m -= winning_hand sub = 0 if m // ( k - 1 ) > 0 : sub += m // ( k - 1 ) if m % ( k - 1 ) > 0 : sub += 1 elif m % ( k - 1 ) > 0 : sub += 1   print ( winning_hand - sub )         for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) poker ( n , m , k )                     NEW_LINE

for i in range ( int ( input ( ) ) ) : a , b , c = list ( map ( int , input ( ) . split ( ) ) ) print ( ( a // c ) + ( - ( b - ( a // c ) ) // ( c - 1 ) ) if a // c < b else b ) NEW_LINE

t = int ( input ( ) )   for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) d = n // k a1 = min ( m , d ) a2 = ( m - a1 + k - 2 ) // ( k - 1 ) print ( a1 - a2 ) NEW_LINE

t = int ( input ( ) )   for i in range ( t ) : n , m , k = map ( int , input ( ) . split ( ) ) ans = 0 d = n // k for a1 in range ( m + 1 ) : for a2 in range ( a1 + 1 ) : if ( a1 > d ) : continue if ( a1 + a2 > m ) : continue if ( a1 + ( k - 1 ) * a2 < m ) : continue ans = max ( ans , a1 - a2 ) print ( ans ) NEW_LINE


import java . util . * ; public class AntonPoly { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int out = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String str = s . next ( ) ; if ( str . equals ( " Tetrahedron " ) ) { out = out + 4 ; } else if ( str . equals ( " Cube " ) ) { out = out + 6 ; } else if ( str . equals ( " Octahedron " ) ) { out = out + 8 ; } else if ( str . equals ( " Dodecahedron " ) ) { out = out + 12 ; } else if ( str . equals ( " Icosahedron " ) ) { out = out + 20 ; } } System . out . println ( out ) ; } }

import java . util . * ; public class Anton { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; if ( s . contains ( " Tetrahedron " ) ) sum = sum + 4 ; else if ( s . contains ( " Cube " ) ) sum = sum + 6 ; else if ( s . contains ( " Octahedron " ) ) sum = sum + 8 ; else if ( s . contains ( " Dodecahedron " ) ) sum = sum + 12 ; else if ( s . contains ( " Icosahedron " ) ) sum = sum + 20 ; } System . out . println ( sum ) ; } }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashMap < String , Integer > hm = new HashMap < String , Integer > ( ) ; hm . put ( " Tetrahedron " , 4 ) ; hm . put ( " Cube " , 6 ) ; hm . put ( " Octahedron " , 8 ) ; hm . put ( " Dodecahedron " , 12 ) ; hm . put ( " Icosahedron " , 20 ) ; String str ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { str = sc . next ( ) ; sum = sum + hm . get ( str ) ; } System . out . println ( sum ) ;   } }

import java . util . Scanner ;   public class AntonAndPoly { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; scanner . nextLine ( ) ;   int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String poly = scanner . nextLine ( ) . trim ( ) ; switch ( poly ) { case " Tetrahedron " : res += 4 ; break ; case " Cube " : res += 6 ; break ; case " Octahedron " : res += 8 ; break ; case " Dodecahedron " : res += 12 ; break ; case " Icosahedron " : res += 20 ; break ; } } System . out . println ( res ) ; } }

n = int ( input ( ) )   mapping = { " Icosahedron " : 20 , " Dodecahedron " : 12 , " Cube " : 6 , " Octahedron " : 8 , " Tetrahedron " : 4 , }   sum = 0 for i in range ( n ) : string = input ( ) sum += mapping [ string ]   print ( sum ) NEW_LINE

num_of_hed = int ( input ( ) ) faces = 0   for i in range ( 0 , num_of_hed ) : str1 = input ( ) if str1 [ 0 ] == " T " : faces += 4 elif str1 [ 0 ] == " C " : faces += 6 elif str1 [ 0 ] == " O " : faces += 8 elif str1 [ 0 ] == " D " : faces += 12 else : faces += 20   print ( faces ) NEW_LINE

n = int ( input ( ) ) c = 0 for i in range ( n ) : s = input ( ) if s [ 0 ] == ' T ' : c += 4 elif s [ 0 ] == ' C ' : c += 6 elif s [ 0 ] == ' O ' : c += 8 elif s [ 0 ] == ' D ' : c += 12 elif s [ 0 ] == ' I ' : c += 20 print ( c ) NEW_LINE

n = int ( input ( ) ) c = 0 for i in range ( n ) : s = input ( ) if ( s == " Tetrahedron " ) : c += 4 if ( s == " Cube " ) : c += 6 if ( s == " Octahedron " ) : c += 8 if ( s == " Dodecahedron " ) : c += 12 if ( s == " Icosahedron " ) : c += 20 print ( c ) NEW_LINE

a = int ( input ( ) ) x = 0 for i in range ( a ) : b = input ( ) if b == " Tetrahedron " : x += 4 elif b == " Cube " : x += 6 elif b == " Octahedron " : x += 8 elif b == " Dodecahedron " : x += 12 else : x += 20 print ( x ) NEW_LINE


import java . awt . * ; import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . util . List ; import java . util . Queue ;   import static java . lang . Math . max ; import static java . lang . Math . min ;    public class B implements Runnable {

n , k = map ( int , input ( ) . split ( ) ) NEW_LINE b = list ( map ( int , input ( ) . split ( ) ) )   taken = [ False for i in range ( n + 2 ) ] NEW_LINE a = [ ]   for i in range ( n ) : has = - 1 NEW_LINE for j in range ( 1 , n + 1 ) : if NEW_LINE not taken [ j ] and b [ j - 1 ] == 0 : has = j NEW_LINE break NEW_LINE a . append ( has ) NEW_LINE taken [ has ] = True NEW_LINE for j in range ( 1 , has - k + 1 ) : b [ j - 1 ] -= 1   print ( * a ) NEW_LINE

s = input ( ) NEW_LINE l = s . split ( )   n = int ( l [ 0 ] ) NEW_LINE k = int ( l [ 1 ] )   s = input ( ) NEW_LINE l = s . split ( )   b = [ - 1 ]   for i in range ( 1 , n + 1 ) : b . append ( int ( l [ i - 1 ] ) )   for i in range ( 1 , n + 1 ) :     NEW_LINE j = 1 NEW_LINE while b [ j ] != 0 : j += 1   b [ j ] -= 1 NEW_LINE print ( j , end = ' ▁ ' )   for t in range ( 1 , n + 1 ) : if NEW_LINE j - k >= t : b [ t ] -= 1   NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) { 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 ) throws IOException { FastIO io = new FastIO ( ) ; long n = io . nextInt ( ) ; System . out . println ( findSuperLucky ( n , 0 , 0 , 0 ) ) ; } static long findSuperLucky ( long n , int f , int s , long formed ) { if ( formed >= n && f == s ) { return formed ; } if ( formed > n * 100 ) { return Long . MAX_VALUE ; } return Math . min ( findSuperLucky ( n , f + 1 , s , formed * 10 + 4 ) , findSuperLucky ( n , f , s + 1 , formed * 10 + 7 ) ) ; } }

import java . io . IOException ; import java . util . * ; import java . util . Arrays ; import java . util . Scanner ; public class Bit_year { static Set < String > set ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; set = new TreeSet < String > ( ) ; System . out . println ( ( long ) permute ( n ) ) ; } public static long permute ( int n ) { int pow = 2 ; while ( pow <= 10 ) { char [ ] ar = new char [ pow ] ; for ( int i = 0 ; i < pow / 2 ; i ++ ) ar [ i ] = '4' ; for ( int i = pow / 2 ; i < pow ; i ++ ) ar [ i ] = '7' ; permuteHelper ( ar , 0 ) ; for ( String s : set ) { if ( Long . parseLong ( s ) >= n ) { return Long . parseLong ( s ) ; } } pow += 2 ; } return 0 ; } private static void permuteHelper ( char [ ] arr , int index ) { if ( index >= arr . length - 1 ) { set . add ( new String ( arr ) ) ; return ; } for ( int i = index ; i < arr . length ; i ++ ) { char t = arr [ index ] ; arr [ index ] = arr [ i ] ; arr [ i ] = t ; permuteHelper ( arr , index + 1 ) ; t = arr [ index ] ; arr [ index ] = arr [ i ] ; arr [ i ] = t ; } } }

import java . util . * ; public class LuckyNumbersEasy { static ArrayList < Long > arr = new ArrayList < > ( ) ; static double cons = Math . pow ( 10 , 12 ) ; static long n ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; n = sc . nextLong ( ) ; calc ( 0 ) ; Collections . sort ( arr ) ; System . out . println ( arr . get ( 0 ) ) ; } public static void calc ( long i ) { if ( i > cons ) { return ; } String [ ] temp = Long . toString ( i ) . split ( " " ) ; long s = 0 ; long f = 0 ; for ( String x : temp ) { if ( x . equals ( "4" ) ) { f ++ ; } else { s ++ ; } } if ( i >= n && s == f ) { arr . add ( i ) ; } calc ( ( i * 10 ) + 4 ) ; calc ( ( i * 10 ) + 7 ) ; } }

n = int ( input ( ) ) NEW_LINE l = [ 0 ] NEW_LINE i = 0 NEW_LINE while True : NEW_LINE INDENT t = l [ i ] NEW_LINE if t >= n : NEW_LINE INDENT if str ( t ) . count ( '7' ) == str ( t ) . count ( '4' ) : NEW_LINE INDENT print ( t ) ; NEW_LINE break NEW_LINE DEDENT DEDENT l += [ t * 10 + 4 , t * 10 + 7 ] NEW_LINE i += 1 NEW_LINE DEDENT

def luckynumwithequalnumberoffourandseven ( x , n , a ) : NEW_LINE INDENT if x >= n and str ( x ) . count ( "4" ) == str ( x ) . count ( "7" ) : NEW_LINE INDENT a . append ( x ) NEW_LINE DEDENT else : NEW_LINE INDENT if x < 1e12 : NEW_LINE INDENT luckynumwithequalnumberoffourandseven ( x * 10 + 4 , n , a ) NEW_LINE luckynumwithequalnumberoffourandseven ( x * 10 + 7 , n , a ) NEW_LINE DEDENT DEDENT return a NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE s = [ ] NEW_LINE luckynumwithequalnumberoffourandseven ( 0 , n , s ) NEW_LINE s = sorted ( s ) NEW_LINE print ( s [ 0 ] ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

a = [ ] NEW_LINE def f ( n , x ) : NEW_LINE INDENT if x <= 1e11 : NEW_LINE INDENT if x >= n and str ( x ) . count ( '4' ) == str ( x ) . count ( '7' ) : NEW_LINE INDENT a . append ( x ) NEW_LINE DEDENT f ( n , 10 * x + 4 ) NEW_LINE f ( n , 10 * x + 7 ) NEW_LINE DEDENT DEDENT f ( int ( input ( ) ) , 0 ) NEW_LINE a . sort ( ) NEW_LINE print ( a [ 0 ] ) NEW_LINE

slucky = [ 4 , 7 ] NEW_LINE i = 0 NEW_LINE while slucky [ - 1 ] < 10 ** 9 : NEW_LINE INDENT slucky . append ( slucky [ i ] * 10 + 4 ) NEW_LINE slucky . append ( slucky [ i ] * 10 + 7 ) NEW_LINE i += 1 NEW_LINE DEDENT def superlucky ( n ) : NEW_LINE INDENT four = 0 NEW_LINE seven = 0 NEW_LINE while n > 0 : NEW_LINE INDENT if n % 10 == 4 : NEW_LINE INDENT four += 1 NEW_LINE DEDENT else : NEW_LINE INDENT seven += 1 NEW_LINE DEDENT n = n // 10 NEW_LINE DEDENT if four == seven : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT lucky = [ ] NEW_LINE for item in slucky : NEW_LINE INDENT if superlucky ( item ) : NEW_LINE INDENT lucky . append ( item ) NEW_LINE DEDENT DEDENT lucky = [ 0 ] + lucky + [ 4444477777 ] NEW_LINE def binarySearch ( n ) : NEW_LINE INDENT left = 0 NEW_LINE right = len ( lucky ) - 1 NEW_LINE mid = ( left + right ) // 2 NEW_LINE while left <= right : NEW_LINE INDENT mid = ( left + right ) // 2 NEW_LINE if lucky [ mid - 1 ] < n <= lucky [ mid ] : NEW_LINE INDENT print ( lucky [ mid ] ) NEW_LINE break NEW_LINE DEDENT elif n > lucky [ mid ] : NEW_LINE INDENT left = mid + 1 NEW_LINE DEDENT else : NEW_LINE INDENT right = mid - 1 NEW_LINE DEDENT DEDENT DEDENT n = int ( input ( ) ) NEW_LINE binarySearch ( n ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class Main {    public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int [ ] arrx = new int [ n ] ; int [ ] arry = new int [ n ] ; int [ ] sortedx = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arrx [ i ] = sc . nextInt ( ) ; sortedx [ i ] = arrx [ i ] ; arry [ i ] = sc . nextInt ( ) ; } Arrays . sort ( sortedx ) ; boolean ans = true ; for ( int i = 0 ; i < n ; i ++ ) { if ( sortedx [ i ] < s ) { int idx = find ( sortedx [ i ] , arrx ) ; s += arry [ idx ] ; } else { ans = false ; break ; } } if ( ans ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static int find ( int x , int [ ] arr ) { int ans = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] == x ) { ans = i ; arr [ i ] = - 1 ; break ; } } return ans ; } }

import java . util . * ;   public class DemoObj { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int n = sc . nextInt ( ) ;   int arr [ ] [ ] = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < 2 ; j ++ ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] [ 0 ] < s ) { s += arr [ i ] [ 1 ] ; arr [ i ] = arr [ n - 1 ] ; n -- ; i = - 1 ; } } if ( n == 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

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

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int s = scan . nextInt ( ) ; int n = scan . nextInt ( ) ; int [ ] [ ] array = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { array [ i ] [ 0 ] = scan . nextInt ( ) ; array [ i ] [ 1 ] = scan . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( s > array [ i ] [ 0 ] ) { s += array [ i ] [ 1 ] ; array [ i ] = array [ n - 1 ] ; i = - 1 ; n -- ; } } if ( n == 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

f = lambda : map ( int , input ( ) . split ( ) ) s , n = f ( ) for a , b in sorted ( list ( f ( ) ) for i in ' ▁ ' * n ) : s = ( s + b ) * ( s > a ) print ( ' YNEOS ' [ s < 1 : : 2 ] ) NEW_LINE

s , n = [ int ( i ) for i in input ( ) . split ( ) ] dr = [ ]   for i in range ( n ) : dr . append ( [ int ( j ) for j in input ( ) . split ( ) ] )   dr . sort ( )   for i in range ( n ) : if s > dr [ i ] [ 0 ] : s += dr [ i ] [ 1 ] else : print ( " NO " ) exit ( 0 ) print ( " YES " )       NEW_LINE

import sysimport itertoolsimport collections     def rs ( x = ' ' ) : return sys . stdin . readline ( ) . strip ( ) if len ( x ) == 0 else input ( x ) . strip ( ) def ri ( x = ' ' ) : return int ( rs ( x ) ) def rm ( x = ' ' ) : return map ( str , rs ( x ) . split ( ) ) def rl ( x = ' ' ) : return rs ( x ) . split ( ) def rmi ( x = ' ' ) : return map ( int , rs ( x ) . split ( ) ) def rli ( x = ' ' ) : return [ int ( x ) for x in rs ( x ) . split ( ) ] def println ( val ) : sys . stdout . write ( str ( val ) + ' \n ' )     def solve ( testCase ) : s , n = rmi ( ) A = [ tuple ( rmi ( ) ) for _ in range ( n ) ] A . sort ( ) for x , y in A : if x < s : s += y else : print ( ' NO ' ) return print ( ' YES ' )     for _ in range ( ri ( ) if 0 else 1 ) : solve ( _ + 1 ) NEW_LINE

a = lambda : map ( int , input ( ) . split ( ) ) s , n = a ( ) g = 0 l = [ ] for i in ' ▁ ' * n : l . append ( ( list ( a ( ) ) ) ) l . sort ( ) for i in range ( n ) : if l [ i ] [ 0 ] < s : s += l [ i ] [ 1 ] else : g = 1 print ( [ ' YES ' , ' NO ' ] [ g == 1 ] ) NEW_LINE

s , n = map ( int , input ( ) . split ( ) ) dragons = [ ] for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) dragons += [ [ x , y ] ] dragons . sort ( ) ans = ' YES ' for i in range ( n ) : if s > dragons [ i ] [ 0 ] : s += dragons [ i ] [ 1 ] else : ans = ' NO ' breakprint ( ans ) NEW_LINE


import java . util . * ; import java . math . * ; public class ConnerAndMarkland { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int runs = sc . nextInt ( ) ; while ( runs -- > 0 ) { int n = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; ArrayList < Integer > arr = new ArrayList < > ( ) ; for ( int i = 0 ; i < k ; i ++ ) arr . add ( sc . nextInt ( ) ) ;   for ( int i = 0 ; i <= k ; i ++ ) { if ( s - i >= 1 && ! arr . contains ( s - i ) ) { System . out . println ( i ) ; break ; } if ( s + i <= n && ! arr . contains ( s + i ) ) { System . out . println ( i ) ; break ; } } } } }

import java . util . * ; import java . io . * ; import java . math . * ;     public class A {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   long n = sc . nextLong ( ) , s = sc . nextLong ( ) ; int k = sc . nextInt ( ) ; HashSet < Long > set = new HashSet < Long > ( ) ; long i = s , j = s ; for ( int ii = 0 ; ii < k ; ii ++ ) { long a = sc . nextLong ( ) ; set . add ( a ) ; while ( set . contains ( j ) ) j ++ ; while ( set . contains ( i ) ) i -- ; } long min = INF ; if ( i > 0 ) min = min ( min , s - i ) ; if ( j <= n ) min = min ( min , j - s ) ; System . out . println ( min ) ;   }

import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ;

for _ in range ( int ( input ( ) ) ) : n , s , k = [ int ( x ) for x in input ( ) . split ( ) ] fl = { int ( x ) for x in input ( ) . split ( ) } i = 0 while 1 : if max ( s - i , 1 ) not in fl or min ( n , s + i ) not in fl : print ( i ) ; break i += 1 NEW_LINE

for _ in range ( int ( input ( ) ) ) :   n , k , s = map ( int , input ( ) . split ( ) ) t = list ( map ( int , input ( ) . split ( ) ) )   if k not in t : print ( 0 ) else : dist = 1 while k + dist <= n or k - dist >= 1 : if k + dist > n : if k - dist not in t : break elif k - dist <= 0 : if k + dist not in t : break elif k + dist not in t or k - dist not in t : break dist += 1 print ( dist ) NEW_LINE

adet = int ( input ( ' ' ) ) liste = [ ] for _ in range ( adet ) : p1 = input ( ' ' ) p2 = input ( ' ' ) liste . append ( ( p1 , p2 ) ) for __ in liste : occ = __ [ 1 ] . split ( ) mevcut_konum = int ( __ [ 0 ] . split ( ) [ 1 ] ) finder1 = mevcut_konum finder2 = mevcut_konum while True : if str ( finder1 ) not in occ : print ( abs ( finder1 - mevcut_konum ) ) break elif str ( finder2 ) not in occ : print ( abs ( finder2 - mevcut_konum ) ) break if finder1 < int ( __ [ 0 ] . split ( ) [ 0 ] ) : finder1 += 1 if finder2 > 1 : finder2 -= 1 NEW_LINE


import java . io . IOException ; import java . util . * ; import java . util . Arrays ; import java . util . Scanner ;   public class Bit_year {   public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] ch = s . toCharArray ( ) ; List < Integer > heavy = new ArrayList < Integer > ( ) ; List < Integer > metal = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < ch . length ; i ++ ) { if ( i + 5 > s . length ( ) ) break ; String t = s . substring ( i , i + 5 ) ;

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 ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public static void main ( String [ ] args ) { new Codeforces ( ) . solve ( ) ; } void solve ( ) { String str = next ( ) ; long cnt = 0 , res = 0 ; for ( int i = 0 ; i < str . length ( ) - 4 ; i ++ ) { if ( str . substring ( i , i + 5 ) . equals ( " heavy " ) ) cnt ++ ; else if ( str . substring ( i , i + 5 ) . equals ( " metal " ) ) res += cnt ; } out . println ( res ) ; out . close ( ) ; } }

import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import javafx . util . Pair ;   public class CodeForce { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringBuilder sb = new StringBuilder ( ) ;   static boolean flag = false ; static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; }   public static void main ( String [ ] args ) throws IOException { String sr = br . readLine ( ) ; long count = 0 ; long total = 0 ; if ( sr . length ( ) < 10 ) System . out . println ( "0" ) ; else { for ( int i = sr . length ( ) - 5 ; i >= 0 ; i -- ) { if ( sr . charAt ( i ) == ' m ' ) { if ( sr . substring ( i , i + 5 ) . equals ( " metal " ) ) count ++ ; } if ( sr . charAt ( i ) == ' h ' ) { if ( sr . substring ( i , i + 5 ) . equals ( " heavy " ) ) total += count ; } } System . out . println ( total ) ;      }       }    }

import java . io . * ; import java . util . * ;   public class Main { static BufferedReader reader ; static StringTokenizer tokenizer ; static PrintWriter writer ;   static int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; }   static long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; }   static double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; }   static String nextToken ( ) throws IOException { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } static String nexts ( ) throws IOException { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; String s = " " ; while ( tokenizer . hasMoreTokens ( ) ) { s += tokenizer . nextElement ( ) + " ▁ " ; } return s ; }

import sys   text = sys . stdin . readline ( ) . strip ( )   i = 0 heavys = 0 result = 0 while ( i + 5 ) <= len ( text ) : if text [ i : i + 5 ] == " heavy " : heavys += 1 i += 5 elif text [ i : i + 5 ] == " metal " : result += heavys i += 5 else : i += 1 print ( result )   NEW_LINE

string = input ( ' ' ) heavy = list ( ) metal = list ( ) start = 0 while ( string . find ( " heavy " , start ) != - 1 ) : heavy . append ( string . find ( " heavy " , start ) ) start = string . find ( " heavy " , start ) + 5 start = 0 while ( string . find ( " metal " , start ) != - 1 ) : metal . append ( string . find ( " metal " , start ) ) start = string . find ( " metal " , start ) + 5 start = 0 output = 0 for i in range ( len ( heavy ) ) : for j in range ( start , len ( metal ) ) : if heavy [ i ] > metal [ j ] : continue else : output = output + ( len ( metal ) - j ) start = j break   print ( output ) NEW_LINE

s = input ( ) l = len ( s ) i = length = sub = 0 while 1 : if i <= l - 5 : if s [ i : i + 5 ] == ' heavy ' : length += 1 i += 5 elif s [ i : i + 5 ] == ' metal ' : sub += length i += 5 else : i += 1 else : breakprint ( sub ) NEW_LINE

aisa = input ( ) kyu = 0 channa = 0 for i in range ( len ( aisa ) - 4 ) : if aisa [ i : i + 5 ] == ' heavy ' : kyu += 1 if aisa [ i : i + 5 ] == ' metal ' : channa += kyuprint ( channa )   NEW_LINE


import java . util . * ; import java . io . * ; public class a { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- > 0 ) { int n = s . nextInt ( ) ; int [ ] arr = new int [ n + 1 ] ; for ( int i = 1 ; i < arr . length ; i ++ ) { arr [ i ] = s . nextInt ( ) ; } if ( n == 1 && arr [ 1 ] % 2 != 0 ) { System . out . println ( " - 1" ) ; } else if ( arr [ 1 ] % 2 == 0 ) { System . out . println ( "1" ) ; System . out . println ( "1" ) ; } else if ( arr [ 2 ] % 2 == 0 ) { System . out . println ( "1" ) ; System . out . println ( "2" ) ; } else { System . out . println ( "2" ) ; System . out . println ( "1 ▁ 2" ) ; } } } }

import java . util . * ; public class Practi {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ 105 ] ; for ( int i = 1 ; i <= n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } if ( n == 1 && arr [ 1 ] % 2 == 1 ) System . out . println ( " - 1" ) ; else { if ( arr [ 1 ] % 2 == 0 ) System . out . println ( "1 \n 1" ) ; else if ( arr [ 2 ] % 2 == 0 ) System . out . println ( "1 \n 2" ) ; else System . out . println ( "2 \n 1 ▁ 2" ) ; } } }   }

import java . util . * ; import java . io . * ; import java . lang . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int id = - 1 ; ArrayList < Integer > a = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] % 2 == 1 ) a . add ( i + 1 ) ; else if ( id == - 1 ) id = i + 1 ; } if ( id != - 1 ) { System . out . print ( 1 + " \n " + id ) ; System . out . println ( ) ; } else { if ( a . size ( ) >= 2 ) { System . out . print ( 2 + " \n " + a . get ( 0 ) + " ▁ " + a . get ( 1 ) ) ; System . out . println ( ) ; } else System . out . println ( - 1 ) ; } } } }

for _ in [ 0 ] * int ( input ( ) ) : n = input ( ) a = [ * map ( int , input ( ) . split ( ) ) ] if a [ 0 ] % 2 == 0 : print ( '1 \n 1' ) elif n == '1' : print ( - 1 ) elif a [ 1 ] % 2 == 0 : print ( '1 \n 2' ) else : print ( '2 \n 1 ▁ 2' ) NEW_LINE

T = int ( input ( ) ) while T > 0 : T -= 1 n = int ( input ( ) ) lst = [ int ( x ) for x in input ( ) . strip ( ) . split ( ) ] if len ( lst ) == 0 : print ( - 1 ) continue if len ( lst ) == 1 and lst [ 0 ] % 2 : print ( - 1 ) continue d = lst [ 0 ] if not d % 2 : print ( "1 \n 1" ) continue if lst [ 1 ] % 2 : print ( "2 \n 1 ▁ 2" ) else : print ( "1 \n 2" ) NEW_LINE

from sys import stdininput = stdin . readline   t = int ( input ( ) ) for _ in range ( t ) : n = int ( input ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] if n == 1 and a [ 0 ] % 2 > 0 : print ( - 1 ) continue odd = [ ] for i in range ( n ) : if a [ i ] % 2 == 0 : print ( 1 ) print ( i + 1 ) break else : odd . append ( i + 1 ) if len ( odd ) == 2 : print ( 2 ) print ( * odd ) break NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) c = 0 for i in range ( n ) : if a [ i ] % 2 == 0 : print ( 1 ) print ( i + 1 ) c += 1 break if c == 0 : for j in range ( n ) : if n == 1 : print ( - 1 ) c += 1 break elif a [ j ] % 2 != 0 and a [ j + 1 ] % 2 != 0 : print ( 2 ) print ( j + 1 , j + 2 ) c += 1 break if c == 0 : print ( - 1 ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = tuple ( map ( int , input ( ) . split ( ) ) ) if n == 1 : if not a [ 0 ] % 2 : print ( 1 ) print ( 1 ) else : print ( - 1 ) else : if not a [ 0 ] % 2 : print ( 1 ) print ( 1 ) elif not a [ 1 ] % 2 : print ( 1 ) print ( 2 ) else : print ( 2 ) print ( 1 , 2 ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class x190B { public static void main ( String omkar [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; long x1 = Long . parseLong ( st . nextToken ( ) ) ; long y1 = Long . parseLong ( st . nextToken ( ) ) ; long r1 = Long . parseLong ( st . nextToken ( ) ) ; st = new StringTokenizer ( infile . readLine ( ) ) ; long x2 = Long . parseLong ( st . nextToken ( ) ) ; long y2 = Long . parseLong ( st . nextToken ( ) ) ; long r2 = Long . parseLong ( st . nextToken ( ) ) ; double dist = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ; dist = Math . sqrt ( dist ) ; dist -= r1 + r2 ; if ( dist > 0 ) System . out . println ( dist / 2 ) ; else {

import java . util . ArrayList ; import java . util . Scanner ;   public class Surrounded { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; ArrayList < Integer > firstInput = new ArrayList < > ( ) ; ArrayList < Integer > secondInput = new ArrayList < > ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { firstInput . add ( s . nextInt ( ) ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { secondInput . add ( s . nextInt ( ) ) ; }   getMinRadius ( firstInput , secondInput ) ;   }   private static void getMinRadius ( ArrayList < Integer > firstInput , ArrayList < Integer > secondInput ) { double eucledianDistance = getEucledianDistance ( firstInput , secondInput ) ; double diameter = eucledianDistance - ( firstInput . get ( 2 ) + secondInput . get ( 2 ) ) ; double radius = diameter / 2.0 ; if ( radius <= 0 ) { if ( Math . max ( firstInput . get ( 2 ) , secondInput . get ( 2 ) ) > eucledianDistance + Math . min ( firstInput . get ( 2 ) , secondInput . get ( 2 ) ) ) { System . out . printf ( " % .15f " , Math . abs ( radius ) - Math . min ( firstInput . get ( 2 ) , secondInput . get ( 2 ) ) ) ; } else { System . out . printf ( " % .15f " , 0f ) ; } } else { System . out . printf ( " % .15f " , radius ) ;   } }   private static double getEucledianDistance ( ArrayList < Integer > firstInput , ArrayList < Integer > secondInput ) { return Math . sqrt ( Math . pow ( secondInput . get ( 1 ) - firstInput . get ( 1 ) , 2 ) + Math . pow ( secondInput . get ( 0 ) - firstInput . get ( 0 ) , 2 ) ) ; }   }

import java . io . * ; import java . util . * ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; public class b90 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x1 = sc . nextInt ( ) ; int y1 = sc . nextInt ( ) ; int r1 = sc . nextInt ( ) ; int x2 = sc . nextInt ( ) ; int y2 = sc . nextInt ( ) ; int r2 = sc . nextInt ( ) ; double d = Math . sqrt ( Math . pow ( x1 - x2 , 2 ) + Math . pow ( y1 - y2 , 2 ) ) ; if ( Math . pow ( x1 , 2 ) + Math . pow ( y1 , 2 ) == Math . pow ( r1 , 2 ) && Math . pow ( x2 , 2 ) + Math . pow ( y2 , 2 ) == Math . pow ( r2 , 2 ) ) { System . out . println ( 0 ) ; } else if ( d <= ( double ) ( r1 + r2 ) && 2 * d >= ( double ) ( r1 + r2 ) ) { System . out . println ( 0 ) ; } else if ( d < ( double ) Math . max ( r1 , r2 ) ) { System . out . println ( ( ( double ) Math . max ( r1 , r2 ) - ( d + ( double ) Math . min ( r1 , r2 ) ) ) / 2 ) ; } else { System . out . println ( ( d - ( double ) ( r1 + r2 ) ) / 2 ) ; } } }

import mathx1 , y1 , r1 = map ( int , input ( ) . split ( ) ) x2 , y2 , r2 = map ( int , input ( ) . split ( ) ) d = math . sqrt ( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 ) R = max ( r1 , r2 ) r = min ( r1 , r2 ) NEW_LINE

from math import sqrtx1 , y1 , r1 = map ( int , input ( ) . split ( ) ) x2 , y2 , r2 = map ( int , input ( ) . split ( ) )   d = sqrt ( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 ) if d > r1 + r2 : print ( ( d - ( r1 + r2 ) ) / 2 ) elif d < abs ( r1 - r2 ) : print ( ( abs ( r1 - r2 ) - d ) / 2 ) else : print ( 0 ) NEW_LINE

import sysimport mathdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def rinput ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) mod = int ( 1e9 ) + 7   x1 , y1 , r1 = rinput ( ) x2 , y2 , r2 = rinput ( )   d = math . sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) - r1 - r2r = d / 2 f = - ( r + min ( r1 , r2 ) ) NEW_LINE

import math   x1 , y1 , r1 = map ( int , input ( ) . split ( ) ) x2 , y2 , r2 = map ( int , input ( ) . split ( ) )   d = ( x2 - x1 ) ** 2 + ( y2 - y1 ) ** 2 ans = 0.0   if ( d >= ( r1 + r2 ) ** 2 ) : ans = math . sqrt ( d ) - r1 - r2   elif ( d >= ( r1 - r2 ) ** 2 ) : ans = 0.0   else : ans = abs ( r1 - r2 ) - math . sqrt ( d )   ans /= 2 print ( ans ) NEW_LINE


import java . util . Scanner ;   public class B897 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; long mod = in . nextInt ( ) ; long answer = 0 ; for ( int n = 1 ; n <= N ; n ++ ) { String nTxt = Integer . toString ( n ) ; long zcy = Long . parseLong ( nTxt + new StringBuilder ( nTxt ) . reverse ( ) ) ; answer += zcy ; answer %= mod ; } System . out . println ( answer ) ; }   }

import java . util . Scanner ;   public class Eieve {   public static void main ( String args [ ] ) {   Scanner input = new Scanner ( System . in ) ;   long k = input . nextLong ( ) , p = input . nextLong ( ) ; long j = 0 , i1 = 0 , sum = 0 , c = 1 , j1 = 0 ;   for ( int i = 1 ; i <= k ; i ++ ) { j = i ; j1 = i ; while ( j1 > 0 ) {   j = j * 10 + j1 % 10 ;

import java . math . BigInteger ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; int p = in . nextInt ( ) ; BigInteger sum = new BigInteger ( "0" ) ; String newNum = " " ; String num ; for ( int i = 1 ; i <= k ; i ++ ) { num = i + " " ; newNum = num ; for ( int j = num . length ( ) - 1 ; j >= 0 ; j -- ) { newNum += num . charAt ( j ) ; } BigInteger n = new BigInteger ( newNum ) ; sum = sum . add ( n ) ; } String pb1 = p + " " ; BigInteger pb2 = new BigInteger ( pb1 ) ; System . out . println ( sum . mod ( pb2 ) ) ; in . close ( ) ; }   }

import java . io . * ; import java . util . * ; import java . lang . * ;   public class Rextester { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; br . close ( ) ; int n = new Integer ( st . nextToken ( ) ) ; int k = new Integer ( st . nextToken ( ) ) ; int p = 0 ; long ans = 0 ; StringBuffer sb = new StringBuffer ( "11" ) ; for ( int a = 0 ; a < n ; a ++ ) { long x = new Long ( sb . toString ( ) ) ;

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int P = scan . nextInt ( ) ; long sum = 0 ; for ( int i = 1 ; i <= k ; i ++ ) { String first = i + " " ; StringBuilder last = new StringBuilder ( first ) . reverse ( ) ; sum += Long . parseLong ( first + last ) ; sum = sum % P ; } System . out . println ( sum ) ; } }

k , p = map ( int , input ( ) . split ( ) ) res = 0 for i in range ( 1 , k + 1 ) : res += int ( str ( i ) + ( str ( i ) [ : : - 1 ] ) ) res %= pprint ( res ) NEW_LINE

""" ▁ ▁ ▁ ▁ Chtholly ' s ▁ request ▁ ▁ ▁ ▁ You ▁ can ▁ solve ▁ it ▁ recursively """ import math , sysdef nextZCY ( num ) : NEW_LINE

def main ( ) :   k , p = map ( int , input ( ) . split ( ) )   table = [ 0 ] * ( k + 5 ) table [ 0 ] = 1 for i in range ( 1 , k + 5 ) : table [ i ] = table [ i - 1 ] * 10 table [ i ] %= p ans = 0 for i in range ( 1 , k + 1 ) : d = len ( str ( i ) ) j = list ( str ( i ) ) j . reverse ( ) j = int ( ' ' . join ( j ) ) ans += i * table [ d ] + j ans %= p print ( ans )   if __name__ == ' _ _ main _ _ ' : main ( ) 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 pcc15c {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int t = 1 ;

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 {   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; int a1 = input . nextInt ( ) ; int b1 = input . nextInt ( ) ; int a2 = input . nextInt ( ) ; int b2 = input . nextInt ( ) ; int a3 = input . nextInt ( ) ; int b3 = input . nextInt ( ) ; if ( ( a2 + a3 ) <= a1 && Math . max ( b2 , b3 ) <= b1 ) { System . out . println ( " YES " ) ; } else if ( ( a2 + a3 ) <= b1 && Math . max ( b2 , b3 ) <= a1 ) { System . out . println ( " YES " ) ; } else if ( ( a2 + b3 ) <= a1 && Math . max ( b2 , a3 ) <= b1 ) { System . out . println ( " YES " ) ; } else if ( ( a2 + b3 ) <= b1 && Math . max ( b2 , a3 ) <= a1 ) { System . out . println ( " YES " ) ; } else if ( ( b2 + a3 ) <= b1 && Math . max ( a2 , b3 ) <= a1 ) { System . out . println ( " YES " ) ; } else if ( ( b2 + a3 ) <= a1 && Math . max ( a2 , b3 ) <= b1 ) { System . out . println ( " YES " ) ; } else if ( ( b2 + b3 ) <= a1 && Math . max ( a2 , a3 ) <= b1 ) { System . out . println ( " YES " ) ; } else if ( ( b2 + b3 ) <= b1 && Math . max ( a2 , a3 ) <= a1 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; }   }

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) def fn ( x , y , p , q ) : if y + q <= b and max ( x , p ) <= l : return True if x + p <= l and max ( y , q ) <= b : return True return Falsefor _ in range ( 1 ) : NEW_LINE

I = lambda : [ * map ( int , input ( ) . split ( ) ) ] z , u , v = I ( ) , I ( ) , I ( ) r = 0 for x , y in ( z , z [ : : - 1 ] ) : for a , b in ( u , u [ : : - 1 ] ) : for c , d in ( v , v [ : : - 1 ] ) : r |= a + c <= x and max ( b , d ) <= yprint ( ' YNEOS ' [ 1 - r : : 2 ] ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) c , d = map ( int , input ( ) . split ( ) ) e , f = map ( int , input ( ) . split ( ) )   for A , B in [ ( a , b ) , ( b , a ) ] : for C , D in [ ( c , d ) , ( d , c ) ] : for E , F in [ ( e , f ) , ( f , e ) ] : if C + E <= A and max ( D , F ) <= B : print ( ' YES ' ) exit ( ) print ( ' NO ' ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a1 , b1 = map ( int , input ( ) . split ( ) ) a2 , b2 = map ( int , input ( ) . split ( ) ) ar1 = n * mar2 = ( a1 * b1 ) + ( a2 * b2 ) a = a1 + a2b = a1 + b2c = a2 + b1d = b1 + b2t = 1 def fu ( su , q , w , n , m ) : t = 1 mi = min ( n , m ) ma = max ( n , m ) if ( su <= mi ) : if ( q <= ma and w <= ma ) : return t else : t = 0 return t   elif ( su <= ma ) : if ( q <= mi and w <= mi ) : return t else : t = 0 return t else :   t = 0 return t z1 = fu ( a , b1 , b2 , n , m ) z2 = fu ( b , b1 , a2 , n , m ) z3 = fu ( c , a1 , b2 , n , m ) z4 = fu ( d , a1 , a2 , n , m ) NEW_LINE

a , b = [ int ( x ) for x in input ( ) . split ( ) ] c , d = [ int ( x ) for x in input ( ) . split ( ) ] e , f = [ int ( x ) for x in input ( ) . split ( ) ] def do ( a , b , c , d , e , f ) : for i in range ( 1 , 5 ) : if ( c + e <= a and d <= b and f <= b ) or ( d + f <= b and c <= a and e <= a ) : return " YES " if i % 2 : c , d = d , c e , f = f , e return " NO " print ( do ( a , b , c , d , e , f ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void print ( int [ ] arr ) { for ( int i = 0 ; i < arr . length ; i ++ ) { if ( i == arr . length - 1 ) System . out . print ( arr [ i ] ) ; else System . out . print ( arr [ i ] + " ▁ " ) ; } System . out . println ( ) ; } public static boolean method ( int [ ] arr ) { boolean flag = true ; for ( int i = 1 ; i < arr . length ; i += 2 ) { if ( arr [ i ] < arr [ i - 1 ] ) { int temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } } for ( int i = 2 ; i < arr . length ; i += 2 ) { if ( arr [ i ] > arr [ i - 1 ] ) { int temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } } for ( int i = 1 ; i < arr . length ; i ++ ) { if ( i % 2 != 0 && arr [ i ] < arr [ i - 1 ] ) flag = false ; else if ( i % 2 == 0 && arr [ i ] > arr [ i - 1 ] ) flag = false ; } return flag ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; String s = br . readLine ( ) ; String [ ] s1 = s . split ( " ▁ " ) ; int [ ] arr = new int [ x ] ; for ( int j = 0 ; j < s1 . length ; j ++ ) { arr [ j ] = ( Integer . parseInt ( s1 [ j ] ) ) ; } if ( method ( arr ) ) print ( arr ) ; else System . out . println ( " Impossible " ) ; } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = ( int ) sc . nextLong ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; Long [ ] x = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextLong ( ) ; } Arrays . sort ( x ) ; int z = n / 2 ; if ( n % 2 == 0 ) { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( " ▁ " ) ; System . out . print ( x [ i ] + " ▁ " + x [ x . length - i - 1 ] ) ; } } else { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( " ▁ " ) ; System . out . print ( x [ i ] + " ▁ " + x [ x . length - i - 1 ] ) ; } System . out . print ( " ▁ " + x [ z ] ) ; } } }

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

import java . io . * ; import java . util . * ; public class Mangos { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = ( int ) sc . nextLong ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; Long [ ] x = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { x [ i ] = sc . nextLong ( ) ; } Arrays . sort ( x ) ; int z = n / 2 ; if ( n % 2 == 0 ) { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( " ▁ " ) ; System . out . print ( x [ i ] + " ▁ " + x [ x . length - i - 1 ] ) ; } } else { for ( int i = 0 ; i < z ; i ++ ) { if ( i != 0 ) System . out . print ( " ▁ " ) ; System . out . print ( x [ i ] + " ▁ " + x [ x . length - i - 1 ] ) ; } System . out . print ( " ▁ " + x [ z ] ) ; } } }

n = int ( input ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( )   arr . sort ( ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = [ ] check = sorted ( a ) i , j = 0 , n - 1 while i < j : ans . append ( check [ i ] ) ans . append ( check [ j ] ) i += 1 j -= 1 if i == j : ans . append ( check [ i ] ) print ( * ans ) NEW_LINE

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 = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) arr . sort ( ) x = [ ] z = 1 for i in range ( n // 2 ) : x . append ( arr [ i ] ) x . append ( arr [ len ( arr ) - i - 1 ] ) if n % 2 == 1 : x . append ( arr [ ( n // 2 ) ] ) for i in range ( n ) : if i % 2 == 1 : if x [ i ] < x [ i - 1 ] : print ( " Impossible " ) z = 0 break else : if x [ i ] > x [ i - 1 ] : print ( " Impossible " ) z = 0 breakif z != 0 : print ( ' ▁ ' . join ( map ( str , x ) ) ) NEW_LINE

n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) array . sort ( ) ans = [ ]   for i in range ( n // 2 ) : ans . append ( array [ i ] ) ans . append ( array [ n - i - 1 ] )   if len ( array ) % 2 != 0 : ans . append ( array [ n // 2 ] ) print ( " ▁ " . join ( [ str ( i ) for i in ans ] ) ) NEW_LINE

n = int ( input ( ) )   numero = input ( ) . split ( ) for i in range ( n ) : numero [ i ] = int ( numero [ i ] )     if n == 1 : print ( numero [ 0 ] ) else : for i in range ( 1 , n ) : if i % 2 != 0 and numero [ i ] < numero [ i - 1 ] : auxiliar = numero [ i ] numero [ i ] = numero [ i - 1 ] numero [ i - 1 ] = auxiliar elif i % 2 == 0 and numero [ i ] > numero [ i - 1 ] : auxiliar = numero [ i ] numero [ i ] = numero [ i - 1 ] numero [ i - 1 ] = auxiliar   respuesta = str ( numero [ 0 ] ) for i in range ( 1 , n ) : respuesta = respuesta + ' ▁ ' + str ( numero [ i ] ) print ( respuesta ) NEW_LINE


import java . util . * ; import java . io . * ; public class Bets {   public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , m = Integer . parseInt ( st . nextToken ( ) ) ; int a [ ] [ ] = new int [ m ] [ 4 ] ; for ( int i = 0 ; i < m ; i ++ ) { StringTokenizer s = new StringTokenizer ( br . readLine ( ) ) ; a [ i ] [ 0 ] = Integer . parseInt ( s . nextToken ( ) ) ; a [ i ] [ 1 ] = Integer . parseInt ( s . nextToken ( ) ) ; a [ i ] [ 2 ] = Integer . parseInt ( s . nextToken ( ) ) ; a [ i ] [ 3 ] = Integer . parseInt ( s . nextToken ( ) ) ; } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int min = 10001 , max = 0 , position = - 1 ; for ( int p = 0 ; p < m ; p ++ ) { if ( a [ p ] [ 0 ] <= i && a [ p ] [ 1 ] >= i ) { if ( a [ p ] [ 2 ] < min ) { min = a [ p ] [ 2 ] ; position = p ; }

import java . util . Arrays ; import java . util . Scanner ;   public class B69 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; int [ ] minTime = new int [ N ] ; Arrays . fill ( minTime , Integer . MAX_VALUE ) ; int [ ] money = new int [ N ] ; for ( int m = 0 ; m < M ; m ++ ) { int L = in . nextInt ( ) - 1 ; int R = in . nextInt ( ) - 1 ; int T = in . nextInt ( ) ; int C = in . nextInt ( ) ; for ( int n = L ; n <= R ; n ++ ) { if ( T < minTime [ n ] ) { money [ n ] = C ; minTime [ n ] = T ; } } } int answer = 0 ; for ( int amount : money ) { answer += amount ; } System . out . println ( answer ) ; }   }

n , m = map ( int , input ( ) . split ( ) ) NEW_LINE athletes = { } NEW_LINE for i in range ( m ) : l , r , t , c = map ( int , input ( ) . split ( ) ) NEW_LINE athletes [ i + 1 ] = [ l , r , t , c ]   ans = 0 NEW_LINE for i in range ( 1 , n + 1 ) : lowTime = 10 ** 5 NEW_LINE money = 0 NEW_LINE for athlete in athletes : if NEW_LINE athletes [ athlete ] [ 0 ] <= i <= athletes [ athlete ] [ 1 ] and athletes [ athlete ] [ 2 ] < lowTime : lowTime = athletes [ athlete ] [ 2 ] NEW_LINE money = athletes [ athlete ] [ 3 ] NEW_LINE ans += money   print ( ans ) NEW_LINE

n = [ int ( i ) for i in input ( ) . split ( ) ]   batata = [ 1001 ] * ( n [ 0 ] ) NEW_LINE score = [ 0 ] * ( n [ 0 ] )   for i in range ( n [ 1 ] ) : all = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE for b in range ( all [ 0 ] - 1 , all [ 1 ] ) : if NEW_LINE batata [ b ] > all [ 2 ] : batata [ b ] = all [ 2 ] NEW_LINE score [ b ] = all [ 3 ] NEW_LINE sum = 0 NEW_LINE for i in range ( n [ 0 ] ) : sum += score [ i ]   print ( sum )           NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) NEW_LINE athletes = { } NEW_LINE for i in range ( m ) : l , r , t , c = map ( int , input ( ) . split ( ) ) NEW_LINE athletes [ i + 1 ] = [ l , r , t , c ] NEW_LINE ans = 0 NEW_LINE for i in range ( 1 , n + 1 ) : lowTime = 10 ** 5 NEW_LINE money = 0 NEW_LINE for athlete in athletes : if NEW_LINE athletes [ athlete ] [ 0 ] <= i <= athletes [ athlete ] [ 1 ] and athletes [ athlete ] [ 2 ] < lowTime : lowTime = athletes [ athlete ] [ 2 ] NEW_LINE money = athletes [ athlete ] [ 3 ] NEW_LINE ans += money NEW_LINE print ( ans ) 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 . Stack ;   public class Zebras { public static void main ( String [ ] a ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; char [ ] day = br . readLine ( ) . toCharArray ( ) ; Stack < ArrayList < Integer > > zebras = new Stack < ArrayList < Integer > > ( ) ; Stack < ArrayList < Integer > > nonZebras = new Stack < ArrayList < Integer > > ( ) ; for ( int i = 0 ; i < day . length ; i ++ ) { if ( day [ i ] == '0' ) { if ( ! nonZebras . isEmpty ( ) ) { ArrayList < Integer > x = nonZebras . pop ( ) ; x . add ( i + 1 ) ; zebras . push ( x ) ; } else { ArrayList < Integer > x = new ArrayList < Integer > ( ) ; x . add ( i + 1 ) ; zebras . push ( x ) ; } } else { if ( ! zebras . isEmpty ( ) ) { ArrayList < Integer > x = zebras . pop ( ) ; x . add ( i + 1 ) ; nonZebras . push ( x ) ; } else { System . out . println ( - 1 ) ; return ; } } } if ( nonZebras . isEmpty ( ) ) { out . println ( zebras . size ( ) ) ; while ( ! zebras . isEmpty ( ) ) { ArrayList < Integer > x = zebras . pop ( ) ; out . print ( x . size ( ) ) ; for ( int s : x ) out . print ( " ▁ " + s ) ; out . println ( ) ; } } else { out . println ( - 1 ) ; } out . flush ( ) ; } }

s = input ( ) l = [ ] even = [ ] odd = [ ] f = 1 for i in range ( len ( s ) ) : if s [ i ] == '0' : if len ( even ) != 0 : ind = even . pop ( ) l [ ind ] . append ( i + 1 ) odd . append ( ind ) else : l . append ( [ i + 1 ] ) odd . append ( len ( l ) - 1 ) else : if len ( odd ) : ind = odd . pop ( ) l [ ind ] . append ( i + 1 ) even . append ( ind ) else : f = 0 breakif f and len ( even ) == 0 : print ( len ( l ) ) for x in l : print ( len ( x ) , * x ) else : print ( - 1 ) NEW_LINE

s = input ( ) res , p = [ ] , - 1   for i in range ( len ( s ) ) : j = i + 1 if s [ i ] == '0' : if p > - 1 : res [ p ] . append ( j ) p -= 1 else : res . append ( [ j ] ) else : p += 1 if p >= len ( res ) : print ( - 1 ) exit ( ) res [ p ] . append ( j )       if p != - 1 : print ( - 1 ) exit ( )           print ( len ( res ) ) for x in res : print ( len ( x ) , * x ) NEW_LINE

from collections import deque l = input ( ) az = deque ( [ ] ) z = deque ( [ ] ) f = 0 for i in range ( len ( l ) ) : if l [ i ] == '0' : if len ( az ) == 0 : z . append ( [ i + 1 ] ) else : az [ 0 ] . append ( i + 1 ) z . append ( az [ 0 ] ) az . popleft ( ) else : 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 , k ; n = input . nextInt ( ) ; k = input . nextInt ( ) ; char a [ ] [ ] = new char [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { Arrays . fill ( a [ i ] , ' S ' ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( k == 0 ) break ; for ( int j = 0 ; j < n ; j ++ ) { if ( k == 0 ) break ; if ( ( i + j ) % 2 == 0 ) { a [ i ] [ j ] = ' L ' ; k -- ; } } } if ( k > 0 ) { System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( a [ i ] [ j ] ) ; } System . out . println ( ) ; } } }

import java . util . Scanner ;   public class CF544_D2_B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; char [ ] [ ] map = new char [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( i % 2 == 0 ) { if ( j % 2 == 1 || k == 0 ) { map [ i ] [ j ] = ' S ' ; } else if ( k > 0 ) { map [ i ] [ j ] = ' L ' ; k -- ; } } else { if ( j % 2 == 0 || k == 0 ) { map [ i ] [ j ] = ' S ' ; } else if ( k > 0 ) { map [ i ] [ j ] = ' L ' ; k -- ; } } } } if ( k == 0 ) { printMap ( map ) ; } else { System . out . println ( " NO " ) ; }    }   static void printMap ( char [ ] [ ] map ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < map . length ; i ++ ) { for ( int j = 0 ; j < map . length ; j ++ ) { System . out . print ( map [ i ] [ j ] ) ; } System . out . println ( ) ; }   } }

import java . io . BufferedWriter ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main { private static final long MOD = ( long ) 1e9 + 7 ; static InputStream is ; static PrintWriter out ; static String INPUT = " " ; static int lenbuf = 0 , ptrbuf = 0 ; private static byte [ ] inbuf = new byte [ 1024 ] ; static boolean readFile = false ;

import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) map , islands = [ [ ' S ' for x in range ( n ) ] for y in range ( n ) ] , 0     def print_map ( ) : print ( " YES " ) for line in map : print ( " " . join ( line ) )     for i in range ( n ) : for j in range ( n ) : if islands == k : print_map ( ) exit ( ) if ( i + j ) - 1 & 1 : map [ i ] [ j ] = ' L ' islands += 1 if islands == k : print_map ( ) exit ( )   print ( " NO " ) NEW_LINE

from collections import defaultdict , Counter import sys import bisectimport mathdef get_array ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def input ( ) : return sys . stdin . readline ( ) . strip ( )     ( n , k ) = get_ints ( )   mat = [ [ ' S ' for _ in range ( n ) ] for _ in range ( n ) ] if n & 1 : s = ( ( n + 1 ) // 2 ) * ( ( n + 1 ) // 2 ) + ( n // 2 ) * ( n // 2 ) if k > s : print ( " NO " ) else : print ( " YES " ) row = 0 while ( k ) : for col in range ( row % 2 , n , 2 ) : if k == 0 : break mat [ row ] [ col ] = ' L ' k -= 1 NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) matrix = [ [ " S " for i in range ( n ) ] for j in range ( n ) ] for i in range ( n ) : for j in range ( n ) : if k > 0 : if i % 2 == 0 and j % 2 == 0 : matrix [ i ] [ j ] = " L " k -= 1 elif i % 2 == 1 and j % 2 == 1 : matrix [ i ] [ j ] = " L " k -= 1 if k > 0 : print ( " NO " ) else : print ( " YES " ) for lst in matrix : print ( " " . join ( lst ) ) NEW_LINE

n , k = input ( ) . split ( ) n , k = int ( n ) , int ( k ) if k > ( n * n + 1 ) // 2 : print ( " NO " ) exit ( ) print ( " YES " ) for i in range ( 0 , n ) : for j in range ( 0 , n ) : if ( ( i + j ) % 2 == 0 and k > 0 ) : print ( ' L ' , end = ' ' ) k -= 1 else : print ( ' S ' , end = ' ' ) print ( ) NEW_LINE


import java . util . Scanner ; public class A1393 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int answer = N / 2 + 1 ; System . out . println ( answer ) ; } } }

import java . util . Scanner ; public class Div2A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int t = Integer . parseInt ( scanner . nextLine ( ) ) ; int n ; for ( int i = 0 ; i < t ; i ++ ) { n = Integer . parseInt ( scanner . nextLine ( ) ) ; System . out . println ( ( n / 2 ) + 1 ) ; } scanner . close ( ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] nextArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long [ ] nextArray ( long n ) { long [ ] a = new long [ ( int ) n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; } void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; } void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; } } public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; FastWriter out = new FastWriter ( ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; out . println ( ( n / 2 ) + 1 ) ; } out . close ( ) ; } }

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n == 1 : NEW_LINE INDENT print ( n ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( n // 2 + 1 ) NEW_LINE DEDENT DEDENT

import sys NEW_LINE from collections import * NEW_LINE from heapq import * NEW_LINE import math NEW_LINE import bisect NEW_LINE def input ( ) : NEW_LINE INDENT return sys . stdin . readline ( ) NEW_LINE DEDENT for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE if n % 2 : NEW_LINE INDENT tmp = ( n - 1 ) // 2 NEW_LINE print ( 1 + tmp ) NEW_LINE DEDENT else : NEW_LINE INDENT tmp = n // 2 NEW_LINE print ( tmp + 1 ) NEW_LINE DEDENT DEDENT

for _ in range ( int ( input ( ) ) ) : NEW_LINE INDENT print ( int ( input ( ) ) // 2 + 1 ) NEW_LINE DEDENT

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE print ( n // 2 + 1 ) NEW_LINE DEDENT


import java . io . * ; import java . util . * ; import static java . lang . Math . * ;   public class Main implements Runnable {   private boolean console = false ; private long MOD = 1000_000_007L ; private int MAX = 1000_001 ;   private void solve1 ( ) {   int n = in . ni ( ) , m = in . ni ( ) ; ArrayList < Pair > [ ] list = new ArrayList [ m + 1 ] ;   for ( int i = 0 ; i <= m ; ++ i ) { list [ i ] = new ArrayList < > ( ) ; }   for ( int i = 0 ; i < n ; ++ i ) { String name = in . ns ( ) ; int num = in . ni ( ) ; int score = in . ni ( ) ;   list [ num ] . add ( new Pair ( name , score ) ) ; }   for ( int i = 1 ; i <= m ; ++ i ) {   list [ i ] . sort ( ( a , b ) -> b . score - a . score ) ;   if ( list [ i ] . size ( ) == 2 ) { out . println ( list [ i ] . get ( 0 ) . name + " ▁ " + list [ i ] . get ( 1 ) . name ) ; continue ; }   if ( list [ i ] . get ( 1 ) . score == list [ i ] . get ( 2 ) . score ) { out . println ( " ? " ) ; continue ; }   out . println ( list [ i ] . get ( 0 ) . name + " ▁ " + list [ i ] . get ( 1 ) . name ) ; }    }   class Pair { String name ; int score ;   public Pair ( String name , int score ) { this . name = name ; this . score = score ; } }   private void solve ( ) { int testCases = 1 ;

import java . util . * ; import java . lang . * ; import java . math . * ; import java . awt . image . ConvolveOp ; import java . io . * ; import java . text . DecimalFormat ; import java . lang . Math ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ;

def main ( ) : N , M = map ( int , input ( ) . split ( ) ) x = { } for i in range ( M ) : x [ i + 1 ] = [ ] for j in range ( N ) : a , b , c = ( input ( ) . split ( ) ) b = int ( b ) c = int ( c ) x [ b ] += [ ( c , a ) ] for k in range ( M ) : y = sorted ( x [ k + 1 ] ) [ : : - 1 ] if len ( y ) > 2 and ( y [ 1 ] [ 0 ] == y [ 2 ] [ 0 ] ) : print ( " ? " ) else : print ( y [ 0 ] [ 1 ] + ' ▁ ' + y [ 1 ] [ 1 ] ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE

from operator import itemgetterfrom collections import defaultdictn , m = map ( int , input ( ) . split ( ) ) dicta = defaultdict ( list ) details = [ ] for i in range ( n ) : participant = input ( ) . split ( ) participant [ 1 ] = int ( participant [ 1 ] ) participant [ 2 ] = int ( participant [ 2 ] ) details . append ( participant )   details . sort ( key = itemgetter ( 1 , 2 ) ) for j in range ( n ) : dicta [ details [ j ] [ 1 ] ] . append ( [ details [ j ] [ 0 ] , details [ j ] [ 2 ] ] ) for key in dicta . keys ( ) : valu = len ( dicta [ key ] ) if len ( dicta [ key ] ) != 2 and dicta [ key ] [ valu - 2 ] [ 1 ] == dicta [ key ] [ valu - 3 ] [ 1 ] : print ( " ? " ) else : print ( " { } ▁ { } " . format ( dicta [ key ] [ valu - 1 ] [ 0 ] , dicta [ key ] [ valu - 2 ] [ 0 ] ) ) NEW_LINE

n , m = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in range ( 1 , m + 1 ) : d [ i ] = [ ] for i in range ( n ) : a , b , c = input ( ) . split ( ) a = str ( a ) b = int ( b ) c = int ( c ) d [ b ] . append ( [ c , a ] ) for i in range ( 1 , m + 1 ) : a = d [ i ] a . sort ( reverse = True ) if len ( a ) > 2 and a [ 1 ] [ 0 ] == a [ 2 ] [ 0 ] : print ( " ? " ) else : print ( a [ 0 ] [ 1 ] , a [ 1 ] [ 1 ] ) NEW_LINE

from sys import stdin , stdouta , b = map ( int , stdin . readline ( ) . split ( ) ) d = { } for i in range ( 1 , b + 1 ) : d [ i ] = [ ] for _ in " ▁ " * a : x , y , z = stdin . readline ( ) . split ( ) y = int ( y ) ; z = int ( z ) d [ y ] . append ( [ z , x ] ) ans = ' ' for i in d : d [ i ] . sort ( reverse = True ) if len ( d [ i ] ) > 2 and d [ i ] [ 1 ] [ 0 ] == d [ i ] [ 2 ] [ 0 ] : ans += ' ? ' else : ans += d [ i ] [ 0 ] [ 1 ] + ' ▁ ' + d [ i ] [ 1 ] [ 1 ] ans += ' \n ' stdout . write ( ans ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) d = { } for i in range ( a ) : f = list ( input ( ) . split ( ) ) if int ( f [ 1 ] ) in d : d [ int ( f [ 1 ] ) ] . append ( ( int ( f [ 2 ] ) , f [ 0 ] ) ) else : d [ int ( f [ 1 ] ) ] = [ ( int ( f [ 2 ] ) , f [ 0 ] ) ] for i in d : d [ i ] . sort ( ) d [ i ] . reverse ( ) for i in range ( 1 , b + 1 ) : if len ( d [ i ] ) > 2 and d [ i ] [ 2 ] [ 0 ] == d [ i ] [ 1 ] [ 0 ] : print ( ' ? ' ) else : print ( d [ i ] [ 0 ] [ 1 ] , d [ i ] [ 1 ] [ 1 ] ) NEW_LINE


import java . util . * ; public class Main { 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 d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int a1 = ( b * c ) / g ; int a2 = d * e ; int a3 = f / h ; int ans1 = Math . min ( a1 , a2 ) ; int ans = Math . min ( ans1 , a3 ) ; System . out . println ( ans / a ) ; } }

import java . util . Scanner ;   public class A151 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) , k = scanner . nextInt ( ) , l = scanner . nextInt ( ) , c = scanner . nextInt ( ) , d = scanner . nextInt ( ) , p = scanner . nextInt ( ) , nl = scanner . nextInt ( ) , np = scanner . nextInt ( ) ;   int millDrToast = k * l / nl , limesToast = c * d , saltToast = p / np ; System . out . println ( ( Math . min ( millDrToast , Math . min ( limesToast , saltToast ) ) ) / n ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class experiment { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;

n , k , l , c , d , p , nl , np = map ( int , input ( ) . split ( ) ) x = min ( c * d , ( k * l ) // nl , p // np ) print ( x // n ) NEW_LINE

n , k , l , c , d , p , nl , np = map ( int , input ( ) . split ( ) ) a = k * lx = a // nly = c * dz = p // npprint ( min ( x , y , z ) // n ) NEW_LINE

n , k , l , c , d , p , nl , np = map ( int , input ( ) . split ( ) ) NEW_LINE

n , k , l , c , d , p , a , b = map ( int , input ( ) . split ( ) ) print ( min ( k * l // a , c * d , p // b ) // n ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; import java . awt . Point ;

import java . io . * ; import java . util . * ; public class Main { public static PrintWriter out ; public static ArrayList < Integer > [ ] adjacencyList ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; adjacencyList = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i ++ ) adjacencyList [ i ] = new ArrayList < > ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int u = sc . nextInt ( ) , v = sc . nextInt ( ) ; u -- ; v -- ; adjacencyList [ u ] . add ( v ) ; adjacencyList [ v ] . add ( u ) ; } int minn = 1 , maxx = n - 1 ; int root = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( adjacencyList [ i ] . size ( ) == 1 ) { root = i ; break ; } } if ( dfs ( root , root , 0 ) ) minn = 3 ; int c = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( adjacencyList [ i ] . size ( ) == 1 ) continue ; c = 0 ; for ( int j : adjacencyList [ i ] ) { if ( adjacencyList [ j ] . size ( ) == 1 ) c ++ ; } if ( c > 0 ) maxx -= ( c - 1 ) ; } out . println ( minn + " ▁ " + maxx ) ; out . close ( ) ; } public static boolean dfs ( int root , int prnt , int ht ) { boolean flg = false ; boolean haschild = false ; for ( int i = 0 ; i < adjacencyList [ root ] . size ( ) ; i ++ ) { if ( adjacencyList [ root ] . get ( i ) == prnt ) continue ; haschild = true ; flg = flg || dfs ( adjacencyList [ root ] . get ( i ) , root , ht + 1 ) ; } if ( ! haschild ) flg = flg || ( ht % 2 == 1 ) ; return flg ; }

import java . util . * ; import java . io . * ; public class Mamo { static long mod = 998244353 ; static Reader in = new Reader ( ) ; static List < Integer > G [ ] ; static boolean B = true ; static StringBuilder Sd = new StringBuilder ( ) ; public static void main ( String [ ] args ) {

n = int ( input ( ) ) g = [ [ ] for i in range ( n ) ] for i in range ( n - 1 ) : u , v = [ int ( i ) - 1 for i in input ( ) . split ( ) ] g [ u ] . append ( v ) g [ v ] . append ( u )   leaf = [ len ( i ) == 1 for i in g ] root = - 1 mx = n - 1 for i in range ( n ) : if leaf [ i ] : root = i leafs = 0 for j in g [ i ] : if leaf [ j ] : leafs += 1 if leafs > 1 : mx -= leafs - 1   stack = [ ( root , - 1 , 0 ) ] even = Truewhile len ( stack ) > 0 : i , j , d = stack . pop ( ) if leaf [ i ] and d % 2 == 1 : even = False break for k in g [ i ] : if k != j : stack . append ( ( k , i , d + 1 ) ) mn = 1 if even else 3   print ( mn , mx ) NEW_LINE

from types import GeneratorTypedef bootstrap ( f , stack = [ ] ) : def wrappedfunc ( * args , ** kwargs ) : if stack : return f ( * args , ** kwargs ) else : to = f ( * args , ** kwargs ) while True : if type ( to ) is GeneratorType : stack . append ( to ) to = next ( to ) else : stack . pop ( ) if not stack : break to = stack [ - 1 ] . send ( to ) return to return wrappedfunc   def main ( ) : NEW_LINE

from collections import defaultdict , dequefrom sys import * input = stdin . readline   n = int ( input ( ) ) graph = defaultdict ( list ) deg = [ 0 ] * nfor _ in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) graph [ a - 1 ] . append ( b - 1 ) graph [ b - 1 ] . append ( a - 1 ) deg [ a - 1 ] += 1 deg [ b - 1 ] += 1   childLeaves = defaultdict ( int ) idx = 0 for i in range ( n ) : if deg [ i ] == 1 : idx = i childLeaves [ graph [ i ] [ 0 ] ] += 1   mAx = n - 1 + ( len ( childLeaves ) ) - sum ( childLeaves . values ( ) )   dis = defaultdict ( int ) dis [ idx ] = 0 stack = deque ( ) stack . append ( idx ) visited = [ 0 ] * nvisited [ idx ] = 1 mIn = 1   while stack : node = stack . pop ( ) if not visited [ node ] : visited [ node ] = 1 for i in graph [ node ] : if not visited [ i ] : dis [ i ] = dis [ node ] + 1 stack . append ( i ) if deg [ i ] == 1 and dis [ i ] % 2 : mIn = 3   print ( mIn , mAx ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { private static int root ( int [ ] parentIds , int c ) { while ( c != parentIds [ c ] ) { parentIds [ c ] = parentIds [ parentIds [ c ] ] ; c = parentIds [ c ] ; } return c ; } private static boolean union ( int [ ] parentIds , int [ ] groupSizes , int a , int b ) { int rootA = root ( parentIds , a ) ; int rootB = root ( parentIds , b ) ; if ( rootA == rootB ) { return false ; } if ( groupSizes [ rootA ] < groupSizes [ rootB ] ) { parentIds [ rootA ] = rootB ; groupSizes [ rootB ] += groupSizes [ rootA ] ; } else { parentIds [ rootB ] = rootA ; groupSizes [ rootA ] += groupSizes [ rootB ] ; } return true ; } public static void main ( String [ ] args ) throws IOException {

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 N ; List < Integer > [ ] adj ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ;   LinkedList < Integer > freeSet = new LinkedList < > ( ) ; int [ ] a = new int [ N + 1 ] ; UnionFind uf = new UnionFind ( N ) ; int count = 0 ;   int root = - 1 ; for ( int u = 1 ; u <= N ; u ++ ) { int v = in . nextInt ( ) ; a [ u ] = v ;   if ( uf . findParent ( u ) != uf . findParent ( v ) ) { uf . merge ( u , v ) ; continue ; }   if ( u == v && root == - 1 ) { root = u ; continue ; }   count ++ ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) par = [ ] for i in range ( n ) : if a [ i ] == i + 1 : par . append ( i ) v = [ False for i in range ( n ) ] for i in par : v [ i ] = Trueccl = [ ] for i in range ( n ) : if v [ i ] : continue s = [ i ] v [ i ] = True p = set ( s ) t = True while s and t : x = s . pop ( ) j = a [ x ] - 1 if j in p : ccl . append ( j ) t = False else : s . append ( j ) p . add ( j ) if v [ j ] : t = False else : v [ j ] = Trueif len ( par ) == 0 : print ( len ( ccl ) ) c = ccl [ 0 ] a [ c ] = c + 1 for i in range ( 1 , len ( ccl ) ) : a [ ccl [ i ] ] = c + 1 print ( * a ) else : print ( len ( ccl ) + len ( par ) - 1 ) c = par [ 0 ] for i in range ( 1 , len ( par ) ) : a [ par [ i ] ] = c + 1 for i in range ( len ( ccl ) ) : a [ ccl [ i ] ] = c + 1 print ( * a ) NEW_LINE


import java . util . * ; import java . io . * ; public class A { static FastReader in = new FastReader ( ) ; static final Random random = new Random ( ) ; static long mod = 1000000007L ; static HashMap < Integer , Integer > map = new HashMap < > ( ) ;   public static void main ( String args [ ] ) throws IOException { int t = in . nextInt ( ) ; StringBuilder res = new StringBuilder ( ) ; loop : while ( t -- > 0 ) { StringBuilder temp = new StringBuilder ( ) ; Queue < Integer > q = new LinkedList < > ( ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = in . nextInt ( ) ; if ( x % 2 != 0 ) { q . add ( i + 1 ) ; } } if ( q . size ( ) < k ) { res . append ( " NO \n " ) ; continue loop ; } k -- ; while ( k -- > 0 ) { temp . append ( q . poll ( ) + " ▁ " ) ; } if ( q . size ( ) % 2 != 0 ) { temp . append ( n ) ; res . append ( " YES \n " ) ;

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

import java . util . * ; import java . util . * ; import java . io . BufferedReader ; import java . io . FileNotFoundException ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class oddz { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = sc . nextArr ( n ) ; int c1 = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] % 2 != 0 ) { c1 ++ ; } } if ( ( ( c1 % 2 == 0 && k % 2 == 0 ) || ( c1 % 2 != 0 && k % 2 != 0 ) ) && c1 >= k ) { System . out . println ( " YES " ) ; c1 = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( ( c1 + 1 ) == k ) { System . out . print ( a . length ) ; break ; } else if ( a [ i ] % 2 != 0 && ( c1 + 1 ) != k ) { System . out . print ( ( i + 1 ) + " ▁ " ) ; c1 ++ ; }   } System . out . println ( ) ;   }   else { System . out . println ( " NO " ) ; } }   pw . flush ( ) ; pw . close ( ) ; }   public static int findMaxSumSubarray ( int [ ] arr , int k ) { int maxValue = Integer . MIN_VALUE ; int currentRunningSum = 0 ; for ( int i = 0 ; i < arr . length ; i ++ ) { currentRunningSum += arr [ i ] ; if ( i >= k - 1 ) { maxValue = Math . max ( maxValue , currentRunningSum ) ; currentRunningSum -= arr [ i - ( k - 1 ) ] ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class B { public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n , k ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; List < Integer > l = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { int val = sc . nextInt ( ) ; if ( val % 2 != 0 ) { l . add ( i ) ; } } if ( l . size ( ) >= k && ( l . size ( ) - k ) % 2 == 0 ) { System . out . println ( " YES " ) ; for ( int i = 0 ; i < k - 1 ; i ++ ) { System . out . print ( l . get ( i ) + " ▁ " ) ; } System . out . println ( n ) ; } else { System . out . println ( " NO " ) ; } } } static class RealScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

import sys , math , itertoolsfrom collections import Counter , deque , defaultdictfrom bisect import bisect_left , bisect_right from heapq import heappop , heappush , heapifymod = 10 ** 9 + 7 INF = float ( ' inf ' ) def inp ( ) : return int ( sys . stdin . readline ( ) ) def inpl ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def inpl_1 ( ) : return list ( map ( lambda x : int ( x ) - 1 , sys . stdin . readline ( ) . split ( ) ) ) def inps ( ) : return sys . stdin . readline ( ) def inpsl ( x ) : tmp = sys . stdin . readline ( ) ; return list ( tmp [ : x ] ) def err ( x ) : print ( x ) ; exit ( )   for _ in range ( inp ( ) ) : n , k = inpl ( ) a = inpl ( ) cnt = 0 for i in range ( n ) : NEW_LINE

for _ in range ( int ( input ( ) ) ) : n , k = map ( int , input ( ) . split ( ) ) ; ans = [ ] ; idx = 0 ; summ = 0 arr = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : summ += arr [ i ] if summ % 2 == 1 and len ( ans ) != k - 1 : ans . append ( i + 1 ) ; summ = 0 ; if summ % 2 == 1 and len ( ans ) == k - 1 : print ( " YES " ) ; ans . append ( n ) ; print ( * ans ) else : print ( " NO " ) NEW_LINE

q = int ( input ( ) ) while q > 0 : q -= 1 n_k = input ( ) n_k = n_k . split ( ) n = int ( n_k [ 0 ] ) k = int ( n_k [ 1 ] ) s = 0 list_a = input ( ) list_a = list_a . split ( " ▁ " ) for i in range ( n ) : list_a [ i ] = int ( list_a [ i ] ) s = s + list_a [ i ] if ( s % 2 == 0 and k % 2 != 0 ) or ( s % 2 != 0 and k % 2 == 0 ) : print ( " NO " ) continue border = [ ] temp_sum = 0 if k != 1 : for i in range ( n ) : temp_sum = temp_sum + list_a [ i ] if temp_sum % 2 != 0 : border . append ( i + 1 ) temp_sum = 0 if len ( border ) == k - 1 : break temp_len = len ( border ) if temp_len == k - 1 : print ( " YES " ) else : print ( " NO " ) continue for i in range ( temp_len ) : print ( border [ i ] , end = " ▁ " ) print ( n ) else : print ( " YES " ) print ( n ) NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : n , k = map ( int , input ( ) . split ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) [ : n ] r = 0 ind = [ ] for i in range ( n ) : if lst [ i ] % 2 != 0 : r = r + 1 ind . append ( i + 1 ) if r == k : print ( " YES " ) for i in range ( k - 1 ) : print ( ind [ i ] , end = " ▁ " ) print ( n ) elif r >= k : if ( r - ( k - 1 ) ) % 2 != 0 : print ( " YES " ) for i in range ( k - 1 ) : print ( ind [ i ] , end = " ▁ " ) print ( n ) else : print ( " NO " ) else : print ( " NO " ) NEW_LINE


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

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ; while ( t -- > 0 ) { long n = scn . nextLong ( ) ; long x = 1 ; long ans = 0 ; long stair = 1 ; while ( n - x >= 0 ) { n = n - x ; ans ++ ; stair = stair * 2 + 1 ; x = stair * ( stair + 1 ) / 2 ; } System . out . println ( ans ) ; } } }

arr = [ 1 ] NEW_LINE for j in range ( 1 , 30 ) : arr . append ( arr [ - 1 ] + 2 ** j ) NEW_LINE new_arr = [ ] NEW_LINE for j in arr : new_arr . append ( ( j * ( j + 1 ) ) // 2 ) NEW_LINE for j in range ( 1 , len ( arr ) ) : new_arr [ j ] += new_arr [ j - 1 ]   import bisectt = int ( input ( ) ) NEW_LINE for i in range ( t ) : n = int ( input ( ) ) NEW_LINE x = bisect . bisect ( new_arr , n ) NEW_LINE print ( x )   NEW_LINE

for i in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE j = 0 NEW_LINE while n >= 0 : j += 1 NEW_LINE c = 2 ** j - 1 NEW_LINE n -= ( c * ( c + 1 ) ) // 2 NEW_LINE print ( j - 1 ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE sum1 = 0 NEW_LINE base = 1 NEW_LINE ans = 0 NEW_LINE while sum1 <= n : sum1 += ( base * ( base + 1 ) ) // 2 NEW_LINE base = ( base * 2 ) + 1 NEW_LINE ans += 1 NEW_LINE print ( ans - 1 ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = - 1 NEW_LINE x = 0 NEW_LINE while x <= n : a += 1 NEW_LINE k = 2 ** ( a + 1 ) - 1 NEW_LINE x += k * ( k + 1 ) // 2 NEW_LINE print ( a ) NEW_LINE

def fun ( x ) : i = 1 ; ct = 0 NEW_LINE while i < 32 and x > 0 : x -= ( 2 ** ( i - 1 ) ) * ( ( 2 ** i ) - 1 ) NEW_LINE i += 1 ; NEW_LINE ct += 1 NEW_LINE return ct if x == 0 else ct - 1 NEW_LINE for _ in range ( int ( input ( ) ) ) : x = int ( input ( ) )   print ( fun ( x ) ) NEW_LINE