import java . util . * ; import java . io . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String x = sc . next ( ) ; if ( n == 1 & x . equals ( "10" ) ) { System . out . println ( - 1 ) ; return ; } if ( x . equals ( "10" ) ) { while ( n -- > 2 ) { x += "0" ; } } else { while ( n -- > 1 ) { x += "0" ; } } System . out . println ( x ) ; } }

import java . math . * ; import java . util . * ;   public class olesyaNRodion { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; String s = " " ; if ( t == 10 && n < 2 ) System . out . println ( " - 1" ) ; else if ( t == 10 && n >= 2 ) { for ( int i = 0 ; i < n - 1 ; ++ i ) s += Integer . toString ( 1 ) ; s += Integer . toString ( 0 ) ; System . out . println ( s ) ; } else { for ( int i = 0 ; i < n ; ++ i ) s += Integer . toString ( t ) ; System . out . println ( s ) ; } } }

import java . util . Scanner ; import java . lang . Math ;   public class p584a_Olesya_and_Rodion { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; int t = input . nextInt ( ) ; if ( n == 1 ) { if ( t == 10 ) { System . out . print ( - 1 ) ; } else { System . out . print ( t ) ; } } else { if ( t == 10 ) { t -- ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { System . out . print ( t ) ; } System . out . print ( 0 ) ; } } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ;

x , y = map ( int , input ( ) . split ( ) ) if y < 10 : for i in range ( x ) : print ( y , end = " " ) else : if x == 1 : print ( - 1 ) else : s = 10 ** ( x - 1 ) print ( s ) NEW_LINE

n , t = map ( int , input ( ) . split ( " ▁ " ) )   for i in range ( 10 ** ( n - 1 ) , 10 ** ( n ) ) : if ( i % t == 0 ) : print ( i ) breakelse : print ( - 1 ) NEW_LINE

n , t = map ( int , input ( ) . split ( ) ) if t == 10 : if n == 1 : print ( - 1 ) else : print ( '1' + '0' * ( n - 1 ) ) else : print ( str ( t ) * n ) NEW_LINE


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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main {

import java . io . * ; import java . util . * ; import java . util . stream . Collectors ;   public class cpp { 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 ( ) ) ; } char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } 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 {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B222 {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( br . readLine ( ) ) ; int R = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int C = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int Q = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int [ ] [ ] A = new int [ R ] [ C ] ; for ( int r = 0 ; r < R ; r ++ ) { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; for ( int c = 0 ; c < C ; c ++ ) { A [ r ] [ c ] = Integer . parseInt ( tokenizer . nextToken ( ) ) ; } } int [ ] rows = new int [ R ] ; int [ ] columns = new int [ C ] ; for ( int r = 0 ; r < R ; r ++ ) { rows [ r ] = r ; } for ( int c = 0 ; c < C ; c ++ ) { columns [ c ] = c ; } StringBuilder output = new StringBuilder ( ) ; for ( int q = 0 ; q < Q ; q ++ ) { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; char type = tokenizer . nextToken ( ) . charAt ( 0 ) ; int x = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ; int y = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ; if ( type == ' c ' ) { int temp = columns [ x ] ; columns [ x ] = columns [ y ] ; columns [ y ] = temp ; } else if ( type == ' r ' ) { int temp = rows [ x ] ; rows [ x ] = rows [ y ] ; rows [ y ] = temp ; } else { int answer = A [ rows [ x ] ] [ columns [ y ] ] ; output . append ( answer ) . append ( ' \n ' ) ; } } System . out . print ( output ) ; }   }

n , m , k = list ( map ( int , input ( ) . split ( ) ) ) matrix = [ input ( ) . split ( ) for i in range ( n ) ] row = [ i for i in range ( n ) ] col = [ i for i in range ( m ) ]   ans = [ ] for i in range ( k ) : s , x , y = input ( ) . split ( ) x , y = int ( x ) - 1 , int ( y ) - 1 if s == " c " : col [ x ] , col [ y ] = col [ y ] , col [ x ] elif s == " r " : row [ x ] , row [ y ] = row [ y ] , row [ x ] else : ans . append ( matrix [ row [ x ] ] [ col [ y ] ] )   print ( " \n " . join ( ans ) ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) a = [ input ( ) . split ( ) for _ in ' ▁ ' * n ] r = { str ( i ) : i - 1 for i in range ( 1 , n + 1 ) } c = { str ( i ) : i - 1 for i in range ( 1 , m + 1 ) } ans = [ ] for _ in range ( k ) : ch , x , y = input ( ) . split ( ) if ch == ' c ' : c [ x ] , c [ y ] = c [ y ] , c [ x ] elif ch == ' r ' : r [ x ] , r [ y ] = r [ y ] , r [ x ] else : ans . append ( a [ r [ x ] ] [ c [ y ] ] ) print ( ' \n ' . join ( ans ) ) NEW_LINE

row , col , k = map ( int , input ( ) . split ( " ▁ " ) ) li = [ ] res = [ ] for x in range ( row ) : li . append ( input ( ) . split ( " ▁ " ) )     rowchange = [ x for x in range ( row ) ] colchange = [ x for x in range ( col ) ]     for x in range ( k ) : type , i1 , i2 = input ( ) . split ( ) i1 = int ( i1 ) - 1 i2 = int ( i2 ) - 1 if type == " r " : rowchange [ i2 ] , rowchange [ i1 ] = rowchange [ i1 ] , rowchange [ i2 ] elif type == ' c ' :   colchange [ i1 ] , colchange [ i2 ] = colchange [ i2 ] , colchange [ i1 ]   else : NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) R = { str ( i ) : i - 1 for i in range ( n + 1 ) } C = { str ( i ) : i - 1 for i in range ( m + 1 ) } ans = [ ] l = [ input ( ) . split ( ) for i in range ( n ) ] for i in range ( k ) : q , x , y = input ( ) . split ( ) if q == ' c ' : C [ x ] , C [ y ] = C [ y ] , C [ x ] elif q == ' r ' : R [ x ] , R [ y ] = R [ y ] , R [ x ] else : ans . append ( l [ R [ x ] ] [ C [ y ] ] ) print ( ' \n ' . join ( ans ) ) NEW_LINE


import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ;   public class Lecture { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; short n = Short . parseShort ( scanner . next ( ) ) ; short m = Short . parseShort ( scanner . next ( ) ) ; HashMap < String , String > words = new HashMap < > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { words . put ( scanner . next ( ) , scanner . next ( ) ) ; } ArrayList < String > lecture = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { lecture . add ( scanner . next ( ) ) ; } solve ( lecture , words ) ; }   public static void solve ( ArrayList < String > lecture , HashMap < String , String > words ) { for ( int i = 0 ; i < lecture . size ( ) ; i ++ ) { if ( words . get ( lecture . get ( i ) ) . length ( ) < lecture . get ( i ) . length ( ) ) lecture . set ( i , words . get ( lecture . get ( i ) ) ) ; } for ( int i = 0 ; i < lecture . size ( ) - 1 ; i ++ ) { System . out . print ( lecture . get ( i ) + " ▁ " ) ; } System . out . println ( lecture . get ( lecture . size ( ) - 1 ) ) ; } }

import java . util . HashMap ; import java . util . Scanner ;   public class Lecture { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; HashMap < String , String > words = new HashMap < > ( ) ; String [ ] lecture = new String [ n ] ; String res = " " ;   for ( int i = 0 ; i < m ; i ++ ) { words . put ( scanner . next ( ) , scanner . next ( ) ) ; } for ( int i = 0 ; i < n ; i ++ ) { lecture [ i ] = scanner . next ( ) ; }   for ( int i = 0 ; i < n ; i ++ ) { if ( lecture [ i ] . length ( ) > words . get ( lecture [ i ] ) . length ( ) ) { res = res . concat ( words . get ( lecture [ i ] ) ) ; res = res . concat ( " ▁ " ) ; } else { res = res . concat ( lecture [ i ] ) ; res = res . concat ( " ▁ " ) ; } }   System . out . println ( res ) ;    } }

import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;    public static void solve ( int n , int m , String [ ] lang1 , String [ ] lang2 , String [ ] c ) {   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( c [ i ] . equals ( lang1 [ j ] ) ) { if ( lang1 [ j ] . length ( ) == lang2 [ j ] . length ( ) ) { System . out . print ( lang1 [ j ] + " ▁ " ) ; } else if ( lang1 [ j ] . length ( ) > lang2 [ j ] . length ( ) ) { System . out . print ( lang2 [ j ] + " ▁ " ) ; } else { System . out . print ( lang1 [ j ] + " ▁ " ) ; } } } } }   public static void main ( String [ ] args ) {   int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ;   String [ ] lang1 = new String [ m ] ; String [ ] lang2 = new String [ m ] ;   String [ ] c = new String [ n ] ;   for ( int i = 0 ; i < m ; i ++ ) { lang1 [ i ] = scan . next ( ) ; lang2 [ i ] = scan . next ( ) ; }   for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = scan . next ( ) ; } solve ( n , m , lang1 , lang2 , c ) ; } }

a , b = map ( int , input ( ) . split ( ) ) l = { } for i in range ( b ) : p , q = input ( ) . split ( ) if ( len ( q ) >= len ( p ) ) : l [ p ] = p else : l [ p ] = qk = input ( ) . split ( ) for i in k : print ( l [ i ] ) NEW_LINE

list1 = [ int ( i ) for i in input ( " " ) . split ( " ▁ " ) ] list2 = [ ] list3 = [ ] n = list1 [ 1 ] while n : list3 = [ i for i in input ( " " ) . split ( " ▁ " ) ] for i in list3 : list2 . append ( i ) n -= 1 s = input ( " " ) . split ( " ▁ " ) for i in s : if i in list2 : ind = list2 . index ( i ) if len ( list2 [ ind + 1 ] ) < len ( list2 [ ind ] ) : print ( list2 [ ind + 1 ] , end = " ▁ " ) else : print ( list2 [ ind ] , end = " ▁ " ) NEW_LINE

a , b = map ( int , input ( ) . split ( ) ) arr = { } for _ in range ( b ) : x , y = input ( ) . split ( ) arr [ x ] = y       s = input ( ) . split ( )   for i in s : val = arr [ i ] if len ( val ) < len ( i ) : print ( val , end = " ▁ " ) else : print ( i , end = " ▁ " ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) l1 = [ ] l2 = [ ]   for i in range ( m ) : s1 , s2 = input ( ) . split ( ) l1 . append ( s1 ) l2 . append ( s2 ) k = list ( input ( ) . split ( ) )   for i in range ( len ( k ) ) : l = l1 . index ( k [ i ] ) if ( len ( l2 [ l ] ) < len ( l1 [ l ] ) ) : k [ i ] = l2 [ l ] print ( * k ) NEW_LINE

