import java . util . Scanner ; import java . util . stream . IntStream ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] a = IntStream . range ( 0 , N ) . map ( i -> scan . nextInt ( ) ) . toArray ( ) ; int index = 0 ; for ( int i = 0 ; i < N ; ++ i ) if ( Math . abs ( a [ index ] ) < Math . abs ( a [ i ] ) ) index = i ; System . out . println ( 2 * N - 1 ) ; for ( int i = 0 ; i < N ; ++ i ) System . out . println ( ( index + 1 ) + " ▁ " + ( i + 1 ) ) ; if ( a [ index ] > 0 ) { for ( int i = 2 ; i <= N ; ++ i ) System . out . println ( ( i - 1 ) + " ▁ " + i ) ; } else { for ( int i = N - 1 ; i >= 1 ; -- i ) System . out . println ( ( i + 1 ) + " ▁ " + i ) ; } } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNextInt ( ) ) { int N = sc . nextInt ( ) ; int [ ] t = new int [ N ] ; int max = Integer . MIN_VALUE ; int maxIdx = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { t [ i ] = sc . nextInt ( ) ; int abs = Math . abs ( t [ i ] ) ; if ( max < abs ) { max = abs ; maxIdx = i ; } } System . out . println ( N * 2 - 1 ) ; for ( int i = 0 ; i < N ; i ++ ) { System . out . println ( ( maxIdx + 1 ) + " ▁ " + ( i + 1 ) ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( t [ maxIdx ] > 0 ) { System . out . println ( ( i + 1 ) + " ▁ " + ( i + 2 ) ) ; } else { System . out . println ( ( N - i ) + " ▁ " + ( N - i - 1 ) ) ; } } } } }

import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { A [ i ] = sc . nextInt ( ) ; } int pmaxnum = 0 ; int pmax = 0 ; int mmaxnum = 0 ; int mmax = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] >= 0 ) { if ( pmax <= A [ i ] ) { pmax = A [ i ] ; pmaxnum = i + 1 ; } } else { if ( mmax >= A [ i ] ) { mmax = A [ i ] ; mmaxnum = i + 1 ; } } } System . out . println ( N * 2 - 2 ) ; if ( Math . abs ( pmax ) >= Math . abs ( mmax ) ) { for ( int i = 1 ; i <= N ; i ++ ) { if ( i != pmaxnum ) System . out . println ( pmaxnum + " ▁ " + i ) ; } for ( int i = 1 ; i < N ; i ++ ) { System . out . println ( i + " ▁ " + ( i + 1 ) ) ; } } else { for ( int i = 1 ; i <= N ; i ++ ) { if ( i != mmaxnum ) System . out . println ( mmaxnum + " ▁ " + i ) ; } for ( int i = N ; i > 1 ; i -- ) { System . out . println ( i + " ▁ " + ( i - 1 ) ) ; } } } }

import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ; import java . util . TreeSet ; import java . util . concurrent . BlockingQueue ; import java . util . concurrent . LinkedBlockingDeque ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static char c ; public static void main ( String [ ] args ) throws Exception { int k = sc . nextInt ( ) ; int [ ] arr = new int [ k ] ; int max = Integer . MIN_VALUE ; int min = Integer . MAX_VALUE ; int maxIdx = - 1 ; int minIdx = - 1 ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; if ( arr [ i ] > max ) { max = arr [ i ] ; maxIdx = i ; } if ( arr [ i ] < min ) { min = arr [ i ] ; minIdx = i ; } } System . out . println ( k * 2 - 1 ) ; if ( Math . abs ( min ) > max ) { for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( ( minIdx + 1 ) + " ▁ " + ( i + 1 ) ) ; } for ( int i = k ; i > 1 ; i -- ) { System . out . println ( i + " ▁ " + ( i - 1 ) ) ; } } else { for ( int i = 0 ; i < k ; i ++ ) { System . out . println ( ( maxIdx + 1 ) + " ▁ " + ( i + 1 ) ) ; } for ( int i = 1 ; i < k ; i ++ ) { System . out . println ( i + " ▁ " + ( i + 1 ) ) ; } } } }

import java . util . * ; class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; Arrays . setAll ( a , i -> s . nextInt ( ) ) ; ArrayList < String > r = new ArrayList < > ( ) ; int m = 0 ; for ( int i = 1 ; i < n ; ++ i ) if ( Math . abs ( a [ m ] ) < Math . abs ( a [ i ] ) ) m = i ; for ( int i = 0 ; i < n ; ++ i ) if ( a [ m ] >= 0 ^ a [ i ] >= 0 ) r . add ( m + 1 + " ▁ " + ( i + 1 ) ) ; if ( a [ m ] >= 0 ) { for ( int i = 1 ; i < n ; ++ i ) r . add ( i + " ▁ " + ( i + 1 ) ) ; } else { for ( int i = n ; i > 1 ; -- i ) r . add ( i + " ▁ " + ( i - 1 ) ) ; } System . out . println ( r . size ( ) ) ; r . forEach ( System . out :: println ) ; } }

def inpl ( ) : return [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE N = int ( input ( ) ) NEW_LINE a = inpl ( ) NEW_LINE mini = float ( ' inf ' ) NEW_LINE maxi = - mini NEW_LINE for i in a : NEW_LINE INDENT mini = min ( mini , i ) NEW_LINE maxi = max ( maxi , i ) NEW_LINE DEDENT print ( 2 * N - 1 ) NEW_LINE if maxi > - mini : NEW_LINE INDENT x = a . index ( maxi ) + 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT print ( x , i ) NEW_LINE DEDENT for i in range ( 1 , N ) : NEW_LINE INDENT print ( i , i + 1 ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT x = a . index ( mini ) + 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT print ( x , i ) NEW_LINE DEDENT for i in range ( N , 1 , - 1 ) : NEW_LINE INDENT print ( i , i - 1 ) NEW_LINE DEDENT DEDENT

import sys NEW_LINE N = int ( input ( ) ) NEW_LINE A = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE a = max ( A ) NEW_LINE b = min ( A ) NEW_LINE if b >= 0 : NEW_LINE INDENT ans = [ ] NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT ans . append ( [ i , i + 1 ] ) NEW_LINE DEDENT print ( N - 1 ) NEW_LINE for a , b in ans : NEW_LINE INDENT print ( a , b ) NEW_LINE DEDENT sys . exit ( ) NEW_LINE DEDENT if a <= 0 : NEW_LINE INDENT ans = [ ] NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT ans . append ( [ N - i + 1 , N - i ] ) NEW_LINE DEDENT print ( N - 1 ) NEW_LINE for a , b in ans : NEW_LINE INDENT print ( a , b ) NEW_LINE DEDENT sys . exit ( ) NEW_LINE DEDENT x = A . index ( a ) + 1 NEW_LINE y = A . index ( b ) + 1 NEW_LINE if abs ( a ) >= abs ( b ) : NEW_LINE INDENT ans = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT ans . append ( [ x , i + 1 ] ) NEW_LINE DEDENT for i in range ( 1 , N ) : NEW_LINE INDENT ans . append ( [ i , i + 1 ] ) NEW_LINE DEDENT print ( 2 * N - 1 ) NEW_LINE for a , b in ans : NEW_LINE INDENT print ( a , b ) NEW_LINE DEDENT sys . exit ( ) NEW_LINE DEDENT if abs ( b ) > abs ( a ) : NEW_LINE INDENT ans = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT ans . append ( [ y , i + 1 ] ) NEW_LINE DEDENT for i in range ( 1 , N ) : NEW_LINE INDENT ans . append ( [ N - i + 1 , N - i ] ) NEW_LINE DEDENT print ( 2 * N - 1 ) NEW_LINE for a , b in ans : NEW_LINE INDENT print ( a , b ) NEW_LINE DEDENT sys . exit ( ) NEW_LINE DEDENT

import sys NEW_LINE sys . stdin . readline ( ) NEW_LINE lst = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) NEW_LINE N = len ( lst ) NEW_LINE max_val , max_t = lst [ 0 ] , 0 NEW_LINE min_val , min_t = lst [ 0 ] , 0 NEW_LINE for t in range ( 1 , len ( lst ) ) : NEW_LINE INDENT if max_val < lst [ t ] : NEW_LINE INDENT max_val = lst [ t ] NEW_LINE max_t = t NEW_LINE DEDENT if min_val > lst [ t ] : NEW_LINE INDENT min_val = lst [ t ] NEW_LINE min_t = t NEW_LINE DEDENT DEDENT if max_val >= - min_val : NEW_LINE INDENT print ( 2 * N - 2 ) NEW_LINE for i in range ( len ( lst ) ) : NEW_LINE INDENT if i == max_t : NEW_LINE INDENT continue NEW_LINE DEDENT print ( max_t + 1 , i + 1 ) NEW_LINE DEDENT for i in range ( 1 , len ( lst ) ) : NEW_LINE INDENT print ( i , i + 1 ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print ( 2 * N - 2 ) NEW_LINE for i in range ( len ( lst ) ) : NEW_LINE INDENT if i == min_t : NEW_LINE INDENT continue NEW_LINE DEDENT print ( min_t + 1 , i + 1 ) NEW_LINE DEDENT for i in range ( len ( lst ) , 1 , - 1 ) : NEW_LINE INDENT print ( i , i - 1 ) NEW_LINE DEDENT DEDENT

n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE seq = [ ] NEW_LINE for i in range ( 0 , n + 1 ) : NEW_LINE INDENT b = [ None ] * n NEW_LINE for j in range ( 0 , n ) : b [ j ] = a [ j ] NEW_LINE seq = [ ] NEW_LINE for j in range ( i - 2 , - 1 , - 1 ) : NEW_LINE INDENT seq . append ( ( j + 1 , j ) ) NEW_LINE seq . append ( ( j + 1 , j ) ) NEW_LINE b [ j ] += b [ j + 1 ] * 2 NEW_LINE DEDENT for j in range ( i , n - 1 ) : NEW_LINE INDENT seq . append ( ( j , j + 1 ) ) NEW_LINE seq . append ( ( j , j + 1 ) ) NEW_LINE b [ j + 1 ] += b [ j ] * 2 NEW_LINE DEDENT valid = True NEW_LINE for j in range ( n - 1 ) : NEW_LINE INDENT if b [ j ] > b [ j + 1 ] : NEW_LINE INDENT valid = False NEW_LINE break NEW_LINE DEDENT DEDENT if valid : break NEW_LINE DEDENT print ( len ( seq ) ) NEW_LINE print ( ' \n ' . join ( map ( lambda x : ' % d ▁ % d ' % ( x [ 0 ] + 1 , x [ 1 ] + 1 ) , seq ) ) ) NEW_LINE

import numpy as np NEW_LINE N = int ( input ( ) ) NEW_LINE a_lst = [ int ( _ ) for _ in input ( ) . split ( ) ] NEW_LINE a_arr = np . array ( a_lst ) NEW_LINE idx = np . absolute ( a_arr ) . argmax ( ) + 1 NEW_LINE if a_lst [ idx - 1 ] == 0 : NEW_LINE INDENT print ( 0 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 2 * N - 2 ) NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT if i != idx : NEW_LINE INDENT print ( idx , i ) NEW_LINE DEDENT DEDENT if a_lst [ idx - 1 ] > 0 : NEW_LINE INDENT for i in range ( 1 , N ) : NEW_LINE INDENT print ( i , i + 1 ) NEW_LINE DEDENT DEDENT elif a_lst [ idx - 1 ] < 0 : NEW_LINE INDENT for i in range ( N , 1 , - 1 ) : NEW_LINE INDENT print ( i , i - 1 ) NEW_LINE DEDENT DEDENT DEDENT


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int n = in . nextInt ( ) ; while ( n % a != 0 || n % b != 0 ) { n ++ ; } out . println ( n ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . util . * ; import java . util . stream . * ; import static java . lang . System . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; static int nextInt ( ) { return Integer . parseInt ( sc . next ( ) ) ; } static int [ ] nextIntArray ( int n ) { return IntStream . range ( 0 , n ) . map ( i -> nextInt ( ) ) . toArray ( ) ; } static int max ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ ar . length - 1 ] ; } static int min ( int ... ar ) { Arrays . sort ( ar ) ; return ar [ 0 ] ; } static int maxInt = Integer . MAX_VALUE ; static int minInt = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int a = nextInt ( ) , b = nextInt ( ) , n = nextInt ( ) ; int lcm = lcm ( a , b ) ; out . println ( ( lcm * ( int ) Math . ceil ( ( double ) n / ( double ) lcm ) ) ) ; } static int gcd ( int a , int b ) { return b > 0 ? gcd ( b , a % b ) : a ; } static int lcm ( int a , int b ) { return a * b / gcd ( a , b ) ; } }

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 . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int n = in . nextInt ( ) ; while ( n % a != 0 || n % b != 0 ) n ++ ; out . println ( n ) ; } } static class FastScanner { private InputStream in ; private byte [ ] buffer = new byte [ 1024 ] ; private int bufPointer ; private int bufLength ; public FastScanner ( InputStream in ) { this . in = in ; this . bufPointer = 0 ; this . bufLength = 0 ; } private int readByte ( ) { if ( bufPointer >= bufLength ) { if ( bufLength == - 1 ) throw new InputMismatchException ( ) ; bufPointer = 0 ; try { bufLength = in . read ( buffer ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( bufLength <= 0 ) return - 1 ; } return buffer [ bufPointer ++ ] ; } private static boolean isSpaceChar ( int c ) { return c == ' ▁ ' || c == ' \n ' || c == ' \r ' || c == ' \t ' || c == - 1 ; } public int nextInt ( ) { int n = 0 ; int b = readByte ( ) ; while ( isSpaceChar ( b ) ) b = readByte ( ) ; boolean minus = ( b == ' - ' ) ; if ( minus ) b = readByte ( ) ; while ( b >= '0' && b <= '9' ) { n *= 10 ; n += b - '0' ; b = readByte ( ) ; } if ( ! isSpaceChar ( b ) ) throw new NumberFormatException ( ) ; return minus ? - n : n ; } } }

import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; while ( c % a != 0 || c % b != 0 ) { c ++ ; } System . out . println ( c ) ; } static int l_min ( int [ ] a ) { Arrays . sort ( a ) ; return a [ 0 ] ; } static int l_max ( int [ ] a ) { int l = a . length ; Arrays . sort ( a ) ; return a [ l - 1 ] ; } public static PrintWriter out ; public static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int g = gcd ( a , b ) ; int x = a * b / g ; System . out . println ( ( n + x - 1 ) / x * x ) ; } static int gcd ( int a , int b ) { if ( b == 0 ) { return a ; } else { return gcd ( b , a % b ) ; } } }