a , b = ( map ( int , input ( ) . split ( ) ) ) dic = { } for i in range ( b ) : a = input ( ) . split ( ' ▁ ' ) if ( len ( a [ 0 ] ) > len ( a [ 1 ] ) ) : dic [ a [ 0 ] ] = a [ 1 ] dic [ a [ 1 ] ] = a [ 1 ] else : dic [ a [ 0 ] ] = a [ 0 ] dic [ a [ 1 ] ] = a [ 0 ] t = input ( ) . split ( ) for i in range ( len ( t ) ) : print ( dic [ t [ i ] ] , end = ' ▁ ' ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Solution { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; Long a [ ] = sc . readArray ( n ) ; Long maxi = 0L , ans = 0L ; for ( int i = 0 ; i < n ; i ++ ) { maxi = Math . max ( maxi , a [ i ] ) ; a [ i ] = maxi - a [ i ] ; } Long prev = 0L ; for ( int i = 0 ; i < n ; i ++ ) if ( a [ i ] >= prev ) prev = a [ i ] ; else { ans += prev - a [ i ] ; prev = a [ i ] ; } System . out . println ( ans + prev ) ; } static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } Long [ ] readArray ( int n ) { Long [ ] a = new Long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } }

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

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

n = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) c = 0 s = 0 for i in range ( 1 , n ) : x [ i ] += c if x [ i ] < x [ i - 1 ] : c += x [ i - 1 ] - x [ i ] x [ i ] = x [ i - 1 ] print ( c ) NEW_LINE

m = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) t = 0 print ( sum ( l [ i ] - l [ i + 1 ] for i in range ( m - 1 ) if l [ i ] > l [ i + 1 ] ) ) NEW_LINE

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


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

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . util . ArrayList ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BCountSubrectangles solver = new BCountSubrectangles ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BCountSubrectangles { public void solve ( int testNumber , FastReader in , PrintWriter out ) { int n = in . nextInt ( ) , m = in . nextInt ( ) , k = in . nextInt ( ) ; int [ ] a = in . readArray ( n ) , b = in . readArray ( m ) ; ArrayList < Integer > divisors = func . getDivisors ( k ) ; long ans = 0 ; for ( Integer row : divisors ) { int cnt = 0 , rowCnt = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( a [ i ] == 1 ) { cnt ++ ; } else { if ( cnt >= row ) { rowCnt += cnt - row + 1 ; } cnt = 0 ; } } if ( cnt >= row ) { rowCnt += cnt - row + 1 ; } int col = k / row , colCnt = 0 ; cnt = 0 ; for ( int i = 0 ; i < m ; ++ i ) { if ( b [ i ] == 1 ) { cnt ++ ; } else { if ( cnt >= col ) { colCnt += cnt - col + 1 ; } cnt = 0 ; } } if ( cnt >= col ) { colCnt += cnt - col + 1 ; } ans += ( long ) rowCnt * colCnt ; } out . println ( ans ) ; }   }   static class func { public static ArrayList < Integer > getDivisors ( int n ) {

''' ▁ ▁ ▁ ▁ Auther : ▁ ghoshashis545 ▁ Ashis ▁ Ghosh ▁ ▁ ▁ ▁ College : ▁ jalpaiguri ▁ Govt ▁ Enggineering ▁ College  ''' from os import pathfrom io import BytesIO , IOBaseimport sysfrom heapq import heappush , heappopfrom functools import cmp_to_key as ctkfrom collections import deque , Counter , defaultdict as dd from bisect import bisect , bisect_left , bisect_right , insort , insort_left , insort_rightfrom itertools import permutationsfrom datetime import datetimefrom math import ceil , sqrt , log , gcddef ii ( ) : return int ( input ( ) ) def si ( ) : return input ( ) . rstrip ( ) def mi ( ) : return map ( int , input ( ) . split ( ) ) def li ( ) : return list ( mi ( ) ) abc = ' abcdefghijklmnopqrstuvwxyz ' mod = 1000000007 NEW_LINE

from collections import defaultdict   t = 1 for _ in range ( t ) : n , m , k = [ int ( i ) for i in input ( ) . split ( ) ] a = [ int ( i ) for i in input ( ) . split ( ) ] b = [ int ( i ) for i in input ( ) . split ( ) ] cont_ones = [ ] count = 0 for i in range ( n ) : if a [ i ] == 1 : count += 1 else : cont_ones . append ( count ) count = 0 if count > 0 : cont_ones . append ( count ) Dict_a = defaultdict ( int ) for i in range ( len ( cont_ones ) ) : for j in range ( 1 , min ( k + 1 , cont_ones [ i ] + 1 ) ) : Dict_a [ j ] += ( cont_ones [ i ] - j + 1 ) cont_ones = [ ] count = 0 for i in range ( m ) : if b [ i ] == 1 : count += 1 else : cont_ones . append ( count ) count = 0 if count > 0 : cont_ones . append ( count ) Dict_b = defaultdict ( int ) for i in range ( len ( cont_ones ) ) : for j in range ( 1 , min ( k + 1 , cont_ones [ i ] + 1 ) ) : Dict_b [ j ] += ( cont_ones [ i ] - j + 1 ) vals = list ( Dict_b . keys ( ) ) ans = 0 for i in vals : needed = k / i ans += ( Dict_b [ i ] * Dict_a [ needed ] ) print ( ans )         NEW_LINE

import os , sysfrom io import IOBase , BytesIOpy2 = round ( 0.5 ) if py2 : from future_builtins import ascii , filter , hex , map , oct , zip range = xrangeBUFSIZE = 8192 class FastIO ( BytesIO ) : newlines = 0 def __init__ ( self , file ) : self . _file = file self . _fd = file . fileno ( ) self . writable = ' x ' in file . mode or ' w ' in file . mode self . write = super ( FastIO , self ) . write if self . writable else None def _fill ( self ) : s = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . seek ( ( self . tell ( ) , self . seek ( 0 , 2 ) , super ( FastIO , self ) . write ( s ) ) [ 0 ] ) return s def read ( self ) : while self . _fill ( ) : pass return super ( FastIO , self ) . read ( ) def readline ( self ) : while self . newlines == 0 : s = self . _fill ( ) ; self . newlines = s . count ( b ' \n ' ) + ( not s ) self . newlines -= 1 return super ( FastIO , self ) . readline ( ) def flush ( self ) : if self . writable : os . write ( self . _fd , self . getvalue ( ) ) self . truncate ( 0 ) , self . seek ( 0 ) class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable if py2 : self . write = self . buffer . write self . read = self . buffer . read self . readline = self . buffer . readline else : self . write = lambda s : self . buffer . write ( s . encode ( ' ascii ' ) ) self . read = lambda : self . buffer . read ( ) . decode ( ' ascii ' ) self . readline = lambda : self . buffer . readline ( ) . decode ( ' ascii ' ) sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( ' \n ' ) NEW_LINE

def gen_tbl ( a ) : n = len ( a ) ans = [ 0 ] * ( n + 1 ) so_far = 0 for i in range ( n ) : if a [ i ] == 0 : for j in range ( 1 , so_far + 1 ) : ans [ j ] += ( so_far - j + 1 ) so_far = 0 else : so_far += 1 for j in range ( 1 , so_far + 1 ) : ans [ j ] += ( so_far - j + 1 ) so_far = 0 return ans   n , m , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   ans = 0 tbl_a = gen_tbl ( a ) tbl_b = gen_tbl ( b ) for i in range ( 1 , n + 1 ) : j = k // i if k != i * j : continue if j <= m : ans += tbl_a [ i ] * tbl_b [ j ] print ( ans ) NEW_LINE

def getd ( a , n ) : d = { i : 0 for i in range ( 1 , n + 1 ) } s = 0 a . append ( 0 ) for i in range ( n + 1 ) : if a [ i ] == 1 : s += 1 else : for j in range ( 1 , s + 1 ) : d [ j ] += ( s - j + 1 ) s = 0 return d   n , m , k = list ( map ( int , input ( ) . split ( ) ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) v = int ( k ** 0.5 ) + 1 divs = [ ] for i in range ( 1 , v ) : if k % i == 0 : divs . append ( ( i , k // i ) ) da = getd ( a , n ) db = getd ( b , m ) s = 0 for i , j in divs : if i <= n and j <= m : s += da [ i ] * db [ j ] if i != j : if j <= n and i <= m : s += da [ j ] * db [ i ] print ( s ) NEW_LINE


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

import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; for ( int i = 1 ; i <= t ; i ++ ) { int r = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] ar = new int [ 3 ] ; ar [ 0 ] = r ; ar [ 1 ] = g ; ar [ 2 ] = b ; Arrays . sort ( ar ) ; if ( ( ar [ 0 ] + ar [ 1 ] ) >= ( ar [ 2 ] - 1 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; }     }     }   }

t = int ( input ( ) ) for i in range ( t ) : r , g , b = sorted ( map ( int , input ( ) . split ( ) ) ) if ( b > g + r + 1 ) : print ( " NO " ) else : print ( " YES " ) NEW_LINE

n = int ( input ( ) ) for i in range ( n ) : a , b , c = [ int ( x ) for x in input ( ) . split ( ) ] if max ( a , b , c ) == a : if b + c < a - 1 : print ( " NO " ) else : print ( " YES " ) elif max ( a , b , c ) == b : if a + c < b - 1 : print ( " NO " ) else : print ( " YES " ) else : if a + b < c - 1 : print ( " NO " ) else : print ( " YES " ) NEW_LINE

def max3 ( a , b , c ) : if max ( b , c ) == b : if max ( a , b ) == a : return a else : return b else : if max ( a , c ) == a : return a else : return cdef garland ( a , b , c ) : first = max3 ( a , b , c ) if first == a : second = max ( b , c ) third = min ( b , c ) elif first == b : second = max ( a , c ) third = min ( a , c ) else : second = max ( a , b ) third = min ( a , b ) if first > second + third + 1 : return ' No ' else : return ' Yes ' x = int ( input ( ) ) m = [ ] for i in range ( x ) : y = input ( ) z = y . split ( ' ▁ ' ) k = [ int ( t ) for t in z ] m . append ( k ) for j in range ( x ) : print ( garland ( m [ j ] [ 0 ] , m [ j ] [ 1 ] , m [ j ] [ 2 ] ) ) NEW_LINE

t = int ( input ( ) ) while ( t > 0 ) :   a , b , c = map ( int , input ( ) . split ( ) ) n = a + b + c if ( a >= b and a >= c ) : d = a elif ( b >= a and b >= c ) : d = b else : d = c   if ( n % 2 == 0 ) : if ( d <= n / 2 ) : print ( " Yes " ) else : print ( " No " ) else :   if ( d <= ( n / 2 ) + 1 ) : print ( " Yes " )   else : print ( " No " ) t -= 1                           NEW_LINE

cases = int ( input ( ) ) while cases : cases -= 1 arr = sorted ( map ( int , input ( ) . split ( ) ) )   if arr [ 0 ] + arr [ 1 ] + 1 >= arr [ 2 ] : print ( " Yes " ) else : print ( " No " ) NEW_LINE


import java . util . * ; import java . io . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . nextLine ( ) ; String s = scan . nextLine ( ) ; int Xnum = 0 ; int xnum = 0 ; StringBuilder result = new StringBuilder ( ) ; for ( int j = 0 ; j < n ; j ++ ) { char ch = s . charAt ( j ) ; if ( ch == ' X ' ) { Xnum ++ ; } else { xnum ++ ; } } if ( Xnum == xnum ) { result . append ( "0 \n " + s ) ; } else { int r = Math . max ( Xnum - n / 2 , xnum - n / 2 ) ; StringBuilder sr = new StringBuilder ( ) ; for ( int j = 0 ; j < n ; j ++ ) { char ch = s . charAt ( j ) ; if ( ch == ' X ' && Xnum > xnum && r > 0 ) { sr . append ( ' x ' ) ; r -- ; } else if ( ch == ' x ' && Xnum < xnum && r > 0 ) { sr . append ( ' X ' ) ; r -- ; } else { sr . append ( ch ) ; } } result . append ( Math . max ( Xnum - n / 2 , xnum - n / 2 ) + " \n " + sr ) ; } System . out . println ( result ) ; } }

import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 1e7 ;

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

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; String s = in . next ( ) ; int cx = 0 , cX = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) cx ++ ; else cX ++ ; } System . out . println ( Math . abs ( n / 2 - cx ) ) ; String str = " " ; int x = cx - n / 2 ; for ( int i = 0 ; i < n && x > 0 ; i ++ ) { if ( s . charAt ( i ) == ' x ' ) { s = s . substring ( 0 , i ) + ( char ) ( s . charAt ( i ) - 32 ) + s . substring ( i + 1 , n ) ; x -- ; } } x = cX - n / 2 ; for ( int i = 0 ; i < n && x > 0 ; i ++ ) { if ( s . charAt ( i ) == ' X ' ) { s = s . substring ( 0 , i ) + ( char ) ( s . charAt ( i ) + 32 ) + s . substring ( i + 1 , n ) ; x -- ; } } System . out . println ( s ) ; } }