a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE n = int ( input ( ) ) NEW_LINE while n % a > 0 or n % b > 0 : NEW_LINE INDENT n += 1 NEW_LINE DEDENT print ( n ) NEW_LINE

def gcd ( a : int , b : int ) -> int : NEW_LINE INDENT if a < b : NEW_LINE INDENT a , b = b , a NEW_LINE DEDENT return a if b == 0 else gcd ( b , a % b ) NEW_LINE DEDENT def lcm ( a : int , b : int ) -> int : NEW_LINE INDENT return a * b // gcd ( a , b ) NEW_LINE DEDENT def like ( a : int , b : int , n : int ) -> int : NEW_LINE INDENT c = lcm ( a , b ) NEW_LINE d = c NEW_LINE while d < n : NEW_LINE INDENT d += c NEW_LINE DEDENT return d NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE n = int ( input ( ) ) NEW_LINE ans = like ( a , b , n ) NEW_LINE print ( ans ) NEW_LINE DEDENT

a , b , n = map ( int , open ( 0 ) ) NEW_LINE while n % a + n % b : n += 1 NEW_LINE print ( n ) NEW_LINE

import math NEW_LINE def gcd ( a , b ) : NEW_LINE INDENT if a < b : NEW_LINE INDENT a , b = b , a NEW_LINE DEDENT while ( b != 0 ) : NEW_LINE INDENT a , b = b , a % b NEW_LINE DEDENT return a NEW_LINE DEDENT a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE n = int ( input ( ) ) NEW_LINE t = ( a * b ) / gcd ( a , b ) NEW_LINE ans = t NEW_LINE while ( ans < n ) : NEW_LINE INDENT ans += t NEW_LINE DEDENT ans = int ( ans ) NEW_LINE print ( ans ) NEW_LINE

a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE n = int ( input ( ) ) NEW_LINE for i in range ( n , 10000000 ) : NEW_LINE INDENT if i == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT if i % a == 0 and i % b == 0 : NEW_LINE INDENT print ( i ) NEW_LINE break NEW_LINE DEDENT DEDENT


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main implements Runnable { public static void main ( String [ ] args ) { new Thread ( null , new Main ( ) , " " , Runtime . getRuntime ( ) . maxMemory ( ) ) . start ( ) ; } final long MOD = 1_000_000_000 + 7 ; public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; long ans = 1 ; ArrayList < Integer > factor = new ArrayList < > ( ) ; for ( int i = b + 1 ; i <= a ; ++ i ) { int v = i ; for ( int j = 2 ; j * j <= v ; ++ j ) { int c = 0 ; while ( v % j == 0 ) { v /= j ; ++ c ; } if ( c > 0 ) { factor . add ( j ) ; } } if ( v > 1 ) { factor . add ( v ) ; } } Collections . sort ( factor ) ; for ( int i = 0 ; i < factor . size ( ) ; ++ i ) { int j = i ; while ( j + 1 < factor . size ( ) && factor . get ( i ) == factor . get ( j + 1 ) ) ++ j ; int c = 0 ; int v = factor . get ( i ) ; for ( int k = b + 1 ; k <= a ; ++ k ) { int u = k ; while ( u % v == 0 ) { u /= v ; ++ c ; } } ans = ans * ( c + 1 ) % MOD ; i = j ; } System . out . println ( ans ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }

import java . util . * ; public class Main { static final long MOD = 1000000007L ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = b + 1 ; i <= a ; i ++ ) { int x = i ; for ( int j = 2 ; j <= Math . sqrt ( i ) ; j ++ ) { while ( x % j == 0 ) { if ( map . containsKey ( j ) ) { map . put ( j , map . get ( j ) + 1 ) ; } else { map . put ( j , 1 ) ; } x /= j ; } } if ( x != 1 ) { if ( map . containsKey ( x ) ) { map . put ( x , map . get ( x ) + 1 ) ; } else { map . put ( x , 1 ) ; } } } long ans = 1 ; for ( int x : map . values ( ) ) { ans = ( ans * ( long ) ( x + 1 ) ) % MOD ; } System . out . println ( ans ) ; } }

import sys NEW_LINE from collections import defaultdict NEW_LINE input = sys . stdin . readline NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def inpl ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE A , B = inpl ( ) NEW_LINE cnt = 1 NEW_LINE num_cnt = defaultdict ( int ) NEW_LINE for n in range ( B + 1 , A + 1 ) : NEW_LINE INDENT i = 2 NEW_LINE while i * i <= n : NEW_LINE INDENT if n % i == 0 : NEW_LINE INDENT cnt = 0 NEW_LINE while n % i == 0 : NEW_LINE INDENT cnt += 1 NEW_LINE n //= i NEW_LINE DEDENT num_cnt [ i ] += cnt NEW_LINE DEDENT i += 1 NEW_LINE DEDENT if n != 1 : NEW_LINE INDENT num_cnt [ n ] += 1 NEW_LINE DEDENT DEDENT ans = 1 NEW_LINE for key in num_cnt . keys ( ) : NEW_LINE INDENT ans *= num_cnt [ key ] + 1 NEW_LINE ans %= MOD NEW_LINE DEDENT print ( ans ) NEW_LINE

import sys NEW_LINE from collections import defaultdict , Counter NEW_LINE from itertools import product , groupby , count , permutations , combinations NEW_LINE from math import pi , sqrt , ceil , floor , factorial NEW_LINE from collections import deque NEW_LINE from bisect import bisect , bisect_left , bisect_right NEW_LINE from string import ascii_lowercase NEW_LINE from functools import lru_cache , reduce NEW_LINE from operator import xor NEW_LINE from heapq import heappush , heappop NEW_LINE INF = float ( " inf " ) NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE MOD = 1000000007 NEW_LINE dy4 , dx4 = [ 0 , - 1 , 0 , 1 ] , [ 1 , 0 , - 1 , 0 ] NEW_LINE def inside ( y : int , x : int , H : int , W : int ) -> bool : return 0 <= y < H and 0 <= x < W NEW_LINE def ceil ( a , b ) : return ( a + b - 1 ) // b NEW_LINE def prime_factor_decomposition ( n ) : NEW_LINE INDENT import math NEW_LINE m = defaultdict ( int ) NEW_LINE while n > 1 : NEW_LINE INDENT find_factor = False NEW_LINE for i in range ( 2 , int ( math . sqrt ( n ) ) + 1 ) : NEW_LINE INDENT if n % i == 0 : NEW_LINE INDENT m [ i ] += 1 NEW_LINE n //= i NEW_LINE find_factor = True NEW_LINE break NEW_LINE DEDENT DEDENT if not find_factor : NEW_LINE INDENT m [ n ] += 1 NEW_LINE break NEW_LINE DEDENT DEDENT return m NEW_LINE DEDENT def main ( ) : NEW_LINE INDENT A , B = map ( int , input ( ) . split ( ) ) NEW_LINE d = defaultdict ( int ) NEW_LINE for x in range ( B + 1 , A + 1 ) : NEW_LINE INDENT m = prime_factor_decomposition ( x ) NEW_LINE for k , v in m . items ( ) : NEW_LINE INDENT d [ k ] += v NEW_LINE DEDENT DEDENT ans = 1 NEW_LINE for k , v in d . items ( ) : NEW_LINE INDENT ans = ( ans * ( v + 1 ) ) % MOD NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT main ( ) NEW_LINE DEDENT

def get_prime_set ( ub ) : NEW_LINE INDENT from itertools import chain NEW_LINE from math import sqrt NEW_LINE if ub < 4 : NEW_LINE INDENT return ( { } , { } , { 2 } , { 2 , 3 } ) [ ub ] NEW_LINE DEDENT ub , ub_sqrt = ub + 1 , int ( sqrt ( ub ) ) + 1 NEW_LINE primes = { 2 , 3 } | set ( chain ( range ( 5 , ub , 6 ) , range ( 7 , ub , 6 ) ) ) NEW_LINE du = primes . difference_update NEW_LINE for n in chain ( range ( 5 , ub_sqrt , 6 ) , range ( 7 , ub_sqrt , 6 ) ) : NEW_LINE INDENT if n in primes : NEW_LINE INDENT du ( range ( n * 3 , ub , n * 2 ) ) NEW_LINE DEDENT DEDENT return primes NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT from math import sqrt NEW_LINE from collections import defaultdict NEW_LINE from functools import reduce NEW_LINE from operator import mul NEW_LINE A , B = map ( int , input ( ) . split ( ) ) NEW_LINE primes = sorted ( get_prime_set ( int ( sqrt ( A ) ) ) ) NEW_LINE divisors = defaultdict ( int , { 1 : 0 } ) NEW_LINE for num in range ( B + 1 , A + 1 ) : NEW_LINE INDENT for p in primes : NEW_LINE INDENT while num % p == 0 : NEW_LINE INDENT divisors [ p ] += 1 NEW_LINE num //= p NEW_LINE DEDENT DEDENT if num > 1 : NEW_LINE INDENT divisors [ num ] += 1 NEW_LINE DEDENT DEDENT print ( reduce ( mul , [ k + 1 for k in divisors . values ( ) ] ) % ( 10 ** 9 + 7 ) ) NEW_LINE DEDENT

import math , string , itertools , fractions , heapq , collections , re , array , bisect , sys , random , time , copy , functools NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE inf = 10 ** 20 NEW_LINE mod = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LI_ ( ) : return [ int ( x ) - 1 for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LF ( ) : return [ float ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def I ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def F ( ) : return float ( sys . stdin . readline ( ) ) NEW_LINE def S ( ) : return input ( ) NEW_LINE def main ( ) : NEW_LINE INDENT a , b = LI ( ) NEW_LINE d = collections . defaultdict ( int ) NEW_LINE for i in range ( b + 1 , a + 1 ) : NEW_LINE INDENT while i % 2 == 0 : NEW_LINE INDENT d [ 2 ] += 1 NEW_LINE i //= 2 NEW_LINE DEDENT for j in range ( 3 , 10 ** 5 , 2 ) : NEW_LINE INDENT while i % j == 0 : NEW_LINE INDENT d [ j ] += 1 NEW_LINE i //= j NEW_LINE DEDENT if i < j : NEW_LINE INDENT d [ i ] += 1 NEW_LINE break NEW_LINE DEDENT DEDENT if i >= 10 ** 5 : NEW_LINE INDENT d [ i ] += 1 NEW_LINE DEDENT DEDENT r = 1 NEW_LINE d [ 1 ] = 0 NEW_LINE for v in d . values ( ) : NEW_LINE INDENT r *= v + 1 NEW_LINE r %= mod NEW_LINE DEDENT return r NEW_LINE DEDENT print ( main ( ) ) NEW_LINE

import math NEW_LINE a , b = map ( int , input ( ) . split ( ) ) NEW_LINE n = math . floor ( math . sqrt ( a ) ) + 1 NEW_LINE t = { } NEW_LINE ans = 1 NEW_LINE for i in range ( b + 1 , a + 1 ) : NEW_LINE INDENT x = i NEW_LINE for j in range ( 2 , n ) : NEW_LINE INDENT if j not in t : NEW_LINE INDENT t [ j ] = 0 NEW_LINE DEDENT while x % j == 0 : NEW_LINE INDENT x /= j NEW_LINE t [ j ] += 1 NEW_LINE DEDENT if x == 1 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT if x != 1 : NEW_LINE INDENT if x not in t : NEW_LINE INDENT t [ x ] = 0 NEW_LINE DEDENT t [ x ] += 1 NEW_LINE DEDENT DEDENT for k , v in t . items ( ) : NEW_LINE INDENT ans *= ( v + 1 ) NEW_LINE ans %= 1000000007 NEW_LINE DEDENT print ( ans ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] e = new int [ 55556 ] ; int count = 0 ; for ( int i = 2 ; i < 55556 ; i ++ ) { if ( e [ i ] != - 1 ) { if ( i % 5 == 1 ) { count ++ ; System . out . print ( i + " ▁ " ) ; } if ( count == n ) { return ; } int k = i ; k += i ; while ( k < 55556 ) { e [ k ] = - 1 ; k += i ; } } } } }