import java . util . * ; import java . io . * ; import java . lang . * ; import java . math . BigInteger ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ;

n = int ( input ( ) )   s = input ( )   a = s . count ( ' X ' ) b = s . count ( ' x ' )   if a == b : print ( 0 ) print ( s ) else : if a > b : c = a - n // 2 s = s . replace ( ' X ' , ' x ' , c ) print ( c ) else : c = b - n // 2 print ( c ) s = s . replace ( ' x ' , ' X ' , c )   print ( s ) NEW_LINE

def solve ( s ) : u = 0 d = 0 for c in s : if c == ' X ' : u += 1 else : d += 1 res = abs ( d - u ) // 2 s = list ( s ) i = 0 while res > 0 : if s [ i ] == ' x ' and d > u : s [ i ] = ' X ' res -= 1 elif s [ i ] == ' X ' and u > d : s [ i ] = ' x ' res -= 1 i += 1 print ( abs ( d - u ) // 2 ) print ( " " . join ( s ) )             def main ( ) : n = int ( input ( ) ) s = input ( ) NEW_LINE

n = input ( ) s = input ( ) X = s . count ( ' X ' ) x = s . count ( ' x ' ) c = abs ( ( X - x ) // 2 ) print ( c ) if X > x : s = s . replace ( ' X ' , ' x ' , c ) else : s = s . replace ( ' x ' , ' X ' , c ) print ( s ) NEW_LINE

n = int ( input ( ) ) s = input ( ) cnt = s . count ( ' x ' ) - s . count ( ' X ' ) print ( abs ( cnt // 2 ) ) s = list ( s ) for i in range ( len ( s ) ) : if cnt > 0 and s [ i ] == ' x ' : s [ i ] = ' X ' cnt -= 2 elif cnt < 0 and s [ i ] == ' X ' : s [ i ] = ' x ' cnt += 2 print ( ' ' . join ( s ) ) NEW_LINE

n = int ( input ( ) ) s = input ( ) ans = [ ] c , C = 0 , 0 for i in s : if i == " x " : c += 1 else : C += 1 NEW_LINE


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 a = fs . nextInt ( ) ; int b = fs . nextInt ( ) ; int h = fs . nextInt ( ) ; String ans = fs . next ( ) ; int one = 0 ; int zero = 0 ; for ( char c : ans . toCharArray ( ) ) { if ( c == '0' ) zero ++ ; else one ++ ; } int an = 0 ; if ( a == b ) an = a * n ; else if ( a + h < b ) an = a * zero + ( a + h ) * one ; else if ( b + h < a ) an = ( b + h ) * zero + b * one ; else an = a * zero + b * one ; System . out . println ( an ) ; } } 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 . * ; public class cc { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int c0 = sc . nextInt ( ) ; int c1 = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; char a [ ] = sc . next ( ) . toCharArray ( ) ; int cnt0 = 0 , cnt1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == '0' ) cnt0 ++ ; } cnt1 = n - cnt0 ; int ans = 0 ; if ( c0 >= c1 + h ) { ans = c1 * cnt1 + ( c1 + h ) * cnt0 ; } else if ( c1 >= c0 + h ) { ans = c0 * cnt0 + ( c0 + h ) * cnt1 ; } else ans = c0 * cnt0 + c1 * cnt1 ; System . out . println ( ans ) ; } } }

import java . util . Scanner ;   public class A1440 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { in . nextInt ( ) ; int C0 = in . nextInt ( ) ; int C1 = in . nextInt ( ) ; int H = in . nextInt ( ) ; int zeros = 0 ; int ones = 0 ; String S = in . next ( ) ; for ( char c : S . toCharArray ( ) ) { if ( c == '0' ) { zeros ++ ; } else { ones ++ ; } } int cost = 0 ; if ( C0 > C1 + H ) { cost += H * zeros ; ones += zeros ; zeros = 0 ; } if ( C1 > C0 + H ) { cost += H * ones ; zeros += ones ; ones = 0 ; } cost += C0 * zeros + C1 * ones ; System . out . println ( cost ) ; } }   }

import java . util . * ; import java . util . Collections ; public class HelloWorld { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; String st = sc . next ( ) ; int f = 0 ; int s = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( st . charAt ( i ) == '0' ) f ++ ; else s ++ ; } if ( h + b < a ) { ans += h * f + b * f + b * s ; }   else if ( h + a < b ) { ans += h * s + a * f + a * s ; } else ans = a * f + b * s ; System . out . println ( ans ) ; } } }

import java . util . * ; import java . io . * ; public class Solution {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . valueOf ( br . readLine ( ) ) ; while ( t -- > 0 ) { String all = br . readLine ( ) ; String [ ] an = all . split ( " ▁ " ) ; int n = Integer . valueOf ( an [ 0 ] ) ; int co = Integer . valueOf ( an [ 1 ] ) ; int ci = Integer . valueOf ( an [ 2 ] ) ; int k = Integer . valueOf ( an [ 3 ] ) ; int cost = 0 ; int count = 0 ; String s = br . readLine ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '0' ) count ++ ; } int cos = ( count * co ) + ( ( n - count ) * ci ) ; int cos1 = ( count * k ) + ( n * ci ) ; int cos2 = ( ( n - count ) * k ) + ( n * co ) ; cost = Math . min ( cos1 , Math . min ( cos , cos2 ) ) ; System . out . println ( cost ) ; } } }

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n , c0 , c1 , h = map ( int , input ( ) . split ( ) ) NEW_LINE s = [ int ( x ) for x in str ( input ( ) [ : n ] ) ] NEW_LINE ori = c0 * s . count ( 0 ) + c1 * s . count ( 1 ) NEW_LINE x = ( h * ( s . count ( 0 ) ) ) + ( n * c1 ) NEW_LINE y = ( h * ( s . count ( 1 ) ) ) + ( n * c0 ) NEW_LINE print ( min ( ori , x , y ) ) NEW_LINE

I = inputfor NEW_LINE _ in [ 0 ] * int ( I ( ) ) : n , c , d , h = map ( int , I ( ) . split ( ) ) ; NEW_LINE k = I ( ) . count ( '0' ) ; NEW_LINE print ( min ( a * ( h - c + d ) + b * ( h + c - d ) + k * ( c - d ) + n * dfor a in ( 0 , k ) for b in ( 0 , n - k ) ) ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : n , c0 , c1 , h = input ( ) . split ( ' ▁ ' ) NEW_LINE n , c0 , c1 , h = int ( n ) , int ( c0 ) , int ( c1 ) , int ( h ) NEW_LINE digits = input ( ) NEW_LINE digit0 = digits . count ( '0' ) NEW_LINE digit1 = n - digit0 NEW_LINE if ( h >= c0 and h >= c1 ) : NEW_LINE INDENT print ( digit0 * c0 + digit1 * c1 ) elif ( c0 <= h and c1 > h ) : NEW_LINE if NEW_LINE DEDENT ( c0 + h < c1 ) : print ( digit0 * c0 + digit1 * ( c0 + h ) ) else : print ( digit0 * c0 + digit1 * c1 ) elif ( c0 > h and c1 <= h ) : NEW_LINE if ( c1 + h < c0 ) : NEW_LINE INDENT print ( digit0 * ( c1 + h ) + digit1 * c1 ) else : NEW_LINE print ( digit0 * c0 + digit1 * c1 ) else : if ( c1 < c0 and ( c1 + h ) < c0 ) : NEW_LINE print ( digit0 * ( h + c1 ) + digit1 * c1 ) elif ( c0 < c1 and ( c0 + h ) < c1 ) : NEW_LINE print ( digit0 * c0 + digit1 * ( h + c0 ) ) else : NEW_LINE print ( digit0 * c0 + digit1 * c1 ) NEW_LINE DEDENT


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class BearAndFindingCriminals { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; int n = fs . nextInt ( ) ; int location = fs . nextInt ( ) ; boolean [ ] cities = new boolean [ n ] ; int criminals = 0 ; for ( int i = 0 ; i < n ; i ++ ) { cities [ i ] = fs . nextInt ( ) == 1 ; } if ( n == 1 ) { System . out . println ( cities [ 0 ] ? 1 : 0 ) ; return ; } if ( cities [ location - 1 ] ) { criminals ++ ; } int left = location - 2 ; int right = location ; while ( true ) { if ( left >= 0 && right < n ) { if ( cities [ left ] && cities [ right ] ) { criminals += 2 ; } left -- ; right ++ ; } else if ( left == - 1 && right < n ) { criminals += cities [ right ++ ] ? 1 : 0 ; } else if ( left >= 0 && right == n ) { criminals += cities [ left -- ] ? 1 : 0 ; } else { break ; } } System . out . println ( criminals ) ; }   static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . * ;    public class Practise {

import java . util . Arrays ; import java . util . Locale ; import java . util . Scanner ; import java . lang . String ; import java . util . Random ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int m = sc . nextInt ( ) - 1 ; int mas [ ] = new int [ l ] ; for ( int i = 0 ; i < l ; i ++ ) { mas [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( mas [ i ] == 1 ) { if ( Math . abs ( i - m ) == 0 || 2 * m - i < 0 || 2 * m - i >= l || mas [ 2 * m - i ] == 1 ) { ans ++ ; } } } System . out . println ( ans ) ; } }

import sys   n , a = map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) t = list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) a = a - 1   res = 0 for i in range ( len ( t ) ) : if ( a - i ) >= 0 and ( a + i ) < len ( t ) : res += ( 1 if i == 0 else 2 ) * ( t [ a - i ] * t [ a + i ] ) elif not ( ( a - i ) >= 0 or ( a + i ) < len ( t ) ) : break elif ( a - i ) < 0 : res += t [ a + i ] else : res += t [ a - i ] print ( res )   NEW_LINE