import java . util . ArrayList ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > data = new ArrayList < Integer > ( ) ; for ( int i = 2 ; i <= 55555 ; i ++ ) { boolean ok = true ; for ( int j = 2 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { ok = false ; break ; } } if ( ok ) { if ( ( i - 1 ) % 10 == 0 ) { data . add ( i ) ; } } } for ( int i = 0 ; i < n ; i ++ ) { System . out . println ( data . get ( i ) ) ; } } } class UnionFind { int [ ] parent ; public UnionFind ( int N ) { this . parent = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { parent [ i ] = i ; } } public int root ( int x ) { if ( parent [ x ] == x ) { return x ; } else { return parent [ x ] = root ( parent [ x ] ) ; } } public void unite ( int x , int y ) { if ( same ( x , y ) ) { return ; } int xroot = root ( x ) ; int yroot = root ( y ) ; parent [ xroot ] = yroot ; return ; } public boolean same ( int x , int y ) { return ( root ( x ) == root ( y ) ) ; } } class Pair implements Comparable { int from ; int end ; int num ; int bango ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return end - otherpair . end ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = Integer . parseInt ( in . nextLine ( ) ) ; in . close ( ) ; int MAX = 55555 ; boolean [ ] isPrime = new boolean [ MAX + 1 ] ; Arrays . fill ( isPrime , true ) ; isPrime [ 0 ] = false ; isPrime [ 1 ] = false ; primeDetection ( isPrime ) ; boolean [ ] valid = new boolean [ MAX + 1 ] ; int count = 0 ; for ( int i = 2 ; i < isPrime . length ; ++ i ) { if ( isPrime [ i ] && i % 5 == 1 ) { System . out . print ( i + " ▁ " ) ; count ++ ; } if ( count >= N ) { break ; } } System . out . println ( " " ) ; } private static void primeDetection ( boolean [ ] isPrime ) { for ( int i = 2 ; i < isPrime . length ; ++ i ) { if ( ! isPrime [ i ] ) { continue ; } for ( int j = i * 2 ; j < isPrime . length ; j = j + i ) { isPrime [ j ] = false ; } } } }

import java . util . * ; public class Main { static boolean [ ] comp = new boolean [ 1310 ] ; static ArrayList < Integer > list = new ArrayList < > ( ) ; public static void main ( String [ ] args ) { sieve ( ) ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( i != 0 ) sb . append ( " ▁ " ) ; sb . append ( list . get ( i ) ) ; } System . out . println ( sb . toString ( ) ) ; } public static void sieve ( ) { for ( int i = 2 ; i < comp . length ; i ++ ) { if ( ! comp [ i ] ) { if ( i % 5 == 3 ) list . add ( i ) ; for ( int j = 2 ; i * j < comp . length ; j ++ ) comp [ i * j ] = true ; } } } }

import java . util . Scanner ; class Main { static char [ ] [ ] map ; static int H ; static int W ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] data = new int [ 10000001 ] ; int c = 0 ; for ( int i = 10 ; i <= 55555 ; i ++ ) { for ( int j = 2 ; j <= ( i + 1 ) / 2 ; j ++ ) { if ( i % j == 0 ) { break ; } if ( j == ( i + 1 ) / 2 && i % 5 == 1 ) { data [ c ] = i ; c ++ ; if ( c == N ) { for ( int k = 0 ; k < N ; k ++ ) { System . out . println ( data [ k ] ) ; } return ; } } } } } } class Pair implements Comparable { String from ; int end ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return end - otherpair . end ; } }

N = int ( input ( ) ) NEW_LINE mod = 5 NEW_LINE def prime_sieve_mod ( n ) : NEW_LINE INDENT _sieve = list ( range ( 2 , n + 1 ) ) NEW_LINE _sieve . reverse ( ) NEW_LINE _prime = [ ] NEW_LINE while _sieve and len ( _prime ) < N : NEW_LINE INDENT _num = _sieve . pop ( ) NEW_LINE if _num % mod == 1 : NEW_LINE INDENT _prime . append ( _num ) NEW_LINE DEDENT _del = [ ] NEW_LINE for _i , _v in enumerate ( _sieve ) : NEW_LINE INDENT if _v % _num == 0 : NEW_LINE INDENT _del . append ( _i ) NEW_LINE DEDENT DEDENT _del . reverse ( ) NEW_LINE for _i in _del : NEW_LINE INDENT del _sieve [ _i ] NEW_LINE DEDENT DEDENT return _prime NEW_LINE DEDENT prime_list = prime_sieve_mod ( 1381 ) NEW_LINE print ( * prime_list ) NEW_LINE

import sys NEW_LINE import math NEW_LINE def Sieve_of_Eratosthenes ( N ) : NEW_LINE INDENT prime = set ( i for i in range ( 2 , N + 1 ) ) NEW_LINE for i in range ( 2 , math . ceil ( N ** 0.5 ) + 1 ) : NEW_LINE INDENT tmp = set ( ) NEW_LINE for j in prime : NEW_LINE INDENT if j > i and j % i == 0 : tmp . add ( j ) NEW_LINE DEDENT for j in tmp : NEW_LINE INDENT prime . remove ( j ) NEW_LINE DEDENT DEDENT return ( prime ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE prime = Sieve_of_Eratosthenes ( 55555 ) NEW_LINE ans = [ [ ] for i in range ( 5 ) ] NEW_LINE for i in prime : NEW_LINE INDENT ans [ i % 5 ] . append ( i ) NEW_LINE DEDENT for i in range ( N ) : NEW_LINE INDENT print ( ans [ 1 ] [ i ] , end = " ▁ " ) NEW_LINE DEDENT

era = [ 1 ] * 55556 NEW_LINE era [ 0 ] = era [ 1 ] = 0 NEW_LINE for i in range ( 2 , int ( 55556 ** 0.5 ) + 1 ) : NEW_LINE INDENT if ( era [ i ] == 1 ) : NEW_LINE INDENT for j in range ( i * 2 , 55556 , i ) : era [ j ] = 0 NEW_LINE DEDENT DEDENT v = [ 0 ] * 5 NEW_LINE n = int ( input ( ) ) NEW_LINE for i in range ( 55556 ) : NEW_LINE INDENT if ( era [ i ] and i % 5 == 1 ) : NEW_LINE INDENT print ( i , end = " ▁ " ) NEW_LINE n -= 1 NEW_LINE if ( n == 0 ) : break NEW_LINE DEDENT DEDENT print ( ) NEW_LINE

import sys NEW_LINE input = sys . stdin . readline NEW_LINE N = int ( input ( ) ) NEW_LINE upper = 55555 NEW_LINE p_flag = [ True ] * ( upper + 1 ) NEW_LINE p_flag [ 0 ] = p_flag [ 1 ] = False NEW_LINE prime = [ ] NEW_LINE for i in range ( 2 , upper + 1 ) : NEW_LINE INDENT if p_flag [ i ] : NEW_LINE INDENT prime . append ( i ) NEW_LINE for j in range ( 2 * i , upper + 1 , i ) : NEW_LINE INDENT p_flag [ j ] = False NEW_LINE DEDENT DEDENT DEDENT ans = [ ] NEW_LINE cnt = 0 NEW_LINE for i in prime : NEW_LINE INDENT if i % 5 == 1 : NEW_LINE INDENT ans . append ( i ) NEW_LINE cnt += 1 NEW_LINE DEDENT if cnt == N : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT print ( * ans ) NEW_LINE


import java . util . * ; import java . io . * ; class Main { int retrunN ( int n ) { int i = 0 ; int sum = 0 ; while ( i <= n ) { sum += i ++ ; } return sum ; } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Main At = new Main ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int result = 0 ; result = At . retrunN ( b - a ) - b ; System . out . println ( result ) ; } }

import java . io . * ; import java . util . Arrays ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) throws IOException { String input = ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) . readLine ( ) ; int [ ] highs = Arrays . stream ( input . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int diff = highs [ 1 ] - highs [ 0 ] ; int higher = IntStream . rangeClosed ( 1 , diff ) . sum ( ) ; System . out . println ( higher - highs [ 1 ] ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int A = reader . nextInt ( ) ; int B = reader . nextInt ( ) ; int gap = B - A ; int ans = - A ; for ( int i = 1 ; i < gap ; i ++ ) { ans += i ; } System . out . print ( ans ) ; reader . close ( ) ; } }

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

import java . util . Scanner ; public class Main { public static void main ( String [ ] srgs ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int sa = b - a ; int s = 0 ; for ( int i = 0 ; i <= 999 ; i ++ ) { s += i ; if ( i == sa ) { System . out . println ( s - b ) ; return ; } } scan . close ( ) ; } }

a , b = map ( int , input ( ) . split ( ) ) NEW_LINE sum = 0 NEW_LINE for i in range ( b - a ) : NEW_LINE INDENT sum += i + 1 NEW_LINE DEDENT print ( sum - b ) NEW_LINE

import sys NEW_LINE import re NEW_LINE from collections import deque , defaultdict , Counter NEW_LINE from math import ceil , sqrt , hypot , factorial , pi , sin , cos , radians NEW_LINE from itertools import permutations , combinations , product NEW_LINE from operator import itemgetter , mul NEW_LINE from copy import deepcopy NEW_LINE from string import ascii_lowercase , ascii_uppercase , digits NEW_LINE def input ( ) : return sys . stdin . readline ( ) . strip ( ) NEW_LINE def INT ( ) : return int ( input ( ) ) NEW_LINE def MAP ( ) : return map ( int , input ( ) . split ( ) ) NEW_LINE def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE INF = float ( ' inf ' ) NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE a , b = MAP ( ) NEW_LINE for x in range ( 2 , 1000 ) : NEW_LINE INDENT if b - a == x : NEW_LINE INDENT print ( int ( ( x - 1 ) * x / 2 - a ) ) NEW_LINE DEDENT DEDENT

def sigma ( num ) : NEW_LINE INDENT ret = 0 NEW_LINE for i in range ( num + 1 ) : NEW_LINE INDENT ret += i NEW_LINE DEDENT return ret NEW_LINE DEDENT n , m = map ( int , input ( ) . split ( ) ) NEW_LINE a = sigma ( m - n ) NEW_LINE print ( a - m ) NEW_LINE

from itertools import accumulate as acc NEW_LINE a = [ i for i in range ( 1000 ) ] NEW_LINE a = list ( acc ( a ) ) NEW_LINE A , B = map ( int , input ( ) . split ( ) ) NEW_LINE print ( a [ B - A ] - B ) NEW_LINE