n , a = map ( int , input ( ) . split ( ) ) criminals = [ int ( i ) for i in input ( ) . split ( ) ] if ( n == 1 or n == 2 ) : print ( criminals . count ( 1 ) ) else : if ( a - 1 < n - a ) : x = a - 1 c1 = criminals [ : 2 * a - 1 ] c2 = criminals [ 2 * a - 1 : ] else : x = n - a c2 = criminals [ : n - 2 * ( n - a ) - 1 ] c1 = criminals [ n - 2 * ( n - a ) - 1 : ] NEW_LINE

n , a = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) )   c = 0 if ( l [ a - 1 ] == 1 ) : c = c + 1 if ( len ( l ) == 1 ) : print ( c ) exit ( ) i = 0j = nwhile True : if ( abs ( j - a ) > abs ( a - i - 1 ) ) : if ( l [ j - 1 ] == 1 ) : c = c + 1 j = j - 1 elif ( abs ( j - a ) < abs ( a - i - 1 ) ) : if ( l [ i ] == 1 ) : c = c + 1 i = i + 1 elif ( abs ( j - a ) == abs ( a - i - 1 ) ) : if ( l [ i ] == 1 and l [ j - 1 ] == 1 or l [ j - 1 ] == 1 and l [ i ] == 1 ) : c = c + 2 i += 1 j -= 1   if ( i == a - 1 and j == a ) : breakprint ( c ) NEW_LINE

import pdb   def solve ( ) : m , n = map ( int , input ( ) . split ( ) ) criminals = list ( map ( int , input ( ) . split ( ) ) ) l = n - 1 r = n - 1 acc = 0 while l >= 0 or r < len ( criminals ) : if l == r : acc += criminals [ l ] else : if l >= 0 and r < len ( criminals ) : if criminals [ l ] == criminals [ r ] : acc += 2 * criminals [ l ] elif l >= 0 : acc += criminals [ l ] elif r < len ( criminals ) : acc += criminals [ r ] l -= 1 r += 1 print ( acc )   if __name__ == ' _ _ main _ _ ' : solve ( ) NEW_LINE


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

import java . util . Scanner ;   public class Race3 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int x = in . nextInt ( ) ; for ( int i = 1 ; i <= x ; i ++ ) { for ( int j = 1 ; j <= x ; j ++ ) { if ( i % j == 0 && i * j > x && i / j < x ) { System . out . println ( i + " ▁ " + j ) ; System . exit ( 0 ) ; } } } System . out . println ( - 1 ) ; } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = n , b = 1 , c = 0 ; while ( a >= b ) { if ( a % b == 0 ) { if ( a * b > n ) { if ( a / b < n ) { c ++ ; break ; } } else { b ++ ; } } else { a -- ; } } if ( c > 0 ) { System . out . println ( a + " ▁ " + b ) ; } else { System . out . println ( " - 1" ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x ; Boolean exsit = false ; Scanner input = new Scanner ( System . in ) ; x = input . nextInt ( ) ; for ( int a = 1 ; a <= x ; a ++ ) { for ( int b = 1 ; a % b == 0 ; b ++ ) { if ( a * b > x && a / b < x ) { System . out . println ( a + " ▁ " + b ) ; exsit = true ; break ; } } if ( exsit ) break ; } if ( ! exsit ) System . out . println ( - 1 ) ; } }

import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n == 1 ) System . out . println ( - 1 ) ; else if ( n == 2 | n == 3 ) System . out . println ( 2 + " ▁ " + 2 ) ; else if ( n > 3 ) { if ( ( n & 1 ) == 0 ) System . out . println ( n + " ▁ " + 2 ) ; if ( ( n & 1 ) == 1 ) System . out . println ( n - 1 + " ▁ " + 2 ) ; } } }

x = int ( input ( ) ) a = b = xif a * b > x : print ( a , b ) else : print ( - 1 ) NEW_LINE

import sys   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) return n != 1 and ( n , n ) or ( - 1 , ) print ( * main ( ) ) NEW_LINE

x = int ( input ( ) )   flag = Falsefor a in range ( 1 , x + 1 ) : for b in range ( 1 , x + 1 ) : if a % b == 0 and a * b > x and a / b < x : flag = True break if flag : breakif not flag : print ( ' - 1' ) if flag : print ( a , b ) NEW_LINE

n = int ( input ( ) ) l = [ ] for a in range ( 1 , n + 1 ) : for b in range ( 1 , n + 1 ) : if a % b == 0 and a * b > n and a / b < n : l . append ( a ) l . append ( b ) if len ( l ) > 0 : print ( l [ 0 ] , l [ 1 ] ) else : print ( - 1 )                           NEW_LINE

def main_function ( ) : x = int ( input ( ) ) for a in range ( 1 , x + 1 ) : i = 1 while i * a <= x : if i * a ** 2 > x and i < x : return f " { i ▁ * ▁ a } ▁ { a } " i += 1 return " - 1"         print ( main_function ( ) ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class x430A { public static void main ( String hi [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int M = Integer . parseInt ( st . nextToken ( ) ) ; Pair [ ] arr = new Pair [ N ] ; st = new StringTokenizer ( infile . readLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) arr [ i ] = new Pair ( Integer . parseInt ( st . nextToken ( ) ) , i ) ; Arrays . sort ( arr ) ; int tag = 0 ; int [ ] res = new int [ N ] ; for ( Pair p : arr ) { res [ p . dex ] = tag ; tag = 1 - tag ; } for ( int x : res ) System . out . print ( x + " ▁ " ) ; } } class Pair implements Comparable < Pair > { int val ; int dex ; public Pair ( int a , int b ) { val = a ; dex = b ; } public int compareTo ( Pair oth ) { return val - oth . val ; } }

import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;

import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 1e7 ;

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE

n , m = [ int ( i ) for i in input ( ) . split ( ) ] p = list ( map ( int , input ( ) . split ( ) ) ) s = [ input ( ) . split ( ) for _ in range ( m ) ] ps , result = sorted ( p ) , [ - 1 ] * nfor i in range ( n ) : if i % 2 == 0 : c = 1 else : c = 0 result [ p . index ( ps [ i ] ) ] = cprint ( * result ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : arr [ i ] = ( arr [ i ] , i ) arr . sort ( ) res = [ 0 ] * nfor i in range ( n ) : res [ arr [ i ] [ 1 ] ] = i % 2 print ( * res ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) X = [ int ( x ) for x in input ( ) . split ( ) ] segs = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( m ) ]   D = { e : i % 2 for i , e in enumerate ( sorted ( X ) ) }   for i in range ( n ) : X [ i ] = D [ X [ i ] ] print ( * X ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . stream . Collectors ;   public class CF1385B { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] hash = new int [ n + 1 ] ; int [ ] a = Arrays . stream ( br . readLine ( ) . split ( " \\ s + " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; List < Integer > perm = new ArrayList < > ( ) ; for ( final int value : a ) { if ( hash [ value ] == 0 ) { perm . add ( value ) ; hash [ value ] = 1 ; } } System . out . println ( perm . stream ( ) . map ( String :: valueOf ) . collect ( Collectors . joining ( " ▁ " ) ) ) ; } } }

import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ;   while ( t -- > 0 ) { int n = scn . nextInt ( ) ;   int [ ] arr = new int [ 2 * n ] ; HashSet < Integer > hs = new HashSet < > ( ) ;   boolean [ ] mark = new boolean [ n ] ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) { arr [ i ] = scn . nextInt ( ) ; if ( ! mark [ arr [ i ] - 1 ] ) { al . add ( arr [ i ] ) ; mark [ arr [ i ] - 1 ] = true ; } }   for ( int i = 0 ; i < n ; i ++ ) System . out . print ( al . get ( i ) + " ▁ " ) ;   System . out . println ( ) ; } } }

import static java . lang . Math . abs ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Codeforces {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > all_val = new ArrayList < > ( ) ; int big_loop = sc . nextInt ( ) ; for ( int loop = 0 ; loop < big_loop ; loop ++ ) { int num = sc . nextInt ( ) * 2 ; ArrayList < String > input = new ArrayList < > ( ) ; String ans = " " ; for ( int i = 0 ; i < num ; i ++ ) { String val = sc . nextInt ( ) + " " ; if ( input . contains ( val ) ) { ans += val + " ▁ " ; } else { input . add ( val ) ; } } all_val . add ( ans ) ; } for ( String an : all_val ) { System . out . println ( an ) ; } } }

import java . util . LinkedHashSet ; import java . util . Scanner ;   public class B1383 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int t = scanner . nextInt ( ) ; LinkedHashSet < Integer > set = new LinkedHashSet < > ( ) ;   for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; for ( int j = 0 ; j < 2 * n ; j ++ ) { int b = scanner . nextInt ( ) ; set . add ( b ) ; } for ( Integer integer : set ) { System . out . print ( integer + " ▁ " ) ; } set . clear ( ) ; System . out . println ( ) ; } } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ n * 2 ] ; String s [ ] = br . readLine ( ) . split ( " ▁ " ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) arr [ i ] = Integer . parseInt ( s [ i ] ) ; HashSet < Integer > hs = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) { if ( ! hs . contains ( arr [ i ] ) ) { System . out . print ( arr [ i ] + " ▁ " ) ; hs . add ( arr [ i ] ) ; } } System . out . println ( ) ; } } }

for _ in range ( int ( input ( ) ) ) : input ( ) ; print ( * set ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE

t = int ( input ( ) ) answer = [ ] for i in range ( t ) : n = int ( input ( ) ) li = [ int ( j ) for j in input ( ) . split ( ) ] ans = [ ] for item in li : if item not in ans : ans . append ( item ) answer . append ( ans )     for x in answer : print ( * x ) NEW_LINE

for s in [ * open ( 0 ) ] [ 2 : : 2 ] : a = list ( map ( int , s . split ( ) ) ) ans = [ ] ; used = set ( ) for n in a : if n in used : continue ans . append ( n ) ; used . add ( n ) print ( * ans ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = [ ] for i in a : if i not in b : b . append ( i ) print ( * b , sep = " ▁ " ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : a = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) u = [ ] for k in x : if k not in u : u . append ( k ) print ( * u ) NEW_LINE


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

import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000899A { static public void main ( final String [ ] args ) throws IOException { p000899A . _main ( args ) ; }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Problem { 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 ( ) ) ; String line = br . readLine ( ) ; int [ ] ar = Arrays . stream ( line . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int one = 0 , two = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ar [ i ] == 1 ) one ++ ; else two ++ ; } int sum = 0 ; if ( two == one ) sum += two ; else if ( two < one ) { sum += two ; one -= two ; sum += one / 3 ; } else { sum += one ; } System . out . println ( sum ) ; } }

import java . util . * ; import java . io . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; Scanner sc = new Scanner ( System . in ) ; int n = fr . nextInt ( ) ; int one = 0 , two = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = fr . nextInt ( ) ; if ( x == 1 ) one ++ ; else two ++ ; } if ( one == two ) System . out . print ( two ) ; else if ( one < two ) System . out . print ( one ) ; else { int ans = two ; one -= two ; ans += one / 3 ; System . out . print ( ans ) ; } } }

a = int ( input ( ) ) b = input ( ) c2 = b . count ( '2' ) c1 = b . count ( '1' ) sum = 0 sum += min ( c2 , c1 ) c1 -= c2if c1 > 0 : sum += c1 // 3 print ( sum ) NEW_LINE

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ris = 0 num2 = arr . count ( 2 ) num1 = arr . count ( 1 ) if num1 >= num2 : ris += num2 num1 -= num2 ris += num1 // 3 elif num1 <= num2 and 1 in arr : ris += num1print ( ris ) NEW_LINE

n = int ( input ( ) ) T = list ( map ( int , input ( ) . split ( ) ) ) one = T . count ( 1 ) two = T . count ( 2 ) if one == 0 or two == 0 : print ( one // 3 ) elif one <= two : print ( one ) else : print ( two + ( one - two ) // 3 ) NEW_LINE

num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ones = sum ( 1 for i in arr if i == 1 ) twos = num - ones   ans = max ( ones // 3 + min ( ones % 3 , twos ) , min ( ones , twos ) + ( ones - min ( ones , twos ) ) // 3 )   print ( ans ) NEW_LINE

n = int ( input ( ) ) nums = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) one = nums . count ( 1 ) two = nums . count ( 2 ) if one == 0 : print ( 0 ) elif two == 0 : print ( one // 3 ) else : discard = max ( one , two ) - min ( one , two ) form = len ( nums ) - discard if discard > 2 and one > two : discard = discard // 3 print ( ( form // 2 ) + discard ) else : print ( form // 2 ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintStream ;   public class _81B implements Runnable { private BufferedReader in ;   private Object solve ( ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; String s = nextToken ( ) ; for ( int i = 0 , q = 0 , n = s . length ( ) ; i < n ; i ++ ) { char x = s . charAt ( i ) ; switch ( q ) { case 0 : if ( x == ' . ' ) { sb . append ( sb . length ( ) == 0 ? " . . . " : " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x != ' ▁ ' ) { sb . append ( x ) ; q = 4 ; } break ; case 1 : if ( x == ' . ' ) { sb . append ( " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( " ▁ , " ) ; } else if ( x != ' ▁ ' ) { sb . append ( ' ▁ ' ) . append ( x ) ; q = 4 ; } break ; case 2 : q = 3 ; break ; case 3 : q = 0 ; break ; case 4 : if ( x == ' . ' ) { sb . append ( " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x == ' ▁ ' ) { q = 5 ; } else { sb . append ( x ) ; } break ; default : if ( x == ' . ' ) { sb . append ( " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x != ' ▁ ' ) { sb . append ( ' ▁ ' ) . append ( x ) ; q = 4 ; } }   } return sb ; }

import java . io . * ; import java . util . * ;   public class B implements Runnable {   private static final boolean ONLINE_JUDGE = System . getProperty ( " ONLINE _ JUDGE " ) != null ;   private BufferedReader in ; private PrintWriter out ; private StringTokenizer tok = new StringTokenizer ( " " ) ;   private void init ( ) throws FileNotFoundException { Locale . setDefault ( Locale . US ) ; String fileName = " " ; if ( ONLINE_JUDGE && fileName . isEmpty ( ) ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; } else { if ( fileName . isEmpty ( ) ) { in = new BufferedReader ( new FileReader ( " input . txt " ) ) ; out = new PrintWriter ( " output . txt " ) ; } else { in = new BufferedReader ( new FileReader ( fileName + " . in " ) ) ; out = new PrintWriter ( fileName + " . out " ) ; } } }   String readString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) ) ; } catch ( Exception e ) { return null ; } } return tok . nextToken ( ) ; }   int readInt ( ) { return Integer . parseInt ( readString ( ) ) ; }   long readLong ( ) { return Long . parseLong ( readString ( ) ) ; }   double readDouble ( ) { return Double . parseDouble ( readString ( ) ) ; }   int [ ] readIntArray ( int size ) { int [ ] a = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { a [ i ] = readInt ( ) ; } return a ; }   public static void main ( String [ ] args ) {

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String s = in . nextLine ( ) ;   s = s . replaceAll ( " ▁ { 2 , } " , " ▁ " )

a = input ( ) NEW_LINE b = ' ' NEW_LINE c = 0 NEW_LINE n = len ( a ) NEW_LINE d = 0 NEW_LINE e = 0 NEW_LINE for i in range ( n ) : if NEW_LINE a [ i ] == ' . ' : NEW_LINE if c % 3 == 0 and i != 0 and ( e == 0 or b [ - 1 ] != ' ▁ ' ) : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE b += a [ i ] NEW_LINE e += 1 NEW_LINE c += 1 NEW_LINE d = 0 elif a [ i ] == ' , ' : b += a [ i ] NEW_LINE e += 1 NEW_LINE if i != n - 1 : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE d = 0 elif a [ i ] != ' ▁ ' : NEW_LINE if d == 2 : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE b += a [ i ] NEW_LINE e += 1 NEW_LINE d = 1 else : if d == 1 : d = 2 NEW_LINE print ( b ) NEW_LINE

from sys import stdin , stdoutfrom NEW_LINE math NEW_LINE import gcd , ceil , sqrtii1 = lambda : int ( stdin . readline ( ) . strip ( ) ) NEW_LINE is1 = lambda : stdin . readline ( ) . strip ( ) NEW_LINE iia = lambda : list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE isa = lambda : stdin . readline ( ) . strip ( ) . split ( ) NEW_LINE mod = 1000000007   s = is1 ( ) NEW_LINE res = " " NEW_LINE for j , i in enumerate ( s ) : if NEW_LINE i == ' , ' : res += " , ▁ " elif i . isdigit ( ) : NEW_LINE if s [ j - 1 ] == " ▁ " and res [ - 1 ] . isdigit ( ) : res += " ▁ " NEW_LINE res += i elif i == " . " : NEW_LINE if len ( res ) > 0 and res [ - 1 ] != " ▁ " and res [ - 1 ] != " . " : res += " ▁ " NEW_LINE if len ( res ) >= 3 and res [ - 1 ] == " . " and res [ - 2 ] == ' . ' and res [ - 3 ] == ' . ' : res += " ▁ " NEW_LINE res += " . " elif i == " ▁ " : NEW_LINE if len ( res ) > 0 and res [ - 1 ] not in "0123456789 ▁ . " : res += " ▁ " NEW_LINE print ( res . strip ( ) ) NEW_LINE

s = input ( ) NEW_LINE ans = ' ▁ ' . join ( s . split ( ) ) NEW_LINE ans = ans . replace ( ' , ▁ ' , ' , ' ) NEW_LINE ans = ans . replace ( ' ▁ , ' , ' , ' ) NEW_LINE ans = ans . replace ( ' , ' , ' , ▁ ' ) NEW_LINE ans = ans . replace ( ' . . . ▁ ' , ' . . . ' ) NEW_LINE ans = ans . replace ( ' ▁ . . . ' , ' . . . ' ) NEW_LINE ans = ans . replace ( ' . . . ' , ' ▁ . . . ' ) NEW_LINE if ans [ 0 ] == ' ▁ ' : ans = ans [ : 0 ] + ans [ 1 : ] NEW_LINE if ans [ - 1 ] == ' ▁ ' : ans = ans [ : - 1 ] NEW_LINE print ( ans ) NEW_LINE


import java . util . Scanner ; import java . math . * ;   public class Main { static long mul [ ] = new long [ 100010 ] ; static long res = 0 ; static long ans = 0 ;   static void dfs ( long x , int len , long s ) { if ( x <= 7 ) { if ( res < len + x ) { res = len + x ; ans = s + x ; } else if ( res == len + x && ans < s + x ) ans = s + x ; return ; } int lb = 1 , ub = 100000 ; int ans = 1 ; while ( ub >= lb ) { int mid = ub + lb >> 1 ; if ( mul [ mid ] > x ) { ub = mid - 1 ; } else { lb = mid + 1 ; ans = mid ; } } dfs ( x - mul [ ans ] , len + 1 , s + mul [ ans ] ) ; dfs ( mul [ ans ] - mul [ ans - 1 ] - 1 , len + 1 , s + mul [ ans - 1 ] ) ; }   public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; for ( int i = 1 ; i <= 100000 ; i ++ ) mul [ i ] = ( long ) i * i * i ; long m = cin . nextLong ( ) ; dfs ( m , 0 , 0 ) ; System . out . println ( res + " ▁ " + ans ) ; } }

import math   def steps ( m , dct ) : if m <= 7 : return m if dct . get ( m ) : return dct [ m ] x = math . floor ( m ** ( 1 / 3 ) ) dct [ m ] = 1 + steps ( max ( m - x ** 3 , ( x ** 3 - 1 ) - ( x - 1 ) ** 3 ) , dct ) return dct [ m ]   if __name__ == " _ _ main _ _ " : m = int ( input ( ) ) total_blocks_used = 0 total_vol = 0 steps_dct = { } while ( m > 0 ) : x = math . floor ( m ** ( 1 / 3 ) ) if steps ( m , steps_dct ) == 1 + steps ( m - x ** 3 , steps_dct ) : m -= x ** 3 total_vol += x ** 3 else : m = x ** 3 - 1 - ( x - 1 ) ** 3 total_vol += ( x - 1 ) ** 3 total_blocks_used += 1 print ( f " { total _ blocks _ used } ▁ { total _ vol } " ) NEW_LINE