a , b = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE print ( int ( ( b - a ) * ( b - a - 1 ) / 2 ) - a ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int an [ ] = new int [ a + 1 ] ; long ans = 1 ; int c = 0 ; int d = ( int ) Math . pow ( 10 , 9 ) + 7 ; for ( int i = 0 ; i < a + 1 ; i ++ ) { an [ i ] = 1 ; } for ( int i = 2 ; i <= a ; i ++ ) { c = i ; while ( c % 2 == 0 ) { c /= 2 ; an [ 2 ] ++ ; } for ( int n = 3 ; n * n <= c ; n += 2 ) { while ( c % n == 0 ) { c /= n ; an [ n ] ++ ; } } if ( c > 1 ) { an [ c ] ++ ; } } for ( int i = 0 ; i < an . length ; i ++ ) { ans = ( long ) ans * an [ i ] % d ; } 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 . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { static public int mod = ( int ) ( 1e9 + 7 ) ; public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; boolean mark [ ] = new boolean [ n + 1 ] ; for ( int i = 0 ; i <= n ; ++ i ) mark [ i ] = true ; for ( int i = 2 ; i <= n ; ++ i ) if ( mark [ i ] ) { for ( int j = i + i ; j <= n ; j += i ) mark [ j ] = false ; } long r = 1 ; for ( int i = 2 ; i <= n ; ++ i ) if ( mark [ i ] ) { int c = 0 ; for ( long p = i ; p <= n ; p *= i ) c += n / p ; r = r * ( c + 1 ) % mod ; } out . println ( r ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } }

import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; if ( n < 3 ) { System . out . println ( n ) ; return ; } ArrayList < Integer > list = new ArrayList < Integer > ( ) ; list . add ( 2 ) ; for ( int i = 3 ; i <= n ; i ++ ) { boolean b = true ; for ( int j = 0 ; j < list . size ( ) ; j ++ ) { if ( i % list . get ( j ) == 0 ) { b = false ; break ; } } if ( b ) { list . add ( i ) ; } } long [ ] [ ] num = new long [ n ] [ list . size ( ) ] ; for ( int i = 1 ; i <= n ; i ++ ) { int x = i ; for ( int j = 0 ; j < list . size ( ) ; j ++ ) { while ( x % list . get ( j ) == 0 ) { num [ i - 1 ] [ j ] ++ ; x /= list . get ( j ) ; } } } long [ ] sum = new long [ list . size ( ) ] ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 0 ; j < list . size ( ) ; j ++ ) { sum [ j ] += num [ i - 1 ] [ j ] ; } } long ans = 1 ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { if ( sum [ i ] != 0 ) { ans *= sum [ i ] + 1L ; } if ( ans >= 1000000007L ) { ans %= 1000000007L ; } } System . out . println ( ans ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( calc ( N ) ) ; } private static long calc ( int x ) { int [ ] primes = new int [ x + 1 ] ; Arrays . fill ( primes , 1 ) ; primes [ 0 ] = primes [ 1 ] = 0 ; for ( int i = 3 ; i < primes . length ; i ++ ) { if ( i % 2 == 0 ) primes [ i ] = 0 ; } int j = 3 ; while ( j * j < primes . length ) { for ( int k = j + 1 ; k < primes . length ; k ++ ) { if ( k % j == 0 ) primes [ k ] = 0 ; } j += 2 ; } int [ ] factors = new int [ x + 1 ] ; while ( x > 1 ) { int i = 3 ; int f = x ; while ( f % 2 == 0 ) { factors [ 2 ] ++ ; f /= 2 ; } while ( i <= f ) { if ( primes [ i ] == 1 ) { while ( f % i == 0 ) { factors [ i ] ++ ; f /= i ; } } i += 2 ; } if ( f != 1 ) factors [ f ] ++ ; x -- ; } long d = ( long ) Math . pow ( 10 , 9 ) + 7 ; long count = 1 ; for ( int f : factors ) { if ( f != 0 ) count *= ( f + 1 ) ; while ( count >= d ) { count -= d ; } } return count ; } private static void test ( ) { assert calc ( 6 ) == 30 ; assert calc ( 1000 ) == 972926972 ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean [ ] prime = new boolean [ 1000 ] ; prime [ 1 - 1 ] = false ; for ( int i = 2 ; i <= 1000 ; i ++ ) prime [ i - 1 ] = true ; for ( int i = 1 ; i <= 1000 ; i ++ ) { if ( prime [ i - 1 ] ) { for ( int j = 2 ; i * j <= 1000 ; j ++ ) prime [ i * j - 1 ] = false ; } } int [ ] counter = new int [ 1000 ] ; for ( int i = 1 ; i <= 1000 ; i ++ ) counter [ i - 1 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= i ; j ++ ) { if ( prime [ j - 1 ] ) { int x = i ; int count = 0 ; while ( x % j == 0 ) { x = x / j ; count ++ ; } counter [ j - 1 ] += count ; } } } long result = 1 ; for ( int i = 1 ; i <= 1000 ; i ++ ) result = ( result * ( counter [ i - 1 ] + 1 ) ) % 1000000007 ; System . out . println ( String . valueOf ( result % 1000000007 ) ) ; } }

import sys NEW_LINE import collections NEW_LINE ns = lambda : sys . stdin . readline ( ) . rstrip ( ) NEW_LINE ni = lambda : int ( ns ( ) ) NEW_LINE nm = lambda : map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE nl = lambda : list ( nm ( ) ) NEW_LINE nsl = lambda : map ( str , sys . stdin . readline ( ) . split ( ) ) NEW_LINE def era ( n ) : NEW_LINE INDENT data = [ i for i in range ( 2 , n + 1 ) ] NEW_LINE for d in data : NEW_LINE INDENT data = [ x for x in data if ( x == d or x % d != 0 ) ] NEW_LINE DEDENT data1 = [ ] NEW_LINE for d in data : NEW_LINE INDENT data1 . append ( [ d , 1 ] ) NEW_LINE DEDENT return data1 NEW_LINE DEDENT mod = 10 ** 9 + 7 NEW_LINE n = ni ( ) NEW_LINE lis = era ( n ) NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT for j in range ( len ( lis ) ) : NEW_LINE INDENT if i < lis [ j ] [ 0 ] : NEW_LINE INDENT break NEW_LINE DEDENT elif i % lis [ j ] [ 0 ] == 0 : NEW_LINE INDENT count = 0 NEW_LINE m = i NEW_LINE while ( m % lis [ j ] [ 0 ] == 0 ) : NEW_LINE INDENT m = m // lis [ j ] [ 0 ] NEW_LINE count += 1 NEW_LINE DEDENT lis [ j ] [ 1 ] += count NEW_LINE DEDENT DEDENT DEDENT ans = 1 NEW_LINE for i in range ( len ( lis ) ) : NEW_LINE INDENT ans *= lis [ i ] [ 1 ] NEW_LINE ans %= mod NEW_LINE DEDENT print ( ans ) NEW_LINE

N = int ( input ( ) ) NEW_LINE MOD = int ( 1e+9 ) + 7 NEW_LINE prime = [ 2 ] NEW_LINE for i in range ( 2 , 1001 ) : NEW_LINE INDENT for j in range ( 2 , i - 1 ) : NEW_LINE INDENT if i % j == 0 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT prime . append ( i ) NEW_LINE DEDENT DEDENT factor = [ 1 ] * 1000 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT for p in prime : NEW_LINE INDENT if i == 1 : NEW_LINE INDENT break NEW_LINE DEDENT while i % p == 0 : NEW_LINE INDENT i /= p NEW_LINE factor [ p ] += 1 NEW_LINE DEDENT DEDENT DEDENT ans = 1 NEW_LINE for fact in factor : NEW_LINE INDENT ans *= fact NEW_LINE ans %= MOD NEW_LINE DEDENT print ( int ( ans ) ) NEW_LINE

from functools import reduce NEW_LINE def primes_list ( N ) : NEW_LINE INDENT l = [ v for v in range ( 2 , N + 1 ) ] NEW_LINE ret = [ ] NEW_LINE while l : NEW_LINE INDENT cur = l . pop ( 0 ) NEW_LINE l = list ( filter ( lambda x : x % cur != 0 , l ) ) NEW_LINE ret . append ( cur ) NEW_LINE DEDENT return ret NEW_LINE DEDENT mod = 10 ** 9 + 7 NEW_LINE N = int ( input ( ) ) NEW_LINE l = [ 0 ] * ( N + 1 ) NEW_LINE primes = primes_list ( N ) NEW_LINE for i in range ( 2 , N + 1 ) : NEW_LINE INDENT for p in primes : NEW_LINE INDENT if p > i : NEW_LINE INDENT break NEW_LINE DEDENT tmp = 0 NEW_LINE while i % p == 0 : NEW_LINE INDENT i //= p NEW_LINE tmp += 1 NEW_LINE DEDENT l [ p ] += tmp NEW_LINE DEDENT DEDENT ans = 1 NEW_LINE for i in l : NEW_LINE INDENT if i == 0 : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT ans = ans * ( i + 1 ) % mod NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

thelist = [ 2 ] NEW_LINE for i in range ( 3 , 1000 ) : NEW_LINE INDENT t = 0 NEW_LINE for j in range ( 2 , i ) : NEW_LINE INDENT if i % j == 0 : NEW_LINE INDENT t = 1 NEW_LINE continue NEW_LINE DEDENT DEDENT if t == 0 : NEW_LINE INDENT thelist . append ( i ) NEW_LINE DEDENT DEDENT while True : NEW_LINE INDENT try : NEW_LINE INDENT n = int ( input ( ) ) NEW_LINE DEDENT except : NEW_LINE INDENT break NEW_LINE DEDENT thedic = { } NEW_LINE for i in thelist : NEW_LINE INDENT thedic [ i ] = 0 NEW_LINE DEDENT for i in range ( 1 , n + 1 ) : NEW_LINE INDENT t = i NEW_LINE j = 0 NEW_LINE while j != len ( thelist ) : NEW_LINE INDENT if t % thelist [ j ] == 0 : NEW_LINE INDENT thedic [ thelist [ j ] ] += 1 NEW_LINE t = t / thelist [ j ] NEW_LINE continue NEW_LINE DEDENT j = j + 1 NEW_LINE if t == 1 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT DEDENT value = 1 NEW_LINE for i in thedic : NEW_LINE INDENT value = value % ( 1000000000 + 7 ) * ( thedic [ i ] + 1 ) NEW_LINE DEDENT print ( value % ( 1000000000 + 7 ) ) NEW_LINE DEDENT

from math import * NEW_LINE n = factorial ( int ( input ( ) ) ) NEW_LINE def dv ( n ) : NEW_LINE INDENT if n == 1 : NEW_LINE INDENT return 1 NEW_LINE DEDENT divisorsNum = 1 NEW_LINE i = 2 NEW_LINE while i * i <= n : NEW_LINE INDENT cnt = 1 NEW_LINE while n % i == 0 : NEW_LINE INDENT cnt += 1 NEW_LINE n //= i NEW_LINE DEDENT divisorsNum *= cnt NEW_LINE i += 1 NEW_LINE DEDENT return divisorsNum * 2 NEW_LINE DEDENT mod = ( 10 ** 9 + 7 ) NEW_LINE print ( dv ( n ) % mod ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; int [ ] a = mp ( str ) ; int n = str . length ( ) ; int shuki = n - a [ n ] ; if ( shuki == 1 ) { System . out . println ( n ) ; System . out . println ( 1 ) ; } else if ( n % shuki != 0 || shuki == n ) { System . out . println ( 1 ) ; System . out . println ( 1 ) ; } else { System . out . println ( 2 ) ; StringBuilder restr = new StringBuilder ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) restr . append ( str . charAt ( i ) ) ; int [ ] b = mp ( restr . toString ( ) ) ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int shuki1 = i + 1 - a [ i + 1 ] ; if ( shuki1 != ( i + 1 ) && ( i + 1 ) % shuki1 == 0 ) continue ; int shuki2 = n - i - 1 - b [ n - i - 1 ] ; if ( shuki2 != ( n - i - 1 ) && ( n - i - 1 ) % shuki2 == 0 ) continue ; count ++ ; } System . out . println ( count ) ; } } static int [ ] mp ( String str ) { int n = str . length ( ) ; int [ ] a = new int [ n + 1 ] ; a [ 0 ] = - 1 ; int j = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { while ( j >= 0 && str . charAt ( i ) != str . charAt ( j ) ) j = a [ j ] ; j ++ ; a [ i + 1 ] = j ; } return a ; } }