import math   def root ( m ) : ret = m ** ( 1.0 / 3.0 ) if ( math . ceil ( ret ) ** 3 == m ) : ret = math . ceil ( ret ) else : ret = math . floor ( ret ) return ret   F = { }   def f ( m ) : if ( m < 0 ) : return [ - 1e5 - 10 , - 1e15 - 1 ] if ( m <= 7 ) : return [ m , m ] rootm = root ( m ) ans1 = [ 0 , 0 ] ans2 = [ 0 , 0 ] ans1 = f ( m - rootm ** 3 ) if ( rootm != 1 ) : ans2 = f ( rootm ** 3 - 1 - ( rootm - 1 ) ** 3 ) ; ans2 [ 1 ] += ( rootm - 1 ) ** 3 ; ans2 [ 0 ] += 1 ; ans1 [ 1 ] += rootm ** 3 ; ans1 [ 0 ] += 1 ; if ( ans1 [ 0 ] > ans2 [ 0 ] ) : return ans1 elif ( ans1 [ 0 ] < ans2 [ 0 ] ) : return ans2 else : if ( ans1 [ 1 ] > ans2 [ 1 ] ) : return ans1 else : return ans2   m = int ( input ( ) ) ans = f ( m ) print ( ans [ 0 ] , ans [ 1 ] )   NEW_LINE

def cube ( a ) : return a ** 3     def steps ( m ) : if m <= 7 : return m x = 1 while cube ( x + 1 ) <= m : x += 1 return 1 + steps ( max ( m - cube ( x ) , cube ( x ) - 1 - cube ( x - 1 ) ) )     class CodeforcesTask679BSolution : def __init__ ( self ) : self . result = ' ' self . m = 0   def read_input ( self ) : self . m = int ( input ( ) )   def process_task ( self ) : sub = 0 ste = 0 while self . m : ste += 1 x = 1 while cube ( x + 1 ) <= self . m : x += 1 if steps ( self . m ) == 1 + steps ( self . m - cube ( x ) ) : self . m -= cube ( x ) sub += cube ( x ) else : self . m = cube ( x ) - 1 - cube ( x - 1 ) sub += cube ( x - 1 ) self . result = " { 0 } ▁ { 1 } " . format ( ste , sub )   def get_result ( self ) : return self . result     if __name__ == " _ _ main _ _ " : Solution = CodeforcesTask679BSolution ( ) Solution . read_input ( ) Solution . process_task ( ) print ( Solution . get_result ( ) ) NEW_LINE

B1 = 0 B2 = 0 def solve ( rem , step , sub ) : global B1 , B2 if rem == 0 : if ( step == B1 ) : B2 = max ( B2 , sub ) if ( step > B1 ) : B1 = step B2 = sub return cnt = 1 while ( ( cnt + 1 ) ** 3 <= rem ) : cnt += 1 solve ( rem - cnt ** 3 , step + 1 , sub + cnt ** 3 ) if ( cnt > 0 ) : solve ( cnt ** 3 - 1 - ( cnt - 1 ) ** 3 , step + 1 , sub + ( cnt - 1 ) ** 3 )     x = int ( input ( ) ) solve ( x , 0 , 0 ) print ( B1 , B2 ) NEW_LINE