from collections import Counter NEW_LINE * W , = map ( ord , input ( ) ) NEW_LINE N = len ( W ) NEW_LINE C = Counter ( W ) NEW_LINE if len ( C ) == 1 : NEW_LINE INDENT print ( N ) NEW_LINE print ( 1 ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT def z_algo ( S ) : NEW_LINE INDENT A = [ 0 ] * N NEW_LINE i = 1 ; j = 0 NEW_LINE A [ 0 ] = l = len ( S ) NEW_LINE while i < l : NEW_LINE INDENT while i + j < l and S [ j ] == S [ i + j ] : NEW_LINE INDENT j += 1 NEW_LINE DEDENT A [ i ] = j NEW_LINE if not j : NEW_LINE INDENT i += 1 NEW_LINE continue NEW_LINE DEDENT k = 1 NEW_LINE while l - i > k < j - A [ k ] : NEW_LINE INDENT A [ i + k ] = A [ k ] NEW_LINE k += 1 NEW_LINE DEDENT i += k ; j -= k NEW_LINE DEDENT return A NEW_LINE DEDENT def calc ( W ) : NEW_LINE INDENT Z = z_algo ( W ) NEW_LINE G = [ 0 ] * N NEW_LINE for i in range ( N ) : NEW_LINE INDENT G [ i ] = 1 NEW_LINE DEDENT for p in range ( 1 , N ) : NEW_LINE INDENT if not G [ p - 1 ] : NEW_LINE INDENT continue NEW_LINE DEDENT for k in range ( 2 , Z [ p ] // p + 2 ) : NEW_LINE INDENT G [ k * p - 1 ] = 0 NEW_LINE DEDENT DEDENT return G NEW_LINE DEDENT G0 = calc ( W ) NEW_LINE W . reverse ( ) NEW_LINE G1 = calc ( W ) NEW_LINE if G0 [ N - 1 ] : NEW_LINE INDENT print ( 1 ) NEW_LINE print ( 1 ) NEW_LINE exit ( 0 ) NEW_LINE DEDENT print ( 2 ) NEW_LINE print ( sum ( p and q for p , q in zip ( G0 [ : - 1 ] , reversed ( G1 [ : - 1 ] ) ) ) ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; if ( A == B ) { System . out . println ( 1 ) ; } else { int abi = 62 ; for ( ; abi >= 0 ; abi -- ) if ( ( ( A ^ B ) & ( 1l << abi ) ) != 0 ) break ; long mask = ( 1l << abi ) - 1 ; long ans = mask - ( A & mask ) + 1 ; int bi = abi - 1 ; for ( ; bi >= 0 ; bi -- ) if ( ( ( 1l << bi ) & B ) != 0 ) break ; long temp = 1l << ( bi + 1 ) ; ans += temp + ( 1l << abi ) - Math . max ( temp , A & mask ) ; System . out . println ( ans ) ; } sc . close ( ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; System . out . println ( calc ( A , B ) ) ; } public static long calc ( long A , long B ) { if ( A == B ) { return 1 ; } long ans = 0 ; long k = 1 ; for ( int i = 0 ; i <= 60 ; i ++ ) { k = k * 2 ; } while ( ( A & k ) == ( B & k ) ) { A = ( A | k ) ^ k ; B = ( B | k ) ^ k ; k = k / 2 ; } long s1 = k - A ; long s2 = k - A ; long s3 = maxbit ( B - k ) ; ans = s1 + s2 + s3 ; long rb = k + s3 - 1 ; long lb = k + A ; if ( rb >= lb ) { ans = ans - ( rb - lb + 1 ) ; } return ans ; } public static long maxbit ( long n ) { if ( n == 0 ) { return 1 ; } long k = 1 , ans = 0 ; for ( int i = 0 ; i <= 60 ; i ++ ) { if ( ( n & k ) > 0 ) { ans = k ; } k = k * 2 ; } return ans * 2 ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long A = scan . nextLong ( ) ; long B = scan . nextLong ( ) ; long [ ] two = new long [ 61 ] ; two [ 0 ] = 1 ; for ( int i = 1 ; i < 61 ; i ++ ) { two [ i ] = two [ i - 1 ] * 2 ; } int maxk = 0 ; out : for ( int j = 60 ; j >= 0 ; j -- ) { for ( int i = j ; i >= 0 ; i -- ) { if ( A <= two [ i ] && B >= two [ i ] ) { maxk = i ; break out ; } if ( i == 0 ) { for ( int k = 1 ; k <= 60 ; k ++ ) { if ( A < two [ k ] ) { A -= two [ k - 1 ] ; B -= two [ k - 1 ] ; break ; } } } } } long ans = two [ maxk ] - A ; B -= two [ maxk ] ; int maxk_ = 0 ; for ( int i = 0 ; i <= 60 ; i ++ ) { if ( B < two [ i ] ) { maxk_ = i ; break ; } } ans += two [ maxk_ ] ; if ( two [ maxk_ ] <= A ) { ans += two [ maxk ] - A ; } else { ans += two [ maxk ] - two [ maxk_ ] ; } System . out . println ( ans ) ; } }

import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; while ( A > 0 && Long . highestOneBit ( A ) == Long . highestOneBit ( B ) ) { long flip = Long . highestOneBit ( A ) ; A ^= flip ; B ^= flip ; } if ( B == 0 ) { System . out . println ( 1 ) ; return ; } int first = Long . numberOfTrailingZeros ( Long . highestOneBit ( B ) ) ; int second = - 1 ; if ( B == ( 1L << first ) ) { second = - 1 ; } else { second = Long . numberOfTrailingZeros ( Long . highestOneBit ( B ^ ( 1L << first ) ) ) ; } long l1 = A ; long r1 = ( ( 1L << first ) + ( ( 1L << ( second + 1 ) ) - 1 ) ) ; long l2 = A + ( 1L << first ) ; long r2 = ( 1L << ( first + 1 ) ) - 1 ; long res = - 1 ; if ( l2 <= r1 && r1 <= r2 ) { res = r2 - l1 + 1 ; } else if ( l1 <= r2 && r2 <= r1 ) { res = r1 - l1 + 1 ; } else if ( r1 <= l2 ) { res = ( r1 - l1 + 1 ) + ( r2 - l2 + 1 ) ; } System . out . println ( res ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner io = new Scanner ( System . in ) ; long A = io . nextLong ( ) ; long B = io . nextLong ( ) ; System . out . println ( orNum ( A , B ) ) ; } public static long orNum ( long A , long B ) { long q = 1L << 59 ; for ( ; q > 0 ; q = q >> 1 ) { if ( ( A & q ) == 0 && ( B & q ) == 0 ) continue ; if ( ( A & q ) != 0 && ( B & q ) != 0 ) { A -= q ; B -= q ; continue ; } if ( ( A & q ) == 0 && ( B & q ) != 0 ) { break ; } if ( ( ( A & q ) != 0 && ( B & q ) == 0 ) ) { return 0 ; } } if ( A == B ) { return 1 ; } long ans = q - A ; ans = ans * 2 + 1 ; B -= q ; ans += Math . min ( A - 1 , orNum ( 1 , B ) ) ; return ans ; } }

res = 0 NEW_LINE A = int ( input ( ) ) NEW_LINE B = int ( input ( ) ) NEW_LINE def pow2_floor_log2 ( x ) : NEW_LINE INDENT res = 1 NEW_LINE while res * 2 <= x : NEW_LINE INDENT res *= 2 NEW_LINE DEDENT return res NEW_LINE DEDENT if A == B : NEW_LINE INDENT res += 1 NEW_LINE DEDENT while A < B : NEW_LINE INDENT C = pow2_floor_log2 ( B ) NEW_LINE if A < C : NEW_LINE INDENT res += C - A NEW_LINE if B > C : NEW_LINE INDENT B_ = C + pow2_floor_log2 ( B - C ) * 2 - 1 NEW_LINE DEDENT else : NEW_LINE INDENT B_ = C NEW_LINE DEDENT if C + A <= B_ : NEW_LINE INDENT res += C NEW_LINE break NEW_LINE DEDENT else : NEW_LINE INDENT res += ( C - A ) + ( B_ - C + 1 ) NEW_LINE break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT A -= C NEW_LINE B -= C NEW_LINE DEDENT DEDENT print ( res ) NEW_LINE

import sys NEW_LINE def solve ( ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE if a == b : NEW_LINE INDENT print ( 1 ) NEW_LINE return NEW_LINE DEDENT t = a ^ b NEW_LINE N = bitlen ( t ) NEW_LINE a = a & ( 2 ** N - 1 ) NEW_LINE b = b & ( 2 ** N - 1 ) NEW_LINE blen = bitlen ( b ) NEW_LINE sb = b & ( 2 ** ( blen - 1 ) - 1 ) NEW_LINE sblen = bitlen ( sb ) NEW_LINE s = 2 ** sblen - 1 NEW_LINE ymax = b | s NEW_LINE T = 2 ** ( N - 1 ) NEW_LINE ans = T - a NEW_LINE if ymax < T + a : NEW_LINE INDENT ans += ymax + 1 - a NEW_LINE DEDENT else : NEW_LINE INDENT ans += T NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT def bitlen ( x ) : NEW_LINE INDENT return 1 + bitlen ( x >> 1 ) if x else 0 NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT solve ( ) NEW_LINE DEDENT

a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE if a == b : NEW_LINE INDENT print ( 1 ) NEW_LINE exit ( ) NEW_LINE DEDENT def bitlen ( x ) : NEW_LINE INDENT return 1 + bitlen ( x >> 1 ) if x else 0 NEW_LINE DEDENT t = a ^ b NEW_LINE n = bitlen ( t ) NEW_LINE T = 1 << ( n - 1 ) NEW_LINE a = a & ( T * 2 - 1 ) NEW_LINE b = b & ( T * 2 - 1 ) NEW_LINE sb = b & ( T - 1 ) NEW_LINE b_max = ( 2 ** bitlen ( sb ) - 1 ) | T NEW_LINE if ( T + a ) > b_max : NEW_LINE INDENT print ( ( b_max - a + 1 ) + ( 2 * T - 1 - ( T + a ) + 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( 2 * T - 1 - a + 1 ) NEW_LINE DEDENT

import math NEW_LINE A = int ( input ( ) ) NEW_LINE B = int ( input ( ) ) NEW_LINE if B < A : A , B = B , A NEW_LINE if A == B : NEW_LINE INDENT print ( 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT t = int ( math . floor ( math . log2 ( B ) ) ) NEW_LINE while ( A & 2 ** t ) == ( B & 2 ** t ) : NEW_LINE INDENT if A & 2 ** t : NEW_LINE INDENT A -= 2 ** t NEW_LINE B -= 2 ** t NEW_LINE DEDENT t -= 1 NEW_LINE DEDENT ans = 2 ** t - A NEW_LINE r = t - 1 NEW_LINE while 2 ** t + 2 ** r > B and r >= 0 : NEW_LINE INDENT r -= 1 NEW_LINE DEDENT C = 2 ** ( r + 1 ) NEW_LINE if C < A : NEW_LINE INDENT ans += C + 2 ** t - A NEW_LINE DEDENT else : NEW_LINE INDENT ans += 2 ** t NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT

import sys NEW_LINE def solve ( ) : NEW_LINE INDENT a = int ( input ( ) ) NEW_LINE b = int ( input ( ) ) NEW_LINE if a == b : NEW_LINE INDENT print ( 1 ) NEW_LINE return NEW_LINE DEDENT t = a ^ b NEW_LINE N = len ( bin ( t ) ) - 2 NEW_LINE t = 1 << N NEW_LINE a = a & ( t - 1 ) NEW_LINE b = b & ( t - 1 ) NEW_LINE blen = len ( bin ( b ) ) - 2 NEW_LINE sb = b & ( 2 ** ( blen - 1 ) - 1 ) NEW_LINE if sb == 0 : NEW_LINE INDENT sblen = 0 NEW_LINE DEDENT else : NEW_LINE INDENT sblen = len ( bin ( sb ) ) - 2 NEW_LINE DEDENT s = ( 1 << sblen ) - 1 NEW_LINE ymax = b | s NEW_LINE T = 1 << ( N - 1 ) NEW_LINE ans = T - a NEW_LINE if ymax < T + a : NEW_LINE INDENT ans += ymax - T + 1 + T - a NEW_LINE DEDENT else : NEW_LINE INDENT ans += T NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT solve ( ) NEW_LINE DEDENT


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] S = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { char [ ] c = sc . next ( ) . toCharArray ( ) ; for ( int j = 0 ; j < n ; j ++ ) { S [ i ] [ j ] = c [ j ] - '0' ; } } System . out . println ( Math . abs ( detMt ( S ) % 2 ) == 1 ? " Odd " : " Even " ) ; } int count = 1 ; int detMt ( int [ ] [ ] A ) { assert A . length == A [ 0 ] . length ; int n = A . length ; int det = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( A [ i ] [ i ] == 0 ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( A [ j ] [ i ] != 0 ) { for ( int k = 0 ; k < n ; k ++ ) { int d = A [ i ] [ k ] ; A [ i ] [ k ] = A [ j ] [ k ] ; A [ j ] [ k ] = d ; } break ; } if ( j == n - 1 ) return 0 ; } } for ( int j = i + 1 ; j < n ; j ++ ) { double rate = A [ j ] [ i ] / A [ i ] [ i ] ; for ( int k = 0 ; k < n ; k ++ ) { A [ j ] [ k ] += rate * A [ i ] [ k ] ; A [ j ] [ k ] %= 2 ; } } } for ( int i = 0 ; i < n ; i ++ ) det *= A [ i ] [ i ] ; while ( det < 0 ) det ++ ; return det ; } }

def det ( a ) : NEW_LINE INDENT n = len ( a ) NEW_LINE if n == 1 : NEW_LINE INDENT return a [ 0 ] [ 0 ] NEW_LINE DEDENT b = [ [ a [ i ] [ j ] for i in range ( n ) ] for j in range ( n ) ] NEW_LINE k = - 1 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if b [ i ] [ 0 ] == 1 : NEW_LINE INDENT k = i NEW_LINE break NEW_LINE DEDENT DEDENT if k == - 1 : NEW_LINE INDENT return 0 NEW_LINE DEDENT else : NEW_LINE INDENT for j in range ( n ) : NEW_LINE INDENT b [ k ] [ j ] , b [ 0 ] [ j ] = b [ 0 ] [ j ] , b [ k ] [ j ] NEW_LINE DEDENT DEDENT for i in range ( 1 , n ) : NEW_LINE INDENT if b [ i ] [ 0 ] == 1 : NEW_LINE INDENT for j in range ( n ) : NEW_LINE INDENT b [ i ] [ j ] = ( b [ i ] [ j ] + b [ 0 ] [ j ] ) % 2 NEW_LINE DEDENT DEDENT DEDENT c = [ [ b [ i ] [ j ] for i in range ( 1 , n ) ] for j in range ( 1 , n ) ] NEW_LINE return det ( c ) NEW_LINE DEDENT N = int ( input ( ) ) NEW_LINE a = [ [ int ( i ) for i in list ( input ( ) ) ] for j in range ( N ) ] NEW_LINE ans = det ( a ) NEW_LINE if ans == 1 : NEW_LINE INDENT print ( " Odd " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Even " ) NEW_LINE DEDENT

N = int ( input ( ) ) NEW_LINE matrix = [ list ( map ( int , input ( ) ) ) for _ in range ( N ) ] NEW_LINE ans = 1 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if matrix [ i ] [ i ] == 0 : NEW_LINE INDENT for j in range ( i , N ) : NEW_LINE INDENT if matrix [ j ] [ i ] == 1 : NEW_LINE INDENT matrix [ i ] , matrix [ j ] = matrix [ j ] , matrix [ i ] NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT if matrix [ i ] [ i ] == 0 : NEW_LINE INDENT ans = 0 NEW_LINE break NEW_LINE DEDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT if matrix [ j ] [ i ] == 1 : NEW_LINE INDENT for k in range ( N ) : NEW_LINE INDENT matrix [ j ] [ k ] ^= matrix [ i ] [ k ] NEW_LINE DEDENT DEDENT DEDENT DEDENT print ( " Even " if ans % 2 == 0 else " Odd " ) NEW_LINE

n = int ( input ( ) ) NEW_LINE a = [ list ( input ( ) ) for i in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT for j in range ( n ) : NEW_LINE INDENT a [ i ] [ j ] = ord ( a [ i ] [ j ] ) - ord ( '0' ) NEW_LINE DEDENT DEDENT ans = True NEW_LINE for i in range ( n ) : NEW_LINE INDENT u = i NEW_LINE while u < n and a [ u ] [ i ] == 0 : NEW_LINE INDENT u += 1 NEW_LINE DEDENT if u == n : NEW_LINE INDENT ans = False NEW_LINE break NEW_LINE DEDENT for j in range ( u + 1 , n ) : NEW_LINE INDENT if a [ j ] [ i ] == 1 : NEW_LINE INDENT a [ j ] = [ p ^ q for p , q in zip ( a [ j ] , a [ u ] ) ] NEW_LINE DEDENT DEDENT a [ i ] , a [ u ] = a [ u ] , a [ i ] NEW_LINE DEDENT if ans : NEW_LINE INDENT print ( " Odd " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Even " ) NEW_LINE DEDENT

def printmat ( matrix ) : NEW_LINE INDENT for x in matrix : NEW_LINE INDENT print ( [ int ( y ) for y in x ] ) NEW_LINE DEDENT print ( ) NEW_LINE DEDENT def det ( matrix ) : NEW_LINE INDENT N = len ( matrix ) NEW_LINE a = 1 NEW_LINE for i in range ( N ) : NEW_LINE INDENT if matrix [ i ] [ i ] == 0 : NEW_LINE INDENT index = [ k for k in range ( i + 1 , N ) if matrix [ k ] [ i ] != 0 ] NEW_LINE if len ( index ) == 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT else : NEW_LINE INDENT k = index [ 0 ] NEW_LINE a *= - 1 NEW_LINE matrix [ i ] , matrix [ k ] = matrix [ k ] , matrix [ i ] NEW_LINE DEDENT DEDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT buf = matrix [ j ] [ i ] / matrix [ i ] [ i ] NEW_LINE for k in range ( N ) : NEW_LINE INDENT matrix [ j ] [ k ] = ( matrix [ j ] [ k ] - matrix [ i ] [ k ] * buf ) % 2 NEW_LINE DEDENT DEDENT DEDENT res = 1 NEW_LINE for i in range ( N ) : NEW_LINE INDENT res *= matrix [ i ] [ i ] NEW_LINE DEDENT return a * res NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE m = [ input ( ) for _ in range ( n ) ] NEW_LINE m = [ [ int ( j ) for j in i ] for i in m ] NEW_LINE print ( " Even " if det ( m ) == 0 else " Odd " ) NEW_LINE

import sys NEW_LINE input = sys . stdin . readline NEW_LINE def det ( A ) : NEW_LINE INDENT l = len ( A ) NEW_LINE if l == 1 : NEW_LINE INDENT return A [ 0 ] [ 0 ] NEW_LINE DEDENT B = [ [ A [ i ] [ j ] for i in range ( l ) ] for j in range ( l ) ] NEW_LINE for i in range ( l ) : NEW_LINE INDENT if B [ i ] [ 0 ] == 1 : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT return 0 NEW_LINE DEDENT for j in range ( l ) : NEW_LINE INDENT B [ i ] [ j ] , B [ 0 ] [ j ] = B [ 0 ] [ j ] , B [ i ] [ j ] NEW_LINE DEDENT for i in range ( 1 , l ) : NEW_LINE INDENT if B [ i ] [ 0 ] == 1 : NEW_LINE INDENT for j in range ( l ) : NEW_LINE INDENT B [ i ] [ j ] ^= B [ 0 ] [ j ] NEW_LINE DEDENT DEDENT DEDENT C = [ [ B [ i ] [ j ] for i in range ( 1 , l ) ] for j in range ( 1 , l ) ] NEW_LINE return det ( C ) NEW_LINE DEDENT n = int ( input ( ) ) NEW_LINE A = [ list ( map ( int , input ( ) . replace ( ' \n ' , ' ' ) ) ) for _ in range ( n ) ] NEW_LINE print ( ' Odd ' if det ( A ) else ' Even ' ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String args [ ] ) { int rep = 1 ; if ( args . length > 0 ) { rep = Integer . parseInt ( args [ 0 ] ) ; } ( new Main ( ) ) . __solve ( rep ) ; } void __solve ( int rep ) { try ( Scanner cin = new Scanner ( System . in ) ; ) { for ( int i = 0 ; i < rep ; ++ i ) { __solve ( cin ) ; } } } void __solve ( Scanner cin ) { String s = cin . next ( ) ; int K = cin . nextInt ( ) ; int N = s . length ( ) ; String array [ ] = new String [ N ] ; for ( int i = 0 ; i < N ; ++ i ) { array [ i ] = s . substring ( i ) ; } Arrays . sort ( array ) ; ans = null ; solve ( 0 , 0 , N , array , 0 , K ) ; System . out . println ( ans ) ; } String ans = null ; int solve ( int depth , int start , int end , String array [ ] , int total , int K ) { if ( ans != null ) { return - 1 ; } if ( array [ start ] . length ( ) == depth ) { ++ start ; } while ( start < end ) { char c = array [ start ] . charAt ( depth ) ; int next = start + 1 ; for ( ; next < end ; ++ next ) { if ( array [ next ] . charAt ( depth ) != c ) { break ; } } ++ total ; if ( total == K ) { ans = array [ start ] . substring ( 0 , depth + 1 ) ; return - 1 ; } total = solve ( depth + 1 , start , next , array , total , K ) ; start = next ; } return total ; } }

import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . TreeSet ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { public void solve ( int testNumber , InputReader in , PrintWriter out ) { String s = in . nextString ( ) ; int k = in . nextInt ( ) ; TreeSet < String > treeSet = new TreeSet < > ( ) ; for ( int i = 1 ; i <= k ; i ++ ) { for ( int j = 0 ; j + i <= s . length ( ) ; j ++ ) { treeSet . add ( s . substring ( j , j + i ) ) ; } } for ( int i = 0 ; i < k - 1 ; i ++ ) { treeSet . pollFirst ( ) ; } out . println ( treeSet . first ( ) ) ; } } static class InputReader { BufferedReader in ; StringTokenizer tok ; public String nextString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) , " ▁ " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return tok . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } }

import java . util . ArrayList ; import java . util . Scanner ; import java . util . TreeSet ; import java . util . stream . IntStream ; public class Main { public static String process ( TestCase testCase ) { final String s = testCase . s ; final int K = testCase . K ; TreeSet < String > set = new TreeSet < > ( ) ; final int length = s . length ( ) ; IntStream . range ( 0 , K + 1 ) . forEach ( i -> IntStream . range ( 0 , length - i ) . forEach ( j -> set . add ( s . substring ( j , j + i + 1 ) ) ) ) ; return new ArrayList < > ( set ) . get ( K - 1 ) ; } public static void main ( String [ ] args ) { TestCase testCase = readFromInput ( ) ; final String result = process ( testCase ) ; output ( result ) ; } private static TestCase readFromInput ( ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int K = sc . nextInt ( ) ; return new TestCase ( s , K ) ; } private static void output ( String result ) { System . out . println ( result ) ; } public static class TestCase { final String s ; final int K ; public TestCase ( String s , int K ) { this . s = s ; this . K = K ; } } }

import java . util . * ; public class Main { static int n , k ; static int [ ] a ; static int modP = 1000000007 ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; k = in . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; Queue < String > pq = new PriorityQueue < > ( ) ; int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { int lim = i + k + 1 < len + 1 ? i + k + 1 : len + 1 ; for ( int j = i + 1 ; j < lim ; j ++ ) { String sub = s . substring ( i , j ) ; if ( ! set . contains ( sub ) ) { pq . add ( sub ) ; set . add ( sub ) ; } } } for ( int i = 0 ; i < k - 1 ; i ++ ) { pq . poll ( ) ; } print ( pq . peek ( ) ) ; } static void print ( String s ) { System . out . println ( s ) ; } static void print ( int i ) { System . out . println ( i ) ; } } class P { int x , y ; P ( int x , int y ) { this . x = x ; this . y = y ; } } class E { int l , r , d ; E ( int l , int r , int d ) { this . l = l ; this . r = r ; this . d = d ; } }

import java . util . ArrayList ; import java . util . * ; class Main { public static void main ( String [ ] args ) { ArrayList < String > array = new ArrayList < String > ( ) ; ArrayList < String > arraySub ; Scanner scan = new Scanner ( System . in ) ; String substring = scan . nextLine ( ) ; int outNum = scan . nextInt ( ) ; for ( int i = 0 ; i < substring . length ( ) ; i ++ ) { String subText = substring . substring ( i ) ; for ( int j = 0 ; j < subText . length ( ) && j < outNum ; j ++ ) { array . add ( subText . substring ( 0 , j + 1 ) ) ; } } arraySub = new ArrayList < String > ( new HashSet < > ( array ) ) ; Collections . sort ( arraySub ) ; System . out . println ( arraySub . get ( outNum - 1 ) ) ; } }

s = input ( ) NEW_LINE k = int ( input ( ) ) NEW_LINE keys = [ ] NEW_LINE for start in range ( len ( s ) ) : NEW_LINE INDENT for end in range ( start + 1 , min ( start + 6 , len ( s ) + 1 ) ) : NEW_LINE INDENT key = s [ start : end ] NEW_LINE if key in keys : NEW_LINE INDENT continue NEW_LINE DEDENT if len ( keys ) < 5 : NEW_LINE INDENT keys . append ( key ) NEW_LINE keys . sort ( ) NEW_LINE DEDENT elif keys [ - 1 ] > key : NEW_LINE INDENT keys . append ( key ) NEW_LINE keys . sort ( ) NEW_LINE keys = keys [ : - 1 ] NEW_LINE DEDENT DEDENT DEDENT print ( keys [ k - 1 ] ) NEW_LINE