B = ( 0 , 0 ) def solve ( rem , step , sub ) : global B if rem == 0 : B = max ( B , ( step , sub ) ) return cnt = 1 while ( ( cnt + 1 ) ** 3 <= rem ) : cnt += 1 solve ( rem - cnt ** 3 , step + 1 , sub + cnt ** 3 ) if ( cnt > 0 ) : solve ( cnt ** 3 - 1 - ( cnt - 1 ) ** 3 , step + 1 , sub + ( cnt - 1 ) ** 3 )     x = int ( input ( ) ) solve ( x , 0 , 0 ) print ( B [ 0 ] , B [ 1 ] ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static FileWriter fw ; static long oo = Long . MAX_VALUE ;

import java . io . FileInputStream ; import java . io . InputStream ; import java . util . * ;    public class powersoftwo {   public static void main ( String [ ] args ) throws Exception { FastIO sc = new FastIO ( System . in ) ; int N = sc . nextInt ( ) ; TreeSet < Integer > powersOfTwo = new TreeSet < Integer > ( ) ; int val = 1 ; for ( int i = 0 ; i < 31 ; i ++ ) { powersOfTwo . add ( val ) ; val *= 2 ; } HashMap < Integer , Integer > hmap = new HashMap < Integer , Integer > ( ) ; int [ ] arr = new int [ N ] ; long pairs = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int a = sc . nextInt ( ) ; Iterator < Integer > iter = powersOfTwo . tailSet ( a ) . iterator ( ) ; while ( iter . hasNext ( ) ) { int pow = iter . next ( ) ; if ( hmap . containsKey ( pow - a ) ) {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class PowersOfTwo { public static TreeMap < Integer , Integer > tm = new TreeMap < > ( ) ;   public static long matches ( int x ) { int ans = 0 ;   int sum = 2 ; for ( int i = 1 ; i <= 30 ; i ++ ) { int y = sum - x ; if ( tm . containsKey ( y ) ) ans += tm . get ( y ) ; sum <<= 1 ; } return ans ; }   public static void addToTreeMap ( int x ) { int freq = 0 ; if ( tm . containsKey ( x ) ) freq = tm . get ( x ) ;   tm . put ( x , freq + 1 ) ; }   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   int n = Integer . parseInt ( br . readLine ( ) ) ;   long ans = 0 ;   StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ;    for ( int i = 0 ; i < n ; i ++ ) { int a = Integer . parseInt ( st . nextToken ( ) ) ; ans += matches ( a ) ; addToTreeMap ( a ) ; }   System . out . println ( ans ) ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . util . HashMap ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; EPowersOfTwo solver = new EPowersOfTwo ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class EPowersOfTwo { int n ; int [ ] arr ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { readInput ( sc ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j < 31 ; j ++ ) { ans += map . getOrDefault ( ( 1 << j ) - arr [ i ] , 0 ) ; } map . put ( arr [ i ] , map . getOrDefault ( arr [ i ] , 0 ) + 1 ) ; } pw . println ( ans ) ; }   }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

import java . io . * ; import java . util . * ; import java . math . BigInteger ; import java . lang . Object ;    public class Main { static class sort implements Comparator < int [ ] > { public int compare ( int [ ] a , int [ ] b ) {

lst = [ 2 ** i for i in range ( 1 , 34 ) ] s = dict ( ) n = int ( input ( ) ) ss = [ int ( i ) for i in input ( ) . split ( ) ] sss = 0 for i in range ( 0 , n ) : for j in lst : if j - ss [ i ] in s : sss += s [ j - ss [ i ] ] if ss [ i ] in s : s [ ss [ i ] ] += 1 else : s [ ss [ i ] ] = 1 print ( sss ) NEW_LINE

from collections import Counter     def solve ( a ) : res = 0 c = Counter ( a ) for e in a : for p in range ( 31 ) : power = 2 ** p r = power - e if r in c : res += c [ r ] - ( 1 if r == e else 0 ) assert res % 2 == 0 return res // 2     input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a ) ) NEW_LINE

from math import log2 , ceildef powerof2 ( k ) : if ( 2 ** ( ceil ( log2 ( k ) ) ) == k ) : return ceil ( log2 ( k ) + 1 ) return ceil ( log2 ( k ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in a : try : d [ i ] += 1 except : d [ i ] = 1 c = 0 y = max ( a ) for i in a : r = powerof2 ( i ) for j in range ( r , 33 ) : if ( 2 ** j - i > y ) : break if ( 2 ** j - i == i ) : try : if ( d [ i ] >= 2 ) : NEW_LINE

from math import logfrom collections import defaultdictn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) dic = defaultdict ( lambda : 0 ) ans = 0 for el in a : i = int ( log ( el * 2 , 2 ) ) temp = 2 ** i while temp > 0 : if dic [ temp - el ] != 0 : ans += dic [ temp - el ] temp //= 2 dic [ el ] += 1 print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class InnaAndChooseOptions { public static boolean isValid ( String s , int rows , int cols ) { int pointer = 0 ; char [ ] [ ] grid = new char [ rows ] [ cols ] ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) grid [ i ] [ j ] = s . charAt ( pointer ++ ) ; }   for ( int j = 0 ; j < cols ; j ++ ) { boolean allX = true ; for ( int i = 0 ; i < rows ; i ++ ) if ( grid [ i ] [ j ] == ' O ' ) allX = false ; if ( allX ) return true ; } return false ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; int rows [ ] = { 1 , 2 , 3 , 4 , 6 , 12 } ; int cols [ ] = { 12 , 6 , 4 , 3 , 2 , 1 } ; String ans [ ] = { " ▁ 1x12" , " ▁ 2x6" , " ▁ 3x4" , " ▁ 4x3" , " ▁ 6x2" , " ▁ 12x1" } ; for ( int i = 0 ; i < t ; i ++ ) { String s = br . readLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; int ansCount = 0 ; for ( int j = 0 ; j < 6 ; j ++ ) { if ( isValid ( s , rows [ j ] , cols [ j ] ) ) { ansCount ++ ; sb . append ( ans [ j ] ) ; } }   pw . print ( ansCount ) ; pw . println ( sb ) ; }   pw . flush ( ) ; pw . close ( ) ; } }

def ok ( s , a , b ) : mat = [ ] for i in range ( 0 , len ( s ) , b ) : mat . append ( s [ i : i + b ] )   for j in range ( b ) : c = 0 for i in range ( a ) : if mat [ i ] [ j ] == ' O ' : c += 1 if not c : return True   return False       t = int ( input ( ) ) for _ in range ( t ) : s = input ( ) x = s . count ( ' X ' ) pos = [ [ 1 , 12 ] , [ 2 , 6 ] , [ 3 , 4 ] , [ 4 , 3 ] , [ 6 , 2 ] , [ 12 , 1 ] ]   ans = 0 for i , j in pos : if ( ok ( s , i , j ) ) : ans += 1   print ( ans , end = " ▁ " )   for i , j in pos : if ( ok ( s , i , j ) ) : print ( f " { i } x { j } " , end = " ▁ " )   print ( ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : s = input ( ) lst = [ ] if ' X ' in s : lst . append ( '1x12' ) for i in range ( 6 ) : if s [ i ] == s [ i + 6 ] == ' X ' : lst . append ( '2x6' ) break for i in range ( 4 ) : if s [ i ] == s [ i + 4 ] == s [ i + 8 ] == ' X ' : lst . append ( '3x4' ) break for i in range ( 3 ) : if s [ i ] == s [ i + 3 ] == s [ i + 6 ] == s [ i + 9 ] == ' X ' : lst . append ( '4x3' ) break for i in range ( 2 ) : if s [ i ] == s [ i + 2 ] == s [ i + 4 ] == s [ i + 6 ] == s [ i + 8 ] == s [ i + 10 ] == ' X ' : lst . append ( '6x2' ) break if ' O ' not in s : lst . append ( '12x1' ) print ( len ( lst ) , * lst ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = input ( ) ab = [ ] if n . find ( ' X ' ) != - 1 : ab . append ( '1x12' ) for i in range ( 0 , 6 ) : if n [ i ] == ' X ' : if n [ 6 + i ] == ' X ' : ab . append ( '2x6' ) break for i in range ( 0 , 4 ) : if n [ i ] == ' X ' and n [ i + 4 ] == ' X ' and n [ i + 8 ] == ' X ' : ab . append ( '3x4' ) break for i in range ( 0 , 3 ) : if n [ i ] == ' X ' and n [ i + 3 ] == ' X ' and n [ i + 6 ] == ' X ' and n [ i + 9 ] == ' X ' : ab . append ( '4x3' ) break if ( n [ 0 ] == ' X ' and n [ 2 ] == ' X ' and n [ 4 ] == ' X ' and n [ 6 ] == ' X ' and n [ 8 ] == ' X ' and n [ 10 ] == ' X ' ) or ( n [ 1 ] == ' X ' and n [ 3 ] == ' X ' and n [ 5 ] == ' X ' and n [ 7 ] == ' X ' and n [ 9 ] == ' X ' and n [ 11 ] == ' X ' ) : ab . append ( '6x2' )   if n . find ( ' XXXXXXXXXXXX ' ) != - 1 : ab . append ( '12x1' ) print ( len ( ab ) , end = ' ▁ ' ) for i in range ( len ( ab ) ) : print ( ab [ i ] , end = ' ▁ ' ) print ( ) NEW_LINE

import mathimport osimport randomimport reimport sysimport functoolsimport datetime as dtfrom operator import itemgetter , attrgetterfrom collections import Counter   if __name__ == ' _ _ main _ _ ' : N = lambda : int ( input ( ) )   t = N ( ) a , r = [ 1 , 2 , 3 , 4 , 6 , 12 ] , list ( )   while t > 0 : s = input ( ) for i in a : for j in range ( 12 // i ) : if s [ j : : 12 // i ] . count ( " X " ) == i : r . append ( " % sx % s " % ( i , 12 // i ) ) break print ( len ( r ) , * r ) r . clear ( ) t -= 1 NEW_LINE

def isMatch ( n , s ) : x = 12 // n res = [ ] for i in range ( 0 , len ( s ) , x ) : res . append ( s [ i : i + x ] ) for col in range ( x ) : for row in range ( len ( res ) ) : if res [ row ] [ col ] != ' X ' : break elif res [ row ] [ col ] == ' X ' and row == len ( res ) - 1 : return True return False   def solve ( s ) : res = [ ] if ' X ' in s : res . append ( "1x12" ) for i in [ 2 , 3 , 4 , 6 ] : if isMatch ( i , s ) : res . append ( f ' { i } x { 12 / / i } ' ) if s == 12 * ' X ' : res . append ( "12x1" ) print ( len ( res ) , sep = " ▁ " , end = " ▁ " ) print ( * res )                 def main ( ) : NEW_LINE


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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class DevuTheDumbGuy {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; long x = fs . nextInt ( ) ; Integer [ ] c = fs . nextArray ( n ) ; Arrays . sort ( c ) ; long minTime = 0 ; for ( int i = 0 ; i < n ; i ++ ) { minTime += c [ i ] * x ; if ( x > 1 ) x -- ; } System . out . println ( minTime ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   Integer [ ] nextArray ( int n ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class CF439_D2_B { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ; Integer [ ] arr = scanner . nextArray ( n ) ; Arrays . sort ( arr ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += x * arr [ i ] ; if ( x > 1 ) x -- ; } System . out . println ( sum ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; }   Integer [ ] nextArray ( int n ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }

import java . util . Arrays ; import java . util . Scanner ;   public class DumDum { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ;   Integer [ ] chapters = new Integer [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) chapters [ i ] = scanner . nextInt ( ) ; Arrays . sort ( chapters ) ;   long total = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { total += x * chapters [ i ] ;   if ( x > 1 ) x -- ; }   System . out . println ( total ) ; } }

import java . util . Arrays ; import java . util . Scanner ; public class Section { static Scanner sc = new Scanner ( System . in ) ; static int n ; static long m ; static long s = 0 ; public static void main ( String [ ] args ) { n = sc . nextInt ( ) ; m = sc . nextLong ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ;   for ( int i = 0 ; i < n ; i ++ ) { s += a [ i ] * m ; if ( m > 1 ) { m -= 1 ; } } System . out . println ( s ) ; } }

inp = input ( ) . split ( ' ▁ ' ) n = int ( inp [ 0 ] ) hrs = int ( inp [ 1 ] ) order = input ( ) . split ( ' ▁ ' ) order = [ int ( x ) for x in order ]   order = sorted ( order ) time = 0 for chapters in order : tps = chapters * hrs if hrs > 1 : hrs -= 1 time += tps   print ( time ) NEW_LINE

import sys     def ints_input ( ) : return [ int ( i ) for i in sys . stdin . readline ( ) . strip ( " \n " ) . split ( " ▁ " ) ]     def print_list ( arr ) : sys . stdout . writelines ( str ( x ) + " ▁ " for x in arr ) sys . stdout . write ( " \n " )     def fast_input ( type = str ) : return type ( sys . stdin . readline ( ) . strip ( " \n " ) )     n , x = ints_input ( ) a = ints_input ( ) a . sort ( ) ans = 0 for i in range ( n ) : ans += a [ i ] * x if x > 1 : x -= 1 print ( ans ) NEW_LINE

n , x = [ int ( j ) for j in input ( ) . split ( ) ] nums = [ int ( j ) for j in input ( ) . split ( ) ] def sort ( l , r ) : size = r - l if size < 2 : return mid = int ( size / 2 + l ) sort ( l , mid ) sort ( mid , r ) decoy , p1 , p2 = [ ] , l , mid while p1 < mid and p2 < r : if nums [ p1 ] < nums [ p2 ] : decoy . append ( nums [ p1 ] ) p1 += 1 else : decoy . append ( nums [ p2 ] ) p2 += 1 while p1 < mid : decoy . append ( nums [ p1 ] ) p1 += 1 while p2 < r : decoy . append ( nums [ p2 ] ) p2 += 1 for j in range ( l , r ) : nums [ j ] = decoy [ j - l ] total = 0 sort ( 0 , n ) for j in range ( n ) : total += nums [ j ] * x x = max ( x - 1 , 1 ) print ( total ) NEW_LINE

import osimport sysfrom io import BytesIO , IOBase BUFSIZE = 8192 class FastIO ( IOBase ) : newlines = 0 def __init__ ( self , file ) : self . _fd = file . fileno ( ) self . buffer = BytesIO ( ) self . writable = " x " in file . mode or " r " not in file . mode self . write = self . buffer . write if self . writable else None def read ( self ) : while True : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) if not b : break ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines = 0 return self . buffer . read ( ) def readline ( self ) : while self . newlines == 0 : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . newlines = b . count ( b " \n " ) + ( not b ) ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines -= 1 return self . buffer . readline ( ) def flush ( self ) : if self . writable : os . write ( self . _fd , self . buffer . getvalue ( ) ) self . buffer . truncate ( 0 ) , self . buffer . seek ( 0 ) class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable self . write = lambda s : self . buffer . write ( s . encode ( " ascii " ) ) self . read = lambda : self . buffer . read ( ) . decode ( " ascii " ) self . readline = lambda : self . buffer . readline ( ) . decode ( " ascii " ) sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( " \n " ) NEW_LINE

n , x = map ( int , input ( ) . split ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li . sort ( ) t = 0 for i in range ( len ( li ) ) : t += li [ i ] * x if x > 1 : x -= 1 elif x == 0 : x = 1 elif x == 1 : continueprint ( t ) NEW_LINE


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

import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int result = 0 , a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x > b && x < c ) { result ++ ; } } System . out . println ( result ) ;   } }

import java . util . * ; public class CodeForces { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int oleg = input . nextInt ( ) ; int first = input . nextInt ( ) ; int second = input . nextInt ( ) ; int n = input . nextInt ( ) ; int [ ] safes = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < safes . length ; i ++ ) { safes [ i ] = input . nextInt ( ) ; } Arrays . sort ( safes ) ; for ( int i = 0 ; i < safes . length ; i ++ ) { if ( safes [ i ] > first && safes [ i ] < second ) { count ++ ; } } System . out . println ( count ) ; } }

import java . util . Scanner ;   public class BankRobbery { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; long a = in . nextLong ( ) , b = in . nextLong ( ) , c = in . nextLong ( ) , t = 0 ; int n = in . nextInt ( ) , i ;   for ( i = 0 ; i < n ; i ++ ) { long x = in . nextLong ( ) ; if ( x > b && x < c ) { t ++ ; } } in . close ( ) ; System . out . println ( t ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; in . nextInt ( ) ; int l = in . nextInt ( ) , r = in . nextInt ( ) , n = in . nextInt ( ) , out = 0 ; for ( ; n > 0 ; n -- ) { int x = in . nextInt ( ) ; if ( ( l < x ) && ( x < r ) ) { out ++ ; } } System . out . println ( out ) ; in . close ( ) ; } }

a , b , c = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] n = int ( input ( ) ) s = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] print ( sum ( [ int ( b < x and x < c ) for x in s ] ) ) NEW_LINE

s = input ( ) p = s . split ( ) a = int ( p [ 0 ] ) b = int ( p [ 1 ] ) c = int ( p [ 2 ] ) f = input ( ) ans = [ ] notes = [ int ( i ) for i in input ( ) . split ( ) ] for i in notes : i = int ( i ) if i > b and i < c : ans . append ( i ) print ( len ( ans ) ) NEW_LINE

a , b , c = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] n = int ( input ( ) ) notes = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] answer = len ( [ note for note in notes if b < note < c ] ) print ( answer ) NEW_LINE

s , l , r = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] input ( )   temp = [ 1 for i in input ( ) . split ( " ▁ " ) if l < int ( i ) < r ] print ( sum ( temp ) )   NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ct = 0 for n in arr : if b < n < c : ct += 1   print ( ct ) NEW_LINE


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

import java . util . * ; public class TheChildAndSet { static int lowbit ( double x ) { String s = Integer . toBinaryString ( ( int ) x ) ; int i ; for ( i = s . length ( ) - 1 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == '1' ) break ; } return ( int ) Math . pow ( 2 , s . length ( ) - i - 1 ) ; } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double sum = sc . nextDouble ( ) ; double limit = sc . nextDouble ( ) ; double temp = Math . min ( sum , limit ) ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( double i = temp ; i > 1 ; i -- ) { if ( Math . log ( i ) / Math . log ( 2 ) == Math . floor ( Math . log ( i ) / Math . log ( 2 ) ) ) { if ( sum - i >= 0 ) { sum -= i ; al . add ( ( int ) i ) ; } } }

import java . util . Scanner ;   public class Lowbit { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int sum = scanner . nextInt ( ) ; int limit = scanner . nextInt ( ) ;   int count = 0 ; int k = 0 ; StringBuilder ans = new StringBuilder ( ) ;   for ( int i = limit ; i > 0 ; i -- ) { int lowbit = Integer . lowestOneBit ( i ) ;   if ( lowbit + k <= sum ) { count ++ ; k += lowbit ; ans . append ( i ) . append ( " ▁ " ) ; } }   if ( k < sum ) { System . out . println ( - 1 ) ; } else { System . out . println ( count ) ; System . out . println ( ans ) ; } } }

sum , limit = map ( int , input ( ) . split ( ) )   ans = [ ] while limit > 0 and sum > 0 : if ( limit & - limit ) <= sum : sum -= ( limit & - limit ) ans . append ( limit ) limit -= 1   if sum > 0 : print ( - 1 ) else : print ( len ( ans ) ) print ( * ans ) NEW_LINE

import mathimport sysimport collectionsimport bisectimport stringdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) for t in range ( 1 ) : s , l = get_ints ( ) ans = dict ( ) for i in range ( 1 , l + 1 ) : val = i c = 0 while val & 1 != 1 : val >>= 1 c += 1 number = 2 ** c if number not in ans : ans [ number ] = [ i ] else : ans [ number ] . append ( i ) key = list ( ans . keys ( ) ) key . sort ( reverse = True ) sol = [ ] for i in key : val = min ( len ( ans [ i ] ) , s // i ) for j in range ( val ) : sol . append ( ans [ i ] [ j ] ) s -= val * i NEW_LINE

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


import java . util . * ;    public class Practise {

import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; long sum = 0 ; long [ ] count = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; sum = sum + ar [ i ] ; count [ i ] = sum ; } long [ ] ans = new long [ n ] ; ans [ 0 ] = ( count [ 0 ] / m ) ; long sum2 = ans [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans [ i ] = count [ i ] / m - sum2 ; sum2 += ans [ i ] ;   }   for ( Long integer : ans ) { System . out . print ( integer + " ▁ " ) ; } System . out . println ( ) ; }    public static int getAns ( int [ ] ar , int bigger , int i , int [ ] dp ) {   if ( i < 0 ) { return 0 ; } if ( i == 0 ) { return 1 ; } if ( dp [ i ] != - 1 ) { return dp [ i ] ; } int ans1 = 0 , ans2 ; if ( ar [ i ] < bigger ) { ans1 = 1 + getAns ( ar , ar [ i ] , i - 1 , dp ) ;

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ADeathNote solver = new ADeathNote ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class ADeathNote { int n ; int m ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { int q = 1 ; while ( q -- > 0 ) { readInput ( sc ) ; long prev = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += sc . nextInt ( ) ; pw . print ( sum / m - prev + " ▁ " ) ; prev += sum / m - prev ; } } }   }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

n , m = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) curr = 0 ans = [ ] for n in arr : curr += n turned = curr // m ans . append ( turned ) curr %= m   print ( * ans ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = [ int ( item ) for item in input ( ) . split ( ) ] name_remains = 0 for j in range ( n ) : print ( ( name_remains + a [ j ] ) // m , end = " ▁ " ) name_remains = ( name_remains + a [ j ] ) % m NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) cur = mans = [ 0 ] * nfor i , a in enumerate ( A ) : if a < cur : cur -= a ans [ i ] = 0 else : q = ( a - cur + m - 1 ) // m r = q * m - ( a - cur ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ;   int n = fs . nextInt ( ) ; int ans = 0 ; int b = n ; int sum = 0 ; while ( b > 0 ) { sum += b % 10 ; b /= 10 ; } int to = ( 4 - sum % 4 ) % 4 ; if ( to == 0 ) ans = n ; else if ( to + n % 10 <= 9 ) ans = n + to ; else { ans = ( n / 10 + 1 ) * 10 ; b = ans ; sum = 0 ; while ( b > 0 ) { sum += b % 10 ; b /= 10 ; } to = ( 4 - sum % 4 ) % 4 ; ans = ans + to ; } 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 Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ;   short j = input . nextShort ( ) ;   while ( ( ( j / 1000 ) + ( j % 1000 / 100 ) + ( j % 100 / 10 ) + ( j % 10 ) ) % 4 != 0 ) { j ++ ; }   System . out . println ( j ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; while ( ! check ( a ) ) { a ++ ; } System . out . println ( a ) ; } public static boolean check ( int a ) { int sum = 0 ; while ( a > 0 ) { sum += a % 10 ; a = a / 10 ; } return sum % 4 == 0 ;   } }

import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class _p001183A { static public void main ( final String [ ] args ) throws IOException { p001183A . _main ( args ) ; }

import java . util . Scanner ;   public class NearestInterestingNumber {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int i = n ; i <= 10000 ; i ++ ) { String s = String . valueOf ( i ) ; int sum = 0 ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { sum += s . charAt ( j ) - '0' ; } if ( sum % 4 == 0 ) { System . out . println ( i ) ; break ; } } }   }

n = int ( input ( ) ) s = str ( n ) sum = 1 while ( sum % 4 != 0 ) : s = str ( n ) sum = 0 for i in s : sum += int ( i ) n += 1 print ( n - 1 ) NEW_LINE

n = int ( input ( ) ) while sum ( [ int ( x ) for x in str ( n ) ] ) % 4 != 0 : n += 1 print ( n ) NEW_LINE

m = int ( input ( ) ) while sum ( [ int ( m ) for m in str ( m ) ] ) % 4 != 0 : m = m + 1 print ( m ) NEW_LINE

n = int ( input ( ) )   while True : if sum ( map ( int , list ( str ( n ) ) ) ) % 4 == 0 : rep = n break else : n += 1 print ( rep ) NEW_LINE

def string_to_list ( s , char ) : collector = " " output_list = [ ] for i in range ( len ( s ) ) : if s [ i ] != char : collector += s [ i ] if i == len ( s ) - 1 : output_list . append ( int ( collector ) ) else : output_list . append ( int ( collector ) ) collector = " " return output_list     def list_to_string ( l , char ) : output_string = " " for i in range ( len ( l ) - 1 ) : output_string += str ( l [ i ] ) + char output_string += str ( l [ - 1 ] ) return output_string     def merge_sort ( l ) : def merge ( l1 , l2 ) : output_list = [ ] i , j = 0 , 0 while i < len ( l1 ) and j < len ( l2 ) : if l1 [ i ] < l2 [ j ] : output_list . append ( l1 [ i ] ) i += 1 else : output_list . append ( l2 [ j ] ) j += 1 if i == len ( l1 ) : output_list += l2 [ j : ] else : output_list += l1 [ i : ] return output_list     def recursion_part ( l ) : if len ( l ) < 2 : return l else : mid = len ( l ) // 2 left = recursion_part ( l [ : mid ] ) right = recursion_part ( l [ mid : ] ) return merge ( left , right ) return recursion_part ( l )     def list_reverse ( l ) : def recursion ( l , start , end ) : if start >= end : return l else : l [ start ] , l [ end ] = l [ end ] , l [ start ] return recursion ( l , start + 1 , end - 1 ) return recursion ( l , 0 , len ( l ) - 1 )     def divisibility ( n ) : sum = 0 for i in n : sum += int ( i ) return not sum % 4     def recursive_solution ( x ) : if divisibility ( x ) : return int ( x ) else : return recursive_solution ( str ( int ( x ) + 1 ) )     def main_function ( ) : inp = input ( ) return recursive_solution ( inp )                         print ( main_function ( ) ) NEW_LINE


import java . awt . List ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStreamWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . TreeSet ;       public final class CF_507_D1_A {   static boolean verb = true ; static void log ( Object X ) { if ( verb ) System . err . println ( X ) ; } static void log ( Object [ ] X ) { if ( verb ) { for ( Object U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( int [ ] X ) { if ( verb ) { for ( int U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( int [ ] X , int L ) { if ( verb ) { for ( int i = 0 ; i < L ; i ++ ) System . err . print ( X [ i ] + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( long [ ] X ) { if ( verb ) { for ( long U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } }   static void logWln ( Object X ) { if ( verb ) System . err . print ( X ) ; } static void info ( Object o ) { System . out . println ( o ) ; } static void output ( Object o ) { outputWln ( " " + o + " \n " ) ; } static void outputWln ( Object o ) { try { out . write ( " " + o ) ; } catch ( Exception e ) { } }

n , t = map ( int , input ( ) . split ( ' ▁ ' ) ) aa = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) xx = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) )   res = [ 0 ] * n   prevX = 0 prevV = - 10   for i , ( a , x ) in enumerate ( zip ( aa , xx ) ) : x -= 1 if x < prevX or x < i : print ( ' No ' ) exit ( 0 )   curV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 ) res [ i ] = curV   prevX = x prevV = curV   for i , ( a , x ) in enumerate ( zip ( aa , xx ) ) : x -= 1 if x + 1 < n : if res [ x ] >= aa [ x + 1 ] + t : print ( ' No ' ) exit ( 0 )   print ( ' Yes ' ) print ( * res ) NEW_LINE

def read ( ) : return list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) def fail ( ) : print ( ' No ' ) exit ( 0 )   n , t = read ( ) aa = read ( ) xx = read ( )   res = [ 0 ] * nprevX = 0 prevV = - 10   for i in range ( n ) : x = xx [ i ] - 1 if x < prevX or x < i : fail ( )   prevX = x res [ i ] = prevV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 )   for i in range ( n ) : x = xx [ i ] - 1 if x + 1 < n and res [ x ] >= aa [ x + 1 ] + t : fail ( )   print ( ' Yes ' ) print ( * res ) NEW_LINE

def read ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def fail ( ) : print ( " No " ) exit ( 0 )   n , t = read ( ) aa = read ( ) xx = read ( )   bb = [ 0 ] * nprevX = 0 prevV = - 10   for i in range ( n ) : x = xx [ i ] - 1 if x < prevX or x < i : fail ( ) prevX = x bb [ i ] = prevV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 ) for i in range ( n ) : x = xx [ i ] - 1 if x < n - 1 and bb [ x ] >= aa [ x + 1 ] + t : fail ( )   print ( " Yes " ) print ( * bb ) NEW_LINE