from collections import Counter NEW_LINE from functools import reduce NEW_LINE import fractions NEW_LINE import math NEW_LINE import statistics NEW_LINE import sys NEW_LINE import time NEW_LINE sys . setrecursionlimit ( 10 ** 7 ) NEW_LINE INF = 10 ** 18 NEW_LINE MOD = 10 ** 9 + 7 NEW_LINE def LI ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LF ( ) : return [ float ( x ) for x in sys . stdin . readline ( ) . split ( ) ] NEW_LINE def LS ( ) : return sys . stdin . readline ( ) . split ( ) NEW_LINE def MI ( ) : return map ( int , sys . stdin . readline ( ) . split ( ) ) NEW_LINE def II ( ) : return int ( sys . stdin . readline ( ) ) NEW_LINE def IS ( ) : return input ( ) NEW_LINE def P ( x ) : return print ( x ) NEW_LINE def C ( x ) : return Counter ( x ) NEW_LINE def GCD_LIST ( numbers ) : NEW_LINE INDENT return reduce ( fractions . gcd , numbers ) NEW_LINE DEDENT def LCM_LIST ( numbers ) : NEW_LINE INDENT return reduce ( LCM , numbers ) NEW_LINE DEDENT def LCM ( m , n ) : NEW_LINE INDENT return ( m * n // fractions . gcd ( m , n ) ) NEW_LINE DEDENT s = IS ( ) NEW_LINE K = II ( ) NEW_LINE substring = [ ] NEW_LINE for i in range ( 1 , K + 1 ) : NEW_LINE INDENT for j in range ( len ( s ) - i + 1 ) : NEW_LINE INDENT substring . append ( s [ j : j + i ] ) NEW_LINE DEDENT DEDENT print ( sorted ( set ( substring ) ) [ K - 1 ] ) NEW_LINE

s = list ( input ( ) ) NEW_LINE K = int ( input ( ) ) NEW_LINE n = len ( s ) NEW_LINE s1 = list ( set ( s . copy ( ) ) ) NEW_LINE s1 . sort ( ) NEW_LINE for i in range ( 5 ) : NEW_LINE INDENT s . append ( ' ' ) NEW_LINE DEDENT if ( len ( s1 ) >= 3 ) : n1 = 3 NEW_LINE else : n1 = len ( s1 ) NEW_LINE first = [ ] NEW_LINE for i in range ( n1 ) : NEW_LINE INDENT first . append ( s1 [ i ] ) NEW_LINE DEDENT s2 = [ ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT for j in first : NEW_LINE INDENT if ( s [ i ] == j ) : NEW_LINE INDENT s2 . append ( s [ i ] ) , s2 . append ( s [ i ] + s [ i + 1 ] ) , s2 . append ( s [ i ] + s [ i + 1 ] + s [ i + 2 ] ) NEW_LINE s2 . append ( s [ i ] + s [ i + 1 ] + s [ i + 2 ] + s [ i + 3 ] ) , s2 . append ( s [ i ] + s [ i + 1 ] + s [ i + 2 ] + s [ i + 3 ] + s [ i + 4 ] ) NEW_LINE DEDENT DEDENT DEDENT s2 = list ( set ( s2 ) ) NEW_LINE s2 . sort ( ) NEW_LINE ans = s2 [ K - 1 ] NEW_LINE print ( ans ) NEW_LINE

s = input ( ) ; print ( sorted ( { s [ I // 6 : I // 6 + I % 6 ] for I in range ( 30000 ) } ) [ int ( input ( ) ) ] ) NEW_LINE

import sys NEW_LINE s = input ( ) NEW_LINE K = int ( input ( ) ) NEW_LINE chars = sorted ( set ( s ) ) NEW_LINE n = len ( s ) NEW_LINE for j in range ( min ( 3 , len ( chars ) ) ) : NEW_LINE INDENT ans = chars [ j ] NEW_LINE K -= 1 NEW_LINE if K == 0 : NEW_LINE INDENT print ( ans ) NEW_LINE break NEW_LINE DEDENT while True : NEW_LINE INDENT places = [ ] NEW_LINE index = - 1 NEW_LINE while True : NEW_LINE INDENT index = s . find ( ans , index + 1 ) NEW_LINE if index == - 1 : NEW_LINE INDENT break NEW_LINE DEDENT places . append ( index ) NEW_LINE DEDENT if len ( ans ) == len ( s ) - places [ 0 ] : NEW_LINE INDENT break NEW_LINE DEDENT next_char = ' z ' * 6 NEW_LINE for k in places : NEW_LINE INDENT if k >= len ( s ) - len ( ans ) : NEW_LINE INDENT break NEW_LINE DEDENT next_char = min ( next_char , s [ k + len ( ans ) ] ) NEW_LINE DEDENT ans += next_char NEW_LINE K -= 1 NEW_LINE if K == 0 : NEW_LINE INDENT print ( ans ) NEW_LINE sys . exit ( ) NEW_LINE DEDENT DEDENT DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; boolean [ ] [ ] rlist = new boolean [ N ] [ N ] ; for ( int i = 0 ; i < M ; i ++ ) { int x = sc . nextInt ( ) - 1 ; int y = sc . nextInt ( ) - 1 ; rlist [ x ] [ y ] = true ; rlist [ y ] [ x ] = true ; } int r = 1 ; double n = Math . pow ( 2 , N ) ; for ( int i = 1 ; i < n ; i ++ ) { ArrayList < Integer > alist = new ArrayList < Integer > ( ) ; boolean valid = true ; for ( int j = 0 ; j < N ; j ++ ) { if ( ( 1 & i >> j ) == 1 ) { alist . add ( j ) ; } } for ( int j = 0 ; j < alist . size ( ) ; j ++ ) { for ( int k = j + 1 ; k < alist . size ( ) ; k ++ ) { if ( ! rlist [ alist . get ( j ) ] [ alist . get ( k ) ] ) { valid = false ; break ; } } if ( ! valid ) { break ; } } if ( valid ) { r = Math . max ( r , alist . size ( ) ) ; } } System . out . println ( r ) ; } }

import java . util . Arrays ; import java . util . Scanner ; public class Main { int n , m ; boolean [ ] [ ] g ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; g = new boolean [ n ] [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { int a = sc . nextInt ( ) - 1 , b = sc . nextInt ( ) - 1 ; g [ a ] [ b ] = true ; g [ b ] [ a ] = true ; } int ans = 1 ; for ( int i = 0 ; i < ( 1 << n ) ; i ++ ) { if ( check ( i ) ) { ans = Math . max ( ans , Integer . bitCount ( i ) ) ; } } System . out . println ( ans ) ; } boolean check ( int S ) { for ( int t = 0 ; t < n ; t ++ ) for ( int s = t + 1 ; s < n ; s ++ ) { if ( ( ( S >> t ) & 1 ) == 1 && ( ( S >> s ) & 1 ) == 1 ) { if ( ! g [ t ] [ s ] ) { return false ; } } } return true ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } }

import java . io . InputStream ; import java . io . PrintStream ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; int n , m ; Integer [ ] [ ] siri ; private boolean canJoin ( List < Integer > habatu , Integer c ) { if ( habatu . contains ( c ) ) { return false ; } for ( int x : habatu ) { if ( siri [ c ] [ x ] == 0 ) { return false ; } } return true ; } private int solve ( List < Integer > habatu , Integer c ) { if ( canJoin ( habatu , c ) ) { int max = 0 ; List < Integer > newHabatu = new ArrayList < > ( habatu ) ; newHabatu . add ( c ) ; for ( int i = c ; i <= n ; i ++ ) { max = Math . max ( max , solve ( newHabatu , i ) ) ; } return max ; } else { return habatu . size ( ) ; } } public void _main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; siri = new Integer [ n + 1 ] [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { Arrays . fill ( siri [ i ] , 0 ) ; } for ( int i = 0 ; i < m ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; siri [ x ] [ y ] = 1 ; siri [ y ] [ x ] = 1 ; } int max = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { max = Math . max ( max , solve ( new ArrayList < > ( ) , i ) ) ; } out . println ( max ) ; sc . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . _main ( args ) ; } }

import java . util . ArrayList ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int memberCnt = sc . nextInt ( ) ; int relatedCnt = sc . nextInt ( ) ; HashMap < Integer , ArrayList < Integer > > relations = new HashMap < Integer , ArrayList < Integer > > ( ) ; for ( int i = 0 ; i < relatedCnt ; i ++ ) { int oneSelf = sc . nextInt ( ) ; int pair = sc . nextInt ( ) ; ArrayList < Integer > friends = new ArrayList < Integer > ( ) ; if ( relations . containsKey ( oneSelf ) ) { friends = relations . get ( oneSelf ) ; } friends . add ( pair ) ; relations . put ( oneSelf , friends ) ; } int max = 1 ; for ( int n = 1 ; n <= memberCnt ; n ++ ) { if ( relations . containsKey ( n ) ) { max = Math . max ( max , 1 + getMaxRelations ( relations , relations . get ( n ) ) ) ; } } System . out . println ( max ) ; sc . close ( ) ; } public static int getMaxRelations ( HashMap < Integer , ArrayList < Integer > > relations , ArrayList < Integer > friends ) { int max = 1 ; for ( int data : friends ) { if ( relations . containsKey ( data ) ) { ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int temp : relations . get ( data ) ) { if ( friends . contains ( temp ) ) { list . add ( temp ) ; } } if ( list . size ( ) != 0 ) { max = Math . max ( max , 1 + getMaxRelations ( relations , list ) ) ; } } } return max ; } }

import java . util . Scanner ; public class Main { private static int n ; private static boolean [ ] [ ] a ; private static int solve ( int include , int i ) { if ( i == n ) { int res = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( include % 2 == 1 ) res ++ ; include /= 2 ; } return res ; } boolean flag = true ; int tmp = include ; for ( int j = 0 ; j < i ; j ++ ) { if ( tmp % 2 == 1 && ! a [ j ] [ i ] ) { flag = false ; break ; } tmp /= 2 ; } if ( flag ) { return Math . max ( solve ( include + ( int ) Math . pow ( 2 , i ) , i + 1 ) , solve ( include , i + 1 ) ) ; } else { return solve ( include , i + 1 ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; a = new boolean [ n ] [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { int x = sc . nextInt ( ) - 1 ; int y = sc . nextInt ( ) - 1 ; a [ x ] [ y ] = true ; } System . out . println ( solve ( 0 , 0 ) ) ; sc . close ( ) ; } }

import itertools NEW_LINE n , m = map ( int , input ( ) . split ( ) ) NEW_LINE relations = [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in range ( m ) ] NEW_LINE for i in range ( n , 0 , - 1 ) : NEW_LINE INDENT for j in itertools . combinations ( range ( 1 , n + 1 ) , i ) : NEW_LINE INDENT if all ( ( x , y ) in relations for x , y in itertools . combinations ( j , 2 ) ) : NEW_LINE INDENT print ( i ) NEW_LINE break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT continue NEW_LINE DEDENT break NEW_LINE DEDENT

from sys import stdin NEW_LINE input = stdin . readline NEW_LINE N , M = [ int ( x ) for x in input ( ) . rstrip ( ) . split ( ) ] NEW_LINE xy = [ tuple ( [ int ( x ) for x in input ( ) . rstrip ( ) . split ( ) ] ) for _ in range ( M ) ] NEW_LINE xy = set ( xy ) NEW_LINE def is_connected ( node0 , node1 ) : NEW_LINE INDENT edge = ( node0 , node1 ) if node0 < node1 else ( node1 , node0 ) NEW_LINE return edge in xy NEW_LINE DEDENT def find_kyokudai ( target ) : NEW_LINE INDENT ok = [ ] NEW_LINE not_searched = [ x for x in range ( 1 , N + 1 ) if x != target ] NEW_LINE flag = 0 NEW_LINE ok . append ( target ) NEW_LINE while not flag : NEW_LINE INDENT for x in not_searched : NEW_LINE INDENT for y in ok : NEW_LINE INDENT if is_connected ( y , x ) : NEW_LINE INDENT pass NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT ok . append ( x ) NEW_LINE not_searched . remove ( x ) NEW_LINE break NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT flag = 1 NEW_LINE DEDENT DEDENT return len ( ok ) NEW_LINE DEDENT ans = [ ] NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT ans . append ( find_kyokudai ( i ) ) NEW_LINE DEDENT print ( max ( ans ) ) NEW_LINE

import numpy as np NEW_LINE N , M = map ( int , input ( ) . rstrip ( ) . split ( ) ) NEW_LINE relationships = [ [ False for j in range ( N + 1 ) ] for i in range ( N + 1 ) ] NEW_LINE for i in range ( M ) : NEW_LINE INDENT a , b = map ( int , input ( ) . rstrip ( ) . split ( ) ) NEW_LINE relationships [ a ] [ b ] = True NEW_LINE relationships [ b ] [ a ] = True NEW_LINE DEDENT for i in range ( 1 , N + 1 ) : NEW_LINE INDENT relationships [ i ] [ i ] = True NEW_LINE DEDENT def list_and ( lst1 , lst2 ) : NEW_LINE INDENT array = np . logical_and ( np . array ( lst1 ) , np . array ( lst2 ) ) NEW_LINE return array . tolist ( ) NEW_LINE DEDENT ans = 0 NEW_LINE for i in range ( 2 ** N ) : NEW_LINE INDENT members = list ( str ( bin ( i ) ) . lstrip ( '0b ' ) . zfill ( N + 1 ) ) NEW_LINE habatsu = list ( map ( int , members ) ) NEW_LINE for n in range ( 1 , len ( members ) ) : NEW_LINE INDENT if members [ n ] == '1' : NEW_LINE INDENT habatsu = list_and ( habatsu , relationships [ n ] ) NEW_LINE DEDENT DEDENT total = sum ( habatsu ) NEW_LINE if ans < total : NEW_LINE INDENT ans = total NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

print ( ( lambda c , d , N , M : ( lambda a : max ( len ( d [ ' J ' ] ) for i in range ( 1 << N ) if d . update ( J = [ j + 1 for j in range ( N ) if i >> j & 1 ] ) or all ( i in a for i in c ( d [ ' J ' ] , 2 ) ) ) ) ( [ tuple ( map ( int , input ( ) . split ( ) ) ) for _ in [ 0 ] * M ] ) ) ( __import__ ( ' itertools ' ) . combinations , { } , * map ( int , input ( ) . split ( ) ) ) ) NEW_LINE

def habatu ( ) : NEW_LINE INDENT n , m = map ( int , input ( ) . split ( ) ) NEW_LINE gin = [ [ 0 for i in range ( n ) ] for i in range ( n ) ] NEW_LINE for i in range ( m ) : NEW_LINE INDENT x , y = map ( int , input ( ) . split ( ) ) NEW_LINE gin [ x - 1 ] [ y - 1 ] = 1 NEW_LINE gin [ y - 1 ] [ x - 1 ] = 1 NEW_LINE DEDENT gg = [ [ i ] for i in range ( n ) ] NEW_LINE for i in gg : NEW_LINE INDENT for j in range ( n ) : NEW_LINE INDENT for x in i : NEW_LINE INDENT d = True NEW_LINE if gin [ x ] [ j ] == 0 : NEW_LINE INDENT d = False NEW_LINE break NEW_LINE DEDENT DEDENT if d : NEW_LINE INDENT i += [ j ] NEW_LINE DEDENT DEDENT gg [ i [ 0 ] ] = i NEW_LINE DEDENT gg = list ( map ( lambda x : len ( x ) , gg ) ) NEW_LINE return max ( gg ) NEW_LINE DEDENT print ( habatu ( ) ) NEW_LINE


import java . util . Scanner ; public class Main { static String ban [ ] ; static int ban2 [ ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ban = sc . next ( ) . split ( " " ) ; ban2 = new int [ ban . length ] ; int sum = 0 ; boolean flag = true ; int left = 1 ; int right = ban . length - 2 ; while ( flag ) { String colorL = handan ( 0 ) ; String colorR = handan ( ban . length - 1 ) ; for ( int i = left ; left < ban . length ; left ++ ) { if ( ! colorL . equals ( handan ( left ) ) ) { break ; } } for ( int i = right ; right >= 0 ; right -- ) { if ( ! colorR . equals ( handan ( right ) ) ) { break ; } } int R = ban . length - 1 - right ; int L = left ; if ( L > ban . length - 1 ) { flag = false ; break ; } else if ( L < R ) { sum ++ ; for ( int j = 0 ; j < left ; j ++ ) { ban2 [ j ] ++ ; } } else { sum ++ ; for ( int j = right ; j >= 0 ; j -- ) { ban2 [ j ] ++ ; } } } System . out . println ( sum ) ; } static String handan ( int a ) { if ( ban2 [ a ] % 2 == 0 ) { return ban [ a ] ; } else { if ( ban [ a ] . equals ( " B " ) ) { return " W " ; } else { return " B " ; } } } }

import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int total = 0 ; char c = line . charAt ( 0 ) ; for ( int i = 1 ; i < line . length ( ) ; i ++ ) { if ( c != line . charAt ( i ) ) { c = line . charAt ( i ) ; total ++ ; } } System . out . println ( total ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; String string = input . nextLine ( ) ; char first = ' ▁ ' ; int counter = 0 ; for ( char b : string . toCharArray ( ) ) { if ( first == ' ▁ ' ) { first = b ; } else { if ( b == first ) { } else { first = b ; counter ++ ; } } } System . out . println ( counter ) ; } }

import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String __ [ ] ) { solve ( s . next ( ) ) ; } private static final void solve ( String s ) { int count = 0 ; for ( int i = 1 ; i < s . length ( ) ; i ++ ) if ( s . charAt ( i ) != s . charAt ( i - 1 ) ) count ++ ; System . out . println ( count ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { char [ ] s = sc . next ( ) . toCharArray ( ) ; char preC = s [ 0 ] ; int count = 0 ; for ( char c : s ) { if ( c != preC ) { count ++ ; } preC = c ; } System . out . println ( count ) ; } }

S = input ( ) NEW_LINE count = 0 NEW_LINE stn = S [ 0 ] NEW_LINE i = 1 NEW_LINE while i < len ( S ) : NEW_LINE INDENT while i < len ( S ) and stn == S [ i ] : i += 1 NEW_LINE if i < len ( S ) : NEW_LINE INDENT count += 1 NEW_LINE stn = S [ i ] NEW_LINE DEDENT DEDENT print ( count ) NEW_LINE

s = input ( ) NEW_LINE ans = 0 NEW_LINE pre = s [ 0 ] NEW_LINE for i in range ( 1 , len ( s ) ) : NEW_LINE INDENT if ( pre == s [ i ] ) : NEW_LINE INDENT continue NEW_LINE DEDENT else : NEW_LINE INDENT ans += 1 NEW_LINE pre = s [ i ] NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

S = [ i for i in input ( ) ] NEW_LINE ans = 0 NEW_LINE for i in range ( len ( S ) - 1 ) : NEW_LINE INDENT if S [ i ] == " W " and S [ i + 1 ] == " B " : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT elif S [ i ] == " B " and S [ i + 1 ] == " W " : NEW_LINE INDENT ans += 1 NEW_LINE DEDENT DEDENT print ( ans ) NEW_LINE

s = input ( ) NEW_LINE print ( s . count ( " BW " ) + s . count ( " WB " ) ) NEW_LINE

S = input ( ) NEW_LINE Slen = len ( S ) NEW_LINE cnt = 0 NEW_LINE index = 0 NEW_LINE if S [ 0 ] == " B " : NEW_LINE INDENT while index <= Slen - 2 : NEW_LINE INDENT if S [ index ] == " B " and S [ index + 1 ] == " W " : NEW_LINE INDENT cnt += 1 NEW_LINE index += 2 NEW_LINE DEDENT else : NEW_LINE INDENT index += 1 NEW_LINE DEDENT DEDENT if S [ - 1 ] == " W " : NEW_LINE INDENT print ( str ( cnt * 2 - 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( str ( cnt * 2 ) ) NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT while index <= Slen - 2 : NEW_LINE INDENT if S [ index ] == " W " and S [ index + 1 ] == " B " : NEW_LINE INDENT cnt += 1 NEW_LINE index += 2 NEW_LINE DEDENT else : NEW_LINE INDENT index += 1 NEW_LINE DEDENT DEDENT if S [ - 1 ] == " B " : NEW_LINE INDENT print ( str ( cnt * 2 - 1 ) ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( str ( cnt * 2 ) ) NEW_LINE DEDENT DEDENT


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; int p = sc . nextInt ( ) ; int q = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int ans = 0 ; int n1 = ( n / p ) * ( m / q ) * ( l / r ) ; int n2 = ( n / p ) * ( m / r ) * ( l / q ) ; int n3 = ( n / q ) * ( m / p ) * ( l / r ) ; int n4 = ( n / q ) * ( m / r ) * ( l / p ) ; int n5 = ( n / r ) * ( m / p ) * ( l / q ) ; int n6 = ( n / r ) * ( m / q ) * ( l / p ) ; ans = Math . max ( ans , n1 ) ; ans = Math . max ( ans , n2 ) ; ans = Math . max ( ans , n3 ) ; ans = Math . max ( ans , n4 ) ; ans = Math . max ( ans , n5 ) ; ans = Math . max ( ans , n6 ) ; System . out . println ( ans ) ; } }

import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int [ ] box = new int [ 3 ] ; int [ ] parcel = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { box [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 3 ; i ++ ) { parcel [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { ans = max ( ans , ( box [ 0 ] / parcel [ i ] ) * ( box [ 1 ] / parcel [ ( i + 1 ) % 3 ] ) * ( box [ 2 ] / parcel [ ( i + 2 ) % 3 ] ) ) ; } int t = box [ 0 ] ; box [ 0 ] = box [ 1 ] ; box [ 1 ] = t ; for ( int i = 0 ; i < 3 ; i ++ ) { ans = max ( ans , ( box [ 0 ] / parcel [ i ] ) * ( box [ 1 ] / parcel [ ( i + 1 ) % 3 ] ) * ( box [ 2 ] / parcel [ ( i + 2 ) % 3 ] ) ) ; } out . println ( ans ) ; } }

import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { static final Scanner s = new Scanner ( System . in ) ; static IntStream REPS ( int v ) { return IntStream . range ( 0 , v ) ; } static IntStream REPS ( int l , int r ) { return IntStream . rangeClosed ( l , r ) ; } static IntStream INS ( int n ) { return REPS ( n ) . map ( i -> getInt ( ) ) ; } static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static int n = getInt ( ) , m = getInt ( ) , l = getInt ( ) ; public static void main ( String [ ] $ ) { int p = getInt ( ) , q = getInt ( ) , r = getInt ( ) ; System . out . println ( Arrays . stream ( new int [ ] { hoge ( p , q , r ) , hoge ( p , r , q ) , hoge ( q , p , r ) , hoge ( q , r , p ) , hoge ( r , p , q ) , hoge ( r , q , p ) } ) . max ( ) . getAsInt ( ) ) ; } static int hoge ( int p , int q , int r ) { return ( n / p ) * ( m / q ) * ( l / r ) ; } }

import java . util . Scanner ; import java . util . function . BiFunction ; public class Main { static final Scanner s = new Scanner ( System . in ) ; static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } @ SafeVarargs static < T > T ofAll ( BiFunction < T , T , T > funk , T ... a ) { T t = a [ 0 ] ; for ( int i = 1 ; i < a . length ; i ++ ) t = funk . apply ( t , a [ i ] ) ; return t ; } static int n = getInt ( ) , m = getInt ( ) , l = getInt ( ) , p = getInt ( ) , q = getInt ( ) , r = getInt ( ) ; public static void main ( String [ ] $ ) { System . out . println ( ofAll ( Integer :: max , solve ( p , q , r ) , solve ( p , r , q ) , solve ( q , p , r ) , solve ( q , r , p ) , solve ( r , p , q ) , solve ( r , q , p ) ) ) ; } static int solve ( int x , int y , int z ) { return ( n / x ) * ( m / y ) * ( l / z ) ; } }

import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , m = in . nextInt ( ) , l = in . nextInt ( ) , p = in . nextInt ( ) , q = in . nextInt ( ) , r = in . nextInt ( ) , max = 0 ; max = Math . max ( max , ( n / p ) * ( m / q ) * ( l / r ) ) ; max = Math . max ( max , ( n / p ) * ( m / r ) * ( l / q ) ) ; max = Math . max ( max , ( n / q ) * ( m / p ) * ( l / r ) ) ; max = Math . max ( max , ( n / q ) * ( m / r ) * ( l / p ) ) ; max = Math . max ( max , ( n / r ) * ( m / p ) * ( l / q ) ) ; max = Math . max ( max , ( n / r ) * ( m / q ) * ( l / p ) ) ; System . out . println ( max ) ; } }

N , M , L = map ( int , input ( ) . split ( ) ) NEW_LINE P , Q , R = map ( int , input ( ) . split ( ) ) NEW_LINE pqr = ( N // P ) * ( M // Q ) * ( L // R ) NEW_LINE prq = ( N // P ) * ( M // R ) * ( L // Q ) NEW_LINE qpr = ( N // Q ) * ( M // P ) * ( L // R ) NEW_LINE qrp = ( N // Q ) * ( M // R ) * ( L // P ) NEW_LINE rpq = ( N // R ) * ( M // P ) * ( L // Q ) NEW_LINE rqp = ( N // R ) * ( M // Q ) * ( L // P ) NEW_LINE print ( max ( pqr , prq , qpr , qrp , rpq , rqp ) ) NEW_LINE

def main ( ) : NEW_LINE INDENT x1 , y1 , z1 = map ( int , input ( ) . split ( ) ) NEW_LINE x2 , y2 , z2 = map ( int , input ( ) . split ( ) ) NEW_LINE print ( solve ( x1 , y1 , z1 , x2 , y2 , z2 ) ) NEW_LINE DEDENT def solve ( x1 , y1 , z1 , x2 , y2 , z2 ) : NEW_LINE INDENT r = 0 NEW_LINE r = max ( r , ( x1 // x2 ) * ( y1 // y2 ) * ( z1 // z2 ) ) NEW_LINE r = max ( r , ( x1 // x2 ) * ( y1 // z2 ) * ( z1 // y2 ) ) NEW_LINE r = max ( r , ( x1 // y2 ) * ( y1 // x2 ) * ( z1 // z2 ) ) NEW_LINE r = max ( r , ( x1 // y2 ) * ( y1 // z2 ) * ( z1 // x2 ) ) NEW_LINE r = max ( r , ( x1 // z2 ) * ( y1 // x2 ) * ( z1 // y2 ) ) NEW_LINE r = max ( r , ( x1 // z2 ) * ( y1 // y2 ) * ( z1 // x2 ) ) NEW_LINE return r NEW_LINE DEDENT main ( ) NEW_LINE

from functools import reduce NEW_LINE from itertools import permutations NEW_LINE import sys NEW_LINE sys . setrecursionlimit ( 10 ** 9 ) NEW_LINE input = sys . stdin . readline NEW_LINE def di ( A , B ) : NEW_LINE INDENT return [ a // b for a , b in zip ( A , B ) ] NEW_LINE DEDENT def mul ( a , b ) : NEW_LINE INDENT return a * b NEW_LINE DEDENT def mu ( A ) : NEW_LINE INDENT return reduce ( mul , A ) NEW_LINE DEDENT A = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE B = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE ans = 0 NEW_LINE pe = permutations ( B ) NEW_LINE for a in pe : NEW_LINE INDENT ans = max ( ans , mu ( di ( A , a ) ) ) NEW_LINE DEDENT print ( ans ) NEW_LINE

from itertools import * NEW_LINE f , g , h , * a , = map ( int , open ( 0 ) . read ( ) . split ( ) ) NEW_LINE ans = 1 NEW_LINE l = [ ] NEW_LINE for s , t , r in ( permutations ( a ) ) : NEW_LINE INDENT ans *= ( f // s ) * ( g // t ) * ( h // r ) NEW_LINE l . append ( ans ) NEW_LINE ans = 1 NEW_LINE DEDENT print ( max ( l ) ) NEW_LINE