<<<<<<< HEAD import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String in = br . readLine ( ) ; String chr [ ] = in . split ( " " ) ; int a = Integer . parseInt ( chr [ 0 ] ) ; int b = Integer . parseInt ( chr [ 1 ] ) ; int c = Integer . parseInt ( chr [ 2 ] ) ; System . out . println ( Math . max ( a , Math . max ( b , c ) ) - Math . min ( a , Math . min ( b , c ) ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double deg = ( double ) ( h + ( double ) m / 60 ) * 30 - ( double ) m * 6 ; deg = Math . toRadians ( deg ) ; double acos = a * Math . cos ( deg ) ; double asin = a * Math . sin ( deg ) ; double ans = Math . pow ( b - acos , 2 ) + Math . pow ( asin , 2 ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 2 ] ; b [ 0 ] = 0 ; b [ 1 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] = = 5 ) { b [ 0 ] + + ; } else if ( a [ i ] = = 7 ) { b [ 1 ] + + ; } } if ( ( b [ 0 ] = = 2 ) & & ( b [ 1 ] = = 1 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antennaArr = new int [ 5 ] ; for ( int i = 0 ; i < antennaArr . length ; i + + ) { antennaArr [ i ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean canConnect = true ; for ( int i = 0 ; i < antennaArr . length ; i + + ) { for ( int j = 0 ; j < antennaArr . length ; j + + ) { if ( i > = j ) { continue ; } if ( antennaArr [ j ] - antennaArr [ i ] > border ) { canConnect = false ; } } } if ( canConnect ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = n ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( n -- > 0 ) { if ( sc . next ( ) . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; break ; } if ( n = = 0 ) System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int H = scan . nextInt ( ) ; int R = scan . nextInt ( ) ; if ( H + R > 0 ) { System . out . println ( " 1 " ) ; } else if ( H + R < 0 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " 0 " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean i = true ; String [ ] s = new String [ N ] ; for ( int l = 0 ; l < N ; l + + ) { s [ l ] = sc . next ( ) ; if ( s [ l ] . equals ( " Y " ) ) i = false ; } sc . close ( ) ; if ( i ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } 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 k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int com = s - ( i + j ) ; if ( com > = 0 & & k > = com ) count + + ; } } System . out . println ( count ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( in . next ( ) . equals ( " Y " ) ) { out . print ( " Four " ) ; return ; } } out . print ( " Three " ) ; } } } import java . util . * ; public class Main { public static Map < Long , Long > map = new HashMap < > ( ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; bunkai ( P ) ; long ans = 1 ; for ( Long n : map . keySet ( ) ) { if ( map . get ( n ) > = N ) { long tmp = map . get ( n ) / N ; ans * = pow ( n , tmp ) ; } } System . out . println ( ans ) ; } public static void bunkai ( long n ) { while ( n ! = 1 ) { long num = sosuHantei ( n ) ; long count = 0 ; while ( n % num = = 0 ) { count + + ; n / = num ; } map . put ( num , count ) ; } } public static long sosuHantei ( long n ) { for ( long i = 2 ; i * i < = n ; i + + ) { if ( n % i = = 0 ) return i ; } return n ; } public static long pow ( long x , long y ) { long ans = 1 ; for ( long i = 0 ; i < y ; i + + ) { ans * = x ; } return ans ; } } import java . util . Arrays ; import java . util . Optional ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Integer [ ] num = new Integer [ new Scanner ( System . in ) . nextInt ( ) ] ; for ( int i = 1 ; i < = num . length ; i + + ) { num [ i - 1 ] = i ; } Optional < Integer > maxdivision = Arrays . asList ( num ) . stream ( ) . map ( Main : : countCanDivideBy2 ) . max ( Integer : : compare ) ; int result = ( int ) Math . pow ( 2d , maxdivision . get ( ) . doubleValue ( ) ) ; System . out . println ( result ) ; } public static int countCanDivideBy2 ( Integer i ) { int result = 0 ; for ( ; i % 2 = = 0 & & i > 0 ; result + + ) { i / = 2 ; } return result ; } } import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] antenna = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antenna [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; String ans = " Yay ! " ; x : for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 - j ; j + + ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > k ) { ans = " : ( " ; break x ; } } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { MyReader r = new MyReader ( ) ; int K , S ; { int [ ] a = r . ii ( ) ; K = a [ 0 ] ; S = a [ 1 ] ; } int count = 0 ; for ( int i = 0 ; i < K + 1 ; i + + ) for ( int j = 0 , k ; j < K + 1 ; j + + ) if ( 0 < = ( k = S - i - j ) & & k < = K ) count + + ; println ( count ) ; } static void print ( Object o ) { System . out . print ( o . toString ( ) ) ; } static void println ( Object o ) { System . out . println ( o . toString ( ) ) ; } static int Int ( String s ) { return Integer . parseInt ( s ) ; } static long Long ( String s ) { return Long . parseLong ( s ) ; } static class MyReader extends BufferedReader { MyReader ( ) { super ( new InputStreamReader ( System . in ) ) ; } String s ( ) throws IOException { return readLine ( ) ; } String [ ] ss ( ) throws IOException { return s ( ) . split ( " " ) ; } int i ( ) throws IOException { return Int ( s ( ) ) ; } int [ ] ii ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; int [ ] ii = new int [ size ] ; for ( int j = 0 ; j < size ; j + + ) ii [ j ] = Integer . parseInt ( ss [ j ] ) ; return ii ; } long l ( ) throws IOException { return Long ( s ( ) ) ; } long [ ] ll ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; long [ ] ll = new long [ size ] ; for ( int j = 0 ; j < size ; j + + ) ll [ j ] = Long . parseLong ( ss [ j ] ) ; return ll ; } } } import java . util . * ; public class Main { public static final int MAX = 3501 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = Long . parseLong ( sc . next ( ) ) ; for ( long x = 2 ; x < MAX ; x + = 2 ) { for ( long y = x ; y < MAX ; y + = 2 ) { long u = n * x * y ; long d = 4L * x * y - n * x - n * y ; if ( d ! = 0 & & u % d = = 0 & & u / d > 0 ) { long z = u / d ; System . out . println ( x + " " + y + " " + z ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 0 , count2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 5 ) { count + + ; } if ( a = = 7 ) { count2 + + ; } } if ( count = = 2 & & count2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; sc . close ( ) ; long h = - 1 ; long n = - 1 ; long w = - 1 ; for ( long x = 1 ; x < = 3500 ; x + + ) { for ( long y = 1 ; y < = 3500 ; y + + ) { long dived = 4 * x * y - N * ( x + y ) ; if ( dived = = 0 ) continue ; long z = ( N * x * y ) / dived ; if ( 4 * x * y * z = = N * ( x * y + y * z + z * x ) & & z > = 0 ) { h = x ; n = y ; w = z ; break ; } } if ( h > 0 ) break ; } System . out . println ( String . format ( " % d % d % d " , h , n , w ) ) ; } } 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 ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < m ; i + + ) { y [ i ] = sc . nextLong ( ) ; } long xSum = 0 ; n -- ; m -- ; for ( int i = 0 ; i < n / 2.0 ; i + + ) { xSum + = ( x [ n - i ] - x [ i ] ) * ( long ) ( n - 2 * i ) ; xSum = xSum % 1000000007l ; } long ySum = 0 ; for ( int i = 0 ; i < m / 2.0 ; i + + ) { ySum + = ( y [ m - i ] - y [ i ] ) * ( long ) ( m - 2 * i ) ; ySum = ySum % 1000000007l ; } long result = 0 ; result = xSum % 1000000007l ; result = ( result * ySum ) % 1000000007l ; System . out . println ( result ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long T1 = sc . nextLong ( ) , T2 = sc . nextLong ( ) ; long A1 = sc . nextLong ( ) , A2 = sc . nextLong ( ) ; long B1 = sc . nextLong ( ) , B2 = sc . nextLong ( ) ; long D1 = A1 - B1 , D2 = A2 - B2 ; if ( T1 * D1 + T2 * D2 = = 0 ) System . out . println ( " infinity " ) ; else if ( ( T1 * D1 > 0 ) = = ( T1 * D1 + T2 * D2 > 0 ) ) System . out . println ( 0 ) ; else { if ( D1 > 0 ) { D1 * = - 1 ; D2 * = - 1 ; } long cycleDistance = T1 * D1 + T2 * D2 ; long backLimit = Math . abs ( D1 * T1 ) ; System . out . println ( 2 * ( backLimit / cycleDistance ) + ( backLimit % cycleDistance = = 0 ? 0 : 1 ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String result = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { result = " Four " ; break ; } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int x = i ; int a = 0 ; while ( x % 2 = = 0 ) { x / = 2 ; a + + ; } if ( max < a ) { max = a ; ans = i ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int [ ] A = in . Int ( 3 ) ; Arrays . sort ( A ) ; int cost = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { cost + = ( A [ i ] - A [ i - 1 ] ) ; } out . println ( cost ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl = = null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } public int [ ] Int ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Int ( ) ; } return a ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int P = scanner . nextInt ( ) ; if ( P < = min ) { count + + ; min = P ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( e - a > k | | d - a > k | | c - a > k | | b - a > k ) { System . out . println ( " : ( " ) ; return ; } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int min = 200005 ; for ( int i = 0 ; i < n ; i + + ) { int val = sc . nextInt ( ) ; if ( val < min ) { + + count ; min = val ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { long a = N * h * n ; long b = 4 * h * n - N * n - N * h ; if ( b < = 0 ) continue ; if ( a % b = = 0 ) { System . out . printf ( " % d % d % d \ n " , h , n , a / b ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int array [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; Arrays . sort ( array ) ; if ( ( array [ 4 ] - array [ 0 ] ) < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int h = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; double a _ angle = h * ( 360 / 12 ) + m * 0.5 ; double b _ angle = m * ( 360 / 60 ) ; double c = a _ angle - b _ angle ; if ( c < 0 ) c + = 360 ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( c ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; scan . close ( ) ; int waru ; int max = 0 ; int cnt = 0 ; int max _ num = 1 ; while ( n > 0 ) { cnt = 0 ; waru = n ; while ( waru % 2 = = 0 ) { cnt + + ; waru = waru / 2 ; } if ( max < cnt ) { max = cnt ; max _ num = n ; } n -- ; } System . out . println ( max _ num ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( ( S - i - j ) < = K & & 0 < = ( S - i - j ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] num = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; + + i ) { int n = scanner . nextInt ( ) ; num [ n ] + + ; } if ( num [ 1 ] = = 1 & & num [ 9 ] = = 1 & & num [ 7 ] = = 1 & & num [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; List < Long > aList = new ArrayList < > ( ) ; List < Long > diffList = new ArrayList < > ( ) ; long sumA = 0 ; long sumB = 0 ; for ( long i = 0 ; i < n ; i + + ) { long a = sc . nextLong ( ) ; aList . add ( a ) ; sumA + = a ; } for ( long i = 0 ; i < n ; i + + ) { long b = sc . nextLong ( ) ; sumB + = b ; diffList . add ( b - aList . get ( ( int ) i ) ) ; } if ( sumA < sumB ) { System . out . println ( - 1 ) ; } else { Collections . sort ( diffList ) ; long totalNeed = diffList . stream ( ) . filter ( d - > d > 0 ) . mapToLong ( x - > x ) . sum ( ) ; long resultCount = diffList . stream ( ) . filter ( d - > d > 0 ) . mapToLong ( x - > x ) . count ( ) ; if ( totalNeed = = 0 ) { System . out . println ( 0 ) ; } else { for ( long i = 0 ; i < diffList . size ( ) ; i + + ) { long curSupplier = diffList . get ( ( int ) i ) ; totalNeed + = curSupplier ; resultCount + + ; if ( totalNeed < = 0 ) { break ; } } System . out . println ( resultCount ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ ] { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( a ) ; int cost = 0 ; cost + = a [ 1 ] - a [ 0 ] ; cost + = a [ 2 ] - a [ 1 ] ; System . out . println ( cost ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; for ( int i = n ; 0 < i ; i -- ) { int cnt = 0 ; for ( int j = 2 ; ; j * = 2 ) { if ( i % j = = 0 ) { cnt = j ; } else { break ; } } ans = Math . max ( ans , cnt ) ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 1 ; int count = 0 ; int x = 0 ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = n ; i + + ) { if ( i % 2 = = 0 ) { x = countHalf ( i ) ; if ( count < x ) { count = x ; ans = i ; } } } System . out . println ( ans ) ; sc . close ( ) ; } public static int countHalf ( int i ) { int count = 0 ; boolean a = true ; while ( a ) { if ( i % 2 = = 0 ) { i / = 2 ; count + + ; } else { a = false ; } } return count ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 0 ; int ans = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int x = i ; int y = 0 ; for ( int j = 1 ; j < = 100 ; j + + ) { if ( x % 2 ! = 0 ) { break ; } else { x = x / 2 ; y + = 1 ; } } max = Math . max ( max , y ) ; if ( max = = y ) { ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int counter = 0 ; double x = Math . log ( a ) / Math . log ( 2 ) ; int num = ( int ) x ; System . out . print ( ( int ) Math . pow ( 2 , num ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int k = 1 ; int now = 0 ; for ( int i = 1 ; i < n ; i + + ) { now = sc . nextInt ( ) ; if ( now < = min ) { min = now ; k + + ; } } System . out . println ( k ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i ; j < 5 ; j + + ) { if ( i = = j ) continue ; int dist = Math . abs ( antennas [ i ] - antennas [ j ] ) ; if ( dist > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str [ ] = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int h = Integer . parseInt ( str [ 2 ] ) ; int m = Integer . parseInt ( str [ 3 ] ) ; double mk = ( double ) ( m * 360 ) / 60 ; double hk = ( double ) ( h * 60 + m ) * 360 / ( 12 * 60 ) ; double sita = Math . abs ( mk - hk ) ; double cos = Math . cos ( ( double ) sita / 180 * Math . PI ) ; double naiseki = a * b * cos ; double ans = a * a + b * b - 2 * naiseki ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int res = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) res + + ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) , A2 = sc . nextInt ( ) , A3 = sc . nextInt ( ) ; sc . close ( ) ; int a1 = Math . abs ( A1 - A2 ) , a2 = Math . abs ( A2 - A3 ) , a3 = Math . abs ( A3 - A1 ) ; int max = Math . max ( a1 , Math . max ( a2 , a3 ) ) ; System . out . println ( a1 + a2 + a3 - max ) ; } } import java . util . Scanner ; public class Main { public static final String OK = " Yay ! " ; public static final String NO = " : ( " ; public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] abcde = new int [ 5 ] ; abcde [ 0 ] = sc . nextInt ( ) ; abcde [ 1 ] = sc . nextInt ( ) ; abcde [ 2 ] = sc . nextInt ( ) ; abcde [ 3 ] = sc . nextInt ( ) ; abcde [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { int idx = i ; for ( int j = 0 ; j < 5 ; j + + ) { int p = abcde [ idx ] ; int q = abcde [ j ] ; if ( i ! = j & & Math . abs ( p - q ) > k ) { System . out . println ( NO ) ; return ; } } } System . out . println ( OK ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; String line ; ArrayList < Integer > n = new ArrayList < Integer > ( ) ; for ( int i = 0 ; cin . hasNext ( ) ; i + + ) { line = cin . nextLine ( ) ; if ( i = = 0 ) { String [ ] _ n = line . split ( " " , 0 ) ; for ( int j = 0 ; j < 4 ; j + + ) { n . add ( Integer . parseInt ( _ n [ j ] ) ) ; } } else { } } Collections . sort ( n ) ; String res = " NO " ; if ( n . get ( 0 ) = = 1 & & n . get ( 1 ) = = 4 & & n . get ( 2 ) = = 7 & & n . get ( 3 ) = = 9 ) { res = " YES " ; } System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Integer N [ ] = new Integer [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { N [ i ] = sc . nextInt ( ) ; } if ( Arrays . asList ( N ) . contains ( 1 ) & & Arrays . asList ( N ) . contains ( 7 ) & & Arrays . asList ( N ) . contains ( 9 ) & & Arrays . asList ( N ) . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , h = sc . nextInt ( ) , m = sc . nextInt ( ) ; final double ji = 0.5 , fun = 6.0 ; double now _ ji = ji * ( h * 60 + m ) , now _ fun = fun * m ; if ( now _ ji = = now _ fun ) { System . out . println ( Math . abs ( a - b ) ) ; } else { double dis = Math . abs ( now _ ji - now _ fun ) * Math . PI / 180 ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( dis ) ) ; System . out . printf ( " % .10f \ n " , ans ) ; } } } import java . io . * ; import java . util . * ; class Main { static final long MOD = 1000000007 ; static long f ( long [ ] a ) { int n = a . length ; long ans = 0 ; for ( int i = 0 ; i < n ; + + i ) { a [ i ] % = MOD ; if ( a [ i ] < 0 ) a [ i ] + = MOD ; long f = ( 2 * i - n + 1 + MOD ) % MOD ; ans = ( ans + f * a [ i ] ) % MOD ; } return ans ; } public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long [ ] x = new long [ n ] , y = new long [ m ] ; for ( int i = 0 ; i < n ; + + i ) x [ i ] = sc . nextLong ( ) ; for ( int i = 0 ; i < m ; + + i ) y [ i ] = sc . nextLong ( ) ; out . println ( f ( x ) * f ( y ) % MOD ) ; out . close ( ) ; } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; double A = scn . nextInt ( ) ; double B = scn . nextInt ( ) ; double H = scn . nextInt ( ) ; double M = scn . nextInt ( ) ; double hx = A * Math . cos ( Math . PI * 2 * ( H * 60 + M ) / 720.0 ) ; double hy = A * Math . sin ( Math . PI * 2 * ( H * 60 + M ) / 720.0 ) ; double mx = B * Math . cos ( Math . PI * 2 * M / 60.0 ) ; double my = B * Math . sin ( Math . PI * 2 * M / 60.0 ) ; double L = Math . sqrt ( ( hx - mx ) * ( hx - mx ) + ( hy - my ) * ( hy - my ) ) ; System . out . println ( L ) ; } } import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; map . put ( a , map . getOrDefault ( a , 0 ) + 1 ) ; map . put ( b , map . getOrDefault ( b , 0 ) + 1 ) ; map . put ( c , map . getOrDefault ( c , 0 ) + 1 ) ; if ( map . get ( 5 ) = = 2 & & map . get ( 7 ) = = 1 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } } import java . util . Scanner ; import java . util . Stack ; public class Main { final int [ ] [ ] dir = { { - 1 , - 1 } , { - 1 , 1 } , { 1 , - 1 } , { 1 , 1 } } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = readInt ( sc ) ; int s = readInt ( sc ) ; int cnt = 0 ; for ( int a = 0 ; a < = k ; a + + ) { for ( int b = 0 ; b < = k ; b + + ) { int c = s - a - b ; if ( c > = 0 & & c < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } static int readInt ( Scanner sc ) { return Integer . parseInt ( sc . next ( ) ) ; } static double calcDistance ( Pair p1 , Pair p2 ) { return Math . pow ( Math . pow ( p1 . getX ( ) - p2 . getX ( ) , 2 ) + Math . pow ( p1 . getY ( ) - p2 . getY ( ) , 2 ) , 0.5 ) ; } } class Pair { private int x ; private int y ; public int getX ( ) { return x ; } public void setX ( int x ) { this . x = x ; } public int getY ( ) { return y ; } public void setY ( int y ) { this . y = y ; } public Pair ( ) { } public Pair ( int x , int y ) { this . x = x ; this . y = y ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; e = scan . nextInt ( ) ; e = scan . nextInt ( ) ; e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] input = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( input [ 0 ] ) ; int s = Integer . parseInt ( input [ 1 ] ) ; int x = 0 ; int y = 0 ; int z = 0 ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { x = i ; for ( int j = 0 ; j < = k ; j + + ) { y = j ; int rest = s - x - y ; if ( rest > = 0 & & rest < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; long ans = 2 ; for ( int i = 0 ; i < x ; i + + ) { ans = ans * 2 + 2 ; } 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 ( ) ; long count = 0 ; int price = 1 ; for ( int i = 0 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; if ( x = = price ) { price + + ; continue ; } int d = ( x - 1 ) / price ; count + = d ; if ( price = = 1 ) { price + + ; } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( arr ) ; int [ ] ok = { 1 , 4 , 7 , 9 } ; System . out . println ( Arrays . equals ( arr , ok ) ? " YES " : " NO " ) ; } } import java . math . BigDecimal ; import java . nio . ByteBuffer ; 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ans = 0.0D ; if ( h = = 0 & & m = = 0 ) { ans = Math . max ( a , b ) - Math . min ( a , b ) ; System . out . println ( ans ) ; } else { double kakudo1 = 30.0 * h + 0.5 * m ; double kakudo2 = 6.0 * m ; if ( kakudo1 = = 0 ) kakudo1 = 360.0 ; if ( kakudo2 = = 0 ) kakudo2 = 360.0 ; double kakudo3 = Math . max ( kakudo1 , kakudo2 ) - Math . min ( kakudo1 , kakudo2 ) ; double aa = Math . sqrt ( ( Math . pow ( a , 2.0 ) ) + ( Math . pow ( b , 2.0 ) ) - ( 2 * a * b * Math . cos ( Math . toRadians ( kakudo3 ) ) ) ) ; System . out . println ( BigDecimal . valueOf ( aa ) ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 1 ; for ( ; result < = N ; result * = 2 ) { } System . out . println ( result / 2 ) ; } } import java . util . Scanner ; public class Main { public static double pie = 3.14159265358979323846264338327950 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double rad = pie * 2 * ( ( double ) h / 12.0 + ( ( double ) m / 60.0 ) / 12.0 - ( double ) m / 60.0 ) ; double rsq = ( ( double ) ( a * a + b * b ) - ( double ) ( 2 * a * b ) * Math . cos ( rad ) ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int min = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; int c = input . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) System . out . println ( " YES " ) ; else if ( a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else if ( a = = 5 & & b = = 7 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } ; if ( Arrays . asList ( s ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { static int [ ] [ ] mat = new int [ 3 ] [ 3 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i , j ; for ( i = 0 ; i < 3 ; i + + ) { for ( j = 0 ; j < 3 ; j + + ) { mat [ i ] [ j ] = sc . nextInt ( ) ; } } System . out . println ( ( mat [ 0 ] [ 0 ] - mat [ 0 ] [ 1 ] = = mat [ 1 ] [ 0 ] - mat [ 1 ] [ 1 ] & & mat [ 1 ] [ 0 ] - mat [ 1 ] [ 1 ] = = mat [ 2 ] [ 0 ] - mat [ 2 ] [ 1 ] & & mat [ 0 ] [ 1 ] - mat [ 0 ] [ 2 ] = = mat [ 1 ] [ 1 ] - mat [ 1 ] [ 2 ] & & mat [ 1 ] [ 1 ] - mat [ 1 ] [ 2 ] = = mat [ 2 ] [ 1 ] - mat [ 2 ] [ 2 ] & & mat [ 0 ] [ 0 ] - mat [ 1 ] [ 0 ] = = mat [ 0 ] [ 1 ] - mat [ 1 ] [ 1 ] & & mat [ 0 ] [ 1 ] - mat [ 1 ] [ 1 ] = = mat [ 0 ] [ 2 ] - mat [ 1 ] [ 2 ] & & mat [ 1 ] [ 0 ] - mat [ 2 ] [ 0 ] = = mat [ 1 ] [ 1 ] - mat [ 2 ] [ 1 ] & & mat [ 1 ] [ 1 ] - mat [ 2 ] [ 1 ] = = mat [ 1 ] [ 2 ] - mat [ 2 ] [ 2 ] ) ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; boolean b = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } loop : for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { if ( c [ i ] [ 0 ] - c [ j ] [ 0 ] = = c [ i ] [ 1 ] - c [ j ] [ 1 ] & & c [ i ] [ 1 ] - c [ j ] [ 1 ] = = c [ i ] [ 2 ] - c [ j ] [ 2 ] ) { } else { b = false ; break loop ; } } } loop : for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { if ( c [ 0 ] [ i ] - c [ 0 ] [ j ] = = c [ 1 ] [ i ] - c [ 1 ] [ j ] & & c [ 1 ] [ i ] - c [ 1 ] [ j ] = = c [ 2 ] [ i ] - c [ 2 ] [ j ] ) { } else { b = false ; break loop ; } } } if ( b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long suma = 0 ; long sumb = 0 ; long minus = 0 ; ArrayList < Long > list = new ArrayList < Long > ( ) ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; suma + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; sumb + = b [ i ] ; } if ( suma < sumb ) { System . out . println ( - 1 ) ; return ; } long ret = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < b [ i ] ) { minus + = b [ i ] - a [ i ] ; ret + + ; } else { list . add ( ( a [ i ] - b [ i ] ) ) ; } } if ( list . size ( ) = = n ) { System . out . println ( 0 ) ; return ; } Collections . sort ( list , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i + + ) { ret + + ; if ( list . get ( i ) > = minus ) { break ; } minus - = list . get ( i ) ; } System . out . println ( ret ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int ans = 0 , min = n ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < = min ) { ans + + ; min = p [ i ] ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner stdin = new Scanner ( System . in ) ; int inN = stdin . nextInt ( ) ; String result = " Three " ; for ( int i = 0 ; i < inN ; i + + ) { if ( stdin . next ( ) . equals ( " Y " ) ) { result = " Four " ; break ; } } System . out . println ( result ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int ab [ ] = new int [ 3 ] ; ab [ 0 ] = scan . nextInt ( ) ; ab [ 1 ] = scan . nextInt ( ) ; ab [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( ab ) ; if ( ab [ 0 ] = = 5 & & ab [ 1 ] = = 5 & & ab [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int N = sc . nextInt ( ) ; if ( N = = 1 ) n [ 0 ] + + ; else if ( N = = 9 ) n [ 1 ] + + ; else if ( N = = 7 ) n [ 2 ] + + ; else if ( N = = 4 ) n [ 3 ] + + ; } if ( n [ 0 ] = = 1 & & n [ 1 ] = = 1 & & n [ 2 ] = = 1 & & n [ 3 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int five = 2 ; int seven = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { int moji = scan . nextInt ( ) ; if ( moji = = 5 ) { five - = 1 ; } else if ( moji = = 7 ) { seven - = 1 ; } } if ( five = = 0 & & seven = = 0 ) { System . out . print ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( sc . nextInt ( ) ) { case 5 : five + + ; break ; case 7 : seven + + ; } } if ( five ! = 2 | | seven ! = 1 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = 3 * K & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double rad = Math . abs ( H * 30 + M * 0.5 - M * 6 ) ; if ( rad > = 180 ) { rad = 360 - rad ; } double C = 0 ; C = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( rad ) ) ; System . out . println ( Math . pow ( C , 0.5 ) ) ; } } import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int [ ] ns = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { ns [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ns ) ; if ( ns [ 0 ] = = 1 & & ns [ 1 ] = = 4 & & ns [ 2 ] = = 7 & & ns [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } 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 [ ] sa = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( sa [ 0 ] ) ; int m = Integer . parseInt ( sa [ 1 ] ) ; sa = br . readLine ( ) . split ( " " ) ; long [ ] x = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = Integer . parseInt ( sa [ i ] ) ; } sa = br . readLine ( ) . split ( " " ) ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < m ; i + + ) { y [ i ] = Integer . parseInt ( sa [ i ] ) ; } br . close ( ) ; int mod = 1000000007 ; long xx = 0 ; for ( int i = 0 ; i < n ; i + + ) { xx + = i * x [ i ] - ( n - i - 1 ) * x [ i ] ; xx % = mod ; } long yy = 0 ; for ( int i = 0 ; i < m ; i + + ) { yy + = i * y [ i ] - ( m - i - 1 ) * y [ i ] ; yy % = mod ; } long ans = xx * yy % mod ; if ( ans < 0 ) { ans + = mod ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) ; int A2 = sc . nextInt ( ) ; int A3 = sc . nextInt ( ) ; int max = Math . max ( A1 , Math . max ( A2 , A3 ) ) ; int min = Math . min ( A1 , Math . min ( A2 , A3 ) ) ; System . out . println ( max - min ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a + b > 0 ) { System . out . println ( " 1 " ) ; } else if ( a + b < 0 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " 0 " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long [ ] dif = new long [ n ] ; long suma = 0 ; long sumb = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; suma + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; sumb + = b [ i ] ; dif [ i ] = a [ i ] - b [ i ] ; } if ( suma < sumb ) { System . out . println ( - 1 ) ; return ; } Arrays . sort ( dif ) ; long csum = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( dif [ i ] < 0 ) { csum + = dif [ i ] ; ans + + ; } else { break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( csum > = 0 ) break ; csum + = dif [ n - 1 - i ] ; ans + + ; if ( csum > = 0 ) break ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; int max = 0 ; int min = 100000000 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int M = Integer . parseInt ( sc . next ( ) ) ; if ( M > max ) { max = M ; } if ( M < = min ) { min = M ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 , a2 , a3 , b1 , b2 , b3 ; boolean fans = false ; for ( int i = 0 ; i < = 100 ; i + + ) { boolean ans = true ; a1 = i ; b1 = c [ 0 ] [ 0 ] - i ; b2 = c [ 1 ] [ 0 ] - a1 ; b3 = c [ 2 ] [ 0 ] - a1 ; a2 = c [ 0 ] [ 1 ] - b1 ; a3 = c [ 0 ] [ 2 ] - b1 ; if ( a1 < 0 | | b1 < 0 | | a2 < 0 | | a3 < 0 | | b2 < 0 | | b3 < 0 ) ans = false ; if ( b2 + a2 ! = c [ 1 ] [ 1 ] ) ans = false ; if ( b2 + a3 ! = c [ 1 ] [ 2 ] ) ans = false ; if ( b3 + a2 ! = c [ 2 ] [ 1 ] ) ans = false ; if ( b3 + a3 ! = c [ 2 ] [ 2 ] ) ans = false ; if ( ans ) fans = true ; } if ( fans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double rad = Math . PI * 2 * ( h / 12.0 + ( m / 60.0 ) / 12.0 - m / 60.0 ) ; double rsq = Math . sqrt ( ( a * a + b * b ) - ( 2 * a * b ) * Math . cos ( rad ) ) ; System . out . printf ( " % .20f " , rsq ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; long num = 1 ; long n = 1 ; if ( N = = 1 ) { System . out . println ( P ) ; return ; } for ( long i = 1 ; n < = P ; i + + ) { if ( P % n = = 0 ) { num = i ; } n = ( long ) Math . pow ( i + 1 , N ) ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] f = new int [ 4 ] ; for ( int i = 0 ; i < n ; i + + ) { String a = sc . next ( ) ; if ( a . equals ( " P " ) ) f [ 0 ] = 1 ; if ( a . equals ( " W " ) ) f [ 1 ] = 1 ; if ( a . equals ( " G " ) ) f [ 2 ] = 1 ; if ( a . equals ( " Y " ) ) f [ 3 ] = 1 ; } sc . close ( ) ; int cnt = 0 ; for ( int i = 0 ; i < 4 ; i + + ) cnt + = f [ i ] ; System . out . println ( cnt = = 3 ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer input = new Integer ( scanner . next ( ) ) ; Integer count = 0 ; Integer data = 2 ; while ( input > = data ) { data = data * 2 ; count + + ; } System . out . println ( data / 2 ) ; scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " P " ) ) { count + + ; break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " W " ) ) { count + + ; break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " G " ) ) { count + + ; break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " Y " ) ) { count + + ; break ; } } if ( count = = 3 ) { System . out . println ( " Three " ) ; } else if ( count = = 4 ) { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n > = 64 ) { System . out . println ( 64 ) ; } else if ( n > = 32 ) { System . out . println ( 32 ) ; } else if ( n > = 16 ) { System . out . println ( 16 ) ; } else if ( n > = 8 ) { System . out . println ( 8 ) ; } else if ( n > = 4 ) { System . out . println ( 4 ) ; } else if ( n > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n > = 64 ) { System . out . println ( 64 ) ; } else if ( n > = 32 ) { System . out . println ( 32 ) ; } else if ( n > = 16 ) { System . out . println ( 16 ) ; } else if ( n > = 8 ) { System . out . println ( 8 ) ; } else if ( n > = 4 ) { System . out . println ( 4 ) ; } else if ( n > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int want = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int m = 0 ; m < = k ; m + + ) { if ( want - i - m < = k & & want - i - m > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int cnt = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( S - X - Y < = K & & S - X - Y > = 0 ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int a = sc . nextInt ( ) ; if ( a = = 1 ) { System . out . println ( 1 ) ; return ; } int result = 0 ; int max = 0 ; for ( int i = 1 ; i < = a ; i + + ) { int tmp = i ; for ( int j = 1 ; j < 8 ; j + + ) { if ( tmp % 2 = = 0 ) { tmp / = 2 ; } else { if ( max < j - 1 ) { result = i ; max = j - 1 ; } break ; } } } System . out . println ( result ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( ( S - x - y > = 0 ) & & ( S - x - y < = K ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int row = 1 ; row < = 3 ; row + + ) { for ( int col = 1 ; col < = 3 ; col + + ) { c [ row ] [ col ] = sc . nextInt ( ) ; } } String ans = " Yes " ; for ( int col = 2 ; col < = 3 ; col + + ) { int cur = c [ 1 ] [ 1 ] - c [ 1 ] [ col ] ; int d1 = c [ 2 ] [ 1 ] - c [ 2 ] [ col ] ; int d2 = c [ 3 ] [ 1 ] - c [ 3 ] [ col ] ; if ( cur ! = d1 | | cur ! = d2 ) ans = " No " ; } if ( ! ( c [ 1 ] [ 2 ] - c [ 1 ] [ 3 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 3 ] & & c [ 1 ] [ 2 ] - c [ 1 ] [ 3 ] = = c [ 3 ] [ 2 ] - c [ 3 ] [ 3 ] ) ) ans = " No " ; for ( int row = 2 ; row < = 3 ; row + + ) { int cur = c [ 1 ] [ 1 ] - c [ row ] [ 1 ] ; int d1 = c [ 1 ] [ 2 ] - c [ row ] [ 2 ] ; int d2 = c [ 1 ] [ 3 ] - c [ row ] [ 3 ] ; if ( cur ! = d1 | | cur ! = d2 ) ans = " No " ; } if ( ! ( c [ 2 ] [ 1 ] - c [ 3 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 3 ] [ 2 ] & & c [ 2 ] [ 1 ] - c [ 3 ] [ 1 ] = = c [ 2 ] [ 3 ] - c [ 3 ] [ 3 ] ) ) ans = " No " ; System . out . println ( ans ) ; } } import java . util . * ; import java . util . HashSet ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > colors = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { colors . add ( sc . next ( ) ) ; } if ( colors . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int kyori [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { kyori [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = kyori [ 4 ] - kyori [ 0 ] ; if ( max < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double angleMinute = ( ( double ) m ) * 6 ; double angleHours = ( ( ( double ) h ) * 60 + m ) / 2 ; double diff = Math . abs ( angleHours - angleMinute ) ; diff = diff > 180 ? 360 - diff : diff ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( diff * ( Math . PI / 180 ) ) ) ; System . out . println ( String . format ( " % .16f " , result ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double shortradian = ( double ) h * 30 + ( double ) m * 0.5 ; double y1 = Math . cos ( Math . toRadians ( shortradian ) ) * a ; double x1 = Math . tan ( Math . toRadians ( shortradian ) ) * y1 ; double longradian = ( double ) m * 6 ; double y2 = Math . cos ( Math . toRadians ( longradian ) ) * b ; double x2 = Math . tan ( Math . toRadians ( longradian ) ) * y2 ; double tmp = Math . sqrt ( ( y1 - y2 ) * ( y1 - y2 ) + ( x1 - x2 ) * ( x1 - x2 ) ) ; System . out . println ( tmp ) ; } } import java . util . * ; import java . io . * ; import java . util . * ; import java . io . * ; public class Main { public static long sum ( long [ ] array ) { long ans = 0 ; for ( long e : array ) ans + = e ; return ans ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; for ( int n = 0 ; n < N ; n + + ) A [ n ] = sc . nextLong ( ) ; for ( int n = 0 ; n < N ; n + + ) B [ n ] = sc . nextLong ( ) ; if ( sum ( A ) < sum ( B ) ) { System . out . println ( " -1 " ) ; return ; } int notEnoughStudy = 0 ; long extraStudy = 0 ; PriorityQueue < Long > margin = new PriorityQueue < > ( ) ; for ( int n = 0 ; n < N ; n + + ) { if ( A [ n ] < B [ n ] ) { notEnoughStudy + + ; extraStudy + = ( B [ n ] - A [ n ] ) ; } else { margin . add ( B [ n ] - A [ n ] ) ; } } int decrease = 0 ; while ( extraStudy > 0 ) { extraStudy + = margin . poll ( ) ; decrease + + ; } System . out . println ( notEnoughStudy + decrease ) ; } } import java . util . * ; class Main { static int [ ] [ ] c ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; a [ 3 ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; String ans = ( a [ 0 ] = = 1 & & a [ 1 ] = = 4 & & a [ 2 ] = = 7 & & a [ 3 ] = = 9 ) ? " YES " : " NO " ; System . out . println ( ans ) ; } } import java . util . * ; import java . util . HashSet ; import java . util . Map ; import java . util . HashMap ; import java . util . ArrayList ; import java . util . List ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . lang . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } long gcd ( long a , long b ) { if ( b = = 0 ) { return a ; } return gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int arr [ ] = new int [ 100 ] ; arr [ ob . nextInt ( ) ] + + ; arr [ ob . nextInt ( ) ] + + ; arr [ ob . nextInt ( ) ] + + ; if ( arr [ 5 ] = = 2 & & arr [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; sc . close ( ) ; for ( int i = Math . max ( 0 , s - 2 * k ) ; i < = Math . min ( k , s ) ; i + + ) { for ( int j = Math . max ( 0 , s - i - k ) ; j < = Math . min ( k , s - i ) ; j + + ) { if ( ( s - i - j ) > = 0 & & ( s - i - j ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { Map < Integer , Integer > map = new HashMap < > ( ) ; IntStream . range ( 0 , N ) . forEach ( i - > { int a = scanner . nextInt ( ) ; map . put ( a , map . getOrDefault ( a , 0 ) + 1 ) ; } ) ; System . out . println ( ( ( 2 = = map . getOrDefault ( 5 , 0 ) ) & & ( 1 = = map . getOrDefault ( 7 , 0 ) ) ) ? " YES " : " NO " ) ; } } } import javax . print . DocFlavor ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . nio . charset . StandardCharsets ; import java . util . * ; import java . util . function . BiConsumer ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; ArrayList set = new ArrayList ( ) ; set . add ( sc . next ( ) ) ; set . add ( sc . next ( ) ) ; set . add ( sc . next ( ) ) ; set . add ( sc . next ( ) ) ; set . remove ( " 1 " ) ; set . remove ( " 9 " ) ; set . remove ( " 7 " ) ; set . remove ( " 4 " ) ; String ans = " NO " ; if ( set . size ( ) = = 0 ) { ans = " YES " ; } 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 ( ) ; int answer = 1 ; while ( n > = answer ) { answer * = 2 ; } System . out . println ( answer / 2 ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int h = Integer . parseInt ( str [ 2 ] ) ; int m = Integer . parseInt ( str [ 3 ] ) ; double hour = ( h * 30 ) + ( m * 0.5 ) ; double min = m * 6 ; double anglediff = Math . abs ( hour - min ) ; double ans = 0 ; double sqrt = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( anglediff ) ) ; System . out . println ( Math . sqrt ( sqrt ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = - 100 ; i < = 100 ; i + + ) { for ( int j = - 100 ; j < = 100 ; j + + ) { for ( int k = - 100 ; k < = 100 ; k + + ) { int [ ] b = new int [ 3 ] ; b [ 0 ] = c [ 0 ] [ 0 ] - i ; b [ 1 ] = c [ 1 ] [ 1 ] - j ; b [ 2 ] = c [ 2 ] [ 2 ] - k ; if ( i + b [ 0 ] = = c [ 0 ] [ 0 ] & & i + b [ 1 ] = = c [ 0 ] [ 1 ] & & i + b [ 2 ] = = c [ 0 ] [ 2 ] & & j + b [ 0 ] = = c [ 1 ] [ 0 ] & & j + b [ 1 ] = = c [ 1 ] [ 1 ] & & j + b [ 2 ] = = c [ 1 ] [ 2 ] & & k + b [ 0 ] = = c [ 2 ] [ 0 ] & & k + b [ 1 ] = = c [ 2 ] [ 1 ] & & k + b [ 2 ] = = c [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveC ( ) ; } private void solveC ( ) { Scanner sc = new Scanner ( System . in ) ; final long MOD = 1000000007 ; long N = sc . nextInt ( ) ; long M = sc . nextInt ( ) ; if ( N - M > 1 | | M - N > 1 ) { System . out . println ( 0 ) ; } else { if ( N = = M ) { System . out . println ( 2 * perm ( N , MOD ) * perm ( N , MOD ) % MOD ) ; } else { System . out . println ( perm ( N , MOD ) * perm ( M , MOD ) % MOD ) ; } } } private long perm ( long N , long mod ) { long mul = 1L ; for ( ; N > 0 ; N -- ) { mul = ( mul * N ) % mod ; } return mul ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = stdIn . nextInt ( ) ; if ( a [ i ] = = 5 ) count5 + = 1 ; else if ( a [ i ] = = 7 ) count7 + = 1 ; } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] ary = { a , b , c } ; Arrays . sort ( ary ) ; System . out . println ( ( ary [ 0 ] = = 5 & & ary [ 1 ] = = 5 & & ary [ 2 ] = = 7 ) ? " YES " : " NO " ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ ] { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( array ) ; if ( array [ 0 ] = = 5 & & array [ 1 ] = = 5 & & array [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String moji = sc . nextLine ( ) ; String [ ] moji2 = moji . split ( " " ) ; int [ ] moji3 = new int [ 3 ] ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { moji3 [ i ] = Integer . parseInt ( moji2 [ i ] ) ; } for ( int j = 0 ; j < 3 ; j + + ) { if ( moji3 [ j ] = = 5 ) { five + + ; } else if ( moji3 [ j ] = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int P [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int ok = Integer . MAX _ VALUE ; int count = 0 ; for ( int j = 0 ; j < N ; j + + ) { ok = Math . min ( ok , P [ j ] ) ; if ( ok = = P [ j ] ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int fiveCount = 0 , sevenCount = 0 ; if ( A = = 5 ) { fiveCount + + ; } if ( A = = 7 ) { sevenCount + + ; } if ( B = = 5 ) { fiveCount + + ; } if ( B = = 7 ) { sevenCount + + ; } if ( C = = 5 ) { fiveCount + + ; } if ( C = = 7 ) { sevenCount + + ; } System . out . println ( ( fiveCount = = 2 & & sevenCount = = 1 ) ? " YES " : " NO " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int num = in . nextInt ( ) ; int i ; for ( i = 1 ; i < = num ; i < < = 1 ) { if ( i > num ) { break ; } } out . println ( i / 2 ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int k , s ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { long count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; String str = sc . nextLine ( ) ; str = sc . nextLine ( ) ; sc . close ( ) ; if ( str . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; int result = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { result = result + Math . abs ( A [ i - 1 ] - A [ i ] ) ; } System . out . println ( result ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int short _ hand = in . nextInt ( ) ; int long _ hand = in . nextInt ( ) ; int hour = in . nextInt ( ) ; int minutes = in . nextInt ( ) ; double pai = Math . PI ; double x = Math . abs ( hour * pai / 6 + minutes * pai / 360 - minutes * pai / 30 ) ; double cos _ x = Math . cos ( x ) ; double result _ pow2 = short _ hand * short _ hand + long _ hand * long _ hand - 2 * short _ hand * long _ hand * cos _ x ; double result = 1.0 ; while ( Math . abs ( result - result _ pow2 / result ) > 1e-10 ) { result = ( result + result _ pow2 / result ) / 2 ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; long bwa = 0 ; long awa = 0 ; long lost = 0 ; int yono = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; awa + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; bwa + = b [ i ] ; c [ i ] = a [ i ] - b [ i ] ; if ( c [ i ] < 0 ) { lost - = c [ i ] ; yono + + ; } } sc . close ( ) ; if ( bwa > awa ) { System . out . println ( - 1 ) ; } else { int cha = 0 ; Arrays . sort ( c ) ; while ( lost > 0 ) { cha + + ; lost - = c [ n - cha ] ; } System . out . println ( cha + yono ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] a _ str = in . readLine ( ) . split ( " " ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = Integer . parseInt ( a _ str [ 0 ] ) ; a [ 1 ] = Integer . parseInt ( a _ str [ 1 ] ) ; a [ 2 ] = Integer . parseInt ( a _ str [ 2 ] ) ; int min = Math . min ( Math . min ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; int sum = a [ 0 ] + a [ 1 ] + a [ 2 ] ; int max = Math . max ( Math . max ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; System . out . println ( max - ( sum - min - max ) + ( sum - min - max ) - min ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] costArray = { scanner . nextInt ( ) , scanner . nextInt ( ) , scanner . nextInt ( ) } ; Arrays . sort ( costArray ) ; int ans = 0 + Math . abs ( costArray [ 1 ] - costArray [ 0 ] ) + Math . abs ( costArray [ 2 ] - costArray [ 1 ] ) ; System . out . println ( ans ) ; scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 7 | | B = = 7 | | C = = 7 ) { if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( B = = 7 ) { if ( C = = 5 & & A = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( C = = 7 ) { if ( A = = 5 & & B = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { } } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Character > set = new HashSet < Character > ( ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; char c = s . charAt ( 0 ) ; set . add ( c ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int n4 = sc . nextInt ( ) ; sc . close ( ) ; int [ ] r = new int [ 10 ] ; r [ n1 ] + + ; r [ n2 ] + + ; r [ n3 ] + + ; r [ n4 ] + + ; System . out . println ( r [ 1 ] = = 1 & & r [ 4 ] = = 1 & & r [ 7 ] = = 1 & & r [ 9 ] = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int number = scanner . nextInt ( ) ; if ( number = = 5 ) { five = five + 1 ; } else if ( number = = 7 ) { seven = seven + 1 ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int maxNum = scan . nextInt ( ) ; int sum = scan . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = maxNum ; + + x ) { for ( int y = 0 ; y < = maxNum ; + + y ) { int z = sum - x - y ; if ( 0 < = z & & z < = maxNum ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) , s = sc . nextInt ( ) , t = 0 ; Map < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { m . put ( i + j , m . get ( i + j ) = = null ? 1 : m . get ( i + j ) + 1 ) ; } } for ( int k = 0 ; k < = K ; k + + ) if ( m . containsKey ( s - k ) ) t + = m . get ( s - k ) ; System . out . println ( t ) ; sc . close ( ) ; } public static void main ( String args [ ] ) { solve ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = Integer . parseInt ( stdIn . next ( ) ) ; int [ ] p = new int [ n ] ; p [ 0 ] = Integer . parseInt ( stdIn . next ( ) ) ; int min = p [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( stdIn . next ( ) ) ; if ( min > p [ i ] ) { min = p [ i ] ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) y [ i ] = a [ 0 ] [ i ] ; x [ 1 ] = a [ 1 ] [ 0 ] - y [ 0 ] ; x [ 2 ] = a [ 2 ] [ 0 ] - y [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; public class Main { public static void main ( String [ ] args ) throws Exception { String [ ] lines = Io . read ( ) ; int [ ] parsed = parse ( lines ) ; int a = parsed [ 0 ] ; int e = parsed [ 4 ] ; int k = parsed [ 5 ] ; if ( e - a > k ) { Io . write ( " : ( " ) ; } else { Io . write ( " Yay ! " ) ; } } private static int [ ] parse ( String [ ] lines ) { int [ ] parsed = new int [ lines . length ] ; for ( int i = 0 ; i < lines . length ; i + + ) { parsed [ i ] = Integer . parseInt ( ( lines [ i ] ) ) ; } return parsed ; } } class Io { public static String [ ] read ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < String > inputs = new ArrayList < > ( ) ; String line ; while ( ( line = br . readLine ( ) ) ! = null ) { if ( line . equals ( " " ) ) break ; inputs . add ( line ) ; } br . close ( ) ; return inputs . toArray ( new String [ 0 ] ) ; } public static void write ( String answer ) { System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int rs = 2 ; int N = scan . nextInt ( ) ; for ( int i = 0 ; i < 7 ; i + + ) { if ( N = = 1 ) break ; if ( N < rs ) break ; rs = rs * 2 ; } if ( N = = 1 ) System . out . println ( 1 ) ; else System . out . println ( rs / 2 ) ; scan . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String iShortNeedle = sc . next ( ) ; String iLongNeedle = sc . next ( ) ; String h = sc . next ( ) ; String m = sc . next ( ) ; double hour = Double . parseDouble ( h ) ; double min = Double . parseDouble ( m ) ; double wholeMin = ( hour * 60 ) + min ; double shortNeedle = Double . parseDouble ( iShortNeedle ) ; double longNeedle = Double . parseDouble ( iLongNeedle ) ; double shortAngleByOneMin = ( 360.0 / 12.0 ) / 60.0 ; double longAngleByOneMin = 360.0 / 60.0 ; double rHour = 0 ; double rMin = 0 ; if ( wholeMin ! = 0 ) { rHour = shortAngleByOneMin * wholeMin ; } if ( min ! = 0 ) { rMin = longAngleByOneMin * min ; } double diffAngle = Math . abs ( rHour - rMin ) ; double aLength = 0 ; if ( diffAngle ! = 0 | | diffAngle ! = 180 ) { aLength = Math . sqrt ( Math . pow ( shortNeedle , 2 ) + Math . pow ( longNeedle , 2 ) - 2 * shortNeedle * longNeedle * Math . cos ( Math . toRadians ( diffAngle ) ) ) ; } else if ( diffAngle = = 0 ) { aLength = longNeedle - shortNeedle ; } else if ( diffAngle = = 180 ) { aLength = longNeedle + shortNeedle ; } System . out . println ( aLength ) ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int arare = scn . nextInt ( ) ; int count = 0 ; String [ ] arares = new String [ arare ] ; for ( int i = 0 ; i < arare ; i + + ) { arares [ i ] = scn . next ( ) ; } List < String > listA = Arrays . asList ( arares ) ; List < String > listB = new ArrayList < String > ( new HashSet < > ( listA ) ) ; for ( int j = 0 ; j < listB . size ( ) ; j + + ) { if ( listB . contains ( " P " ) ) count + + ; else if ( listB . contains ( " W " ) ) count + + ; else if ( listB . contains ( " G " ) ) count + + ; else if ( listB . contains ( " Y " ) ) count + + ; } if ( count = = 3 ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; try { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < 2 ; i + + ) { if ( ! check _ h ( c , i ) ) { System . out . println ( " No " ) ; return ; } } for ( int j = 0 ; j < 2 ; j + + ) { if ( ! check _ v ( c , j ) ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } finally { scanner . close ( ) ; } } private static boolean check _ v ( int [ ] [ ] c , int j ) { for ( int i = 0 ; i < 2 ; i + + ) { if ( c [ i ] [ j + 1 ] - c [ i ] [ j ] ! = c [ i + 1 ] [ j + 1 ] - c [ i + 1 ] [ j ] ) return false ; } return true ; } private static boolean check _ h ( int [ ] [ ] c , int i ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( c [ i + 1 ] [ j ] - c [ i ] [ j ] ! = c [ i + 1 ] [ j + 1 ] - c [ i ] [ j + 1 ] ) return false ; } return true ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angle = Math . abs ( h * 30 + m * 0.5 - m * 6 ) ; double result = Math . cos ( Math . toRadians ( angle ) ) ; double x = a * a + b * b - 2 * a * b * result ; double ans = Math . sqrt ( x ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = s . nextInt ( ) ; } } int flag = 0 ; for ( int i = 0 ; i < 2 ; i + + ) { if ( ( arr [ i ] [ 0 ] - arr [ i ] [ 1 ] ) ! = ( arr [ i + 1 ] [ 0 ] - arr [ i + 1 ] [ 1 ] ) ) flag = 1 ; if ( ( arr [ i ] [ 1 ] - arr [ i ] [ 2 ] ) ! = ( arr [ i + 1 ] [ 1 ] - arr [ i + 1 ] [ 2 ] ) ) flag = 1 ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( ( arr [ 0 ] [ i ] - arr [ 1 ] [ i ] ) ! = ( arr [ 0 ] [ i + 1 ] - arr [ 1 ] [ i + 1 ] ) ) flag = 1 ; if ( ( arr [ 1 ] [ i ] - arr [ 2 ] [ i ] ) ! = ( arr [ 1 ] [ i + 1 ] - arr [ 2 ] [ i + 1 ] ) ) flag = 1 ; } if ( flag ! = 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int A , B , C ; int Five = 0 ; int Seven = 0 ; Scanner sc = new Scanner ( System . in ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; if ( A = = 5 ) Five + + ; if ( A = = 7 ) Seven + + ; if ( B = = 5 ) Five + + ; if ( B = = 7 ) Seven + + ; if ( C = = 5 ) Five + + ; if ( C = = 7 ) Seven + + ; if ( ( Five = = 2 ) & & ( Seven = = 1 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] line = new int [ 5 ] ; boolean check = true ; for ( int i = 0 ; i < 5 ; i + + ) { line [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; ArrayList < Integer > lis = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( line [ i ] - line [ j ] ) > k ) { check = false ; break ; } } } if ( check ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Arrays ; import java . util . Scanner ; class A { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int [ ] N = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) N [ i ] = sc . nextInt ( ) ; Arrays . sort ( N ) ; System . out . println ( Arrays . equals ( N , new int [ ] { 1 , 4 , 7 , 9 } ) ? " YES " : " NO " ) ; } } public class Main { public static void main ( String ... args ) { A . main ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int P ; int min = 0 ; int counter = 0 ; for ( int i = 0 ; i < N ; i + + ) { P = sc . nextInt ( ) ; if ( min < 1 | | P < min ) { min = P ; counter + + ; } } System . out . println ( counter ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } String result = set . size ( ) = = 3 ? " Three " : " Four " ; System . out . println ( result ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; a [ 3 ] = sc . nextInt ( ) ; a [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean e = false ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ! ( Math . abs ( a [ i ] - a [ j ] ) < = k ) ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int [ ] min _ p = new int [ n ] ; int counter = 0 ; for ( int i = 0 ; i < p . length ; i + + ) { p [ i ] = sc . nextInt ( ) ; } min _ p [ 0 ] = p [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( i > = 1 ) { if ( min _ p [ i - 1 ] > p [ i ] ) { min _ p [ i ] = p [ i ] ; } else { min _ p [ i ] = min _ p [ i - 1 ] ; } } if ( p [ i ] = = min _ p [ i ] ) { counter + + ; } } System . out . println ( counter ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; int [ ] A = new int [ 3 ] ; int [ ] B = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = gi ( ) ; } } for ( A [ 0 ] = 0 ; A [ 0 ] < = C [ 0 ] [ 0 ] ; A [ 0 ] + + ) { B [ 0 ] = C [ 0 ] [ 0 ] - A [ 0 ] ; for ( A [ 1 ] = 0 ; A [ 1 ] < = C [ 1 ] [ 1 ] ; A [ 1 ] + + ) { B [ 1 ] = C [ 1 ] [ 1 ] - A [ 1 ] ; for ( A [ 2 ] = 0 ; A [ 2 ] < = C [ 2 ] [ 2 ] ; A [ 2 ] + + ) { B [ 2 ] = C [ 2 ] [ 2 ] - A [ 2 ] ; boolean f = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( A [ i ] + B [ j ] ! = C [ i ] [ j ] ) { f = false ; break ; } } } if ( f ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] val = new int [ 3 ] ; for ( int x = 0 ; x < 3 ; x + + ) val [ x ] = scanner . nextInt ( ) ; int sum = 0 ; Arrays . sort ( val ) ; for ( int y = 1 ; y < 3 ; y + + ) { sum = sum + Math . abs ( val [ y ] - val [ y - 1 ] ) ; } System . out . println ( sum ) ; } } import java . util . * ; public class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; ArrayList < Character > s = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { char c = scan . next ( ) . charAt ( 0 ) ; if ( ! s . contains ( c ) ) s . add ( c ) ; } System . out . println ( s . size ( ) = = 3 ? " Three " : " Four " ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int total = 2 ; while ( n > = total ) { total * = 2 ; } System . out . print ( total / 2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; int [ ] Y = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { N [ i ] = sc . nextInt ( ) ; Y [ N [ i ] ] + + ; } if ( Y [ 1 ] > 0 & & Y [ 4 ] > 0 & & Y [ 7 ] > 0 & & Y [ 9 ] > 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < s + 1 ; i + + ) { int x = i ; for ( int j = 0 ; j < s + 1 - i ; j + + ) { int y = j ; int z = s - x - y ; if ( x > k | | y > k | | z > k ) { continue ; } result + + ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int res = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int targetNumber = i ; int tmpCount = 0 ; while ( targetNumber % 2 = = 0 ) { tmpCount + + ; targetNumber / = 2 ; } if ( count < tmpCount ) { res = i ; count = tmpCount ; } } System . out . println ( n = = 1 ? 1 : res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int b0b1 _ 1 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; int b1b2 _ 1 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; int b0b1 _ 2 = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ; int b1b2 _ 2 = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ; int b0b1 _ 3 = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ; int b1b2 _ 3 = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ; int a0a1 _ 1 = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] ; int a1a2 _ 1 = c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] ; int a0a1 _ 2 = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ; int a1a2 _ 2 = c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] ; int a0a1 _ 3 = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ; int a1a2 _ 3 = c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] ; String result = " No " ; if ( b0b1 _ 1 = = b0b1 _ 2 & & b0b1 _ 2 = = b0b1 _ 3 ) { if ( b1b2 _ 1 = = b1b2 _ 2 & & b1b2 _ 2 = = b1b2 _ 3 ) { if ( a0a1 _ 1 = = a0a1 _ 2 & & a0a1 _ 2 = = a0a1 _ 3 ) { if ( a1a2 _ 1 = = a1a2 _ 2 & & a1a2 _ 2 = = a1a2 _ 3 ) { result = " Yes " ; } } } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double t = h * 60 + m ; double hx = Math . cos ( Math . toRadians ( t * 0.5 - 90 ) ) * a ; double hy = Math . sin ( Math . toRadians ( t * 0.5 - 90 ) ) * a ; double mx = Math . cos ( Math . toRadians ( t * 6 - 90 ) ) * b ; double my = Math . sin ( Math . toRadians ( t * 6 - 90 ) ) * b ; double d = Math . sqrt ( ( hy - my ) * ( hy - my ) + ( hx - mx ) * ( hx - mx ) ) ; System . out . println ( d ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String msg = " Yes " ; for ( int i = 1 ; i < 3 ; i + + ) { int a = c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] ; if ( c [ i ] [ 1 ] - c [ i ] [ 0 ] ! = a ) { msg = " No " ; break ; } a = c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] ; if ( c [ i ] [ 2 ] - c [ i ] [ 1 ] ! = a ) { msg = " No " ; break ; } a = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( c [ 1 ] [ i ] - c [ 0 ] [ i ] ! = a ) { msg = " No " ; break ; } a = c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] ; if ( c [ 2 ] [ i ] - c [ 1 ] [ i ] ! = a ) { msg = " No " ; break ; } } System . out . println ( msg ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { sum = S - ( i + j ) ; if ( 0 < = sum & & sum < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a > k ) { System . out . println ( " : ( " ) ; } else if ( c - a > k ) { System . out . println ( " : ( " ) ; } else if ( d - a > k ) { System . out . println ( " : ( " ) ; } else if ( e - a > k ) { System . out . println ( " : ( " ) ; } else if ( c - b > k ) { System . out . println ( " : ( " ) ; } else if ( d - b > k ) { System . out . println ( " : ( " ) ; } else if ( e - b > k ) { System . out . println ( " : ( " ) ; } else if ( d - c > k ) { System . out . println ( " : ( " ) ; } else if ( e - c > k ) { System . out . println ( " : ( " ) ; } else if ( e - d > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < c . length ; i + + ) { for ( int j = 0 ; j < c [ i ] . length ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < b . length ; i + + ) { b [ i ] = c [ 0 ] [ i ] ; } for ( int i = 1 ; i < a . length ; i + + ) { a [ i ] = c [ i ] [ 0 ] - b [ 0 ] ; } boolean jdg = true ; outer : for ( int i = 0 ; i < c . length ; i + + ) { for ( int j = 0 ; j < c [ i ] . length ; j + + ) { if ( ! ( jdg = ( a [ i ] + b [ j ] = = c [ i ] [ j ] ) ) ) break outer ; } } System . out . println ( jdg ? " Yes " : " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int [ ] n = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) { n [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 1 , min = n [ 0 ] ; for ( int i = 1 ; i < a ; i + + ) { if ( min > n [ i ] ) { cnt + + ; min = n [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] arr = new int [ 8 ] ; arr [ a ] + + ; arr [ b ] + + ; arr [ c ] + + ; if ( arr [ 5 ] = = 2 & & arr [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CADDi _ C solver = new CADDi _ C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CADDi _ C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long n = in . nextLong ( ) ; long p = in . nextLong ( ) ; long copy = p ; long ans = 1 ; long cnt = 0 ; for ( long i = 2 ; i < Math . sqrt ( ( double ) copy ) + 2 ; i + + ) { if ( p = = 1 ) break ; while ( p % i = = 0 ) { cnt + + ; p / = i ; } if ( cnt > = n ) { ans * = ( long ) Math . pow ( i , ( cnt / n ) ) ; } cnt = 0 ; } if ( p ! = 1 ) { if ( 1 > = n ) { ans * = p * ( 1 / n ) ; } } out . print ( ans ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int d = stdIn . nextInt ( ) ; int e = stdIn . nextInt ( ) ; int k = stdIn . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] S = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { S [ i ] = stdIn . nextInt ( ) ; } Arrays . sort ( S ) ; int j = S [ 2 ] - S [ 1 ] ; int k = S [ 1 ] - S [ 0 ] ; System . out . println ( j + k ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int firstAnt = 0 ; int lastAnt = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = Integer . parseInt ( sc . nextLine ( ) ) ; if ( i = = 0 ) { firstAnt = tmp ; } else if ( i = = 4 ) { lastAnt = tmp ; } } int allowedDistant = Integer . parseInt ( sc . nextLine ( ) ) ; String result = " " ; if ( ( lastAnt - firstAnt ) < = allowedDistant ) { result = " Yay ! " ; } else { result = " : ( " ; } System . out . println ( result ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int s = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s > = i + j & & s - ( i + j ) < = k ) { count + + ; } if ( s < i + j ) break ; } if ( s < i ) break ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 2 ; if ( n = = 1 ) { System . out . println ( 1 ) ; } else { while ( num * 2 < = n ) { num = num * 2 ; } System . out . println ( num ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { double ans = 0 ; Scanner scan = new Scanner ( System . in ) ; int minutes _ length = scan . nextInt ( ) ; int hour _ length = scan . nextInt ( ) ; double hour _ time = scan . nextInt ( ) ; double minutes _ time = scan . nextInt ( ) ; double minutes _ pi = Math . PI / 30 * minutes _ time ; double hour _ pi = Math . PI / 6 * ( hour _ time + minutes _ time / 60 ) ; double theta = Math . PI / 30 * ( 5 * ( hour _ time + minutes _ time / 60 ) - minutes _ time ) ; ans = minutes _ length * minutes _ length + hour _ length * hour _ length - 2 * hour _ length * minutes _ length * Math . cos ( theta ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanIn = new Scanner ( System . in ) ; int a = scanIn . nextInt ( ) ; int b = scanIn . nextInt ( ) ; int c = scanIn . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 ) | | ( b = = 5 & & c = = 5 ) | | ( c = = 5 & & a = = 5 ) ) { if ( a = = 7 | | b = = 7 | | c = = 7 ) { System . out . println ( " YES " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { MyReader r = new MyReader ( ) ; int n = r . i ( ) ; int digit = 1 ; while ( ( n = n > > 1 ) > 0 ) digit + + ; println ( 1 < < digit - 1 ) ; } static void print ( Object o ) { System . out . print ( o . toString ( ) ) ; } static void println ( Object o ) { System . out . println ( o . toString ( ) ) ; } static int Int ( String s ) { return Integer . parseInt ( s ) ; } static long Long ( String s ) { return Long . parseLong ( s ) ; } static class MyReader extends BufferedReader { MyReader ( ) { super ( new InputStreamReader ( System . in ) ) ; } String s ( ) throws IOException { return readLine ( ) ; } String [ ] ss ( ) throws IOException { return s ( ) . split ( " " ) ; } int i ( ) throws IOException { return Int ( s ( ) ) ; } int [ ] ii ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; int [ ] ii = new int [ size ] ; for ( int j = 0 ; j < size ; j + + ) ii [ j ] = Int ( ss [ j ] ) ; return ii ; } long l ( ) throws IOException { return Long ( s ( ) ) ; } long [ ] ll ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; long [ ] ll = new long [ size ] ; for ( int j = 0 ; j < size ; j + + ) ll [ j ] = Long ( ss [ j ] ) ; return ll ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int k = sc . nextInt ( ) ; if ( arr [ 4 ] - arr [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , n ) ; Set < Character > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( line [ i ] . charAt ( 0 ) ) ; } if ( set . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ABC = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { ABC [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ABC ) ; boolean flg = false ; if ( ABC [ 0 ] = = 5 ) { if ( ABC [ 1 ] = = 5 ) { if ( ABC [ 2 ] = = 7 ) { flg = true ; } } } if ( flg ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . Closeable ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { final Scanner sc = new Scanner ( System . in ) ; int [ ] count = new int [ 11 ] ; count [ sc . nextInt ( ) ] + + ; count [ sc . nextInt ( ) ] + + ; count [ sc . nextInt ( ) ] + + ; if ( count [ 5 ] = = 2 & & count [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static class Scanner implements Closeable { private BufferedReader br ; private StringTokenizer tok ; public Scanner ( InputStream is ) throws IOException { br = new BufferedReader ( new InputStreamReader ( is ) ) ; } private void getLine ( ) throws IOException { while ( ! hasNext ( ) ) { tok = new StringTokenizer ( br . readLine ( ) ) ; } } private boolean hasNext ( ) { return tok ! = null & & tok . hasMoreTokens ( ) ; } public String next ( ) throws IOException { getLine ( ) ; return tok . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public void close ( ) throws IOException { br . close ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; sc . close ( ) ; double Hx = A * Math . sin ( Math . toRadians ( 360 * ( H + M / 60 ) / 12 ) ) ; double Hy = A * Math . cos ( Math . toRadians ( 360 * ( H + M / 60 ) / 12 ) ) ; double Mx = B * Math . sin ( Math . toRadians ( 360 * M / 60 ) ) ; double My = B * Math . cos ( Math . toRadians ( 360 * M / 60 ) ) ; double x = ( Hx - Mx ) ; double y = ( Hy - My ) ; System . out . println ( Math . sqrt ( Math . pow ( x , 2 ) + Math . pow ( y , 2 ) ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Set ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } Arrays . sort ( nums ) ; System . out . println ( ( nums [ 1 ] - nums [ 0 ] ) + ( nums [ 2 ] - nums [ 1 ] ) ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; int ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int count1 = 0 ; int tmp = i ; while ( tmp % 2 = = 0 ) { tmp = tmp / 2 ; count1 = count1 + 1 ; } if ( count1 > count ) { count = count1 ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double angle = Math . toRadians ( ( h * 30 + m * 0.5 ) - m * 6 ) ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle ) ) ; System . out . printf ( " % .20f % n " , ans ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ; public class Main { int n ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; set . add ( s ) ; } if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > hashset = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hashset . add ( sc . next ( ) ) ; } if ( hashset . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } 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 . FileReader ; import java . io . InputStreamReader ; import java . io . File ; import java . io . FileNotFoundException ; 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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i + + ) { String s = in . nextString ( ) ; if ( s . equals ( " Y " ) ) cnt + + ; } if ( cnt = = 0 ) out . println ( " Three " ) ; else out . println ( " Four " ) ; } } static class FastScanner { private BufferedReader br ; private StringTokenizer st ; public FastScanner ( File f ) { try { br = new BufferedReader ( new FileReader ( f ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } public FastScanner ( InputStream f ) { br = new BufferedReader ( new InputStreamReader ( f ) ) ; } public String nextString ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { String s = null ; try { s = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } if ( s = = null ) return null ; st = new StringTokenizer ( s ) ; } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; boolean f = false ; for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { f = true ; break ; } } System . out . println ( f ? " Four " : " Three " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > arr = new ArrayList < > ( ) ; for ( ; sc . hasNext ( ) ; ) { arr . add ( sc . nextInt ( ) ) ; } int count = 0 ; int min = arr . get ( 0 ) ; for ( int num : arr ) { if ( num < = min ) { count + + ; min = num ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( ( e - a ) < = k ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double theta1 = ( h / 12.0 + m / 60.0 / 12.0 ) * Math . PI * 2 ; double theta2 = m / 60.0 * Math . PI * 2 ; double ret = a * a + b * b - 2 * a * b * Math . cos ( theta1 - theta2 ) ; ret = Math . sqrt ( ret ) ; System . out . printf ( " % .12f \ n " , ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; String ans = " No " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) { if ( c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] & & c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 0 ] ) { if ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) { if ( c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] & & c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] ) { ans = " Yes " ; } } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 11 ] ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; n [ a ] + + ; n [ b ] + + ; n [ c ] + + ; if ( n [ 5 ] = = 2 & & n [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean b = true ; b & = a [ 0 ] [ 0 ] - a [ 1 ] [ 0 ] = = a [ 0 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 0 ] [ 2 ] - a [ 1 ] [ 2 ] = = a [ 0 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 0 ] - a [ 1 ] [ 0 ] = = a [ 2 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 2 ] - a [ 1 ] [ 2 ] = = a [ 2 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 0 ] [ 0 ] - a [ 0 ] [ 1 ] = = a [ 1 ] [ 0 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 0 ] - a [ 2 ] [ 1 ] = = a [ 1 ] [ 0 ] - a [ 1 ] [ 1 ] ; b & = a [ 0 ] [ 2 ] - a [ 0 ] [ 1 ] = = a [ 1 ] [ 2 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 2 ] - a [ 2 ] [ 1 ] = = a [ 1 ] [ 2 ] - a [ 1 ] [ 1 ] ; System . out . println ( b ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = in . nextInt ( ) ; } } int [ ] sum = new int [ 6 ] ; sum [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; sum [ 1 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; sum [ 2 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; sum [ 3 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] ; sum [ 4 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; sum [ 5 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; boolean takahashi = true ; for ( int i = 1 ; i < 6 ; i + + ) { if ( sum [ 0 ] ! = sum [ i ] ) { takahashi = false ; break ; } } if ( takahashi ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; in . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = N ; i + + ) { for ( int j = 0 ; j < = N ; j + + ) { if ( 0 < = S - i - j & & S - i - j < = N ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int targetNumber = sc . nextInt ( ) ; int max _ dividing = 0 ; int max _ number = 1 ; for ( int i = 1 ; i < = targetNumber ; i + + ) { int ExTargetNumber = i ; int manyOfdividing = 0 ; while ( true ) { if ( ExTargetNumber % 2 = = 0 & & ExTargetNumber > 0 ) { ExTargetNumber = ExTargetNumber / 2 ; manyOfdividing + + ; } else { if ( max _ dividing < manyOfdividing ) { max _ dividing = manyOfdividing ; max _ number = i ; } break ; } } } System . out . println ( max _ number ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ 2 * ( int ) n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; a [ i + ( int ) n ] = a [ i ] ; } long [ ] [ ] costs = new long [ ( int ) n ] [ ( int ) n ] ; for ( int i = ( int ) n ; i < 2 * n ; i + + ) { long best = a [ i ] ; for ( int j = 0 ; j < n ; j + + ) { best = Math . min ( best , a [ i - j ] ) ; costs [ i - ( int ) n ] [ j ] = best ; } } long best = n * 1000000000 ; for ( int j = 0 ; j < n ; j + + ) { long curr = j * x ; for ( int i = 0 ; i < n ; i + + ) { curr + = costs [ i ] [ j ] ; } best = Math . min ( best , curr ) ; } System . out . println ( best ) ; } } import java . lang . reflect . Array ; import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] arr = { a , b , c } ; Arrays . sort ( arr ) ; System . out . println ( arr [ 2 ] - arr [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int cnt5 = 0 ; int cnt7 = 0 ; if ( a = = 5 ) { cnt5 + = 1 ; } else if ( a = = 7 ) { cnt7 + = 1 ; } if ( b = = 5 ) { cnt5 + = 1 ; } else if ( b = = 7 ) { cnt7 + = 1 ; } if ( c = = 5 ) { cnt5 + = 1 ; } else if ( c = = 7 ) { cnt7 + = 1 ; } sc . close ( ) ; System . out . println ( ( cnt5 = = 2 & & cnt7 = = 1 ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double Ar = ( 60 * H + M ) / 2 ; double Br = M * 6 ; double ans ; if ( Ar > Br ) { double ans2 ; ans2 = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Ar - Br ) ) ; ans = Math . sqrt ( ans2 ) ; } else if ( Ar = = Br ) { ans = Math . abs ( A - B ) ; } else { double ans2 ; ans2 = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Br - Ar ) ) ; ans = Math . sqrt ( ans2 ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count1 = 0 ; int count2 = 0 ; int a = sc . nextInt ( ) ; if ( a = = 5 ) { count1 + = 1 ; } if ( a = = 7 ) { count2 + = 1 ; } int b = sc . nextInt ( ) ; if ( b = = 5 ) { count1 + = 1 ; } if ( b = = 7 ) { count2 + = 1 ; } int c = sc . nextInt ( ) ; if ( c = = 5 ) { count1 + = 1 ; } if ( c = = 7 ) { count2 + = 1 ; } if ( count1 = = 2 & & count2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double a , b , h , m ; a = in . nextDouble ( ) ; b = in . nextDouble ( ) ; h = in . nextDouble ( ) ; m = in . nextDouble ( ) ; in . close ( ) ; double h _ angle = 0.5 * ( h * 60 + m ) ; double m _ angle = 6 * m ; double angle = Math . abs ( h _ angle - m _ angle ) ; angle = Math . min ( angle , 360 - angle ) ; double res = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle * Math . PI / 180 ) ) ; System . out . printf ( " % .20f \ n " , res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String result = " NO " ; int [ ] input = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { input [ i ] = sc . nextInt ( ) ; } int count5 = 0 ; int count7 = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { if ( input [ j ] = = 5 ) { count5 + + ; } else if ( input [ j ] = = 7 ) { count7 + + ; } else { break ; } } if ( count5 = = 2 & & count7 = = 1 ) { result = " YES " ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean flg = false ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { flg = true ; } } if ( flg ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; int curMin = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( i = = 0 ) { curMin = p ; cnt + + ; continue ; } if ( p < curMin ) { curMin = p ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int max = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; max = Math . max ( max , P [ i ] ) ; } int min = max ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; sc . next ( ) ; sc . next ( ) ; sc . next ( ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String ans = ( e - a > k ) ? " : ( " : " Yay ! " ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int csum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; csum + = c [ i ] [ j ] ; } } int [ ] threesum = new int [ 6 ] ; threesum [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; threesum [ 1 ] = c [ 0 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 1 ] [ 2 ] ; threesum [ 2 ] = c [ 1 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 2 ] [ 2 ] ; threesum [ 3 ] = c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 0 ] [ 2 ] ; threesum [ 4 ] = c [ 2 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 0 ] [ 2 ] ; threesum [ 5 ] = c [ 2 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] ; for ( int i = 1 ; i < 6 ; i + + ) { if ( threesum [ 0 ] ! = threesum [ i ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . TreeSet ; import java . util . Arrays ; import java . util . SortedSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { SortedSet < Integer > k = new TreeSet < > ( Arrays . asList ( 1 , 4 , 7 , 9 ) ) ; SortedSet < Integer > m = new TreeSet < > ( ) ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 4 ; i + + ) { int z = sc . nextInt ( ) ; if ( k . contains ( z ) ) { m . add ( z ) ; } } if ( m . toArray ( ) . length = = 4 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt5 = 0 ; int cnt7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) { cnt5 + + ; } else if ( n = = 7 ) { cnt7 + + ; } } if ( cnt5 = = 2 & & cnt7 = = 1 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 , a , count , ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { count = 0 ; if ( i % 2 = = 1 ) continue ; a = i ; for ( ; ; ) { if ( a / 2 ! = 0 ) { a = a / 2 ; count + + ; } else { count + + ; break ; } } if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int k , s , x , y , z , n ; n = 0 ; Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( 0 < = z & & z < = k ) { n + + ; } } } System . out . println ( n ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxCnt = 0 ; int maxNum = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int cnt = 0 ; int num = i ; while ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } if ( cnt > maxCnt ) { maxCnt = cnt ; maxNum = i ; } } System . out . println ( maxNum ) ; sc . close ( ) ; } } import java . io . * ; import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; int a [ ] = new int [ n ] ; int min [ ] = new int [ n ] ; int c = 0 , minval = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = Integer . parseInt ( s [ i ] ) ; min [ 0 ] = a [ 0 ] ; minval = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < minval ) { minval = a [ i ] ; min [ i ] = minval ; } } for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < = min [ i ] ) c + + ; } out . println ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { byte [ ] distances = new byte [ 5 ] ; byte k ; for ( int i = 0 ; i < 5 ; i + + ) { distances [ i ] = scan . nextByte ( ) ; } k = scan . nextByte ( ) ; boolean isOk = true ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ! isCommunicatable ( distances [ i ] , distances [ j ] , k ) ) { isOk = false ; break ; } } } System . out . println ( isOk ? " Yay ! " : " : ( " ) ; } } private static boolean isCommunicatable ( int c1 , int c2 , int k ) { return ( c2 - c1 ) < = k ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < list . length ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int cnt = 1 ; int min = list [ 0 ] ; for ( int i = 1 ; i < list . length ; i + + ) { if ( min > = list [ i ] ) { cnt + + ; min = list [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] abc = new int [ 10 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int tmp = sc . nextInt ( ) ; abc [ tmp ] + + ; } if ( abc [ 5 ] = = 2 & & abc [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . math . BigInteger ; import java . security . NoSuchAlgorithmException ; import java . util . ArrayList ; import java . util . HashMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; int max = - 1 ; for ( int i = 1 ; i < = N ; i + + ) { int cc = 0 ; int ck = i ; while ( ck % 2 = = 0 ) { ck / = 2 ; cc + + ; } if ( max < cc ) { ans = i ; max = cc ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - ( i + j ) & & S - ( i + j ) < = K ) { answer + + ; } } } System . out . println ( answer ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) a [ i ] = sc . nextInt ( ) ; int [ ] min = a . clone ( ) ; long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { long temp = ( long ) x * i ; for ( int j = 0 ; j < N ; j + + ) { min [ j ] = Math . min ( min [ j ] , a [ ( j - i + N ) % N ] ) ; temp + = min [ j ] ; } ans = Math . min ( ans , temp ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double rate = ( h * 60 + m - 12 * m ) / 720.0 ; if ( rate > 0.5 ) { rate = 1.0 - rate ; } double rad = 2 * Math . PI * rate ; double c2 = a * a + b * b - 2 * a * b * Math . cos ( rad ) ; double c = Math . sqrt ( c2 ) ; System . out . println ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } boolean F = false ; int A = 0 ; int B = 0 ; int C = 0 ; A = c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 0 ] ; B = c [ 0 ] [ 1 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 1 ] ; C = c [ 0 ] [ 2 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 2 ] ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ( A - i ) % 3 = = 0 & & ( B - i ) % 3 = = 0 & & ( C - i ) % 3 = = 0 ) { F = true ; } } if ( F ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } 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 ; import java . util . * ; 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 c = in . nextInt ( ) ; int Max = Math . max ( a , Math . max ( b , c ) ) ; int Min = Math . min ( a , Math . min ( b , c ) ) ; int Mid = a + b + c - Max - Min ; if ( Min = = 5 & & Mid = = 5 & & Max = = 7 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } } 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 . 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 ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; out . println ( ( int ) Math . pow ( 2 , ( int ) ( Math . log ( n ) / Math . log ( 2 ) ) ) ) ; } } static class InputReader { private final InputStream stream ; private final byte [ ] buf = new byte [ 8192 ] ; private int curChar ; private int snumChars ; public InputReader ( InputStream st ) { this . stream = st ; } public int read ( ) { if ( snumChars = = - 1 ) throw new InputMismatchException ( ) ; if ( curChar > = snumChars ) { curChar = 0 ; try { snumChars = stream . read ( buf ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( snumChars < = 0 ) return - 1 ; } return buf [ curChar + + ] ; } public int nextInt ( ) { int c = read ( ) ; while ( isSpaceChar ( c ) ) { c = read ( ) ; } int sgn = 1 ; if ( c = = ' -' ) { sgn = - 1 ; c = read ( ) ; } int res = 0 ; do { res * = 10 ; res + = c - ' 0' ; c = read ( ) ; } while ( ! isSpaceChar ( c ) ) ; return res * sgn ; } public boolean isSpaceChar ( int c ) { return c = = ' ' | | c = = ' \ n ' | | c = = ' \ r ' | | c = = ' \ t ' | | c = = - 1 ; } } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num1 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int hour = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; double degOfMin = min * 6 ; double degOfHour = hour * 30 + degOfMin / 12 ; double deg = Math . abs ( degOfHour - degOfMin ) ; if ( deg > 180 ) { deg = 360 - deg ; } double rad = Math . toRadians ( deg ) ; double num3 = ( num1 * num1 ) + ( num2 * num2 ) - ( 2 * num1 * num2 * Math . cos ( rad ) ) ; System . out . print ( Math . sqrt ( num3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( ( a = = 5 ) & & ( b = = 5 ) & & ( c = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 5 ) & & ( b = = 7 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 7 ) & & ( b = = 5 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; String line = s . nextLine ( ) ; int N = Integer . parseInt ( line ) ; line = s . nextLine ( ) ; String [ ] str = line . split ( " " ) ; long [ ] A = new long [ N ] ; long sumA = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = Long . parseLong ( str [ i ] ) ; sumA + = A [ i ] ; } line = s . nextLine ( ) ; str = line . split ( " " ) ; long [ ] B = new long [ N ] ; long sumB = 0 ; for ( int i = 0 ; i < N ; i + + ) { B [ i ] = Long . parseLong ( str [ i ] ) ; sumB + = B [ i ] ; } if ( sumB > sumA ) { System . out . println ( - 1 ) ; return ; } int changeCnt = 0 ; long penaSum = 0L ; long [ ] pena = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { pena [ i ] = B [ i ] - A [ i ] ; if ( pena [ i ] > 0 ) { changeCnt + + ; penaSum + = pena [ i ] ; } } Arrays . sort ( pena ) ; for ( int i = 0 ; i < N ; i + + ) { if ( penaSum < = 0 ) break ; else { penaSum + = pena [ i ] ; changeCnt + + ; } } System . out . println ( changeCnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double A = in . nextDouble ( ) ; double B = in . nextDouble ( ) ; double ho = in . nextDouble ( ) ; double mi = in . nextDouble ( ) ; double rad = 60 / mi ; double radMi = 360 / rad ; double radiHo = ( ho * 30 ) + ( 30 / rad ) ; double radian = 0 ; if ( radiHo > radMi ) { radian = radiHo - radMi ; } else { radian = radMi - radiHo ; } double result = ( A * A ) + ( B * B ) - 2 * A * B * Math . cos ( Math . toRadians ( radian ) ) ; double ans = Math . sqrt ( result ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int c = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n > 5 ) { num [ 2 ] = n ; } else { num [ c + + ] = n ; } } if ( num [ 0 ] = = 5 & & num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int fiveCount = search ( str , ' 5' ) ; int sevenCount = search ( str , ' 7' ) ; if ( fiveCount = = 2 & & sevenCount = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } static int search ( String str , char target ) { int count = 0 ; for ( char x : str . toCharArray ( ) ) { if ( x = = target ) { count + + ; } } return count ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int deg2h = h * 60 + m ; int deg2m = m * 12 ; int deg2x = Math . max ( deg2m , deg2h ) - Math . min ( deg2m , deg2h ) ; if ( deg2x > 360 ) deg2x = 720 - deg2x ; double radx = Math . toRadians ( ( double ) ( deg2x / 2d ) ) ; double cc = ( double ) ( a * a ) + ( double ) ( b * b ) - 2d * ( double ) a * ( double ) b * Math . cos ( radx ) ; double c = Math . sqrt ( cc ) ; System . out . println ( c ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; long aSum = 0 ; long bSum = 0 ; long downCount = 0 ; long upSum = 0 ; long downSum = 0 ; long ansCount = 0 ; List < Integer > upList = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; aSum + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; bSum + = b [ i ] ; if ( a [ i ] - b [ i ] > = 0 ) { upList . add ( a [ i ] - b [ i ] ) ; upSum + = a [ i ] - b [ i ] ; } else { downCount + + ; downSum + = ( b [ i ] - a [ i ] ) ; } } Collections . sort ( upList , Comparator . reverseOrder ( ) ) ; if ( downCount = = 0 ) { System . out . println ( 0 ) ; return ; } if ( upSum < downSum ) { System . out . println ( - 1 ) ; return ; } for ( Integer integer : upList ) { downSum - = integer ; ansCount + + ; if ( downSum < = 0 ) { System . out . println ( ansCount + downCount ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; boolean [ ] b = new boolean [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 5 ) { count _ 5 + + ; } else if ( a = = 7 ) { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . List ; import java . util . Scanner ; import java . util . Collections ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = Integer . parseInt ( in . next ( ) ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( in . next ( ) ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Integer . parseInt ( in . next ( ) ) ; } List < Long > plus = new ArrayList < > ( ) ; long sum = 0 ; long num = 0 ; for ( int i = 0 ; i < n ; i + + ) { long diff = a [ i ] - b [ i ] ; if ( diff < 0 ) { sum - = diff ; + + num ; } else { plus . add ( diff ) ; } } if ( num = = 0 ) { out . println ( 0 ) ; return ; } else { long ans = num ; Collections . sort ( plus , Collections . reverseOrder ( ) ) ; long ptr = 0 ; for ( int i = 0 ; i < plus . size ( ) ; i + + ) { ptr + = plus . get ( i ) ; + + ans ; if ( ptr > = sum ) { break ; } } if ( ptr > = sum ) out . println ( ans ) ; else out . println ( - 1 ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - i - j & & s - i - j < = k ) { count + + ; } } } System . out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int limit = sc . nextInt ( ) ; int max = 0 ; int result = 1 ; for ( int i = 1 ; i < = limit ; i + + ) { int tmp = i ; int cnt = 0 ; while ( true ) { if ( tmp % 2 ! = 0 ) { break ; } tmp = tmp / 2 ; cnt + + ; } if ( cnt > max ) { max = cnt ; result = i ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; n [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; n [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; n [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( n [ i ] = = 5 ) count5 + + ; if ( n [ i ] = = 7 ) count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( i + j < = s & & s - i - j < = k ) { c + + ; } } } System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int i = sc . nextInt ( ) ; boolean ok = false ; for ( int x = - 100 ; x < = 100 ; x + + ) { if ( a + x = = d & & b + x = = e & & c + x = = f ) { ok = true ; break ; } } if ( ! ok ) { System . out . println ( " No " ) ; return ; } ok = false ; for ( int x = - 100 ; x < = 100 ; x + + ) { if ( g + x = = d & & h + x = = e & & i + x = = f ) { ok = true ; break ; } } if ( ! ok ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a1 = Integer . parseInt ( sc . next ( ) ) ; int a2 = Integer . parseInt ( sc . next ( ) ) ; int a3 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ ] { a1 , a2 , a3 } ; Arrays . sort ( a ) ; int result = 0 ; result + = a [ 1 ] - a [ 0 ] ; result + = a [ 2 ] - a [ 1 ] ; System . out . println ( result ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] list = str . split ( " " ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < list . length ; i + + ) { if ( list [ i ] . equals ( " 5 " ) ) { count5 = count5 + 1 ; } else if ( list [ i ] . equals ( " 7 " ) ) { count7 = count7 + 1 ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ret = 64 ; while ( ret > n ) { ret / = 2 ; } System . out . println ( ret ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] ae = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { ae [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( ae [ 4 ] - ae [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; char arr [ ] = new char [ n ] ; ArrayList < Character > a = new ArrayList < Character > ( ) ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = scan . next ( ) . charAt ( 0 ) ; if ( ! a . contains ( arr [ i ] ) ) { a . add ( arr [ i ] ) ; } } System . out . println ( a . size ( ) = = 4 ? " Four " : " Three " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { FastScanner sc = new FastScanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; while ( n > = 2 ) { n / = 2 ; cnt + + ; } System . out . println ( ( int ) Math . pow ( 2 , cnt ) ) ; } } class FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public String nextLine ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \ n " ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int h = 1 ; h < = 3500 ; h + + ) { for ( int n = 1 ; n < = 3500 ; n + + ) { long a = ( long ) N * h * n ; long b = ( long ) 4 * h * n - ( long ) N * n - ( long ) N * h ; if ( b ! = 0 & & a % b = = 0 & & 1 < = a / b & & a / b < = 3500 ) { System . out . println ( h + " " + n + " " + a / b ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; N [ 0 ] = scan . nextInt ( ) ; N [ 1 ] = scan . nextInt ( ) ; N [ 2 ] = scan . nextInt ( ) ; N [ 3 ] = scan . nextInt ( ) ; Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 & & N [ 1 ] = = 4 & & N [ 2 ] = = 7 & & N [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 124 ; for ( int i = 0 ; i < 5 ; i + + ) { int antena = sc . nextInt ( ) ; if ( antena > max ) { max = antena ; } if ( antena < min ) { min = antena ; } } int k = sc . nextInt ( ) ; if ( max - min < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { 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 min = a [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < = min ) { count + + ; min = a [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; class Main { public static void main ( String [ ] args ) throws Exception { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputStringList = br . readLine ( ) . split ( " \ \ s + " ) ; List < String > fiveList = new ArrayList < > ( ) ; List < String > sevenList = new ArrayList < > ( ) ; for ( String inputString : inputStringList ) { if ( inputString . equals ( " 5 " ) ) { fiveList . add ( inputString ) ; } else if ( inputString . equals ( " 7 " ) ) { sevenList . add ( inputString ) ; } } String result ; if ( fiveList . size ( ) = = 2 & & sevenList . size ( ) = = 1 ) { result = " YES " ; } else { result = " NO " ; } System . out . println ( result ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; boolean gg = true ; Integer [ ] array = new Integer [ n ] ; int a = 1 ; int b = 0 ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = s . nextInt ( ) ; if ( i ! = 0 ) { if ( array [ i ] < b ) { b = array [ i ] ; a + + ; } else { } } else { b = array [ i ] ; } } System . out . print ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int count = 0 ; sc . nextLine ( ) ; String line = sc . nextLine ( ) ; String [ ] array = line . split ( " " ) ; int pi ; int min = a + 1 ; for ( int i = 0 ; i < a ; i + + ) { pi = Integer . parseInt ( array [ i ] ) ; if ( min > pi ) { count + + ; min = pi ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , H , M ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; H = sc . nextInt ( ) ; M = sc . nextInt ( ) ; double thetaA = 30 * H + 0.5 * M ; double thetaB = 6 * M ; double xA , yA , xB , yB ; xA = A * ( Math . sin ( Math . toRadians ( thetaA ) ) ) ; yA = A * ( Math . cos ( Math . toRadians ( thetaA ) ) ) ; xB = B * ( Math . sin ( Math . toRadians ( thetaB ) ) ) ; yB = B * ( Math . cos ( Math . toRadians ( thetaB ) ) ) ; double di = ( xA - xB ) * ( xA - xB ) + ( yA - yB ) * ( yA - yB ) ; double dist = Math . sqrt ( di ) ; System . out . println ( dist ) ; } } import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; public class Main { static Input in = new Input ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int H = in . nextInt ( ) ; int M = in . nextInt ( ) ; double r = 2 * Math . PI * ( ( H / 12d ) + ( M / 60d / 12d ) - ( M / 60D ) ) ; out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( r ) ) ) ; out . flush ( ) ; } static class Input { private BufferedReader br ; private String [ ] buff ; private int index = 0 ; Input ( InputStream is ) { br = new BufferedReader ( new InputStreamReader ( is ) ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return null ; } String next ( ) { while ( buff = = null | | index > = buff . length ) { buff = nextLine ( ) . split ( " " ) ; index = 0 ; } return buff [ index + + ] ; } byte nextByte ( ) { return Byte . parseByte ( next ( ) ) ; } short nextShort ( ) { return Short . parseShort ( next ( ) ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } BigInteger nextBigInteger ( ) { return new BigInteger ( next ( ) ) ; } BigDecimal nextBigDecimal ( ) { return new BigDecimal ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int N = scan . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] C = new int [ N ] ; int count = 0 ; long goA = 0 ; long goB = 0 ; long hu = 0 ; int huco = 0 ; for ( int i = 0 ; i < N ; i + + ) A [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) B [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { C [ i ] = A [ i ] - B [ i ] ; if ( C [ i ] < 0 ) { hu + = ( long ) C [ i ] ; huco + + ; } goA + = ( long ) A [ i ] ; goB + = ( long ) B [ i ] ; if ( A [ i ] < B [ i ] ) count + + ; } if ( goA < goB ) { System . out . println ( - 1 ) ; return ; } if ( count = = 0 ) { System . out . println ( 0 ) ; return ; } int co = 0 ; Arrays . sort ( C ) ; for ( int i = N - 1 ; i > = 0 ; i -- ) { if ( C [ i ] > 0 ) { hu + = C [ i ] ; huco + + ; if ( hu > = 0 ) { break ; } } } System . out . println ( huco ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a , b , c ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; c = in . nextInt ( ) ; int countFive = 0 ; int countSeven = 0 ; if ( a = = 5 ) { countFive + + ; } else if ( a = = 7 ) { countSeven + + ; } if ( b = = 5 ) { countFive + + ; } else if ( b = = 7 ) { countSeven + + ; } if ( c = = 5 ) { countFive + + ; } else if ( c = = 7 ) { countSeven + + ; } if ( countFive = = 2 & & countSeven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws InterruptedException { Scanner in = new Scanner ( System . in ) ; double E = 1e-9 ; double N = in . nextDouble ( ) ; boolean answerFound = false ; double d = 4 / N ; for ( double i = 3500 ; i > 0 & & 1 / i < d & & ! answerFound ; i -- ) { double dd = d - 1 / i ; for ( double j = 3500 ; j > 0 & & 1 / j < dd & & ! answerFound ; j -- ) { double ddd = dd - 1 / j ; double x = 1 / ddd ; int k = 0 ; if ( Math . abs ( Math . ceil ( x ) - x ) < = E ) { k = ( int ) Math . ceil ( x ) ; answerFound = true ; } else if ( Math . abs ( Math . floor ( x ) - x ) < = E ) { k = ( int ) Math . floor ( x ) ; answerFound = true ; } if ( answerFound ) { System . out . printf ( " % d % d % d \ n " , ( int ) i , ( int ) j , k ) ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long sum = 0 ; long minus = 0 ; int C _ minus = 0 ; for ( int i = 0 ; i < N ; i + + ) { long Ai = sc . nextLong ( ) ; A [ i ] = Ai ; C [ i ] = Ai ; } for ( int i = 0 ; i < N ; i + + ) { long Bi = sc . nextLong ( ) ; B [ i ] = Bi ; C [ i ] = C [ i ] - Bi ; sum + = C [ i ] ; if ( C [ i ] < 0 ) { C _ minus + + ; minus + = C [ i ] ; } } if ( C _ minus = = 0 ) { System . out . println ( 0 ) ; } else if ( sum < 0 ) { System . out . println ( - 1 ) ; } else { int answer = 0 ; Arrays . sort ( C ) ; for ( int i = C . length - 1 ; i > = 0 ; i -- ) { minus + = C [ i ] ; if ( minus > 0 ) { answer = C . length - 1 - i + 1 ; break ; } } answer + = C _ minus ; System . out . println ( answer ) ; } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { list . add ( scanner . nextInt ( ) ) ; scanner . nextLine ( ) ; } int k = scanner . nextInt ( ) ; scanner . nextLine ( ) ; list . sort ( ( x , y ) - > x - y ) ; if ( ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k & & x + y + z = = s ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . ArrayDeque ; import java . util . Queue ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static long N = sc . nextLong ( ) ; static long P = sc . nextLong ( ) ; static class Pair { public long x ; public long y ; public Pair ( long x , long y ) { this . x = x ; this . y = y ; } } public static void main ( String [ ] args ) { long ans = 1 ; Queue < Pair > que = new ArrayDeque < > ( ) ; for ( long i = 2 ; i * i < = P ; i + + ) { if ( P % i ! = 0 ) continue ; long count = 0 ; while ( P % i = = 0 ) { count + + ; P / = i ; } Pair pair = new Pair ( i , count ) ; que . add ( pair ) ; } if ( P ! = 1 ) { que . add ( new Pair ( P , 1 ) ) ; } while ( ! que . isEmpty ( ) ) { Pair pair2 = que . poll ( ) ; for ( int i = 0 ; i < pair2 . y / N ; i + + ) { ans * = pair2 . x ; } } System . out . println ( ans ) ; } } import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String result = " No " ; for ( int a1 = - 200 ; a1 < = 200 ; a1 + + ) { boolean bool = true ; int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; int a2 = c [ 1 ] [ 0 ] - b1 ; int a3 = c [ 2 ] [ 0 ] - b1 ; if ( c [ 1 ] [ 1 ] ! = a2 + b2 ) bool = false ; if ( c [ 1 ] [ 2 ] ! = a2 + b3 ) bool = false ; if ( c [ 2 ] [ 1 ] ! = a3 + b2 ) bool = false ; if ( c [ 2 ] [ 2 ] ! = a3 + b3 ) bool = false ; if ( bool ) { result = " Yes " ; break ; } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ sc . nextInt ( ) ] = 1 ; } if ( a [ 1 ] = = 1 & & a [ 7 ] = = 1 & & a [ 9 ] = = 1 & & a [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int z = S - i - j ; if ( 0 < = z & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; class C { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int [ ] A = new int [ N ] ; Arrays . setAll ( A , i - > sc . nextInt ( ) ) ; final int [ ] B = new int [ N ] ; Arrays . setAll ( B , i - > sc . nextInt ( ) ) ; for ( int i = 0 ; i < N ; i + + ) A [ i ] - = B [ i ] ; Arrays . sort ( A ) ; long minus = 0 ; int ans = 0 ; for ( int i = 0 ; i < N & & A [ i ] < 0 ; i + + , ans + + ) minus + = A [ i ] ; for ( int i = N - 1 ; i > = 0 & & A [ i ] > 0 & & minus < 0 ; i -- , ans + + ) minus + = A [ i ] ; System . out . println ( minus < 0 ? - 1 : ans ) ; } } public class Main { public static void main ( String ... args ) { C . main ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String in = br . readLine ( ) ; String chr [ ] = in . split ( " " ) ; int five = 0 ; int seve = 0 ; for ( int i = 0 ; i < chr . length ; i + + ) { if ( Integer . parseInt ( chr [ i ] ) = = 5 ) { five + + ; } else if ( Integer . parseInt ( chr [ i ] ) = = 7 ) { seve + + ; } else { break ; } } if ( five = = 2 & & seve = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . * ; class Main { static int mod = 1000000007 ; static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = s . nextInt ( ) - 1 , m = s . nextInt ( ) - 1 ; long [ ] a = new long [ n ] , b = new long [ m ] ; f ( a ) ; f ( b ) ; System . err . println ( Arrays . toString ( a ) ) ; System . err . println ( Arrays . toString ( b ) ) ; long A = g ( n , a ) , B = g ( m , b ) ; System . out . println ( A * B % mod ) ; } static void f ( long [ ] a ) { long p = s . nextLong ( ) ; for ( int i = 0 ; i < a . length ; + + i ) { long q = s . nextLong ( ) ; a [ i ] = q - p ; p = q ; } } static long g ( int n , long [ ] a ) { long A = 0 ; for ( int i = 0 ; i < n ; + + i ) { long p = Math . min ( i , n - 1 - i ) ; A + = ( ( p + 1 ) * p + ( n - p * 2 ) * ( p + 1 ) ) % mod * a [ i ] ; A % = mod ; } return A ; } } import java . util . Scanner ; import java . io . File ; import java . io . FileNotFoundException ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = scanner . nextInt ( ) ; } int min = ( 1 < < 30 ) , ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] < min ) { min = arr [ i ] ; ans + = 1 ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { for ( int j = 0 ; j < = 100 ; j + + ) { for ( int k = 0 ; k < = 100 ; k + + ) { if ( a [ 0 ] [ 0 ] - i = = a [ 1 ] [ 0 ] - j & & a [ 1 ] [ 0 ] - j = = a [ 2 ] [ 0 ] - k & & a [ 2 ] [ 0 ] - k = = a [ 0 ] [ 0 ] - i ) { if ( a [ 0 ] [ 1 ] - i = = a [ 1 ] [ 1 ] - j & & a [ 1 ] [ 1 ] - j = = a [ 2 ] [ 1 ] - k & & a [ 2 ] [ 1 ] - k = = a [ 0 ] [ 1 ] - i ) { if ( a [ 0 ] [ 2 ] - i = = a [ 1 ] [ 2 ] - j & & a [ 1 ] [ 2 ] - j = = a [ 2 ] [ 2 ] - k & & a [ 2 ] [ 2 ] - k = = a [ 0 ] [ 2 ] - i ) { System . out . println ( " Yes " ) ; return ; } } } } } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] data = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { data [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 = 0 ; int b1 = data [ 0 ] [ 0 ] ; int b2 = data [ 1 ] [ 0 ] ; int b3 = data [ 2 ] [ 0 ] ; int a2 = data [ 0 ] [ 1 ] - b1 ; int a3 = data [ 0 ] [ 2 ] - b1 ; if ( data [ 0 ] [ 0 ] = = a1 + b1 & & data [ 0 ] [ 1 ] = = a2 + b1 & & data [ 0 ] [ 2 ] = = a3 + b1 & & data [ 1 ] [ 0 ] = = a1 + b2 & & data [ 1 ] [ 1 ] = = a2 + b2 & & data [ 1 ] [ 2 ] = = a3 + b2 & & data [ 2 ] [ 0 ] = = a1 + b3 & & data [ 2 ] [ 1 ] = = a2 + b3 & & data [ 2 ] [ 2 ] = = a3 + b3 ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { int N ; public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . read ( ) ; m . solve ( ) ; } private void read ( ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; } private void solve ( ) { long w = 0 , n , h = 0 ; long a , b ; for ( n = 1 ; n < = 3500 ; n + + ) { for ( h = 1 ; h < = 3500 ; h + + ) { a = 4 * h * n - N * ( n + h ) ; b = N * h * n ; if ( a > 0 & & b > 0 & & b % a = = 0 ) { w = b / a ; break ; } } if ( w ! = 0 ) break ; } System . out . printf ( " % d % d % d \ n " , n , h , w ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } boolean f1 = false , f2 = false , f3 = false , f4 = false ; for ( int i = 0 ; i < 4 ; i + + ) { if ( num [ i ] = = 1 ) f1 = true ; else if ( num [ i ] = = 9 ) f2 = true ; else if ( num [ i ] = = 7 ) f3 = true ; else if ( num [ i ] = = 4 ) f4 = true ; } if ( f1 & & f2 & & f3 & & f4 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( sc . hasNext ( ) ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . Arrays ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; long ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) for ( int j = 0 ; j < = K ; j + + ) if ( 0 < = S - i - j & & S - i - j < = K ) ans + + ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String A = scan . next ( ) ; String B = scan . next ( ) ; String C = scan . next ( ) ; if ( A . equals ( " 5 " ) & & B . equals ( " 5 " ) ) { System . out . println ( " YES " ) ; } else if ( B . equals ( " 5 " ) & & C . equals ( " 5 " ) ) { System . out . println ( " YES " ) ; } else if ( A . equals ( " 5 " ) & & C . equals ( " 5 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] ks = scanner . nextLine ( ) . split ( " " , 2 ) ; int k = Integer . parseInt ( ks [ 0 ] ) ; int s = Integer . parseInt ( ks [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = 0 ; y < = Math . min ( k , s - x ) ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { list . add ( sc . next ( ) ) ; } System . out . println ( list . contains ( " 1 " ) & & list . contains ( " 9 " ) & & list . contains ( " 7 " ) & & list . contains ( " 4 " ) ? " YES " : " NO " ) ; } } import java . util . * ; class Main { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double A = 2 * Math . PI * m / 60 ; double B = 2 * Math . PI * ( ( h + m / 60 ) / 12 ) ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . abs ( A - B ) ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N = = 1 ) { System . out . println ( 1 ) ; } else { int ans = 0 ; for ( int i = 2 ; i < = N ; i = i * 2 ) { ans = i ; } System . out . println ( ans ) ; } } } import java . io . IOException ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int [ ] num = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( num ) ; if ( num [ 0 ] = = 5 ) { if ( num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { long N , P ; List < Long > coords ; long limit ; long result = 1 ; Main ( ) { Scanner in = new Scanner ( System . in ) ; N = in . nextLong ( ) ; P = in . nextLong ( ) ; in . close ( ) ; calcLimit ( ) ; } void calcLimit ( ) { long times = N ; limit = P ; while ( times > = 2 ) { limit = ( long ) Math . sqrt ( ( double ) limit ) ; times / = 2 ; } } void calc ( ) { for ( long v = limit ; v > 0 ; -- v ) { if ( Math . pow ( v , N ) > P ) { continue ; } if ( P % ( long ) Math . pow ( v , N ) = = 0 ) { result = v ; break ; } } } public static void main ( String [ ] args ) { Main ins = new Main ( ) ; ins . calc ( ) ; System . out . println ( ins . result ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = scan . next ( ) ; if ( ! list . contains ( s ) ) list . add ( s ) ; } if ( list . size ( ) = = 4 ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int m = H * 60 + M ; double distance = Math . sqrt ( ( A * Math . cos ( m * Math . PI / 30 ) - B * Math . cos ( m * Math . PI / 360 ) ) * ( A * Math . cos ( m * Math . PI / 30 ) - B * Math . cos ( m * Math . PI / 360 ) ) + ( A * Math . sin ( m * Math . PI / 30 ) - B * Math . sin ( m * Math . PI / 360 ) ) * ( A * Math . sin ( m * Math . PI / 30 ) - B * Math . sin ( m * Math . PI / 360 ) ) ) ; System . out . println ( distance ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 0 ; int cout = 0 ; int temp = 0 ; int ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { x = i ; while ( x % 2 = = 0 ) { temp + + ; x / = 2 ; } if ( temp > cout ) { cout = temp ; ans = i ; } temp = 0 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; long A [ ] = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = scan . nextLong ( ) ; } long res = 0 ; long min = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( i = = 0 ) { res + = A [ i ] - 1 ; min = 1 ; continue ; } if ( min + 1 = = A [ i ] ) { min = A [ i ] ; } else if ( min + 1 < A [ i ] ) { res + = ( A [ i ] - 1 ) / ( min + 1 ) ; } } System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; int count = 1 ; int min = sc . nextInt ( ) ; for ( long i = 0 ; i < n - 1 ; i + + ) { int a = sc . nextInt ( ) ; if ( a < = min ) count + + ; min = Math . min ( min , a ) ; } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import static java . lang . Integer . parseInt ; public class Main { static final int INF = 1 < < 29 ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; String [ ] words ; line = br . readLine ( ) ; int H , W ; H = parseInt ( line . substring ( 0 , line . indexOf ( ' ' ) ) ) ; W = parseInt ( line . substring ( line . indexOf ( ' ' ) + 1 ) ) ; int [ ] [ ] map = new int [ H ] [ W ] ; for ( int i = 0 ; i < H ; i + + ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; for ( int j = 0 ; j < W ; j + + ) { map [ i ] [ j ] = parseInt ( st . nextToken ( ) ) ; } } int ans = INF ; for ( int i = 0 ; i < H ; i + + ) { for ( int j = 0 ; j < W ; j + + ) { int sum = 0 ; for ( int m = 0 ; m < H ; m + + ) { for ( int n = 0 ; n < W ; n + + ) { sum + = Math . min ( Math . abs ( i - m ) , Math . abs ( j - n ) ) * map [ m ] [ n ] ; } } ans = Math . min ( ans , sum ) ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . Comparator ; import java . util . PriorityQueue ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; PriorityQueue < Integer > P = new PriorityQueue < > ( Comparator . reverseOrder ( ) ) ; P . add ( Math . abs ( A - B ) ) ; P . add ( Math . abs ( B - C ) ) ; P . add ( Math . abs ( C - A ) ) ; P . poll ( ) ; System . out . println ( P . poll ( ) + P . poll ( ) ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] an = new int [ 5 ] ; an [ 0 ] = sc . nextInt ( ) ; an [ 1 ] = sc . nextInt ( ) ; an [ 2 ] = sc . nextInt ( ) ; an [ 3 ] = sc . nextInt ( ) ; an [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( an [ i ] - an [ j ] ) > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; in . nextLine ( ) ; boolean hasYellow = false ; String s = " " ; for ( int i = 0 ; i < n ; i + + ) { s = in . next ( ) ; if ( s . equals ( " Y " ) ) { hasYellow = true ; break ; } } if ( hasYellow ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 , z = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { z = S - x - y ; if ( z > = 0 & & z < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N ; N = new int [ 4 ] ; N [ 0 ] = sc . nextInt ( ) ; N [ 1 ] = sc . nextInt ( ) ; N [ 2 ] = sc . nextInt ( ) ; N [ 3 ] = sc . nextInt ( ) ; Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 ) { if ( N [ 1 ] = = 4 ) { if ( N [ 2 ] = = 7 ) { if ( N [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] list = new int [ 5 ] ; for ( int i = 0 ; i < list . length ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = 0 ; for ( int i = 0 ; i < list . length ; i + + ) { for ( int j = i + 1 ; j < list . length ; j + + ) { max = Math . max ( max , list [ j ] - list [ i ] ) ; } } if ( max > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; int c = input . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) System . out . println ( " YES " ) ; else if ( a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else if ( a = = 5 & & b = = 7 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double d = 0 ; int x = 6 * m ; double y = 0.5 * m + 30 * h ; double z = Math . abs ( x - y ) ; if ( z < = 180 ) { d = z ; } else { d = 360 - z ; } double rad = Math . toRadians ( z ) ; double A = a * a ; double B = b * b ; double C = 2 * a * b * Math . cos ( rad ) ; System . out . println ( Math . sqrt ( A + B - C ) ) ; } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner sc = new Scanner ( is ) ; int p [ ] = new int [ 5 ] ; for ( int i = 0 ; i < p . length ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < p . length ; i + + ) { for ( int j = 0 ; j < p . length ; j + + ) { if ( Math . abs ( p [ j ] - p [ i ] ) > k ) { os . println ( " : ( " ) ; return ; } } } os . println ( " Yay ! " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; long count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } out . println ( count ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int time = h * 60 + m ; double hd = 0.5 * time ; double md = 6.0 * m ; double hx = Math . sin ( Math . toRadians ( hd ) ) * a ; double hy = Math . cos ( Math . toRadians ( hd ) ) * a ; double mx = Math . sin ( Math . toRadians ( md ) ) * b ; double my = Math . cos ( Math . toRadians ( md ) ) * b ; double x = ( hx - mx ) ; if ( x < 0 ) { x * = - 1 ; } double y = ( hy - my ) ; if ( y < 0 ) { y * = - 1 ; } double ans = x * x + y * y ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int m2 = h * 60 + m ; int rev = 12 * 60 ; double hrot = ( double ) ( m2 ) / rev ; double mrot = ( double ) ( m ) / 60 ; double hx = a * Math . sin ( 2 * Math . PI * hrot ) ; double hy = a * Math . cos ( 2 * Math . PI * hrot ) ; double mx = b * Math . sin ( 2 * Math . PI * mrot ) ; double my = b * Math . cos ( 2 * Math . PI * mrot ) ; double dx = hx - mx ; double dy = hy - my ; double dist = Math . pow ( dx * dx + dy * dy , 0.5 ) ; System . out . println ( dist ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int b = a [ 4 ] - a [ 0 ] ; if ( b > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double r1 = sc . nextDouble ( ) ; double r2 = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double deg1 = ( ( h - 3 ) * - 30 ) + ( m / - 2 ) ; double deg2 = ( ( m - 15 ) * - 6 ) ; while ( deg1 < 0 ) deg1 + = 360d ; while ( deg2 < 0 ) deg2 + = 360d ; deg1 = ( deg1 * Math . PI ) / 180 ; deg2 = ( deg2 * Math . PI ) / 180 ; double x1 = Math . cos ( deg1 ) * r1 ; double y1 = Math . sin ( deg1 ) * r1 ; double x2 = Math . cos ( deg2 ) * r2 ; double y2 = Math . sin ( deg2 ) * r2 ; double xx = ( x1 - x2 ) * ( x1 - x2 ) ; double yy = ( y1 - y2 ) * ( y1 - y2 ) ; double dis = Math . sqrt ( xx + yy ) ; System . out . printf ( " % .16f \ n " , dis ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; int score = 0 ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; if ( S [ i ] . equals ( " Y " ) ) { score + = 1 ; } } if ( score = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; import javax . lang . model . util . ElementScanner6 ; import java . lang . Math ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ao = 2 * Math . PI / ( 12 * 60 ) ; double ax = a * ( Math . sin ( ( h * 60 + m ) * ao ) ) ; double ay = a * ( Math . cos ( ( h * 60 + m ) * ao ) ) ; ; double bx = b * ( Math . sin ( 2 * Math . PI * m / 60 ) ) ; double by = b * ( Math . cos ( 2 * Math . PI * m / 60 ) ) ; ; double out = Math . sqrt ( Math . pow ( ax - bx , 2 ) + Math . pow ( ay - by , 2 ) ) ; System . out . println ( out ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int n ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { int ans = 1 ; while ( ans < = n ) { ans * = 2 ; } ans / = 2 ; System . out . println ( ans ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int output = 0 ; try { String [ ] keyboardInput = br . readLine ( ) . split ( " " ) ; int K = Integer . parseInt ( keyboardInput [ 0 ] ) ; int S = Integer . parseInt ( keyboardInput [ 1 ] ) ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( S - x - y > = 0 & & S - x - y < = K ) { output + + ; } } } System . out . println ( output ) ; } catch ( IOException e ) { System . out . println ( e . getMessage ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int k = scn . nextInt ( ) ; int s = scn . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = k ; + + y ) { if ( s > = x + y & & s - ( x + y ) < = k ) { count = count + 1 ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } long cnt = a [ 0 ] - 1 ; int max = 2 ; for ( int i = 1 ; i < n ; i + + ) { if ( max < a [ i ] ) { int c = a [ i ] % max = = 0 ? ( int ) Math . floor ( a [ i ] / max ) - 1 : ( int ) Math . floor ( a [ i ] / max ) ; cnt + = c ; a [ i ] = 1 ; } max = Math . max ( a [ i ] + 1 , max ) ; } sb . append ( cnt ) ; System . out . println ( sb ) ; } } 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 . FileReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CLowElements solver = new CLowElements ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CLowElements { public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) arr [ i ] = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int c = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] < min ) c + + ; min = Math . min ( min , arr [ i ] ) ; } pw . println ( c ) ; } } static class Scanner { StringTokenizer st ; BufferedReader br ; public Scanner ( FileReader r ) { br = new BufferedReader ( r ) ; } public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] N = new Integer [ 4 ] ; int sum = 0 , product = 1 ; for ( int i = 0 ; i < 4 ; i + + ) { N [ i ] = sc . nextInt ( ) ; sum + = N [ i ] ; product * = N [ i ] ; } if ( sum = = 21 & & product = = 252 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int [ ] positions = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { positions [ i ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean pass = true ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { int difference = positions [ j ] - positions [ i ] ; if ( difference > border ) { pass = false ; break ; } } } if ( pass ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; import java . math . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double s = h / 12 * 360 ; double l = m / 60 * 360 ; s + = l / 12 ; double res = Math . abs ( s - l ) ; res = Math . min ( 360 - res , res ) ; double r = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( res ) ) ) ; System . out . println ( r ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( k < = K & & 0 < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " " ) ; int k = Integer . parseInt ( line [ 0 ] ) ; int s = Integer . parseInt ( line [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { int n = ni ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; + + i ) { a [ i ] = ni ( ) ; } int max = 1 ; long cnt = a [ 0 ] - 1 ; for ( int i = 1 ; i < n ; + + i ) { if ( a [ i ] = = max + 1 ) { + + max ; continue ; } long v = ( a [ i ] - 1 ) / ( max + 1 ) ; cnt + = v ; } System . out . println ( cnt ) ; } int ni ( ) { return Integer . parseInt ( sc . next ( ) ) ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int digit = sc . nextInt ( ) ; if ( min > digit ) { min = digit ; ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int N = input . nextInt ( ) ; long [ ] a = new long [ N ] ; long [ ] b = new long [ N ] ; long [ ] d = new long [ N ] ; boolean [ ] vis = new boolean [ N ] ; long Sa = 0 ; long Sb = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = input . nextLong ( ) ; Sa + = a [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { b [ i ] = input . nextLong ( ) ; Sb + = b [ i ] ; } if ( Sb > Sa ) ans = - 1 ; else { for ( int i = 0 ; i < N ; i + + ) { d [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( d ) ; int L = 0 ; int R = N - 1 ; while ( true ) { if ( d [ L ] > = 0 ) break ; long min = Math . min ( Math . abs ( d [ L ] ) , d [ R ] ) ; d [ L ] + = min ; d [ R ] - = min ; if ( ! vis [ L ] ) ans + + ; if ( ! vis [ R ] ) ans + + ; vis [ L ] = true ; vis [ R ] = true ; if ( d [ R ] = = 0 ) R -- ; if ( d [ L ] = = 0 ) L + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; long X = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] [ ] min = new int [ N ] [ N ] ; for ( int i = 0 ; i < N ; + + i ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; + + i ) { min [ i ] [ i ] = A [ i ] ; } for ( int i = 0 ; i < N ; + + i ) { for ( int j = i + 1 ; j < N ; + + j ) { min [ i ] [ j ] = Math . min ( min [ i ] [ j - 1 ] , A [ j ] ) ; } } long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; + + i ) { long cur = X * i ; for ( int j = 0 ; j < N ; + + j ) { if ( j > = i ) { cur + = min [ j - i ] [ j ] ; } else { cur + = Math . min ( min [ 0 ] [ j ] , min [ N - ( i - j ) ] [ N - 1 ] ) ; } } ans = Math . min ( ans , cur ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( array [ i ] - array [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n , i = 0 ; String result = " Three " , in ; n = Integer . parseInt ( reader . readLine ( ) ) ; char a [ ] = new char [ n ] ; in = reader . readLine ( ) ; while ( i < n ) { a [ i ] = in . charAt ( i ) ; i = + + i ; } for ( i = 0 ; i < n ; i + + ) { if ( a [ i ] = = ' Y ' ) { result = " Four " ; } } System . out . println ( result ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int count = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 4 ; i > 0 ; i -- ) { for ( int j = 3 ; j > = 0 ; j -- ) { if ( A [ i ] - A [ j ] > k ) { count + + ; } } } if ( count > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int j , cnt = 0 ; int min = 999999999 ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( min , p [ i ] ) ; if ( min = = p [ i ] ) cnt + + ; } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int min = Integer . MAX _ VALUE ; int max = Integer . MIN _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = sc . nextInt ( ) ; min = Math . min ( min , tmp ) ; max = Math . max ( max , tmp ) ; sc . nextLine ( ) ; } if ( max - min > sc . nextInt ( ) ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( a , b ) , c ) - Math . min ( Math . min ( a , b ) , c ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int [ ] hairetu = new int [ b ] ; for ( int i = 0 ; i < hairetu . length ; i + + ) { int c = sc . nextInt ( ) ; hairetu [ i ] = c ; } int count = 0 ; int champ = hairetu [ 0 ] ; for ( int k = 0 ; k < hairetu . length ; k + + ) { if ( champ > = hairetu [ k ] ) { champ = hairetu [ k ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N1 = stdIn . nextInt ( ) ; int N2 = stdIn . nextInt ( ) ; int N3 = stdIn . nextInt ( ) ; int N4 = stdIn . nextInt ( ) ; int h1 = 0 , h2 = 0 , h3 = 0 , h4 = 0 ; if ( N1 = = 1 ) h1 + + ; if ( N2 = = 1 ) h1 + + ; if ( N3 = = 1 ) h1 + + ; if ( N4 = = 1 ) h1 + + ; if ( h1 = = 0 | | h1 > 1 ) System . out . println ( " NO " ) ; else { if ( N1 = = 9 ) h2 + + ; if ( N2 = = 9 ) h2 + + ; if ( N3 = = 9 ) h2 + + ; if ( N4 = = 9 ) h2 + + ; if ( h2 = = 0 | | h2 > 1 ) System . out . println ( " NO " ) ; else { if ( N1 = = 7 ) h3 + + ; if ( N2 = = 7 ) h3 + + ; if ( N3 = = 7 ) h3 + + ; if ( N4 = = 7 ) h3 + + ; if ( h3 = = 0 | | h3 > 1 ) System . out . println ( " NO " ) ; else { if ( N1 = = 4 ) h4 + + ; if ( N2 = = 4 ) h4 + + ; if ( N3 = = 4 ) h4 + + ; if ( N4 = = 4 ) h4 + + ; if ( h4 = = 0 | | h4 > 1 ) System . out . println ( " NO " ) ; else { System . out . println ( " YES " ) ; } } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; long n = stdin . nextLong ( ) ; long p = stdin . nextLong ( ) ; if ( n = = 1 ) { System . out . println ( p ) ; System . exit ( 0 ) ; } long q = ( long ) Math . sqrt ( p ) ; long ans = 1 ; for ( long i = 2 ; i < = q ; i + + ) { long v = 0 ; while ( p % i = = 0 ) { v + + ; p / = i ; } if ( n < = v ) { ans * = ( long ) Math . pow ( ( double ) i , ( double ) ( v / n ) ) ; } } System . out . println ( ans ) ; } private static boolean isPrime ( long x ) { if ( x < 2 ) return false ; if ( x = = 2 ) return true ; if ( x % 2 = = 0 ) return false ; for ( long i = 3 ; i * i < = x ; i + = 2 ) { if ( x % i = = 0 ) return false ; } return true ; } } import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { new Solution ( ) ; } } class Solution { Scanner scanner ; public Solution ( ) { scanner = new Scanner ( System . in ) ; while ( scanner . hasNext ( ) ) { run _ case ( ) ; } } private void run _ case ( ) { scanner . nextLine ( ) ; String line = scanner . nextLine ( ) ; int [ ] arr = strToIntArray ( line ) ; int res = 0 ; TreeMap < Integer , Integer > map = new TreeMap < > ( ) ; for ( int u : arr ) { map . put ( u , 1 ) ; if ( map . lowerKey ( u ) = = null ) res + + ; } System . out . println ( res ) ; return ; } private int [ ] strToIntArray ( String str ) { String [ ] vals = str . split ( " \ \ s + " ) ; int sz = vals . length ; int [ ] res = new int [ sz ] ; for ( int i = 0 ; i < sz ; i + + ) { res [ i ] = Integer . parseInt ( vals [ i ] ) ; } return res ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] [ ] a = new int [ 3 ] [ 3 ] ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = true ; for ( int k = 0 ; k < 100 ; k + + ) { x [ 0 ] = k ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = a [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = a [ i ] [ 0 ] - y [ 0 ] ; } flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( x [ i ] + y [ j ] ! = a [ i ] [ j ] ) { flag = false ; break ; } } } if ( flag ) { break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int kai = 2 ; int conut = 0 ; if ( N = = 1 ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < N ; i + + ) { kai = kai * 2 ; if ( kai > N ) { kai = kai / 2 ; break ; } } System . out . println ( kai ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = Double . parseDouble ( sc . next ( ) ) ; double B = Double . parseDouble ( sc . next ( ) ) ; double H = Double . parseDouble ( sc . next ( ) ) ; double M = Double . parseDouble ( sc . next ( ) ) ; sc . close ( ) ; double degree = 0 ; double shortDegree = ( H * 60 + M ) * 0.5 ; double longDegree = M * 6 ; if ( Math . abs ( longDegree - shortDegree ) < = 180 ) { degree = Math . abs ( longDegree - shortDegree ) ; } else { degree = 360 - Math . abs ( longDegree - shortDegree ) ; } double r = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( String . format ( " % .15f " , r ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } int temp1 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; int temp2 = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ; int temp3 = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ; int temp4 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; int temp5 = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ; int temp6 = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ; boolean ans = true ; if ( temp1 ! = temp2 ) { ans = false ; } if ( temp1 ! = temp3 ) { ans = false ; } if ( temp4 ! = temp5 ) { ans = false ; } if ( temp4 ! = temp6 ) { ans = false ; } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N ] ; int C [ ] = new int [ N ] ; int z = 0 , y = 0 , x = 0 , w = 0 ; long m = 0 ; while ( z < N ) { A [ z ] = stdIn . nextInt ( ) ; z + + ; } z = 0 ; while ( z < N ) { B [ z ] = stdIn . nextInt ( ) ; m + = A [ z ] - B [ z ] ; if ( A [ z ] - B [ z ] > 0 ) { C [ y ] = A [ z ] - B [ z ] ; y + + ; } if ( A [ z ] - B [ z ] < 0 ) { x + + ; } z + + ; } z = 0 ; if ( x = = 0 ) System . out . println ( 0 ) ; else if ( m < 0 ) System . out . println ( - 1 ) ; else { Arrays . sort ( C ) ; while ( z < N ) { m - = C [ z ] ; if ( C [ z ] ! = 0 ) w + + ; if ( m < = 0 ) break ; z + + ; } if ( m < 0 ) w - = 1 ; System . out . println ( x + ( y - w ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int antennas [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; if ( antennas [ 4 ] - antennas [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; long sum = 0 ; int check = s - 2 * k ; int initial = ( int ) Math . max ( 0 , check ) ; for ( int i = initial ; i < = k ; i + + ) { int current = s - i ; int start = 0 ; int end = k ; if ( current > 2 * k ) { continue ; } else if ( current > k ) { start = current - k ; sum + = end - start + 1 ; } else if ( current > = 0 ) { end = current ; sum + = end - start + 1 ; } } System . out . println ( sum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } System . out . println ( five = = 2 & & seven = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean P = false ; boolean W = false ; boolean G = false ; boolean Y = false ; for ( int i = 0 ; i < N ; i + + ) { String c = sc . next ( ) ; if ( c . equals ( " P " ) ) { P = true ; } else if ( c . equals ( " W " ) ) { W = true ; } else if ( c . equals ( " G " ) ) { G = true ; } else if ( c . equals ( " Y " ) ) { Y = true ; } } int answer = 0 ; if ( P = = true ) { answer + + ; } if ( W = = true ) { answer + + ; } if ( G = = true ) { answer + + ; } if ( Y = = true ) { answer + + ; } if ( answer = = 3 ) { System . out . println ( " Three " ) ; } else if ( answer = = 4 ) { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int min = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( min > a [ i ] ) { ans + + ; min = a [ i ] ; } } System . out . println ( ans + 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int [ ] [ ] table = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { table [ i ] [ j ] = scanner . nextInt ( ) ; } } int a1 = 0 ; int a2 = 0 ; int a3 = 0 ; int b1 = 0 ; int b2 = 0 ; int b3 = 0 ; for ( a1 = 0 ; a1 < = table [ 0 ] [ 0 ] ; a1 + + ) { b1 = table [ 0 ] [ 0 ] - a1 ; a2 = table [ 1 ] [ 0 ] - b1 ; if ( a2 < 0 ) continue ; a3 = table [ 2 ] [ 0 ] - b1 ; if ( a3 < 0 ) continue ; b2 = table [ 0 ] [ 1 ] - a1 ; if ( b2 < 0 ) continue ; b3 = table [ 0 ] [ 2 ] - a1 ; if ( b3 < 0 ) continue ; if ( a2 + b2 ! = table [ 1 ] [ 1 ] ) continue ; if ( a2 + b3 ! = table [ 1 ] [ 2 ] ) continue ; if ( a3 + b2 ! = table [ 2 ] [ 1 ] ) continue ; if ( a3 + b3 ! = table [ 2 ] [ 2 ] ) continue ; System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . io . * ; import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( args ) ; } public void solve ( String [ ] args ) { MyScanner scanner = new MyScanner ( ) ; int N = scanner . nextInt ( ) ; int a = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { int b = a * 2 ; if ( b > N ) { System . out . println ( a ) ; return ; } else { a = b ; } } System . out . println ( a ) ; } private class MyScanner { String [ ] s ; int i ; BufferedReader br ; String reg = " " ; MyScanner ( ) { s = new String [ 0 ] ; i = 0 ; br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } public String next ( ) { try { if ( i < s . length ) return s [ i + + ] ; String line = br . readLine ( ) ; while ( line . equals ( " " ) ) { line = br . readLine ( ) ; } s = line . split ( reg , 0 ) ; i = 0 ; return s [ i + + ] ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; } public int nextInt ( ) { try { return Integer . parseInt ( next ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return - 1 ; } public double nextDouble ( ) { try { return Double . parseDouble ( next ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return - 1 ; } public long nextLong ( ) { try { return Long . parseLong ( next ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return - 1 ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 1 ; i < 9 ; i + + ) { if ( ans = = N ) break ; else if ( ans > N ) { ans = ans / 2 ; break ; } ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; double x = c * 30 ; double y = d * 6 ; x + = d * 0.5 ; x = ( x - y ) * Math . PI / 180 ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( x ) ) ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double arc = ( 5.5 * ( 60.0 * h + m ) ) % 360 * Math . PI / 180 ; double answer = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( arc ) ) ; System . out . println ( String . format ( " % .20f " , answer ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 ; int o = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( o > p ) { c + + ; o = p ; } } System . out . println ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String input [ ] = new String [ n ] ; int yellow = 0 ; for ( int i = 0 ; i < n ; i + + ) { input [ i ] = sc . next ( ) ; if ( input [ i ] . equals ( " Y " ) ) yellow + + ; } if ( yellow > 0 ) { System . out . println ( " Four " ) ; } else System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int result = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int total = x + y ; if ( ! ( total > S ) & & ( total + K ) > = S ) { result + + ; } } } System . out . println ( result ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double angleH = ( H / 12 + M / 60 / 12 ) * Math . PI * 2 ; double angleM = M / 60 * Math . PI * 2 ; double difference = angleH - angleM ; double cosTheta = Math . cos ( difference ) ; double answer = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * cosTheta ) ) ; System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; double jikakudo = ( double ) h * 30 + ( double ) m / 2.0 ; double hunkakudo = 6.0 * ( double ) m ; double kakudo = 0 ; if ( sa ( jikakudo , hunkakudo ) > = 180 ) kakudo = 360 - sa ( jikakudo , hunkakudo ) ; else kakudo = sa ( jikakudo , hunkakudo ) ; double ans = a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( kakudo ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } static double sa ( double a , double c ) { if ( a < = c ) return c - a ; else return a - c ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int sum = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z < = K & & z > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public Main ( ) { Scanner sc = new Scanner ( System . in ) ; int n = 3 ; int [ ] [ ] a = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) for ( int j = 0 ; j < n ; j + + ) a [ i ] [ j ] = sc . nextInt ( ) ; int [ ] b1 = dif ( a [ 0 ] ) ; int [ ] b2 = dif ( a [ 1 ] ) ; int [ ] b3 = dif ( a [ 2 ] ) ; if ( b1 [ 0 ] = = b2 [ 0 ] & & b1 [ 1 ] = = b2 [ 1 ] & & b2 [ 0 ] = = b3 [ 0 ] & & b2 [ 1 ] = = b3 [ 1 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } private int [ ] dif ( int a [ ] ) { return new int [ ] { a [ 1 ] - a [ 0 ] , a [ 2 ] - a [ 1 ] } ; } public static void main ( String [ ] args ) { new Main ( ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String [ ] lst = line . split ( " " ) ; int five _ cnt = 0 ; int seven _ cnt = 0 ; for ( int i = 0 ; i < lst . length ; i + + ) { int cnt = Integer . parseInt ( lst [ i ] ) ; if ( cnt = = 5 ) { five _ cnt + = 1 ; } else if ( cnt = = 7 ) { seven _ cnt + = 1 ; } } if ( five _ cnt = = 2 & & seven _ cnt = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; String line = sc . nextLine ( ) ; Set < String > sList = new HashSet < > ( Arrays . asList ( line . split ( " " ) ) ) ; if ( sList . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } Arrays . sort ( num ) ; if ( num [ 0 ] = = 1 & & num [ 1 ] = = 4 & & num [ 2 ] = = 7 & & num [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) < = k & & 0 < = s - ( i + j ) ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int z , cnt = 0 , i , j ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { z = s - ( i + j ) ; if ( 0 < = z & & z < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; boolean haveFour = s . contains ( " Y " ) ; System . out . println ( haveFour ? " Four " : " Three " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; double a = s . nextDouble ( ) ; double b = s . nextDouble ( ) ; double h = s . nextDouble ( ) ; double m = s . nextDouble ( ) ; double cosh = Math . cos ( Math . toRadians ( angleh ( h , m ) ) ) ; double sinh = Math . sin ( Math . toRadians ( angleh ( h , m ) ) ) ; double cosm = Math . cos ( Math . toRadians ( anglem ( m ) ) ) ; double sinm = Math . sin ( Math . toRadians ( anglem ( m ) ) ) ; double dist = Math . pow ( ( a * cosh ) - ( b * cosm ) , 2 ) + Math . pow ( ( a * sinh ) - ( b * sinm ) , 2 ) ; dist = Math . sqrt ( dist ) ; System . out . println ( dist ) ; } public static double angleh ( double h , double m ) { double degree = 0 ; degree = degree + ( 360d / 12d ) * h ; degree = degree + ( ( 360d / ( 12 * 60 ) ) * m ) ; return degree ; } public static double anglem ( double m ) { double degree = 0 ; degree = degree + ( ( 360d / 60d ) * m ) ; return degree ; } } import java . io . PrintStream ; import java . util . Scanner ; public class Main { static void exec ( Scanner in , PrintStream out ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + = 1 ) { for ( int j = 0 ; j < 3 ; j + = 1 ) { c [ i ] [ j ] = in . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + = 1 ) { int a1 = i ; int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; int a2 = c [ 1 ] [ 0 ] - b1 ; if ( a2 + b2 ! = c [ 1 ] [ 1 ] | | a2 + b3 ! = c [ 1 ] [ 2 ] ) { continue ; } int a3 = c [ 2 ] [ 0 ] - b1 ; if ( a3 + b2 ! = c [ 2 ] [ 1 ] | | a3 + b3 ! = c [ 2 ] [ 2 ] ) { continue ; } out . println ( " Yes " ) ; return ; } out . println ( " No " ) ; } public static void main ( String [ ] args ) { exec ( new Scanner ( System . in ) , System . out ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double h = 30 * ( H + M / 60.0 ) ; double m = M * 6.0 ; double k = 360 - Math . abs ( m - h ) ; double cos = Math . cos ( Math . toRadians ( k ) ) ; double a = A * A + B * B - ( 2 * A * B * cos ) ; System . out . println ( Math . sqrt ( a ) ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { String line = " " ; try { line = readLine ( ) ; StringTokenizer st = new StringTokenizer ( line , " " ) ; String tempK = st . nextToken ( ) ; String tempS = st . nextToken ( ) ; int k = Integer . parseInt ( tempK ) ; int s = Integer . parseInt ( tempS ) ; int cnt = 0 ; for ( int i = 0 ; i < s + 1 ; i + + ) { if ( i > k ) { continue ; } for ( int j = 0 ; j < s + 1 ; j + + ) { if ( j > k ) { continue ; } else if ( s - i - j > k ) { continue ; } if ( i + j < = s ) { cnt + + ; } } } System . out . println ( cnt ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static String readLine ( ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return br . readLine ( ) ; } } import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int [ ] a = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ sc . nextInt ( ) ] = 1 ; } if ( a [ 1 ] + a [ 9 ] + a [ 7 ] + a [ 4 ] = = 4 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int [ ] num = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = input . nextInt ( ) ; } Arrays . sort ( num ) ; if ( num [ 0 ] = = 1 & & num [ 1 ] = = 4 & & num [ 2 ] = = 7 & & num [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double x = ( m * 11 / 360 - h / 6 ) * Math . PI ; System . out . println ( Math . pow ( a * a + b * b - 2 * a * b * Math . cos ( x ) , 0.5 ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] data = { a , b , c } ; Arrays . sort ( data ) ; if ( data [ 0 ] = = 5 & & data [ 1 ] = = 5 & & data [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; Arrays . setAll ( a , i - > sc . nextInt ( ) ) ; int five = 0 , seven = 0 ; for ( int n : a ) { if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } System . out . println ( five = = 2 & & seven = = 1 ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; int e = in . nextInt ( ) ; int k = in . nextInt ( ) ; System . out . println ( ( e - a ) > k ? " : ( " : " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) , C = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( A , B ) , C ) - Math . min ( Math . min ( A , B ) , C ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } scan . close ( ) ; int check = 0 ; for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( c [ j ] [ i ] - c [ j ] [ i + 1 ] ! = c [ j + 1 ] [ i ] - c [ j + 1 ] [ i + 1 ] ) { check = 1 ; break ; } } if ( check = = 1 ) break ; } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( c [ i ] [ j ] - c [ i + 1 ] [ j ] ! = c [ i ] [ j + 1 ] - c [ i + 1 ] [ j + 1 ] ) { check = 1 ; break ; } } if ( check = = 1 ) break ; } System . out . println ( ( check = = 0 ) ? " Yes " : " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] n = sc . nextLine ( ) . toCharArray ( ) ; int count = 0 ; int seven = 0 ; for ( char c : n ) { if ( c = = ' 5' ) { count + + ; } if ( c = = ' 7' ) { seven + + ; } } if ( count = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static void printArray ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i + + ) { if ( i = = array . length ) { System . out . println ( array [ i ] ) ; } else { System . out . print ( String . format ( " % d " , array [ i ] ) ) ; } } } } import java . util . * ; public class Main { static int a , b , c , d , e , k ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; e = sc . nextInt ( ) ; k = sc . nextInt ( ) ; if ( hoge ( ) ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } static boolean hoge ( ) { if ( b - a > k ) return false ; else if ( c - a > k ) return false ; else if ( d - a > k ) return false ; else if ( e - a > k ) return false ; else if ( c - b > k ) return false ; else if ( d - b > k ) return false ; else if ( e - b > k ) return false ; else if ( d - c > k ) return false ; else if ( e - c > k ) return false ; else if ( e - d > k ) return false ; return true ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { int z = S - x - y ; if ( z < 0 | | z > K ) continue ; + + ans ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; boolean ans = false ; for ( int n = 0 ; n < = c [ 0 ] [ 0 ] ; n + + ) { a [ 0 ] = n ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; loop : for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] = = a [ i ] + b [ j ] ) { ans = true ; } else { ans = false ; break loop ; } } } } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( arr [ 4 ] - arr [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 1 ; while ( true ) { if ( i > n ) { System . out . println ( i / 2 ) ; return ; } i * = 2 ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x [ ] = new long [ 3 ] ; int a = 0 , b = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = sc . nextLong ( ) ; if ( x [ i ] = = 5 ) { a + + ; } else if ( x [ i ] = = 7 ) { b + + ; } } if ( a = = 2 & & b = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; double a = Double . parseDouble ( sc . next ( ) ) ; double b = Double . parseDouble ( sc . next ( ) ) ; double h = Double . parseDouble ( sc . next ( ) ) ; double m = Double . parseDouble ( sc . next ( ) ) ; h = 2 * Math . PI * h / 12 + 2 * Math . PI * m / 720 ; m = 2 * Math . PI * m / 60 ; if ( Math . abs ( h - m ) > Math . PI ) h = 2 * Math . PI - Math . abs ( h - m ) ; else h = Math . abs ( h - m ) ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( h ) ) ; System . out . println ( result ) ; } } import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; String arare [ ] = new String [ a ] ; for ( int x = 0 ; x < a ; x + + ) { arare [ x ] = scanner . next ( ) ; } int n = 0 ; boolean i = false ; String str = " Y " ; for ( n = 0 ; n < a ; n + + ) { if ( str . equals ( arare [ n ] ) ) i = true ; } if ( i ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 1 ; while ( num * 2 < = n ) { num * = 2 ; } System . out . println ( num ) ; sc . close ( ) ; } } import java . util . ArrayDeque ; import java . util . Collections ; import java . util . Deque ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import java . util . stream . Stream ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; long x = scan . nextLong ( ) ; long [ ] a = new long [ 2 * N ] ; for ( int i = 0 ; i < N ; + + i ) a [ i ] = scan . nextLong ( ) ; for ( int i = 0 ; i < N ; + + i ) a [ N + i ] = a [ i ] ; long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; + + i ) { Deque < Integer > que = new ArrayDeque < > ( ) ; long value = x * i ; for ( int j = N - i ; j < N ; + + j ) { que . addLast ( j ) ; while ( a [ que . peekFirst ( ) ] > a [ j ] ) { que . removeFirst ( ) ; } } for ( int j = N ; j < 2 * N ; + + j ) { while ( ! que . isEmpty ( ) & & j > que . peekFirst ( ) + i ) { que . removeFirst ( ) ; } while ( ! que . isEmpty ( ) & & a [ que . peekLast ( ) ] > a [ j ] ) { que . removeLast ( ) ; } que . addLast ( j ) ; value + = a [ que . peekFirst ( ) ] ; } ans = Math . min ( ans , value ) ; } System . out . println ( ans ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; Set < String > hinaSet = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hinaSet . add ( sc . next ( ) ) ; } sc . close ( ) ; if ( hinaSet . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = i ; j + + ) { for ( int k = 0 ; k < = j ; k + + ) { int a = i + j + k ; if ( a = = S ) { if ( i = = j & & j = = k ) { count + + ; } else if ( i ! = j & & j ! = k & & k ! = i ) { count + = 6 ; } else { count + = 3 ; } } } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ j ] = = 7 ) { count + + ; } } if ( count = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 0 ; i < = 100 ; i + + ) { if ( ans > n ) { System . out . println ( ans / 2 ) ; return ; } ans * = 2 ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxCount = 0 ; int maxNum = 0 ; for ( int i = 0 ; i < n ; i + + ) { int count = 0 ; int num = i + 1 ; while ( true ) { if ( num % 2 ! = 0 ) { break ; } num / = 2 ; count + + ; } if ( i = = 0 | | count > maxCount ) { maxCount = count ; maxNum = i + 1 ; } } System . out . println ( maxNum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double minuteHand = M / 60 ; double hourHand = ( H + minuteHand ) / 12 ; double angle = Math . abs ( minuteHand - hourHand ) ; System . out . println ( Math . pow ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * Math . cos ( 2 * Math . PI * angle ) ) , 0.5 ) ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Tenka1 _ 2017 _ C solver = new Tenka1 _ 2017 _ C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Tenka1 _ 2017 _ C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long N = in . nextLong ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { try { long child = N * h * n ; long mother = ( 4 * h * n ) - ( N * n ) - ( N * h ) ; if ( child % mother = = 0 & & mother > 0 ) { out . print ( h + " " + n + " " + child / mother ) ; return ; } } catch ( ArithmeticException e ) { } } } } } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int d = 0 ; for ( int i = 1 ; i < = 4 ; i + + ) { d = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( d - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . lang . * ; import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } } class TaskA { public void solve ( InputReader in , PrintWriter out ) { int k = in . nextInt ( ) , s = in . nextInt ( ) ; int x , y , z ; int ans = 0 ; for ( x = 0 ; x < = k & & x < = s ; + + x ) { for ( y = 0 ; y < = k & & x + y < = s ; + + y ) { z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) + + ans ; } } out . println ( ans ) ; } } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int n = A . length ; for ( int i = 0 ; i < n ; i + + ) { A [ i ] = stdIn . nextInt ( ) ; } int k = stdIn . nextInt ( ) ; String result = " Yay ! " ; for ( int m = 0 ; m < n - 1 ; m + + ) { for ( int j = m + 1 ; j < n ; j + + ) { if ( A [ j ] - A [ m ] > k ) { result = " : ( " ; break ; } } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double r1 = h / 12.0 + m / ( 12.0 * 60 ) ; r1 * = Math . PI * 2 ; double x1 = a * Math . cos ( r1 ) ; double y1 = a * Math . sin ( r1 ) ; double r2 = m / 60.0 * Math . PI * 2 ; double x2 = b * Math . cos ( r2 ) ; double y2 = b * Math . sin ( r2 ) ; System . out . println ( Math . hypot ( x1 - x2 , y1 - y2 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; int diff21 = c21 - c11 ; int diff31 = c31 - c11 ; if ( c22 - c12 = = diff21 & & c23 - c13 = = diff21 & & c32 - c12 = = diff31 & & c33 - c13 = = diff31 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long K = sc . nextInt ( ) ; long S = sc . nextInt ( ) ; long res = 0 ; for ( long i = Math . min ( K , S ) ; i > = 0 ; i -- ) { long v = S - i ; if ( v < K ) res + = ( v + 1 ) ; else if ( v = = K ) res + = ( K + 1 ) ; else if ( v < = 2 * K ) { long a = v - K ; res + = K - a + 1 ; } } System . out . println ( res ) ; } } import java . io . * ; import java . util . * ; class Main { Scanner sc ; int N ; int [ ] P ; private void calc ( ) { sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int N = sc . nextInt ( ) ; P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = sc . nextInt ( ) ; int c = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { if ( min > P [ i ] ) c + + ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( c ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double naga = m * 360 / 60 ; double miji = ( h * 60 + m ) * 360 / ( 12 * 60 ) ; double kaku = miji - naga ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( kaku ) ) ) ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; int max = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int mod = i ; int cnt = 0 ; while ( mod % 2 = = 0 ) { mod = mod / 2 ; cnt + + ; } if ( cnt > = max ) { max = cnt ; ans = i ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; Test [ ] tests = new Test [ N ] ; for ( int i = 0 ; i < N ; i + + ) tests [ i ] = new Test ( ) ; for ( int i = 0 ; i < N ; i + + ) tests [ i ] . a = scanner . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) tests [ i ] . b = scanner . nextInt ( ) ; Arrays . sort ( tests , Comparator . comparingInt ( test - > test . a > test . b ? test . a - test . b : 1 _ 000 _ 000 _ 000 ) ) ; long [ ] casum = new long [ N ] ; casum [ N - 1 ] = tests [ N - 1 ] . a ; for ( int i = N - 2 ; i > = 0 ; i -- ) casum [ i ] = casum [ i + 1 ] + tests [ i ] . a ; long [ ] cbsum = new long [ N ] ; cbsum [ N - 1 ] = tests [ N - 1 ] . b ; for ( int i = N - 2 ; i > = 0 ; i -- ) cbsum [ i ] = cbsum [ i + 1 ] + tests [ i ] . b ; if ( casum [ 0 ] < cbsum [ 0 ] ) { System . out . println ( - 1 ) ; return ; } int i = 0 ; while ( i < N & & tests [ i ] . a > = tests [ i ] . b & & casum [ i ] > = cbsum [ i ] ) i + + ; if ( i = = N ) System . out . println ( 0 ) ; else System . out . println ( N - i + 1 ) ; } private static class Test { private int a ; private int b ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int i = 0 ; i < = k & & i < = s ; i + + ) { for ( int j = 0 ; j < = k & & j < = s - i ; j + + ) { z = s - i - j ; if ( z > = 0 & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String output = " Three " ; int num = sc . nextInt ( ) ; String [ ] colors = new String [ num ] ; for ( int i = 0 ; i < num ; i + + ) { colors [ i ] = sc . next ( ) ; } sc . close ( ) ; for ( int i = 0 ; i < colors . length ; i + + ) { if ( colors [ i ] . equals ( " Y " ) ) { output = " Four " ; break ; } } System . out . println ( output ) ; } } import java . io . * ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String line ; while ( ( line = br . readLine ( ) ) ! = null ) { String [ ] s = line . split ( " " ) ; int n = Integer . parseInt ( s [ 0 ] ) ; long x = Long . parseLong ( s [ 1 ] ) ; s = br . readLine ( ) . split ( " " ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( s [ i ] ) ; } long [ ] [ ] b = new long [ n ] [ ] ; for ( int i = 0 ; i < n ; i + + ) { long [ ] bi = new long [ n ] ; for ( int k = 0 ; k < n ; k + + ) { if ( k = = 0 ) { bi [ 0 ] = a [ ( i - k > = 0 ) ? i - k : i - k + n ] ; } else { bi [ k ] = Math . min ( bi [ k - 1 ] , a [ ( i - k > = 0 ) ? i - k : i - k + n ] ) ; } } b [ i ] = bi ; } long min = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { sum + = b [ i ] [ k ] ; } if ( min > k * x + sum ) { min = k * x + sum ; } } System . out . println ( min ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int Bangle = 6 * M ; double Aangle = H * 30 + 0.5 * M ; double X = Aangle - Bangle ; if ( X < 0 ) { X = Bangle - Aangle ; } if ( X > 180 ) { X = 360 - X ; } System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . PI * X / 180 ) ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { 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 ( ) ; } System . out . println ( cal ( n , a ) ) ; } private static long cal ( final int n , final int [ ] a ) { long res = 0L ; int maxP = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( maxP = = 0 ) { res + = a [ i ] - 1 ; maxP = 1 ; } else { int num = a [ i ] / ( maxP + 1 ) ; if ( a [ i ] = = maxP + 1 ) { maxP + + ; } else if ( a [ i ] % ( maxP + 1 ) = = 0 ) { res + = num - 1 ; } else { res + = num ; } } } return res ; } } import java . util . * ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > hina = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hina . add ( sc . next ( ) ) ; } String ans = " Three " ; if ( hina . size ( ) = = 4 ) { ans = " Four " ; } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String args [ ] ) { ConsoleScanner cin = new ConsoleScanner ( ) ; PrintWriter cout = new PrintWriter ( System . out ) ; solve ( cin , cout ) ; cout . flush ( ) ; } private static void solve ( ConsoleScanner cin , PrintWriter cout ) { for ( int i = 1 ; i < = 100 ; i + + ) assert null ! = System . out . format ( " % d % d \ n " , i , solve ( i ) ) ; int n = cin . nextInt ( ) ; long millis = System . currentTimeMillis ( ) ; int ans = solve ( n ) ; cout . println ( ans ) ; assert null ! = cout . format ( " % d elapsed " , System . currentTimeMillis ( ) - millis ) ; } private static int solve ( int n ) { int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < 30 ; i + + ) if ( n > > i ! = 0 ) ans = Math . min ( ans , ( n > > i ) < < i ) ; return ans ; } static class ConsoleScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { try { while ( ! st . hasMoreElements ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int aaa [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { aaa [ i ] = scn . nextInt ( ) ; } int k = scn . nextInt ( ) ; if ( aaa [ 1 ] - aaa [ 0 ] < = k & & aaa [ 2 ] - aaa [ 0 ] < = k & & aaa [ 3 ] - aaa [ 0 ] < = k & & aaa [ 4 ] - aaa [ 0 ] < = k & & aaa [ 2 ] - aaa [ 1 ] < = k & & aaa [ 3 ] - aaa [ 1 ] < = k & & aaa [ 4 ] - aaa [ 1 ] < = k & & aaa [ 3 ] - aaa [ 2 ] < = k & & aaa [ 4 ] - aaa [ 2 ] < = k & & aaa [ 4 ] - aaa [ 3 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . close ( ) ; int i = 1 ; while ( n > = i ) { i * = 2 ; } System . out . println ( i / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc1 = new Scanner ( System . in ) ; int a = sc1 . nextInt ( ) ; int b = sc1 . nextInt ( ) ; int c = sc1 . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . print ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . print ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; Long facN = this . calcfac ( N ) ; Long facM = this . calcfac ( M ) ; if ( N = = M ) { System . out . println ( 2 * facN * facM % 1000000007 ) ; } else if ( N + 1 = = M | | N = = M + 1 ) { System . out . println ( facN * facM % 1000000007 ) ; } else { System . out . println ( 0 ) ; } } Long calcfac ( int num ) { Long sum = new Long ( 1 ) ; for ( int i = num ; i > 0 ; i -- ) { sum * = i ; sum % = 1000000007 ; } return sum ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < A . length ; i + + ) { A [ i ] = sc . nextInt ( ) ; } int [ ] abs = new int [ 3 ] ; int k = 0 ; for ( int i = 0 ; i < A . length ; i + + ) { for ( int j = i + 1 ; j < A . length ; j + + ) { abs [ k ] = Math . abs ( A [ j ] - A [ i ] ) ; k + + ; } } Arrays . sort ( abs ) ; System . out . println ( abs [ 0 ] + abs [ 1 ] ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double sita = ( ( double ) H / 12 + ( double ) M / 12 / 60 - ( double ) M / 60 ) * 2 * Math . PI ; sita = sita < 0 ? - ( double ) sita : sita ; double answer = Math . sqrt ( ( double ) ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( double ) ( ( double ) ( 2 * A * B ) * Math . cos ( sita ) ) ) ) ; System . out . print ( answer ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int H = in . nextInt ( ) , r = in . nextInt ( ) , res ; if ( H + r = = 0 ) res = 0 ; else if ( H + r > 0 ) res = 1 ; else res = - 1 ; System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( ( s - i - j ) < = k & & ( s - i - j ) > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; String Str = " Two " ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { Str = " Four " ; break ; } else Str = " Three " ; } System . out . println ( Str ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; ; } } System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] ABC = br . readLine ( ) . split ( " " ) ; boolean flgNG = false ; Integer cntFive = 0 ; Integer cntSeven = 0 ; for ( Integer cnt = 0 ; cnt < 3 ; cnt + + ) { Integer i = Integer . valueOf ( ABC [ cnt ] ) ; if ( i = = 5 ) { cntFive + + ; if ( cntFive > 2 ) { flgNG = true ; break ; } } else if ( i = = 7 ) { cntSeven + + ; if ( cntSeven > 1 ) { flgNG = true ; break ; } } else { flgNG = true ; break ; } } if ( flgNG ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { while ( sc . hasNext ( ) ) { if ( sc . nextInt ( ) = = 7 ) sevenCounter + + ; else fiveCounter + + ; } } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int K = Integer . parseInt ( scanner . next ( ) ) ; int S = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int index = ( int ) ( Math . log ( new Scanner ( System . in ) . nextInt ( ) ) / Math . log ( 2.0 ) ) ; System . out . println ( ( int ) Math . pow ( 2 , index ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) , N = sc . nextInt ( ) ; int [ ] T = new int [ D ] ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] C = new int [ N ] ; int [ ] curr = new int [ N ] ; int [ ] next = new int [ N ] ; for ( int i = 0 ; i < D ; i + + ) T [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; B [ i ] = sc . nextInt ( ) ; C [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < D - 1 ; i + + ) { for ( int j = 0 ; j < N ; j + + ) for ( int k = 0 ; k < N ; k + + ) { if ( A [ j ] < = T [ i ] & & T [ i ] < = B [ j ] & & A [ k ] < = T [ i + 1 ] & & T [ i + 1 ] < = B [ k ] ) { int currNext = 0 ; currNext + = curr [ j ] ; currNext + = Math . abs ( C [ j ] - C [ k ] ) ; if ( currNext > next [ k ] ) next [ k ] = currNext ; } } for ( int j = 0 ; j < N ; j + + ) { curr [ j ] = next [ j ] ; next [ j ] = 0 ; } } int max = curr [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) max = Math . max ( max , curr [ i ] ) ; System . out . println ( max ) ; } } import java . util . * ; public class Main { public static final int MAX = 3501 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = Long . parseLong ( sc . next ( ) ) ; for ( long x = 1 ; x < MAX ; x + + ) { for ( long y = 1 ; y < MAX ; y + + ) { long u = n * x * y ; long d = 4L * x * y - n * x - n * y ; if ( d ! = 0 & & u % d = = 0 & & u / d > 0 ) { long z = u / d ; System . out . println ( x + " " + y + " " + z ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int a ; int b ; int cnt = 0 ; for ( a = 0 ; a < = K ; a + + ) { int qw = K ; if ( S - a < qw ) { qw = S - a ; } for ( b = 0 ; b < = qw ; b + + ) { if ( S - a - b < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] l = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) l [ i ] [ j ] = sc . nextInt ( ) ; if ( l [ 0 ] [ 0 ] + l [ 1 ] [ 1 ] = = l [ 1 ] [ 0 ] + l [ 0 ] [ 1 ] & & l [ 0 ] [ 0 ] + l [ 2 ] [ 1 ] = = l [ 2 ] [ 0 ] + l [ 0 ] [ 1 ] & & l [ 1 ] [ 0 ] + l [ 0 ] [ 2 ] = = l [ 0 ] [ 0 ] + l [ 1 ] [ 2 ] & & l [ 0 ] [ 0 ] + l [ 2 ] [ 2 ] = = l [ 2 ] [ 0 ] + l [ 0 ] [ 2 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double zishinKakudo = ( Math . PI * h / 6.0 ) + ( Math . PI * m / 6.0 / 60.0 ) ; double hunshinKakudo = Math . PI * 2.0 * m / 60.0 ; double diffOfKakudo = Math . abs ( zishinKakudo - hunshinKakudo ) ; double L = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2.0 * a * b * Math . cos ( diffOfKakudo ) ) ; double l = Math . sqrt ( L ) ; System . out . println ( l ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y < = k & & s - x - y > = 0 ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; int z = 0 ; for ( int x = 0 ; x < K + 1 ; x + + ) { for ( int y = 0 ; y < K + 1 ; y + + ) { z = S - x - y ; if ( z < = K & & z > = 0 ) { count + + ; } } } System . out . print ( count ) ; System . out . println ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K & & x < = S ; x + + ) { for ( int y = 0 ; y < = K & & x + y < = S ; y + + ) { if ( S - x - y < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; class Point { double x ; double y ; public Point ( double deg , double r ) { double rad = deg * Math . PI / 180.0 ; x = Math . cos ( rad ) * r ; y = Math . sin ( rad ) * r ; } public double getX ( ) { return x ; } public double getY ( ) { return y ; } public double distance ( Point b ) { double c = Math . pow ( x - b . getX ( ) , 2 ) ; double d = Math . pow ( y - b . getY ( ) , 2 ) ; return Math . sqrt ( c + d ) ; } public void show ( ) { System . out . printf ( " [ % f , % f ] \ n " , x , y ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; try { double a = scanner . nextDouble ( ) ; double b = scanner . nextDouble ( ) ; double h = scanner . nextDouble ( ) ; double m = scanner . nextDouble ( ) ; Point bigHand = new Point ( m * 6.0 , b ) ; Point smallHand = new Point ( h * 30.0 + m * 0.5 , a ) ; double ans = bigHand . distance ( smallHand ) ; System . out . println ( ans ) ; } finally { scanner . close ( ) ; } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { List < Integer > list = IntStream . range ( 0 , 5 ) . map ( i - > { int number = scanner . nextInt ( ) ; scanner . nextLine ( ) ; return number ; } ) . sorted ( ) . collect ( ArrayList : : new , ArrayList : : add , ArrayList : : addAll ) ; int k = scanner . nextInt ( ) ; scanner . nextLine ( ) ; if ( ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double allmin = h * 60 + m ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( ( allmin / 2 ) - ( m * 6 ) ) ) ) ) ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static PrintWriter out ; static CF _ Reader in ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; in = new CF _ Reader ( ) ; int n = in . intNext ( ) ; int [ ] nums = in . nextIntArray ( n ) ; int res = 0 ; int minVal = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( nums [ i ] < = minVal ) { minVal = nums [ i ] ; res + = 1 ; } } out . println ( res ) ; out . close ( ) ; } static class CF _ Reader { BufferedReader br ; StringTokenizer st ; public CF _ Reader ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } long longNext ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } int intNext ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } double doubleNext ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } char charNext ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } public int [ ] nextIntArray ( final int n ) throws IOException { final int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = intNext ( ) ; return a ; } public long [ ] nextLongArray ( final int n ) throws IOException { final long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = longNext ( ) ; return a ; } String line ( ) throws IOException { return br . readLine ( ) . trim ( ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < String > hs = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { hs . add ( sc . next ( ) ) ; } if ( hs . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; sc . close ( ) ; int index = 0 ; int x , y , z ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( 0 < = z & & z < = k ) { index + + ; } } } System . out . print ( index ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int SideA = keyboard . nextInt ( ) ; int SideB = keyboard . nextInt ( ) ; int SideC = keyboard . nextInt ( ) ; int [ ] arr = new int [ ] { SideA , SideB , SideC } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } keyboard . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int a = 0 ; int b = 0 ; int c = 0 ; int d = 0 ; int e = 0 ; int k = 0 ; Scanner sc = new Scanner ( System . in ) ; a = Integer . parseInt ( sc . next ( ) ) ; b = Integer . parseInt ( sc . next ( ) ) ; c = Integer . parseInt ( sc . next ( ) ) ; d = Integer . parseInt ( sc . next ( ) ) ; e = Integer . parseInt ( sc . next ( ) ) ; k = Integer . parseInt ( sc . next ( ) ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final String FIVE = " 5 " ; final String SEVEN = " 7 " ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; scanner . close ( ) ; String [ ] arrStr = ( input . split ( " " , 0 ) ) ; int fivCnt = 0 ; int sevCnt = 0 ; for ( String num : arrStr ) { if ( num . equals ( FIVE ) ) { fivCnt + + ; } else if ( num . equals ( SEVEN ) ) { sevCnt + + ; } } String res ; if ( fivCnt = = 2 & & sevCnt = = 1 ) { res = " YES " ; } else { res = " NO " ; } System . out . println ( res ) ; } } import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int sum = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int tmp = 0 ; int tmp2 = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { tmp + = c [ j ] [ ( i + j ) % 3 ] ; tmp2 + = c [ j ] [ ( i - j + 3 ) % 3 ] ; } if ( tmp ! = sum ) { pr . println ( " No " ) ; return ; } if ( tmp2 ! = sum ) { pr . println ( " No " ) ; return ; } } pr . println ( " Yes " ) ; } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } } import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Main { public static class FastReader { BufferedReader br ; StringTokenizer root ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( root = = null | | ! root . hasMoreTokens ( ) ) { try { root = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception addd ) { addd . printStackTrace ( ) ; } } return root . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( Exception addd ) { addd . printStackTrace ( ) ; } return str ; } } public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; public static FastReader sc = new FastReader ( ) ; static int mod = ( int ) ( 1e9 + 7 ) , MAX = ( int ) ( 2e5 ) ; static List < Integer > [ ] edges ; public static void main ( String [ ] args ) throws IOException { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double k = Math . abs ( ( ( 11 * m ) / 2 - 30 * h ) ) ; if ( k > 180 ) k = 360 - k ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( k * ( Math . PI / 180 ) ) ) ; out . print ( ans ) ; out . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int x [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { x [ i ] = stdIn . nextInt ( ) ; } int k = stdIn . nextInt ( ) ; if ( x [ 4 ] - x [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; System . out . println ( ( n [ 0 ] = = 5 & & n [ 1 ] = = 5 & & n [ 2 ] = = 7 ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < min ) { min = p ; count + + ; } } print ( count ) ; sc . close ( ) ; } public static void print ( Object obj ) { System . out . println ( obj ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angle = Math . abs ( ( double ) h / 12 + ( ( double ) m / 60 ) / 12.0 - ( double ) m / 60.0 ) * 2 * Math . PI ; double res = ( double ) a * a + ( double ) b * b - ( double ) 2 * a * b * Math . cos ( angle ) ; res = Math . sqrt ( res ) ; System . out . printf ( " % .20f " , res ) ; } } import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } long MODULO = 1 _ 000 _ 000 _ 000 + 7 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < n ; + + i ) { x [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < m ; + + i ) { y [ i ] = sc . nextLong ( ) ; } System . out . println ( cnt ( x ) * cnt ( y ) % MODULO ) ; } long cnt ( long [ ] arr ) { int n = arr . length ; long ret = 0 ; for ( int i = 0 ; i < arr . length ; + + i ) { ret = ret + arr [ i ] * ( - ( n - 1 - i ) + i ) % MODULO ; ret % = MODULO ; } return ret ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { execute ( ) ; } private static void execute ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; System . out . println ( isHaiku ( br . readLine ( ) . split ( " " ) ) ) ; } public static String isHaiku ( String [ ] sentences ) { if ( sentences . length ! = 3 ) { return " NO " ; } List < String > haiku = new LinkedList < > ( Arrays . asList ( " 5 " , " 7 " , " 5 " ) ) ; for ( String str : sentences ) { if ( haiku . contains ( str ) ) { haiku . remove ( str ) ; } } return haiku . isEmpty ( ) ? " YES " : " NO " ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; for ( int i = 0 ; i < count ; i + + ) { String color = sc . next ( ) ; if ( color . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . exec ( ) ; } private void exec ( ) { Scanner scan = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( scan . nextInt ( ) ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } } import java . util . Scanner ; public class Main { static Main instance = new Main ( ) ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double Aspeed = 360.0 / 60 / 12 ; double Bspeed = 360.0 / 60 / 1 ; double Aposition = Aspeed * ( H * 60 + M ) ; double Bposition = Bspeed * ( H * 60 + M ) ; double result = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Bposition - Aposition ) ) ) ; System . out . println ( result ) ; } } import java . io . * ; import java . util . * ; class Main { Scanner sc ; int N ; int [ ] P ; private void calc ( ) { sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int N = sc . nextInt ( ) ; P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = Integer . parseInt ( sc . next ( ) ) ; int c = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { if ( min > P [ i ] ) c + + ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( c ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int [ ] a = new int [ 5 ] ; int i ; Scanner sc = new Scanner ( System . in ) ; for ( i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; sc . close ( ) ; sc = null ; boolean f = true ; LABEL : for ( i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( a [ i ] - a [ j ] ) > k ) { f = false ; break LABEL ; } } } if ( f ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = in . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( a [ 0 ] = 0 ; a [ 0 ] < 101 ; a [ 0 ] + + ) { b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; for ( a [ 1 ] = 0 ; a [ 1 ] < 101 ; a [ 1 ] + + ) { b [ 1 ] = c [ 1 ] [ 1 ] - a [ 1 ] ; for ( a [ 2 ] = 0 ; a [ 2 ] < 101 ; a [ 2 ] + + ) { b [ 2 ] = c [ 2 ] [ 2 ] - a [ 2 ] ; boolean ok = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { ok = false ; } } } if ( ok ) { out . println ( " Yes " ) ; return ; } } } } out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " " ) ; int n = Integer . parseInt ( line [ 0 ] ) ; int m = Integer . parseInt ( line [ 1 ] ) ; long result = 0 ; if ( Math . abs ( n - m ) > 1 ) { result = 0 ; } else if ( Math . abs ( n - m ) = = 1 ) { result = factorialsModBillion ( n , m ) ; } else { result = factorialsModBillion ( n , m ) ; result = ( result * 2 ) % 1000000007L ; } System . out . println ( result ) ; } private static long factorialsModBillion ( int n , int m ) { long result = 1 ; for ( long i = 1 ; i < = n ; i + + ) { result = ( result * i ) % 1000000007L ; } for ( long i = 1 ; i < = m ; i + + ) { result = ( result * i ) % 1000000007L ; } return result ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; char a [ ] = new char [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = scan . next ( ) . charAt ( 0 ) ; } scan . close ( ) ; int check = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] = = ' Y ' ) { check = 1 ; break ; } } System . out . println ( ( check = = 1 ) ? " Four " : " Three " ) ; } } import java . util . * ; import java . io . * ; import java . awt . geom . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; long MOD = 1 _ 000 _ 000 _ 007 ; String [ ] s = br . readLine ( ) . split ( " " ) ; long n = Long . parseLong ( s [ 0 ] ) ; long m = Long . parseLong ( s [ 1 ] ) ; if ( m > n + 1 | | m < n - 1 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } long fact1 = 1 ; long fact2 = 1 ; for ( int i = 0 ; i < m ; i + + ) { fact1 * = ( i + 1 ) ; fact1 % = MOD ; } for ( int i = 0 ; i < n ; i + + ) { fact2 * = ( i + 1 ) ; fact2 % = MOD ; } long ans = ( fact1 * fact2 ) % MOD ; if ( m = = n ) ans * = 2 ; ans % = MOD ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double da = Math . abs ( h * 30 + m * 0.5 - m * 6 ) ; double d = Math . min ( 360 - da , da ) ; double c = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( d ) ) ) ; System . out . println ( c ) ; scan . close ( ) ; } } import java . util . PriorityQueue ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( 0 < = S - x - y & & S - x - y < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { max = Math . max ( Math . abs ( a [ i ] - a [ j ] ) , max ) ; } } if ( max > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; String S = gs ( ) + gs ( ) + gs ( ) + gs ( ) ; if ( S . contains ( " 1 " ) & & S . contains ( " 7 " ) & & S . contains ( " 9 " ) & & S . contains ( " 4 " ) ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } public static long d ( long n ) { String a = String . valueOf ( n ) ; return ( long ) a . length ( ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int s = 1 ; for ( int i = 0 ; i < 3 ; i + + ) s * = sc . nextInt ( ) ; if ( s = = 175 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = 0 ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a = sc . nextInt ( ) ; if ( a = = 7 ) { count + = 1 ; } else if ( a = = 5 ) { count + = 10 ; } } if ( count = = 21 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z < 0 ) continue ; if ( z > K ) continue ; if ( x + y + z = = S ) ans + + ; } } System . out . println ( ans ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] ary = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . sort ( ary ) ; out . append ( Arrays . equals ( ary , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . * ; import static java . lang . Integer . * ; import static java . lang . Long . parseLong ; import static java . lang . Math . * ; import static java . lang . System . * ; import java . io . PrintWriter ; public class Main { public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; int n = parseInt ( sc . next ( ) ) ; HashSet < String > s = new HashSet < > ( ) ; for ( i = 0 ; i < n ; i + + ) { s . add ( sc . next ( ) ) ; } sc . close ( ) ; out . println ( s . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { z = s - i - j ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . * ; import java . util . * ; public class Main { static int MOD = 1000000007 ; static double EPS = 1e-9 ; public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int x = Integer . parseInt ( st . nextToken ( ) ) ; if ( x = = 5 ) fiveCount + + ; if ( x = = 7 ) sevenCount + + ; } if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; in . close ( ) ; } } import java . io . ByteArrayInputStream ; import java . io . UnsupportedEncodingException ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Scanner ; public class Main { private static String solve ( Scanner scanner ) { long N = Integer . parseInt ( scanner . nextLine ( ) ) ; for ( long n = 3500 ; n > = 1 ; n -- ) { for ( long w = 3500 ; w > = 1 ; w -- ) { long denom = 4 * n * w - N * w - N * n ; long numer = N * n * w ; if ( denom > 0 & & numer % denom = = 0 ) { long h = numer / denom ; return n + " " + w + " " + h ; } } } return null ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( solve ( scanner ) ) ; } private static String [ ] testCases = { " 2 " , " 3485 " , " 4664 " } ; private static void tests ( ) { for ( String t : testCases ) { System . out . println ( solve ( new Scanner ( testCaseToInputStream ( t ) ) ) ) ; } } private static ByteArrayInputStream testCaseToInputStream ( String ex ) { try { return new ByteArrayInputStream ( ex . getBytes ( " utf-8 " ) ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; throw new RuntimeException ( ) ; } } private static int [ ] lineToIntNums ( String line ) { String [ ] numStrs = line . split ( " " ) ; int [ ] nums = new int [ numStrs . length ] ; for ( int i = 0 ; i < nums . length ; i + + ) { nums [ i ] = Integer . parseInt ( numStrs [ i ] ) ; } return nums ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; double A = Double . parseDouble ( st . nextToken ( ) ) ; double B = Double . parseDouble ( st . nextToken ( ) ) ; double H = Double . parseDouble ( st . nextToken ( ) ) ; double M = Double . parseDouble ( st . nextToken ( ) ) ; double angle _ H = ( 60 * H + M ) / 720 * 360 ; double angle _ M = M / 60 * 360 ; double A _ x = A * Math . cos ( Math . toRadians ( angle _ H ) ) ; double A _ y = A * Math . sin ( Math . toRadians ( angle _ H ) ) ; double B _ x = B * Math . cos ( Math . toRadians ( angle _ M ) ) ; double B _ y = B * Math . sin ( Math . toRadians ( angle _ M ) ) ; double ans = Math . sqrt ( Math . pow ( ( A _ x - B _ x ) , 2 ) + Math . pow ( ( A _ y - B _ y ) , 2 ) ) ; pw . println ( ans ) ; br . close ( ) ; pw . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double theta1 = Math . toRadians ( H * 30.0 + M * 0.5 ) ; double theta2 = Math . toRadians ( M * 6.0 ) ; double dist = 0.0 ; if ( theta1 > theta2 ) { dist = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( theta1 - theta2 ) ) ; } else { dist = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( theta2 - theta1 ) ) ; } System . out . println ( dist ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double max = 1 ; if ( N = = 1 ) { max = 2 ; } else { for ( int i = 0 ; i < N ; i + + ) { max = Math . pow ( 2 , i ) ; if ( max > N ) { break ; } } } max = max / 2 ; int answer = ( int ) max ; System . out . println ( answer ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; Set < String > set = new HashSet < String > ( ) ; int i = 0 ; for ( i = 0 ; i < n ; i + + ) { set . add ( scan . next ( ) ) ; } if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( n - i - j < = k & & n - i - j > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int a = 0 ; a < = k ; a + + ) { if ( a = = s ) { ans + + ; break ; } int bc = ( int ) Math . ceil ( ( double ) ( s - a ) / 2 ) ; if ( bc < = k ) { for ( int b = 0 ; b < = k ; b + + ) { if ( s - a - b > = 0 & & s - a - b < = k ) { ans + + ; } } } } System . out . println ( ans ) ; } finally { sc . close ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = ( int ) ( Math . log ( n ) / Math . log ( 2 ) ) ; System . out . println ( ( int ) Math . pow ( 2 , m ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int p [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int cnt = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( min > p [ i ] ) { cnt + + ; min = p [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { private static void p ( Object x ) { System . out . println ( x ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } p ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] nums = { a , b , c , d , e } ; for ( int i = 0 ; i < nums . length ; i + + ) { for ( int j = i + 1 ; j < nums . length ; j + + ) { if ( Math . abs ( nums [ i ] - nums [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } else { continue ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int e = s . nextInt ( ) ; int k = s . nextInt ( ) ; int [ ] f = { a , b , c , d , e , k } ; for ( int i = 0 ; i < f . length ; i + + ) { int n1 = 0 ; int n2 = 0 ; int ans = 0 ; for ( int j = 0 ; j < f . length ; j + + ) { if ( i = = j ) { continue ; } n1 = f [ i ] ; n2 = f [ j ] ; if ( n1 > n2 ) { ans = n1 - n2 ; } else { ans = n2 - n1 ; } ; if ( ans > k ) { System . out . println ( " : ( " ) ; return ; } } ; } ; System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 , a , count , ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { count = 0 ; if ( i % 2 = = 1 ) continue ; a = i ; for ( ; ; ) { if ( a / 2 ! = 0 ) { a = a / 2 ; count + + ; } else { count + + ; break ; } } if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] str = sc . nextLine ( ) . split ( " " ) ; boolean f = false ; for ( int i = 0 ; i < n ; i + + ) { if ( str [ i ] . equals ( " Y " ) ) { f = true ; break ; } } if ( f ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; sc . close ( ) ; int x = 0 ; int y = 0 ; int z = 0 ; int count = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - ( x + y ) ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 , i , j ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( i + j < = s & & s - ( i + j ) < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] suuji = new int [ N ] ; int count = 1 ; for ( int i = 0 ; i < N ; i + + ) { suuji [ i ] = sc . nextInt ( ) ; } int min = suuji [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( min > suuji [ i ] ) { min = suuji [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] an = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { an [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " : ( " ; sc . close ( ) ; if ( an [ 4 ] - an [ 0 ] < = k ) { ans = " Yay ! " ; } 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 ( ) ; Stack < Integer > st = new Stack < > ( ) ; int min = 200001 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int p = sc . nextInt ( ) ; if ( p < min ) { min = p ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c5 = 0 ; int c7 = 0 ; String ans = " NO " ; for ( int i = 0 ; i < 3 ; i + + ) { int que = sc . nextInt ( ) ; if ( que = = 5 ) c5 + + ; if ( que = = 7 ) c7 + + ; } if ( c5 = = 2 & & c7 = = 1 ) ans = " YES " ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long ans = 1 ; if ( a = = 1 ) { System . out . println ( x ) ; return ; } for ( long i = 2 ; Math . pow ( i , a ) < = x ; i + + ) { double c = Math . pow ( i , a ) ; if ( x % c = = 0 ) { ans = Math . max ( ans , i ) ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j > = 0 & & s - i - j < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int product = 175 ; if ( A * B * C = = product ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int sub = array [ 4 ] - array [ 0 ] ; if ( sub > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double a = ( double ) A ; double b = ( double ) B ; double h = ( H * 60 + M ) * 360d / 720d ; double m = M * 360d / 60d ; double ans = Math . sqrt ( a * a + b * b - 2.0d * a * b * Math . cos ( Math . toRadians ( Math . abs ( h - m ) ) ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; String str ; int Y = 0 ; for ( int i = 0 ; i < N ; i + + ) { str = s . next ( ) ; if ( str . equals ( " Y " ) ) { Y + + ; } } if ( Y = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int mod = 1000000007 ; 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 ( ) ) ; } public static void main ( String [ ] _ _ ) { int d = getInt ( ) , m = getInt ( ) ; if ( Math . abs ( d - m ) > = 2 ) { System . out . println ( 0 ) ; return ; } long r = 1 ; for ( int i = 1 ; i < = d ; i + + ) { r * = i ; r % = mod ; } for ( int i = 1 ; i < = m ; i + + ) { r * = i ; r % = mod ; } System . out . println ( d = = m ? r * 2 % mod : r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int H = scanner . nextInt ( ) ; int R = scanner . nextInt ( ) ; if ( H > = 0 ) { System . out . println ( 1 ) ; } else if ( H + R = = 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( - 1 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { int X = i ; for ( int j = 0 ; j < = K ; j + + ) { int Y = j ; if ( S - X - Y > = 0 & & S - X - Y < = K ) { ans + = 1 ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = A [ 4 ] - A [ 0 ] ; if ( max < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; System . out . println ( Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( ( 11 * m - 60 * h ) * Math . PI / 360 ) ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ; 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 ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] permutaion = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { permutaion [ i ] = in . nextInt ( ) ; } int min = permutaion [ 0 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( permutaion [ i ] < = min ) { ans + + ; min = permutaion [ i ] ; } } System . out . println ( ans ) ; } } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; import java . util . List ; import java . util . ArrayList ; import java . util . Comparator ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] pow2 = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; for ( int i = 6 ; i > = 0 ; i -- ) { if ( N > = pow2 [ i ] ) { System . out . println ( pow2 [ i ] ) ; break ; } } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner scan = new Scanner ( System . in ) ) { int h = scan . nextInt ( ) ; int w = scan . nextInt ( ) ; int [ ] [ ] arrays = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { arrays [ i ] [ j ] = scan . nextInt ( ) ; } } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { int sum = 0 ; for ( int k = 0 ; k < h ; k + + ) { for ( int l = 0 ; l < w ; l + + ) { sum + = Math . min ( Math . abs ( i - k ) , Math . abs ( j - l ) ) * arrays [ k ] [ l ] ; } } min = Math . min ( min , sum ) ; } } System . out . println ( min ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 ; int min = sc . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < n - 1 ; i + + ) { m = sc . nextInt ( ) ; if ( m < min ) { min = m ; count + + ; } if ( m = = 1 ) { break ; } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 & & a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Arrays ; 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 ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } if ( Arrays . asList ( s ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; Map < String , Integer > minMap = new HashMap < > ( ) ; final String MIN = " min " ; int [ ] numList = new int [ 220000 ] ; for ( int i = 0 ; i < N ; i + + ) { numList [ i ] = Integer . parseInt ( sc . next ( ) ) ; } minMap . put ( MIN , numList [ 0 ] ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( numList [ i ] < = minMap . get ( MIN ) ) { minMap . put ( MIN , numList [ i ] ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] x = { a , b , c , d , e } ; int count = 0 ; limit : for ( int i = 0 ; i < x . length ; i + + ) { for ( int j = i + 1 ; j < x . length ; j + + ) { if ( x [ j ] - x [ i ] > k ) { count + + ; break limit ; } } } System . out . println ( count = = 1 ? " : ( " : " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; long asum = 0 ; int [ ] b = new int [ N ] ; int [ ] d = new int [ N ] ; long bsum = 0 ; long msum = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = sc . nextInt ( ) ; asum + = a [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { b [ i ] = sc . nextInt ( ) ; bsum + = b [ i ] ; d [ i ] = a [ i ] - b [ i ] ; if ( d [ i ] < 0 ) { msum + = d [ i ] ; ans + + ; } } if ( asum < bsum ) { System . out . println ( - 1 ) ; } else { Arrays . sort ( d ) ; int idx = N - 1 ; while ( msum < 0 ) { ans + + ; msum + = d [ idx ] ; idx -- ; } System . out . println ( ans ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long min = Long . MAX _ VALUE ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { long temp = Long . parseLong ( sc . next ( ) ) ; if ( min > temp ) { ans + + ; min = temp ; } } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i + + ) { list . add ( sc . nextInt ( ) ) ; } int count = 0 ; int min = Collections . max ( list ) ; for ( int i = 0 ; i < N ; i + + ) { if ( list . get ( i ) < = min ) { min = list . get ( i ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int n = kb . nextInt ( ) ; int min = kb . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < n - 1 ; i + + ) { int j = kb . nextInt ( ) ; int b = j ; if ( b > min ) { } else { count + = 1 ; min = b ; } } System . out . println ( count ) ; kb . close ( ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > arare = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { arare . add ( sc . next ( ) ) ; } System . out . println ( arare . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int c = Integer . parseInt ( scan . next ( ) ) ; int [ ] abc = { a , b , c } ; int five = 0 ; int seven = 0 ; for ( int i : abc ) { if ( i = = 5 ) { + + five ; } else if ( i = = 7 ) { + + seven ; } } if ( five = = 2 & & seven = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 123 ; int x ; for ( int i = 0 ; i < 5 ; i + + ) { x = sc . nextInt ( ) ; max = Math . max ( max , x ) ; min = Math . min ( min , x ) ; } int k = sc . nextInt ( ) ; if ( max - min > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N ; N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { C [ i ] = A [ i ] - B [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { sum = sum + C [ i ] ; } if ( sum < 0 ) { System . out . print ( " -1 " ) ; } else { Arrays . sort ( C ) ; long tar = 0 ; for ( int k = 0 ; k < C . length ; k + + ) { if ( C [ k ] > = 0 ) break ; tar = tar + C [ k ] ; ans + + ; } for ( int k = 0 ; k < C . length ; k + + ) { if ( tar > = 0 ) break ; tar = tar + C [ C . length - k - 1 ] ; ans + + ; } System . out . print ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; if ( N % 4 = = 0 ) { System . out . println ( 3 * N / 4 + " " + 3 * N / 4 + " " + 3 * N / 4 ) ; return ; } for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long temp = N * h * w ; long t = 4 * h * w - N * ( h + w ) ; if ( t > 0 & & temp % t = = 0 ) { System . out . println ( h + " " + w + " " + temp / t ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < N ; i + + ) { int now = sc . nextInt ( ) ; if ( now < = min ) { min = now ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int b = sc . nextInt ( ) ; if ( b = = 1 ) a [ 0 ] = 1 ; if ( b = = 4 ) a [ 1 ] = 1 ; if ( b = = 7 ) a [ 2 ] = 1 ; if ( b = = 9 ) a [ 3 ] = 1 ; } if ( a [ 0 ] = = 1 & & a [ 1 ] = = 1 & & a [ 2 ] = = 1 & & a [ 3 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; boolean judge = true ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = c [ 0 ] [ i ] - a [ 0 ] ; } for ( int i = 1 ; i < 3 ; i + + ) { a [ i ] = c [ i ] [ 0 ] - b [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = ( a [ i ] + b [ j ] ) ) { judge = false ; } } } if ( judge ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( solve ( A , B , C ) ? " YES " : " NO " ) ; sc . close ( ) ; } static boolean solve ( int A , int B , int C ) { return Arrays . equals ( IntStream . of ( A , B , C ) . sorted ( ) . toArray ( ) , new int [ ] { 5 , 5 , 7 } ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int g [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { g [ i ] [ j ] = sc . nextInt ( ) ; } } boolean ok = false ; for ( int i = 0 ; i < = 100 ; i + + ) { int a1 = i ; int b1 = g [ 0 ] [ 0 ] - a1 ; int b2 = g [ 0 ] [ 1 ] - a1 ; int b3 = g [ 0 ] [ 2 ] - a1 ; int a2 = g [ 1 ] [ 0 ] - b1 ; int a3 = g [ 2 ] [ 0 ] - b1 ; if ( g [ 0 ] [ 0 ] = = a1 + b1 & & g [ 0 ] [ 1 ] = = a1 + b2 & & g [ 0 ] [ 2 ] = = a1 + b3 & & g [ 1 ] [ 0 ] = = a2 + b1 & & g [ 1 ] [ 1 ] = = a2 + b2 & & g [ 1 ] [ 2 ] = = a2 + b3 & & g [ 2 ] [ 0 ] = = a3 + b1 & & g [ 2 ] [ 1 ] = = a3 + b2 & & g [ 2 ] [ 2 ] = = a3 + b3 ) { ok = true ; break ; } } if ( ok ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double degree = calculateAngle ( H , M ) ; double side = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( side ) ; } static double calculateAngle ( double h , double m ) { double hour _ angle = ( 0.5 * ( h * 60 + m ) ) ; double minute _ angle = ( 6 * m ) ; double angle = Math . abs ( hour _ angle - minute _ angle ) ; angle = Math . min ( 360 - angle , angle ) ; return angle ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; Integer n = scan . nextInt ( ) ; ArrayList < Integer > array = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i + + ) array . add ( scan . nextInt ( ) ) ; int min = array . get ( 0 ) ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( array . get ( i ) < min ) { min = array . get ( i ) ; count + + ; } } System . out . println ( count + 1 ) ; } static int factorial ( int n ) { if ( n = = 0 ) { return 1 ; } return n * factorial ( n - 1 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int X = 0 ; int Y = 0 ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { X = i ; Y = j ; int Z = S - ( X + Y ) ; if ( ( Z > = 0 ) & & ( Z < = K ) ) { sum = sum + 1 ; } } } System . out . println ( sum ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int counter = 0 ; int min = Integer . MAX _ VALUE ; ArrayList < Integer > pi = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; + + i ) { int numPi = Integer . parseInt ( scan . next ( ) ) ; if ( i = = 0 ) { counter + + ; } else { if ( numPi < = min ) { counter + + ; } } if ( min > numPi ) { min = numPi ; } } System . out . println ( counter ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; if ( ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; int tmp = A [ 2 ] - A [ 1 ] ; tmp = tmp + ( A [ 1 ] - A [ 0 ] ) ; System . out . println ( tmp < 0 ? " 0 " : tmp ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = s . nextInt ( ) ; } int min = N + 1 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( min > P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static final String OK = " Yay ! " ; public static final String NO = " : ( " ; public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a > k ) System . out . println ( NO ) ; else System . out . println ( OK ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int x , y , z ; int count = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( x + y < = s & & s - x - y < = k ) count + + ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; int e = in . nextInt ( ) ; int k = in . nextInt ( ) ; System . out . println ( solve ( a , e , k ) ) ; in . close ( ) ; } private static String solve ( int a , int e , int k ) { if ( e - a > k ) return " : ( " ; else return " Yay ! " ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int limit = scanner . nextInt ( ) ; int target = scanner . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int i = 0 ; i < = limit ; i + + ) { for ( int j = 0 ; j < = limit ; j + + ) { z = target - i - j ; if ( z > = 0 & & z < = limit ) { count + = 1 ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int b [ ] = { c [ 0 ] [ 0 ] - 0 , c [ 0 ] [ 1 ] - 0 , c [ 0 ] [ 2 ] - 0 } ; int a [ ] = { 0 , c [ 1 ] [ 0 ] - b [ 0 ] , c [ 2 ] [ 0 ] - b [ 0 ] } ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; int [ ] PList = new int [ N ] ; PList [ 0 ] = sc . nextInt ( ) ; int minNumber = PList [ 0 ] ; int cnt = 1 ; for ( int i = 1 ; i < N ; i + + ) { PList [ i ] = sc . nextInt ( ) ; if ( minNumber > = PList [ i ] ) { minNumber = PList [ i ] ; cnt + + ; } else { } } System . out . println ( cnt ) ; } } import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) list . add ( sc . nextInt ( ) ) ; List < Integer > sorted = list . stream ( ) . sorted ( Comparator . naturalOrder ( ) ) . collect ( Collectors . toList ( ) ) ; System . out . println ( ( sorted . get ( 1 ) - sorted . get ( 0 ) ) + ( sorted . get ( 2 ) - sorted . get ( 1 ) ) ) ; } } import java . util . AbstractMap ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Scanner ; class Main { static final int MOD = 1000000007 ; public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int a = 1 ; a < = 3500 ; a + + ) { for ( int b = 1 ; b < = 3500 ; b + + ) { double num = ( double ) n * a * b / ( 4 * a * b - n * b - n * a ) ; if ( num > 0 & & Math . abs ( num - Math . round ( num ) ) = = 0 ) { System . out . println ( a + " " + b + " " + Math . round ( num ) ) ; return ; } } } throw new Exception ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n ; String s = " " ; n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; + + i ) { s = sc . next ( ) ; if ( s . equals ( " Y " ) ) break ; } if ( s . equals ( " Y " ) ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = sc . nextInt ( ) ; int answer = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a < = max ; a + + ) { for ( int b = 0 ; b < = max ; b + + ) { if ( answer - a - b < = max & & answer - a - b > = 0 ) count + + ; } } System . out . println ( count ) ; ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int K ; int S ; Main ( Scanner sc ) { this . sc = sc ; K = sc . nextInt ( ) ; S = sc . nextInt ( ) ; } private int solve ( ) { int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K & & x + y + z = = S ) { count + + ; } } } return count ; } public void show ( int answer ) { System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { N [ i ] = sc . nextInt ( ) ; } Arrays . sort ( N ) ; if ( N [ 0 ] = = 5 & & N [ 1 ] = = 5 & & N [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double angH = 30 * H ; double angM = 5.5 * M ; double red = Math . toRadians ( Math . abs ( angH - angM ) ) ; double res = 0 ; res = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( red ) ) ; System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double ans ; double sho = ( H * 60 + M ) * 360 / ( 12 * 60 ) ; double lon = M * 360 / 60 ; double ang ; ang = Math . abs ( sho - lon ) ; ans = Math . sqrt ( A * A + B * B - 2.0 * A * B * Math . cos ( Math . toRadians ( ang ) ) ) ; System . out . print ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int a1 , b1 , b2 , b3 ; a1 = 0 ; b1 = c [ 0 ] [ 0 ] ; b2 = c [ 0 ] [ 1 ] ; b3 = c [ 0 ] [ 2 ] ; if ( c [ 1 ] [ 0 ] - b1 = = c [ 1 ] [ 1 ] - b2 & & c [ 1 ] [ 1 ] - b2 = = c [ 1 ] [ 2 ] - b3 ) { } else { System . out . println ( " No " ) ; return ; } if ( c [ 2 ] [ 0 ] - b1 = = c [ 2 ] [ 1 ] - b2 & & c [ 2 ] [ 1 ] - b2 = = c [ 2 ] [ 2 ] - b3 ) { } else { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } } 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 ) ; C4N solver = new C4N ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C4N { static final int CAP = 3500 ; public void solve ( int testNumber , InputReader in , PrintWriter out ) { long n = in . nextInt ( ) ; for ( long b = 1 ; b < = CAP ; b + + ) { for ( long c = 1 ; c < = CAP ; c + + ) { long d = 4 * b * c - n * b - n * c ; if ( d = = 0 ) { continue ; } long a = ( n * b * c ) / d ; if ( a > 0 & & a < = CAP & & n * ( a * b + b * c + c * a ) = = 4 * a * b * c ) { out . println ( a + " " + b + " " + c ) ; return ; } } } } } 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int n4 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; list . add ( n1 ) ; list . add ( n2 ) ; list . add ( n3 ) ; list . add ( n4 ) ; if ( list . contains ( 1 ) & & list . contains ( 9 ) & & list . contains ( 7 ) & & list . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . lang . reflect . Array ; import java . util . * ; public class Main { static int N ; static int K ; static long Q ; static int A ; static long B ; static long C ; static double min = 9999999 ; static long ans = 0 ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] map = new int [ 10 ] ; int a = scanner . nextInt ( ) ; map [ a ] = 1 ; int b = scanner . nextInt ( ) ; map [ b ] = 1 ; a = scanner . nextInt ( ) ; map [ a ] = 1 ; a = scanner . nextInt ( ) ; map [ a ] = 1 ; if ( map [ 1 ] = = 1 & & map [ 7 ] = = 1 & & map [ 9 ] = = 1 & & map [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; sc . close ( ) ; int abs = ( int ) Math . abs ( n - m ) ; long count = 1 ; if ( abs > 1 ) { System . out . println ( " 0 " ) ; System . exit ( 0 ) ; } else { while ( n ! = 1 ) { count = count * n % ( long ) ( Math . pow ( 10 , 9 ) + 7 ) ; n -- ; } while ( m ! = 1 ) { count = count * m % ( long ) ( Math . pow ( 10 , 9 ) + 7 ) ; m -- ; } } if ( abs = = 0 ) System . out . println ( ( int ) count * 2 % ( long ) ( Math . pow ( 10 , 9 ) + 7 ) ) ; else System . out . println ( ( int ) count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a ! = 7 ) { if ( a ! = 5 ) { System . out . println ( " NO " ) ; } if ( a = = 5 ) { if ( b = = 7 ) { if ( c ! = 5 ) { System . out . println ( " NO " ) ; } if ( c = = 5 ) { System . out . println ( " YES " ) ; } } if ( b = = 5 ) { if ( c ! = 7 ) { System . out . println ( " NO " ) ; } if ( c = = 7 ) { System . out . println ( " YES " ) ; } } if ( b ! = 7 & & b ! = 5 ) { System . out . println ( " NO " ) ; } } } if ( a = = 7 ) { if ( b = = 7 ) { System . out . println ( " NO " ) ; } if ( b = = 5 ) { if ( c = = 5 ) { System . out . println ( " YES " ) ; } if ( c ! = 5 ) { System . out . println ( " NO " ) ; } } if ( b ! = 7 & & b ! = 5 ) { System . out . println ( " NO " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int max = Integer . MIN _ VALUE ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = s . nextInt ( ) ; if ( max < tmp ) { max = tmp ; } if ( min > tmp ) { min = tmp ; } } int k = s . nextInt ( ) ; s . close ( ) ; if ( max - min > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] b = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) b [ i ] = sc . nextInt ( ) ; int ans = 1 ; int tmp = b [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( tmp > b [ i ] ) { tmp = b [ i ] ; ans + + ; } } 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 ( ) ; int [ ] values = new int [ N + 1 ] ; for ( int i = 1 ; i < = N ; i + + ) { values [ i ] = i ; } int count = 1 ; hoge : while ( true ) { int cnt = 0 ; for ( int i = 1 ; i < = N ; i + + ) { if ( values [ i ] % 2 = = 0 ) { values [ i ] = values [ i ] / 2 ; count = i ; } else { cnt + + ; } } if ( cnt = = N ) { break hoge ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > number = new ArrayList < > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { number . add ( sc . nextInt ( ) ) ; } Collections . sort ( number ) ; if ( number . get ( 0 ) ! = 1 | | number . get ( 3 ) ! = 9 | | number . get ( 2 ) ! = 7 | | number . get ( 1 ) ! = 4 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; } PriorityQueue < Integer > under = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; PriorityQueue < Integer > over = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; if ( B [ i ] > A [ i ] ) { under . offer ( B [ i ] - A [ i ] ) ; } else if ( A [ i ] > B [ i ] ) { over . offer ( A [ i ] - B [ i ] ) ; } } int ans = 0 ; int remain = 0 ; while ( under . size ( ) > 0 ) { int au = under . poll ( ) ; ans + + ; while ( au > 0 ) { if ( remain = = 0 ) { if ( over . size ( ) = = 0 ) { break ; } int ao = over . poll ( ) ; remain = ao ; ans + + ; } int dec = Math . min ( au , remain ) ; au - = dec ; remain - = dec ; } if ( au > 0 ) { ans = - 1 ; break ; } } 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 ( ) ; int [ ] [ ] arr = new int [ n ] [ 2 ] ; long sumA = 0 ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] [ 0 ] = sc . nextInt ( ) ; sumA + = arr [ i ] [ 0 ] ; } long sumB = 0 ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] [ 1 ] = sc . nextInt ( ) ; sumB + = arr [ i ] [ 1 ] ; } if ( sumA < sumB ) { System . out . println ( - 1 ) ; return ; } Arrays . sort ( arr , ( a1 , a2 ) - > ( a1 [ 0 ] - a1 [ 1 ] ) - ( a2 [ 0 ] - a2 [ 1 ] ) ) ; int cnt = 0 ; long diffSum = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] [ 0 ] > = arr [ i ] [ 1 ] ) break ; cnt + + ; diffSum + = arr [ i ] [ 1 ] - arr [ i ] [ 0 ] ; } for ( int i = n - 1 ; i > = 0 & & diffSum > 0 ; i -- ) { diffSum - = ( arr [ i ] [ 0 ] - arr [ i ] [ 1 ] ) ; cnt + + ; } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int [ ] array = { n1 , n2 , n3 } ; int matchCount1 = 0 ; int matchCount2 = 0 ; for ( int val : array ) { if ( val = = 5 ) { matchCount1 + + ; } else if ( val = = 7 ) { matchCount2 + + ; } } if ( matchCount1 = = 2 & & matchCount2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) arr [ i ] = sc . nextInt ( ) ; int cnt = 1 ; int min = arr [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( min > arr [ i ] ) cnt + + ; min = Math . min ( min , arr [ i ] ) ; } System . out . println ( cnt ) ; } } import java . io . IOException ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int A [ ] = new int [ 3 ] ; A [ 0 ] = scan . nextInt ( ) ; A [ 1 ] = scan . nextInt ( ) ; A [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( A ) ; int sum ; sum = A [ 2 ] - A [ 1 ] ; sum + = A [ 1 ] - A [ 0 ] ; System . out . println ( sum ) ; } public static String myReverse ( String pStr ) { if ( pStr . length ( ) < 1 ) { return " " ; } StringBuffer sb = new StringBuffer ( pStr ) ; return sb . reverse ( ) . toString ( ) ; } public static long myMod ( long a , long b ) { long ret = 0 ; ret = a % b ; if ( ret < 0 ) { ret + = b ; } return ret ; } public static long myPowWithMod ( long kisu , long josu , long primeNumMod _ 0 ) { long ans = 1 ; if ( josu = = 0 ) return 1 ; if ( primeNumMod _ 0 = = 0 ) { while ( josu > 0 ) { if ( josu % 2 = = 0 ) { kisu * = kisu ; josu = josu / 2 ; } else { ans * = kisu ; josu -- ; } } return ans ; } else { kisu = myMod ( kisu , primeNumMod _ 0 ) ; while ( josu > 0 ) { if ( josu % 2 = = 0 ) { kisu * = myMod ( kisu , primeNumMod _ 0 ) ; josu = josu / 2 ; } else { ans * = myMod ( kisu , primeNumMod _ 0 ) ; josu -- ; } } return myMod ( ans , primeNumMod _ 0 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { final long INF = ( long ) 1e15 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } long [ ] b = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = INF ; } long ans = INF ; for ( int k = 0 ; k < n ; k + + ) { long tmp = x * k ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i - k + n ) % n ] ) ; tmp + = b [ i ] ; } ans = Math . min ( ans , tmp ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] list = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int a = Integer . parseInt ( sc . next ( ) ) ; list [ i ] [ j ] = a ; } } if ( list [ 0 ] [ 0 ] - list [ 1 ] [ 0 ] = = list [ 0 ] [ 1 ] - list [ 1 ] [ 1 ] & & list [ 0 ] [ 1 ] - list [ 1 ] [ 1 ] = = list [ 0 ] [ 2 ] - list [ 1 ] [ 2 ] & & list [ 1 ] [ 0 ] - list [ 2 ] [ 0 ] = = list [ 1 ] [ 1 ] - list [ 2 ] [ 1 ] & & list [ 1 ] [ 1 ] - list [ 2 ] [ 1 ] = = list [ 1 ] [ 2 ] - list [ 2 ] [ 2 ] & & list [ 0 ] [ 0 ] - list [ 0 ] [ 1 ] = = list [ 1 ] [ 0 ] - list [ 1 ] [ 1 ] & & list [ 0 ] [ 0 ] - list [ 0 ] [ 1 ] = = list [ 2 ] [ 0 ] - list [ 2 ] [ 1 ] & & list [ 0 ] [ 1 ] - list [ 0 ] [ 2 ] = = list [ 1 ] [ 1 ] - list [ 1 ] [ 2 ] & & list [ 0 ] [ 1 ] - list [ 0 ] [ 2 ] = = list [ 2 ] [ 1 ] - list [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 11 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; nums [ num ] + + ; } if ( nums [ 5 ] = = 2 & & nums [ 7 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int a = 0 ; int b = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = b ) { a + + ; b = P [ i ] ; } } System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( a = = 5 ) { five + + ; } else if ( a = = 7 ) { seven + + ; } if ( b = = 5 ) { five + + ; } else if ( b = = 7 ) { seven + + ; } if ( c = = 5 ) { five + + ; } else if ( c = = 7 ) { seven + + ; } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . nextLine ( ) ) ; int b = Integer . parseInt ( sc . nextLine ( ) ) ; int c = Integer . parseInt ( sc . nextLine ( ) ) ; int d = Integer . parseInt ( sc . nextLine ( ) ) ; int e = Integer . parseInt ( sc . nextLine ( ) ) ; int k = Integer . parseInt ( sc . nextLine ( ) ) ; int a1 = ( int ) Math . abs ( a - b ) ; int a2 = ( int ) Math . abs ( a - c ) ; int a3 = ( int ) Math . abs ( a - d ) ; int a4 = ( int ) Math . abs ( a - e ) ; int b1 = ( int ) Math . abs ( b - c ) ; int b2 = ( int ) Math . abs ( b - d ) ; int b3 = ( int ) Math . abs ( b - e ) ; int c1 = ( int ) Math . abs ( c - d ) ; int c2 = ( int ) Math . abs ( c - e ) ; int d1 = ( int ) Math . abs ( d - e ) ; if ( a1 < = k & & a2 < = k & & a3 < = k & & a4 < = k & & b1 < = k & & b2 < = k & & b3 < = k & & c1 < = k & & c2 < = k & & d1 < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = N ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] distance = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { distance [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int count = 0 ; boolean flag = true ; for ( int i = distance . length - 1 ; i > = 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) { if ( k < distance [ i ] - distance [ j ] ) { flag = false ; break ; } } if ( ! flag ) { break ; } } if ( flag ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long ans1 = 0 ; long ans2 = 0 ; long ans3 = 0 ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = i ; j < = 3500 ; j + + ) { if ( ( ( 4 * i * j - n * i - n * j ) > 0 ) & & ( ( n * i * j ) % ( 4 * i * j - n * i - n * j ) = = 0 ) ) { ans1 = i ; ans2 = j ; ans3 = ( n * i * j ) / ( 4 * i * j - n * i - n * j ) ; break ; } } if ( ans1 > 0 ) break ; } System . out . print ( ans1 + " " ) ; System . out . print ( ans2 + " " ) ; System . out . print ( ans3 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] d = new int [ 6 ] ; for ( int i = 0 ; i < d . length ; i + + ) { d [ i ] = sc . nextInt ( ) ; } System . out . println ( d [ 4 ] - d [ 0 ] < = d [ 5 ] ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; Arrays . sort ( a ) ; if ( k > = a [ 4 ] - a [ 0 ] ) ou . println ( " Yay ! " ) ; else ou . println ( " : ( " ) ; ou . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int kari = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; boolean hanbetsu = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( ( c [ i ] [ j ] + c [ ( i + 1 ) % 3 ] [ ( j + 1 ) % 3 ] + c [ ( i + 2 ) % 3 ] [ ( j + 2 ) % 3 ] ! = kari ) ) { hanbetsu = false ; break ; } } } if ( hanbetsu ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int l = s - ( i + j ) ; if ( l > = 0 & & l < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . File ; import java . io . IOException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] t = { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 101 } ; for ( int i = 0 ; i < t . length ; i + + ) { if ( t [ i ] > N ) { System . out . println ( t [ i - 1 ] ) ; break ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String result = " Yay ! " ; out : for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( num [ i ] - num [ j ] ) > k ) { result = " : ( " ; break out ; } } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] point = new int [ 5 ] ; int k ; String ans = " Yay ! " ; for ( int i = 0 ; i < point . length ; i + + ) { point [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; cmp : for ( int i = 0 ; i < point . length ; i + + ) { for ( int j = i + 1 ; j < point . length ; j + + ) { int p = point [ i ] ; int q = point [ j ] ; if ( ( q - p ) > k ) { ans = " : ( " ; break cmp ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int ary [ ] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; int ans = 0 ; for ( int i = 0 ; i < ary . length ; i + + ) { if ( ary [ i ] < = num ) { ans = ary [ i ] ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { String str = sc . next ( ) ; if ( str . equals ( " Y " ) ) { System . out . println ( " Four " ) ; sc . close ( ) ; return ; } } System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double h = ( H + ( double ) M / 60 ) * 30 ; double m = ( double ) M * 6 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( h - m ) ) ) ; System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( scan . nextInt ( ) ) ; } int count = 0 ; int min = Collections . max ( list ) ; for ( int i = 0 ; i < n ; i + + ) { if ( list . get ( i ) < = min ) { min = list . get ( i ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdIn . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; b [ 0 ] = c [ 0 ] [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] ; b [ 2 ] = c [ 0 ] [ 2 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; boolean flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int maxNum = scan . nextInt ( ) ; int sum = scan . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = maxNum ; + + x ) { for ( int y = 0 ; y < = maxNum ; + + y ) { int z = sum - x - y ; if ( 0 < = z & & z < = maxNum ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; } } import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; final String [ ] sl = s . split ( " " ) ; HashMap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < sl . length ; i + + ) { int k = Integer . parseInt ( sl [ i ] ) ; if ( hm . containsKey ( k ) ) { hm . put ( k , hm . get ( k ) + 1 ) ; } else { hm . put ( k , 1 ) ; } } String ans = " NO " ; if ( hm . containsKey ( 5 ) & & hm . containsKey ( 7 ) & & hm . get ( 5 ) = = 2 & & hm . get ( 7 ) = = 1 ) ans = " YES " ; System . out . println ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean isY = false ; for ( int i = 0 ; i < N ; i + + ) { String S = sc . next ( ) ; if ( S . equals ( " Y " ) ) isY = true ; } System . out . println ( isY ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int [ ] N = { N1 , N2 , N3 } ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( N [ i ] = = 5 ) { count _ 5 + + ; } else { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . PrintStream ; import java . util . Arrays ; import java . util . Scanner ; public class Main { private static final PrintStream so = System . out ; private static final Scanner sc = new Scanner ( System . in ) ; static final String KEYENCE = " keyence " ; static int INF = Integer . MAX _ VALUE ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; Prep [ ] P = new Prep [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; int diff = A [ i ] - B [ i ] ; P [ i ] = new Prep ( A [ i ] , B [ i ] , diff < 0 ? INF : diff ) ; } Arrays . sort ( P , ( p1 , p2 ) - > p1 . d - p2 . d ) ; long sumA = sum ( A ) ; long sumB = sum ( B ) ; long sumDiff = sumA - sumB ; if ( sumDiff < 0 ) { so . println ( - 1 ) ; return ; } int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( sumDiff < P [ i ] . d ) { break ; } sumDiff - = P [ i ] . d ; ans + + ; } so . println ( N - ans ) ; } static long sum ( int [ ] a ) { return Arrays . stream ( a ) . mapToLong ( i - > i ) . sum ( ) ; } static class Prep { int a ; int b ; int d ; public Prep ( int a , int b , int d ) { this . a = a ; this . b = b ; this . d = d ; } @ Override public String toString ( ) { return " ( a : " + a + " , b : " + b + " , d : " + d + " ) " ; } } } import java . util . Scanner ; public class Main { static long bignum = 1000000000 + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double degree = ( ( h + m / 60 ) * 30 - m * 6 ) / 360 * 2 * Math . PI ; double height = Math . sin ( degree ) * a ; double width = b - Math . cos ( degree ) * a ; double ans = Math . pow ( Math . pow ( height , 2 ) + Math . pow ( width , 2 ) , 0.5 ) ; System . out . println ( ans ) ; } static long divn ( int target , int times ) { int sqtimes = ( int ) Math . sqrt ( times ) ; long ans = 1 ; for ( int i = 0 ; i < sqtimes ; i + + ) { ans = ( ans * target ) % ( 1000000000 + 7 ) ; } long holder = ans ; ans = 1 ; for ( int i = 0 ; i < sqtimes ; i + + ) { ans = ( ans * holder ) % ( 1000000000 + 7 ) ; } for ( int i = 0 ; i < times - sqtimes * sqtimes ; i + + ) { ans = ( ans * target ) % ( 1000000000 + 7 ) ; } return ans ; } static long div ( long a ) { if ( a < 0 ) a + = 1000000000 + 7 ; return a % ( 1000000000 + 7 ) ; } } import java . util . * ; import java . util . Map . Entry ; class Main { static int mod = ( int ) 998244353 ; static List < ArrayList < Integer > > list = new ArrayList < ArrayList < Integer > > ( ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = i ; j < = 3500 ; j + + ) { long up = 3501 ; long down = 0 ; while ( up > = down ) { long mid = ( up + down ) / 2 ; if ( 4 * i * j * mid = = N * ( i * j + j * mid + mid * i ) ) { System . out . print ( i ) ; System . out . print ( " " ) ; System . out . print ( j ) ; System . out . print ( " " ) ; System . out . println ( mid ) ; return ; } else if ( 4 * i * j * mid < N * ( i * j + j * mid + mid * i ) ) { down = mid + 1 ; } else { up = mid - 1 ; } } } } System . out . println ( " end " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; long ret = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = 0 ; y < = Math . min ( k , s - x ) ; y + + ) { if ( s - x - y < = k ) { ret + + ; } } } pr . println ( ret ) ; } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } long [ ] [ ] b = new long [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] [ 0 ] = a [ i ] ; for ( int j = 1 ; j < n ; j + + ) { if ( ( i - j ) > = 0 ) { b [ i ] [ j ] = Math . min ( b [ i ] [ j - 1 ] , a [ i - j ] ) ; } else { b [ i ] [ j ] = Math . min ( b [ i ] [ j - 1 ] , a [ n - ( j - i ) ] ) ; } } } long ans = ( long ) Math . pow ( 10 , 18 ) ; for ( int k = 0 ; k < n ; k + + ) { long t = ( x * k ) ; for ( int i = 0 ; i < n ; i + + ) { t + = b [ i ] [ k ] ; } ans = Math . min ( ans , t ) ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner inp = new Scanner ( System . in ) ; int a = inp . nextInt ( ) ; int b = inp . nextInt ( ) ; int c = inp . nextInt ( ) ; int aa [ ] = { a , b , c } ; Arrays . sort ( aa ) ; int ans = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { ans + = ( aa [ i ] - aa [ i - 1 ] ) ; } System . out . println ( ans ) ; inp . close ( ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double a _ angle = ( h * 60 + m ) / ( 12.0 * 60 ) * 360 ; double b _ angle = m / ( 60.0 ) * 360 ; double angle = a _ angle - b _ angle ; System . out . println ( Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b ) * Math . cos ( Math . toRadians ( angle ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String str = scanner . nextLine ( ) ; String [ ] strs = str . split ( " " ) ; int five = 0 ; int seven = 0 ; for ( String s : strs ) { if ( s . equals ( " 5 " ) ) { five + = 1 ; } else if ( s . equals ( " 7 " ) ) { seven + = 1 ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scanner . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] strlist = str . split ( " " ) ; int k = Integer . parseInt ( strlist [ 0 ] ) ; int s = Integer . parseInt ( strlist [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count = count + 1 ; continue ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( ( ( S - x - y ) > = 0 ) & & ( ( S - x - y ) < = K ) ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int m = n ; int a = 0 ; for ( int i = 0 ; i < n ; i + + ) { int c = Integer . parseInt ( sc . next ( ) ) ; m = Math . min ( m , c ) ; if ( m > = c ) { a + = 1 ; } } System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; long T1 = scn . nextLong ( ) , T2 = scn . nextLong ( ) , A1 = scn . nextLong ( ) , A2 = scn . nextLong ( ) , B1 = scn . nextLong ( ) , B2 = scn . nextLong ( ) ; long ans = 0 ; if ( A1 < B1 ) { long buf1 = A1 , buf2 = A2 ; A1 = B1 ; A2 = B2 ; B1 = buf1 ; B2 = buf2 ; } if ( A2 < B2 ) { long d = ( B1 * T1 + B2 * T2 ) - ( A1 * T1 + A2 * T2 ) ; if ( d = = 0 ) { System . out . println ( " infinity " ) ; return ; } if ( d > 0 ) { if ( ( A1 - B1 ) * T1 % d = = 0 ) { ans = ( ( A1 - B1 ) * T1 / d ) * 2 ; } else { ans = ( ( A1 - B1 ) * T1 / d ) * 2 + 1 ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int retu = scan . nextInt ( ) ; Integer [ ] jun = new Integer [ retu ] ; int count = 0 ; for ( int i = 0 ; i < retu ; i + + ) { jun [ i ] = scan . nextInt ( ) ; } int re = 1 ; int min = jun [ 0 ] ; for ( int i = 0 ; i < retu ; i + + ) { if ( min > = jun [ i ] ) { count + + ; } min = Math . min ( min , jun [ i ] ) ; } System . out . println ( count ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int temp = s - x - y ; if ( temp > = 0 & & temp < = k ) count + + ; } } System . out . println ( count ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; + + i ) { if ( in . next ( ) . equals ( " Y " ) ) { ans = " Four " ; } } out . println ( ans ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; String [ ] charac = { " P " , " W " , " G " , " Y " } ; boolean [ ] state = new boolean [ 4 ] ; String h ; for ( int i = 0 ; i < n ; i + + ) { h = tokenizer . nextToken ( ) ; for ( int j = 0 ; j < 4 ; j + + ) { if ( h . equals ( charac [ j ] ) ) { state [ j ] = true ; break ; } } } System . out . println ( state [ 3 ] ? " Four " : " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int A = 5 ; int B = 7 ; int C = 5 ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = A & & b = = B & & c = = C ) { System . out . println ( " YES " ) ; } else if ( a = = B & & b = = C & & c = = A ) { System . out . println ( " YES " ) ; } else if ( a = = C & & b = = A & & c = = B ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = stdIn . nextInt ( ) ; } Arrays . sort ( num ) ; System . out . println ( num [ 2 ] - num [ 0 ] ) ; } } import java . util . Scanner ; public class Main { private void solve ( ) { Scanner in = new Scanner ( System . in ) ; long N = in . nextInt ( ) ; double d _ k = 0 ; long i _ k = 0 ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = 1 ; j < = 3500 ; j + + ) { if ( 4 * i * j - N * i - N * j = = 0 ) continue ; d _ k = ( double ) ( N * i * j ) / ( 4 * i * j - N * i - N * j ) ; i _ k = N * i * j / ( 4 * i * j - N * i - N * j ) ; if ( d _ k = = i _ k & & i _ k > = 0 & & i _ k < = 3500 ) { System . out . println ( i + " " + j + " " + i _ k ) ; return ; } } } } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double hangle = ( h * 30 ) + ( m * 0.5 ) ; double manble = m * 6 ; double angle = Math . abs ( hangle - manble ) ; if ( angle > 180 ) { angle = 360 - angle ; } double length = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ) ; System . out . println ( length ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( ( a = = b & & c = = 7 ) | | ( b = = c & & a = = 7 ) | | ( c = = a & & b = = 7 ) ) & & a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N > = 64 ) { System . out . println ( 64 ) ; } else if ( N > = 32 ) { System . out . println ( 32 ) ; } else if ( N > = 16 ) { System . out . println ( 16 ) ; } else if ( N > = 8 ) { System . out . println ( 8 ) ; } else if ( N > = 4 ) { System . out . println ( 4 ) ; } else if ( N > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } public static int sample ( ) { return 1 ; } } import java . util . Scanner ; public class Main { public Main ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; boolean four = false ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } for ( String i : s ) { if ( i . equals ( " Y " ) ) four = true ; } if ( four ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } public static void main ( String [ ] args ) { new Main ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int n = sc . nextInt ( ) ; int i = 2 ; for ( ; i < = n ; i = i * 2 ) { } System . out . println ( i / 2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; for ( int a1 = 0 ; a1 < 201 ; a1 + + ) { int b1 = c11 - a1 ; int b2 = c12 - a1 ; int b3 = c13 - a1 ; int a2 = c23 - b3 ; int a3 = c33 - b3 ; if ( a2 + b1 = = c21 & & a2 + b2 = = c22 & & a2 + b3 = = c23 & & a3 + b1 = = c31 & & a3 + b2 = = c32 & & a3 + b3 = = c33 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; return ; } } import java . io . * ; import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( long h = 1 ; h < 3501 ; + + h ) { for ( long n = 1 ; n < 3501 ; + + n ) { long u = N * h * n ; long d = 4 * h * n - N * n - N * h ; if ( d < = 0 ) continue ; if ( u < d ) continue ; if ( u % d ! = 0 ) continue ; long w = u / d ; if ( 4 * h * n * w = = N * n * w + N * h * w + N * h * n ) { System . out . println ( h + " " + n + " " + w ) ; return ; } } } System . out . println ( " NO ! " ) ; } } import java . util . * ; import java . io . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String result = " NO " ; if ( a * b * c = = 5 * 5 * 7 ) result = " YES " ; System . out . println ( result ) ; } public static class Scanner { private BufferedReader br ; private StringTokenizer tok ; public Scanner ( InputStream is ) throws IOException { br = new BufferedReader ( new InputStreamReader ( is ) ) ; } private void getLine ( ) throws IOException { while ( ! hasNext ( ) ) tok = new StringTokenizer ( br . readLine ( ) ) ; } private boolean hasNext ( ) { return tok ! = null & & tok . hasMoreTokens ( ) ; } public String next ( ) throws IOException { getLine ( ) ; return tok . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; import java . lang . Math ; import java . util . ArrayList ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; List < Integer > n = new ArrayList < > ( ) ; int [ ] n1 = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) n1 [ i ] = stdIn . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) n . add ( n1 [ i ] ) ; if ( n . contains ( 1 ) ) { int b = n . indexOf ( 1 ) ; n . remove ( b ) ; } if ( n . contains ( 9 ) ) { int c = n . indexOf ( 9 ) ; n . remove ( c ) ; } if ( n . contains ( 7 ) ) { int d = n . indexOf ( 7 ) ; n . remove ( d ) ; } if ( n . contains ( 4 ) ) { int e = n . indexOf ( 4 ) ; n . remove ( e ) ; } if ( n . isEmpty ( ) = = true ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int min = Math . min ( Math . abs ( a - b ) + Math . abs ( b - c ) , Math . abs ( a - c ) + Math . abs ( c - b ) ) ; min = Math . min ( min , Math . abs ( c - a ) + Math . abs ( a - b ) ) ; System . out . println ( min ) ; } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ans = Math . abs ( 30 * h + m / 2.0 - 6 * m ) ; if ( ans > 180 ) ans = 360 - ans ; if ( ans = = 180 ) System . out . println ( x + y ) ; else if ( ans = = 0 ) System . out . println ( Math . abs ( x - y ) ) ; else { double a = Math . toRadians ( ans ) ; double p = x * x + y * y - 2 * x * y * Math . cos ( a ) ; p = Math . sqrt ( p ) ; System . out . println ( p ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x , y , z ; int s , k ; int count = 0 ; Scanner sc = new Scanner ( System . in ) ; k = Integer . parseInt ( sc . next ( ) ) ; s = Integer . parseInt ( sc . next ( ) ) ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( k < Math . abs ( a - b ) ) flag = true ; if ( k < Math . abs ( a - c ) ) flag = true ; if ( k < Math . abs ( a - d ) ) flag = true ; if ( k < Math . abs ( a - e ) ) flag = true ; if ( k < Math . abs ( b - c ) ) flag = true ; if ( k < Math . abs ( b - d ) ) flag = true ; if ( k < Math . abs ( b - e ) ) flag = true ; if ( k < Math . abs ( c - d ) ) flag = true ; if ( k < Math . abs ( c - e ) ) flag = true ; if ( k < Math . abs ( d - e ) ) flag = true ; if ( flag = = false ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double m _ angle = 6.0 * m ; double h _ angle = ( 30.0 * h ) + ( 0.5 * m ) ; double mh _ angle = Math . abs ( h _ angle - m _ angle ) ; double cc = ( a * a ) + ( b * b ) - 2 * a * b * Math . cos ( Math . toRadians ( mh _ angle ) ) ; System . out . println ( Math . sqrt ( cc ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) s [ i ] = sc . next ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " Y " ) ) cnt + + ; } if ( cnt > = 1 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kbd = new Scanner ( System . in ) ; int a = kbd . nextInt ( ) ; int b = kbd . nextInt ( ) ; int h = kbd . nextInt ( ) ; int m = kbd . nextInt ( ) ; double A = h * 30 + m * 0.5 ; double B = m * 6 ; double C = 0 ; if ( A - B > = 0 ) { C = A - B ; } else { C = B - A ; } if ( C > 180 ) { C = 360 - C ; } C = Math . toRadians ( C ) ; double x = b * Math . sin ( C ) * b * Math . sin ( C ) ; double y = ( b * Math . cos ( C ) - a ) * ( b * Math . cos ( C ) - a ) ; System . out . println ( Math . sqrt ( x + y ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int min = a [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = a [ i ] ) { min = a [ i ] ; count + + ; } else { } } System . out . println ( count ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BSumOfThreeIntegers solver = new BSumOfThreeIntegers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BSumOfThreeIntegers { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int k = in . nextInt ( ) , s = in . nextInt ( ) ; long ans = 0 ; for ( int x = Math . max ( 0 , s - 2 * k ) ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = Math . max ( 0 , s - x - k ) ; y < = Math . min ( k , s - x ) ; y + + ) { ans + + ; } } out . println ( ans ) ; } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; final int n = scanner . nextInt ( ) ; int min = 200001 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = scanner . nextInt ( ) ; if ( p < = min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { if ( a = = 5 & & b = = 5 | | a = = 5 & & c = = 5 | | b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int abcde [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { abcde [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { int ans = Math . abs ( abcde [ i ] - abcde [ j ] ) ; if ( ans > k ) { count + + ; } } } if ( count > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; Arrays . sort ( a ) ; ou . println ( a [ 2 ] - a [ 0 ] ) ; ou . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; int z = 0 , y = 0 , fin = 0 ; while ( z < 5 ) { a [ z ] = stdIn . nextInt ( ) ; z + + ; } z = 0 ; int k = stdIn . nextInt ( ) ; while ( z < 5 ) { y = z + 1 ; while ( y < 5 ) { if ( a [ y ] - a [ z ] > k ) { fin = 1 ; break ; } y + + ; } z + + ; } if ( fin = = 1 ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] d = new int [ 3 ] [ 2 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { d [ i ] [ j ] = c [ i ] [ j + 1 ] - c [ i ] [ j ] ; } } if ( d [ 0 ] [ 0 ] = = d [ 1 ] [ 0 ] & & d [ 1 ] [ 0 ] = = d [ 2 ] [ 0 ] & & d [ 0 ] [ 1 ] = = d [ 1 ] [ 1 ] & & d [ 1 ] [ 1 ] = = d [ 2 ] [ 1 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; long N = sc . nextLong ( ) ; for ( long i = 3500 ; i > = 1 ; i -- ) { if ( 4 * i - N > 0 ) { long a = 4 * i - N ; long b = N * i ; for ( int j = 3500 ; j > = 1 ; j -- ) { if ( a * j - b > 0 ) { if ( ( b * j ) % ( a * j - b ) = = 0 ) { pl ( i + " " + j + " " + ( ( b * j ) / ( a * j - b ) ) ) ; System . exit ( 0 ) ; } } } } } } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } public static void pl ( Object o ) { System . out . println ( o ) ; } public static void pl ( ) { System . out . println ( ) ; } public static void p ( Object o ) { System . out . print ( o ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; Map < Integer , Integer > input = new HashMap < Integer , Integer > ( ) ; int in = 0 ; int x = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { in = scan . nextInt ( ) ; if ( input . get ( in ) ! = null ) { x = input . get ( in ) ; x = x + 1 ; input . put ( in , x ) ; } else { x = x + 1 ; input . put ( in , x ) ; } x = 0 ; } int number5 = 0 ; int number7 = 0 ; String ans = " NO " ; number5 = input . get ( 5 ) ; if ( number5 ! = 0 ) { if ( number5 = = 2 ) { number7 = input . get ( 7 ) ; if ( number7 ! = 0 ) { if ( number7 = = 1 ) { ans = " YES " ; } } } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , 4 ) ; int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { arr [ i ] = Integer . parseInt ( line [ i ] ) ; } Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 1 & & arr [ 1 ] = = 4 & & arr [ 2 ] = = 7 & & arr [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String argv [ ] ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; int time = 0 ; if ( H + R < 0 ) time = - 1 ; else if ( H + R > = 2 * R ) time = 1 ; else if ( H + R = = 0 ) time = 0 ; else if ( H + R > = 1 ) time = 1 ; System . out . println ( time ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( solve ( a , b , c , d , e , k ) ) ; sc . close ( ) ; } static String solve ( int a , int b , int c , int d , int e , int k ) { return ( e - a < = k ) ? " Yay ! " : " : ( " ; } } import java . util . Scanner ; public class Main { static int n ; static long x ; static long [ ] [ ] dp ; static long [ ] a ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } dp = new long [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { dp [ 0 ] [ i ] = a [ i ] ; } for ( int i = 1 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { dp [ i ] [ j ] = Math . min ( dp [ i - 1 ] [ ( n + j - 1 ) % n ] , dp [ i - 1 ] [ j ] ) ; } } long ret = Long . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { long sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { sum + = dp [ i ] [ j ] ; } ret = Math . min ( ret , sum + x * i ) ; } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; long ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z > = 0 & & z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; return ; } System . out . println ( " Yay ! " ) ; } } 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 [ ] input = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { input [ i ] = sc . nextInt ( ) ; } int min = Integer . MAX _ VALUE ; int res = 0 ; for ( int i = 0 ; i < input . length ; i + + ) { if ( input [ i ] < min ) { min = input [ i ] ; res + + ; } } System . out . print ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int answer = 0 ; if ( S > K * 3 ) { System . out . println ( 0 ) ; return ; } for ( int i = K ; i > = 0 ; i -- ) { int tmp1 = S - i ; if ( tmp1 > K + K ) { break ; } for ( int j = K ; j > = 0 ; j -- ) { int tmp2 = tmp1 - j ; if ( tmp2 < 0 ) { continue ; } else if ( tmp2 > K ) { break ; } answer + + ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; IrohaAndEasy solver = new IrohaAndEasy ( ) ; System . out . println ( solver . solve ( input ) ) ; } static class IrohaAndEasy { public String solve ( String input ) { String answer ; String abc [ ] = input . split ( " " ) ; int five = 0 ; int seven = 0 ; int other = 0 ; for ( String n : abc ) { Integer i = new Integer ( n ) ; if ( i = = 5 ) { five + + ; } else if ( i = = 7 ) { seven + + ; } else { other + + ; } } if ( five = = 2 & & seven = = 1 ) { answer = " YES " ; } else { answer = " NO " ; } return answer ; } } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int A1 = Integer . parseInt ( sc . next ( ) ) ; int A2 = Integer . parseInt ( sc . next ( ) ) ; int A3 = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int A12 = Math . abs ( A1 - A2 ) ; int A13 = Math . abs ( A1 - A3 ) ; int A23 = Math . abs ( A2 - A3 ) ; int min = Integer . MAX _ VALUE ; if ( A12 + A23 < min ) { min = A12 + A23 ; } if ( A13 + A23 < min ) { min = A13 + A23 ; } if ( A12 + A13 < min ) { min = A12 + A13 ; } if ( A23 + A13 < min ) { min = A23 + A13 ; } if ( A13 + A12 < min ) { min = A13 + A12 ; } if ( A23 + A12 < min ) { min = A23 + A12 ; } out . printf ( " % d \ n " , min ) ; out . flush ( ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; list . add ( Integer . parseInt ( scanner . next ( ) ) ) ; list . add ( Integer . parseInt ( scanner . next ( ) ) ) ; list . add ( Integer . parseInt ( scanner . next ( ) ) ) ; Collections . sort ( list ) ; if ( list . get ( 0 ) = = 5 & & list . get ( 1 ) = = 5 & & list . get ( 2 ) = = 7 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } scanner . close ( ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( n ) ; boolean b = false ; if ( n [ 0 ] = = 1 ) { if ( n [ 1 ] = = 4 ) { if ( n [ 2 ] = = 7 ) { if ( n [ 3 ] = = 9 ) System . out . println ( " YES " ) ; b = true ; } } } if ( b = = false ) System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; class Main { public static void main ( final String [ ] args ) throws Exception { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ) { int N = Integer . parseInt ( br . readLine ( ) ) ; int ans = 1 ; while ( ans < N ) { ans * = 2 ; } if ( ans > N ) { ans / = 2 ; } System . out . println ( ans ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int distance [ ] = new int [ 10 ] ; distance [ 0 ] = b - a ; distance [ 1 ] = c - a ; distance [ 2 ] = d - a ; distance [ 3 ] = e - a ; distance [ 4 ] = c - b ; distance [ 5 ] = d - b ; distance [ 6 ] = e - b ; distance [ 7 ] = d - c ; distance [ 8 ] = e - c ; distance [ 9 ] = e - d ; int flag = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( k < distance [ i ] ) { flag = 0 ; break ; } } if ( flag = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int min = ( int ) 1e9 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < min ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . Comparator ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CExamAndWizard solver = new CExamAndWizard ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CExamAndWizard { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; ArrayList < Long > amari = new ArrayList < > ( ) ; long husoku = 0 ; long res = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = in . nextInt ( ) ; if ( a [ i ] > b [ i ] ) { amari . add ( a [ i ] - b [ i ] ) ; } if ( b [ i ] > a [ i ] ) { husoku + = b [ i ] - a [ i ] ; res + + ; } } amari . sort ( Comparator . reverseOrder ( ) ) ; int index = 0 ; while ( husoku > 0 ) { if ( index = = amari . size ( ) ) { out . println ( - 1 ) ; return ; } husoku - = amari . get ( index + + ) ; res + + ; } out . println ( res ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; String answer = " Three " ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { answer = " Four " ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; sc . close ( ) ; if ( a * b * c = = 175 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; int [ ] data = { a , b , c } ; for ( int i = 0 ; i < 3 ; i + + ) { if ( data [ i ] = = 5 ) count5 + + ; if ( data [ i ] = = 7 ) count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) arr [ i ] [ j ] = in . nextInt ( ) ; for ( int i = 0 ; i < = 100 ; i + + ) { int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; boolean ok = true ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = arr [ j ] [ 0 ] - i ; for ( int j = 0 ; j < 3 ; j + + ) b [ j ] = arr [ 0 ] [ j ] - a [ 0 ] ; for ( int k = 0 ; k < 3 ; k + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( arr [ k ] [ j ] ! = a [ k ] + b [ j ] ) ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; return ; } a = null ; b = null ; } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > List = new ArrayList < > ( ) ; ArrayList < Integer > OPT = new ArrayList < > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) List . add ( sc . nextInt ( ) ) ; for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { int opt = Math . abs ( List . get ( i ) - List . get ( j ) ) ; OPT . add ( opt ) ; } } Collections . sort ( OPT ) ; System . out . println ( OPT . get ( 0 ) + OPT . get ( 1 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int min = 0 ; int count = 0 ; min = array [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( min > = array [ i ] ) { min = array [ i ] ; } else { count + + ; } } System . out . println ( n - count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int w = Integer . parseInt ( sc . next ( ) ) ; double at = ( double ) ( Math . PI * h ) / 6 ; at - = ( double ) ( Math . PI * w * 11 ) / 360 ; double ans = a * a + b * b - 2 * a * b * Math . cos ( at ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . * ; import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String [ ] input = br . readLine ( ) . split ( " " ) ; double A = Double . parseDouble ( input [ 0 ] ) ; double B = Double . parseDouble ( input [ 1 ] ) ; double H = Double . parseDouble ( input [ 2 ] ) ; double M = Double . parseDouble ( input [ 3 ] ) ; double h _ r = 0 ; double m _ r = 0 ; double r = 0 ; double result = 0 ; if ( M = = 0 ) { m _ r = 360 ; h _ r = H * 30 ; } else { m _ r = M * 6 ; h _ r = H * 30 + M * 0.5 ; } if ( H = = 0 & & M = = 0 ) { result = A - B ; } else { r = Math . abs ( h _ r - m _ r ) ; if ( r = = 0 ) { result = 0 ; } else { double cos = Math . cos ( Math . toRadians ( r ) ) ; double a = Math . pow ( A , 2 ) ; double b = Math . pow ( B , 2 ) ; double tmp = a + b - ( 2 * A * B * cos ) ; result = Math . sqrt ( tmp ) ; } } System . out . println ( result ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; int [ ] [ ] nums = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 9 ; i + + ) { nums [ i / 3 ] [ i % 3 ] = sc . nextInt ( ) ; } System . out . println ( nums [ 1 ] [ 0 ] - nums [ 0 ] [ 0 ] = = nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] & & nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] = = nums [ 1 ] [ 2 ] - nums [ 0 ] [ 2 ] & & nums [ 2 ] [ 0 ] - nums [ 1 ] [ 0 ] = = nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] & & nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] = = nums [ 2 ] [ 2 ] - nums [ 1 ] [ 2 ] ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static char [ ] cs = { ' .' , ' # ' } ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } long ans = A [ 0 ] - 1 ; int min = 2 ; for ( int i = 1 ; i < N ; + + i ) { if ( A [ i ] = = min ) { + + min ; continue ; } ans + = ( A [ i ] - 1 ) / min ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( sc . nextInt ( ) ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A + B + C ) ! = 17 ) { System . out . println ( " NO " ) ; } else if ( A ! = 7 & & B ! = 7 & & C ! = 7 ) { System . out . println ( " NO " ) ; } else if ( A ! = 5 & & B ! = 5 & & C ! = 5 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } ; } ; } ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 123 ; int input ; for ( int i = 0 ; i < 5 ; i + + ) { input = sc . nextInt ( ) ; max = Math . max ( max , input ) ; min = Math . min ( min , input ) ; } int k = sc . nextInt ( ) ; if ( k > = max - min ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { z = S - x - y ; if ( 0 < = z & & z < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Long > a = new ArrayList < > ( ) ; long aTotal = 0 ; for ( int i = 0 ; i < n ; i + + ) { long x = sc . nextInt ( ) ; a . add ( x ) ; aTotal + = x ; } List < Long > b = new ArrayList < > ( ) ; long bTotal = 0 ; for ( int i = 0 ; i < n ; i + + ) { long x = sc . nextInt ( ) ; b . add ( x ) ; bTotal + = x ; } if ( aTotal < bTotal ) { System . out . println ( - 1 ) ; return ; } List < Long > sub = new ArrayList < > ( ) ; long cnt = 0 ; long minusTotal = 0 ; for ( int i = 0 ; i < n ; i + + ) { long s = a . get ( i ) - b . get ( i ) ; if ( s < 0 ) { cnt + + ; minusTotal + = s ; } sub . add ( s ) ; } if ( cnt = = 0 ) { System . out . println ( 0 ) ; return ; } Collections . sort ( sub , Comparator . reverseOrder ( ) ) ; boolean ok = false ; for ( long i : sub ) { if ( i < 0 ) { continue ; } minusTotal + = i ; cnt + + ; if ( minusTotal > = 0 ) { ok = true ; break ; } } if ( ! ok ) { System . out . println ( - 1 ) ; return ; } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int P [ ] = new int [ N ] ; int Pj = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; Pj = P [ 0 ] ; } for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = Pj ) { count + + ; Pj = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean ok = true ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { if ( array [ j ] - array [ i ] > k ) ok = false ; } } if ( ok ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . math . BigInteger ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { int n , i , j , m , k , p , q , o , l , s , tt = 1 ; Double x , y , z ; int ar [ ] , br [ ] ; char ch ; BigInteger an , su , u , v ; String a , b = " " , c = " " , d ; Scanner sc = new Scanner ( System . in ) ; Scanner scc = new Scanner ( System . in ) ; ar = new int [ 200001 ] ; br = new int [ 200001 ] ; n = sc . nextInt ( ) ; k = 50000000 ; for ( i = 0 ; i < n ; i + + ) { o = sc . nextInt ( ) ; if ( k > o ) { k = o ; } ar [ i ] = o ; br [ i ] = k ; } k = 0 ; for ( i = 1 ; i < n ; i + + ) { if ( ar [ i ] < = br [ i ] ) { k + + ; } } System . out . println ( k + 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 0 ; for ( i = 1 ; i < = n ; i = i * 2 ) { } i = i / 2 ; System . out . println ( i ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 1 ; while ( x * 2 < = n ) { x * = 2 ; } System . out . println ( x ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 , a , count , ans = 1 ; for ( int i = 2 ; i < = n ; i + + ) { count = 0 ; if ( i % 2 = = 1 ) continue ; a = i ; for ( ; ; ) { if ( a / 2 ! = 0 ) { a = a / 2 ; count + + ; } else { count + + ; break ; } } if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; int sub = 0 ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { if ( i ! = S ) { for ( int j = 0 ; j < = K ; j + + ) { if ( i + j ! = S ) { sub = S - ( i + j ) ; if ( sub > = 0 & & sub < = K ) { count + + ; } } else if ( i + j = = S ) { count + + ; break ; } } } else if ( i = = S ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayDeque ; import java . util . Deque ; import java . util . Collection ; import java . util . LinkedList ; import java . util . Queue ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; boolean f = false ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { f = true ; } if ( A = = 7 & & B = = 5 & & C = = 5 ) { f = true ; } if ( A = = 5 & & B = = 5 & & C = = 7 ) { f = true ; } if ( f ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int answer = 0 ; for ( int x = 0 ; x < = k ; x + + ) { if ( x > s ) { break ; } for ( int y = 0 ; y < = k ; y + + ) { if ( x + y > s ) { break ; } else { if ( x + y + k > = s ) { answer + + ; } } } } System . out . println ( answer ) ; } } 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 s = br . readLine ( ) ; String [ ] array = s . split ( " " ) ; int count1 = 0 ; int count2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( Integer . parseInt ( array [ i ] ) = = 5 ) { count1 + = 1 ; } else if ( Integer . parseInt ( array [ i ] ) = = 7 ) { count2 + = 1 ; } } if ( count1 = = 2 & & count2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int N , A , B , C ; int a = 0 , b = 0 , c = 0 , d = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { N = stdin . nextInt ( ) ; if ( N = = 1 & & a = = 0 ) a + + ; if ( N = = 9 & & b = = 0 ) b + + ; if ( N = = 7 & & c = = 0 ) c + + ; if ( N = = 4 & & d = = 0 ) d + + ; } if ( a + b + c + d > = 4 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; public class Main { private final static int MOD = 1 _ 000 _ 000 _ 000 + 7 ; private final static BigDecimal B _ MOD = BigDecimal . valueOf ( MOD ) ; public static void main ( String ... args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] vals = reader . readLine ( ) . split ( " " ) ; final int N = Integer . parseInt ( vals [ 0 ] ) ; final int M = Integer . parseInt ( vals [ 1 ] ) ; if ( Math . abs ( N - M ) > 1 ) { System . out . print ( 0 ) ; return ; } BigDecimal result ; if ( N = = M ) { result = BigDecimal . valueOf ( 2 ) . multiply ( getPermutation ( N ) ) . multiply ( getPermutation ( N ) ) ; } else { result = getPermutation ( N ) . multiply ( getPermutation ( M ) ) ; } System . out . print ( result . remainder ( B _ MOD ) ) ; } private static BigDecimal getPermutation ( final int n ) { BigDecimal result = BigDecimal . ONE ; for ( int i = 1 ; i < = n ; i + + ) { result = result . multiply ( BigDecimal . valueOf ( i ) ) ; if ( result . compareTo ( B _ MOD ) = = 1 ) result = result . remainder ( B _ MOD ) ; } return result ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int temp ; int devideCnt ; int maxDevideCnt = - 1 ; int ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { temp = i ; devideCnt = 0 ; while ( true ) { if ( temp % 2 = = 0 ) { temp = temp / 2 ; devideCnt + + ; } else { break ; } } if ( devideCnt > maxDevideCnt ) { ans = i ; maxDevideCnt = devideCnt ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double aAng = h * 30 + m * 0.5 ; double bAng = m * 6 ; System . out . println ( Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( 360 - ( aAng - bAng ) ) ) ) ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int antena [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean a = false ; out : for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ( antena [ i ] - antena [ j ] > k ) | | ( antena [ i ] - antena [ j ] < - k ) ) { a = true ; break out ; } } } if ( ! a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ax = a * Math . sin ( Math . PI * 2 * ( 1d / 12 * h + 1d / 12 / 60 * m ) ) ; double ay = a * Math . cos ( Math . PI * 2 * ( 1d / 12 * h + 1d / 12 / 60 * m ) ) ; double bx = b * Math . sin ( Math . PI * 2 / 60 * m ) ; double by = b * Math . cos ( Math . PI * 2 / 60 * m ) ; System . out . printf ( " % .20f \ n " , Math . hypot ( bx - ax , by - ay ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean ans = true ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; sc . close ( ) ; } } import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 1 ] + a [ 1 ] - a [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 1 ; while ( i < = N ) { i * = 2 ; } System . out . println ( i / 2 ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; boolean flag = true ; if ( a [ 0 ] ! = 1 ) flag = false ; if ( a [ 1 ] ! = 4 ) flag = false ; if ( a [ 2 ] ! = 7 ) flag = false ; if ( a [ 3 ] ! = 9 ) flag = false ; if ( flag ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( A * B * C = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . PriorityQueue ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { MScanner sc = new MScanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { pw . println ( " : ( " ) ; } else { pw . println ( " Yay ! " ) ; } pw . flush ( ) ; } static class MScanner { StringTokenizer st ; BufferedReader br ; public MScanner ( InputStream system ) { br = new BufferedReader ( new InputStreamReader ( system ) ) ; } public MScanner ( String file ) throws Exception { br = new BufferedReader ( new FileReader ( file ) ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public char nextChar ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } public Long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public void waitForInput ( ) throws InterruptedException { Thread . sleep ( 3000 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; int [ ] [ ] allType = new int [ n ] [ n ] ; long min = 0 ; for ( int i = 0 ; i < n ; i + + ) { allType [ 0 ] [ i ] = sc . nextInt ( ) ; min + = allType [ 0 ] [ i ] ; } for ( int i = 1 ; i < n ; i + + ) { long sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { allType [ i ] [ j ] = Math . min ( allType [ i - 1 ] [ j ] , allType [ 0 ] [ ( j - i + n ) % n ] ) ; sum + = allType [ i ] [ j ] ; } min = Math . min ( min , sum + i * x ) ; } System . out . println ( min ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int count1 = 0 ; int count2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int token1 = sc . nextInt ( ) ; if ( token1 = = 7 & & count1 < = 1 ) { count1 + + ; } else if ( token1 = = 5 & & count1 < = 2 ) { count2 + + ; } } if ( count1 = = 1 & & count2 = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double ret2 = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2.0 * a * b * Math . cos ( Math . toRadians ( Math . abs ( ( 60.0 * h - 11.0 * m ) / 2 ) ) ) ; double ret = Math . sqrt ( ret2 ) ; System . out . println ( ret ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; final double SHORT _ HAND _ ANGLE _ PER _ MINUTE = 0.5 ; final double LONG _ HAND _ ANGLE _ PER _ MINUTE = 6 ; double angleHour = ( h * 60 + m ) * SHORT _ HAND _ ANGLE _ PER _ MINUTE ; double angleMinute = m * LONG _ HAND _ ANGLE _ PER _ MINUTE ; double eggplantAngle = 0 ; if ( angleHour < = angleMinute ) { eggplantAngle = angleMinute - angleHour ; } else { eggplantAngle = angleHour - angleMinute ; } if ( eggplantAngle > 180 ) { eggplantAngle = 360 - eggplantAngle ; } double radian = Math . toRadians ( eggplantAngle ) ; double c = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( radian ) ) ; System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 999999999 ; long sum = 0 ; for ( int i = 0 ; i < N ; i + + ) { int now = sc . nextInt ( ) ; if ( now < max ) { max = now ; sum + + ; } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int [ ] nums = new int [ k + 1 ] ; for ( int i = 0 ; i < nums . length ; i + + ) { nums [ i ] = i ; } int count = 0 ; for ( int i = 0 ; i < nums . length ; i + + ) { int x = nums [ i ] ; for ( int j = 0 ; j < nums . length ; j + + ) { int y = nums [ j ] ; int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 123 ; for ( int i = 0 ; i < 5 ; i + + ) { int a = sc . nextInt ( ) ; if ( a > max ) { max = a ; } if ( a < min ) { min = a ; } } int k = sc . nextInt ( ) ; if ( max - min > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; int s = in . nextInt ( ) ; int answer = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = x ; y < = k ; y + + ) { int z = s - y - x ; if ( y < = z & & z < = k ) { if ( x = = y & & y = = z & & x = = z ) { answer + = 1 ; } else if ( x = = y | | y = = z | | x = = z ) { answer + = 3 ; } else { answer + = 6 ; } } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a , b , c , abc ; a = sc . next ( ) ; b = sc . next ( ) ; c = sc . next ( ) ; abc = a + b + c ; if ( abc . equals ( " 557 " ) | | abc . equals ( " 575 " ) | | abc . equals ( " 755 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] check = new int [ 3 ] ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; check [ 0 ] = A ; check [ 1 ] = B ; check [ 2 ] = C ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < check . length ; i + + ) { if ( check [ i ] = = 5 ) { count _ 5 + + ; } else if ( check [ i ] = = 7 ) { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int b = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = b ; i + + ) { for ( int n = 0 ; n < = b ; n + + ) { int f = a - i - n ; if ( f < = b & & f > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } Scanner sc = new Scanner ( System . in ) ; void run ( ) { int a [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int b [ ] = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = b [ i ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int [ ] v = new int [ 8 ] ; for ( int i = 0 ; i < 3 ; + + i ) v [ in . nextInt ( ) ] + + ; if ( v [ 5 ] = = 2 & & v [ 7 ] = = 1 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; long [ ] map = new long [ 5 ] ; for ( int i = 0 ; i < N ; i + + ) { String s = scanner . next ( ) ; if ( s . charAt ( 0 ) = = ' P ' ) map [ 0 ] + + ; if ( s . charAt ( 0 ) = = ' Y ' ) map [ 1 ] + + ; if ( s . charAt ( 0 ) = = ' W ' ) map [ 2 ] + + ; if ( s . charAt ( 0 ) = = ' G ' ) map [ 3 ] + + ; } long ans = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( map [ i ] > 0 ) ans + + ; } if ( ans = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = in . nextInt ( ) ; } int minZ = p [ 0 ] , cnt = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( minZ > = p [ i ] ) { minZ = p [ i ] ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) b [ i ] = in . nextInt ( ) ; List < Integer > enough = new ArrayList < > ( ) ; List < Integer > shortage = new ArrayList < > ( ) ; long shortage _ sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] - b [ i ] > 0 ) enough . add ( a [ i ] - b [ i ] ) ; else if ( a [ i ] - b [ i ] < 0 ) { shortage . add ( a [ i ] - b [ i ] ) ; shortage _ sum + = - a [ i ] + b [ i ] ; } } if ( shortage _ sum = = 0 ) System . out . println ( 0 ) ; else { enough . sort ( ( x , y ) - > - x + y ) ; int i = 0 ; for ( ; i < enough . size ( ) ; i + + ) { shortage _ sum - = enough . get ( i ) ; if ( shortage _ sum < = 0 ) break ; } if ( i = = enough . size ( ) ) System . out . println ( - 1 ) ; else System . out . println ( shortage . size ( ) + i + 1 ) ; } in . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; boolean yellow = false ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { yellow = true ; break ; } } if ( yellow ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) a [ i ] [ j ] = sc . nextInt ( ) ; } int sum1 , sum2 , sum3 , sum4 ; sum1 = a [ 0 ] [ 0 ] + a [ 1 ] [ 1 ] + a [ 2 ] [ 2 ] ; sum2 = a [ 0 ] [ 1 ] + a [ 1 ] [ 2 ] + a [ 2 ] [ 0 ] ; sum3 = a [ 1 ] [ 0 ] + a [ 2 ] [ 1 ] + a [ 0 ] [ 2 ] ; if ( sum1 = = sum2 & & sum2 = = sum3 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } int c012 = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; int c021 = c [ 0 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] ; int c102 = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; int c120 = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; int c210 = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; int c201 = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; if ( c012 = = c021 & & c021 = = c102 & & c102 = = c120 & & c120 = = c210 & & c210 = = c201 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = 0 , y = 0 , z , cnt = 0 ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( s - ( x + y ) > = 0 & & s - ( x + y ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } public class Main { static Scanner in = new Scanner ( System . in ) ; public static void solve ( ) { DecimalFormat df = new DecimalFormat ( " # . # # # # # # # # # # # # # # # # # # # # " ) ; double a = in . nextDouble ( ) , b = in . nextDouble ( ) ; double h = in . nextDouble ( ) , m = in . nextDouble ( ) ; double angle = Math . abs ( 30 * h - 11 * m / 2.0 ) ; double ans = Math . toRadians ( angle ) ; double c = Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( ans ) ) ; System . out . println ( df . format ( c ) ) ; } public static void main ( String [ ] args ) throws java . lang . Exception { int t = 1 ; while ( t > 0 ) { solve ( ) ; t -- ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 ) | | ( b = = 5 & & c = = 5 ) | | ( a = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int [ ] ia = new int [ 5 ] ; ia [ 0 ] = sc . nextInt ( ) ; ia [ 1 ] = sc . nextInt ( ) ; ia [ 2 ] = sc . nextInt ( ) ; ia [ 3 ] = sc . nextInt ( ) ; ia [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Arrays . sort ( ia ) ; if ( ia [ 4 ] - ia [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String strArr [ ] = br . readLine ( ) . split ( " " ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < strArr . length ; i + + ) { int temp = Integer . parseInt ( strArr [ i ] ) ; if ( temp = = 5 ) { count5 + + ; } else if ( temp = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; int b = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; int d = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; if ( a = = b & & b = = d ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & S - i - j > = 0 ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; String ans = " NO " ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) ans = " YES " ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int a = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; int c = stdin . nextInt ( ) ; int d = stdin . nextInt ( ) ; int e = stdin . nextInt ( ) ; int k = stdin . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; String count = " Three " ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; if ( S [ i ] . equals ( " Y " ) ) count = " Four " ; } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int [ ] aa = new int [ 3 ] ; aa [ 0 ] = a ; aa [ 1 ] = b ; aa [ 2 ] = c ; Arrays . sort ( aa ) ; if ( aa [ 0 ] = = aa [ 1 ] & & aa [ 2 ] > aa [ 0 ] ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int min = 124 ; int max = - 1 ; for ( int i = 0 ; i < 5 ; i + + ) { int n = in . nextInt ( ) ; if ( n < min ) min = n ; if ( n > max ) max = n ; } int k = in . nextInt ( ) ; System . out . println ( ( max - min < = k ) ? " Yay ! " : " : ( " ) ; in . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c = = 17 ) & & ( a = = 5 | | a = = 7 ) & & ( b = = 5 | | b = = 7 ) & & ( c = = 5 | | c = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a , b , c ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; if ( a + b + c = = 17 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ( ) ; } min = a [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void Solver ( int A , int B , int C ) { int sevenCount = 0 ; int fiveCount = 0 ; if ( A = = 5 ) fiveCount + + ; if ( B = = 5 ) fiveCount + + ; if ( C = = 5 ) fiveCount + + ; if ( A = = 7 ) sevenCount + + ; if ( B = = 7 ) sevenCount + + ; if ( C = = 7 ) sevenCount + + ; if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; Solver ( input . nextInt ( ) , input . nextInt ( ) , input . nextInt ( ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a , b , c ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; c = scan . nextInt ( ) ; if ( a = = 5 ) { if ( b = = 5 ) { if ( c = = 7 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } else if ( b = = 7 ) { if ( c = = 5 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } } else if ( a = = 7 ) { if ( b = = 5 ) { if ( c = = 5 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } else System . out . print ( " NO " ) ; } else System . out . print ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int H = s . nextInt ( ) ; int R = s . nextInt ( ) ; int a = H + R ; int ans = 1 ; if ( a < 0 ) { ans = - 1 ; } else if ( a = = 0 ) { ans = 0 ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int max = Integer . parseInt ( sc . next ( ) ) ; int target = Integer . parseInt ( sc . next ( ) ) ; int cnt = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int total = i + j ; if ( target - total < = max & & target - total > = 0 ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; c [ 0 ] [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 0 ] [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 0 ] [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 1 ] [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 1 ] [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 1 ] [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 2 ] [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 2 ] [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 2 ] [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; a [ 1 ] = c [ 1 ] [ 1 ] - b [ 1 ] ; a [ 2 ] = c [ 2 ] [ 1 ] - b [ 1 ] ; String ans = " Yes " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { ans = " No " ; break ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { String m = sc . next ( ) ; if ( m . equals ( " Y " ) ) { ans = " Four " ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . math . BigInteger ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { 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 ( ) ; } sc . close ( ) ; long ans = a [ 0 ] - 1 ; int p = 2 ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] ! = p ) { ans + = ( a [ i ] - 1 ) / p ; } else { p + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int g [ ] [ ] = new int [ 3 ] [ 3 ] ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { g [ i ] [ j ] = sc . nextInt ( ) ; } } if ( ( g [ 0 ] [ 0 ] + g [ 1 ] [ 1 ] = = g [ 0 ] [ 1 ] + g [ 1 ] [ 0 ] ) & & ( g [ 0 ] [ 1 ] + g [ 1 ] [ 2 ] = = g [ 0 ] [ 2 ] + g [ 1 ] [ 1 ] ) & & ( g [ 1 ] [ 0 ] + g [ 2 ] [ 1 ] = = g [ 1 ] [ 1 ] + g [ 2 ] [ 0 ] ) & & ( g [ 1 ] [ 1 ] + g [ 2 ] [ 2 ] = = g [ 1 ] [ 2 ] + g [ 2 ] [ 1 ] ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public void main ( Scanner sc ) { int n = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } long b [ ] = new long [ n ] ; Arrays . fill ( b , Long . MAX _ VALUE ) ; long ans = n * 1000000000L ; for ( int magic = 0 ; magic < n ; magic + + ) { for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i + n - magic ) % n ] ) ; } ans = Math . min ( ans , magic * x + Arrays . stream ( b ) . sum ( ) ) ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { BufferedReader rd ; Main ( ) throws IOException { rd = new BufferedReader ( new InputStreamReader ( System . in ) ) ; compute ( ) ; } private void compute ( ) throws IOException { rd . readLine ( ) ; String s = rd . readLine ( ) ; out ( s . contains ( " Y " ) ? " Four " : " Three " ) ; } private static void out ( Object x ) { System . out . println ( x ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) ; } } import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; long count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { if ( x = = S ) { count + + ; break ; } if ( x > S ) { break ; } if ( x + K + K < S ) { continue ; } for ( int y = 0 ; y < = K ; y + + ) { if ( x + y = = S ) { count + + ; break ; } if ( x + y > S ) { break ; } if ( x + y + K < S ) { continue ; } count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( 0 < = S - x - y & & S - x - y < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . stream . IntStream ; import java . util . stream . Stream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BHinaArare solver = new BHinaArare ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BHinaArare { public void solve ( int testNumber , Scanner in , PrintWriter out ) { out . println ( IntStream . range ( 0 , in . nextInt ( ) ) . mapToObj ( x - > in . next ( ) ) . distinct ( ) . count ( ) = = 3 ? " Three " : " Four " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int count1 = 0 ; int count9 = 0 ; int count7 = 0 ; int count4 = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { int N = in . nextInt ( ) ; switch ( N ) { case 1 : count1 + + ; break ; case 9 : count9 + + ; break ; case 7 : count7 + + ; break ; case 4 : count4 + + ; break ; } } String str = " NO " ; if ( count1 = = 1 & & count9 = = 1 & & count7 = = 1 & & count4 = = 1 ) { str = " YES " ; } out . println ( str ) ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( sc . next ( ) ) ; } } int [ ] t = new int [ 6 ] ; t [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; t [ 1 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; t [ 2 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; t [ 3 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; t [ 4 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; t [ 5 ] = c [ 0 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 1 ] [ 2 ] ; String ans = " Yes " ; for ( int i = 1 ; i < 6 ; i + + ) { if ( t [ i ] ! = t [ 0 ] ) { ans = " No " ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] p = new int [ n ] ; int a = 1 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = scan . nextInt ( ) ; } int min = p [ 0 ] ; for ( int i = 0 ; i < n - 1 ; i + + ) { if ( p [ i + 1 ] < = min & & p [ i ] > p [ i + 1 ] ) { min = p [ i + 1 ] ; a + + ; } } System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int a = sc . nextInt ( ) ; if ( min > = a ) { ans + + ; min = a ; } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . * ; public class Main { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; void solve ( ) throws IOException { int n = nextInt ( ) ; int x = nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = nextInt ( ) ; } long [ ] cost = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { int best = Integer . MAX _ VALUE ; for ( int j = 0 ; j < n ; j + + ) { int now = ( i + n - j ) % n ; best = Math . min ( best , a [ now ] ) ; cost [ j ] + = best ; } } long outp = Long . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { outp = Math . min ( outp , cost [ i ] + ( long ) i * x ) ; } out . println ( outp ) ; } Main ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) ; } String nextToken ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { eof = true ; return null ; } } return st . nextToken ( ) ; } String nextString ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { eof = true ; return null ; } } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int [ ] list = new int [ 3 ] ; Main ( Scanner sc ) { this . sc = sc ; for ( int i = 0 ; i < 3 ; i + + ) { list [ i ] = sc . nextInt ( ) ; } } private String solve ( ) { String answer = " NO " ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( list [ i ] = = 5 ) { count5 + + ; } else if ( list [ i ] = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { answer = " YES " ; } return answer ; } public void show ( String answer ) { System . out . println ( answer ) ; } } import java . util . * ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 0 ; int max = 0 ; int ans = 0 ; if ( N = = 1 ) { System . out . println ( 1 ) ; return ; } for ( int i = 1 ; i < = N ; i + + ) { cnt = 0 ; int A = i ; while ( A % 2 = = 0 ) { A / = 2 ; cnt + + ; } if ( cnt > max ) { ans = i ; max = cnt ; } } System . out . println ( ans ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . stream . IntStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BSumOfThreeIntegers solver = new BSumOfThreeIntegers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BSumOfThreeIntegers { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int k = in . nextInt ( ) , s = in . nextInt ( ) ; out . println ( IntStream . rangeClosed ( Math . max ( 0 , s - 2 * k ) , Math . min ( k , s ) ) . map ( x - > Math . min ( k , s - x ) - Math . max ( 0 , s - x - k ) + 1 ) . filter ( v - > v > 0 ) . sum ( ) ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( ( set . size ( ) = = 3 ) ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( i = = 0 ) { min = p [ i ] ; count + + ; } else if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 = 0 ; int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; int a2 = c [ 1 ] [ 0 ] - b1 ; int a3 = c [ 2 ] [ 0 ] - b1 ; if ( a2 + b2 = = c [ 1 ] [ 1 ] & & a2 + b3 = = c [ 1 ] [ 2 ] & & a3 + b2 = = c [ 2 ] [ 1 ] & & a3 + b3 = = c [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; long ok = Long . MAX _ VALUE / 3 ; long ng = 0 ; while ( ok - ng > 1 ) { long m = ( ok + ng ) / 2 ; if ( f ( m ) > X ) { ok = m ; } else { ng = m ; } } System . out . println ( ok - 1 ) ; } static int f ( long n ) { if ( n < = 2 ) return 0 ; return 1 + f ( ( n - 1 ) / 2 ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . io . File ; import java . io . IOException ; import java . lang . reflect . Array ; import java . util . * ; import java . util . Map . Entry ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; boolean ans = true ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = in . nextInt ( ) ; } } if ( ! ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ) ) ans = false ; if ( ! ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) ) ans = false ; if ( ! ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ) ) ans = false ; if ( ! ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) ) ans = false ; System . out . println ( ans ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n ; n = sc . nextInt ( ) ; if ( n > = 64 ) { System . out . println ( 64 ) ; } else if ( n > = 32 ) { System . out . println ( 32 ) ; } else if ( n > = 16 ) { System . out . println ( 16 ) ; } else if ( n > = 8 ) { System . out . println ( 8 ) ; } else if ( n > = 4 ) { System . out . println ( 4 ) ; } else if ( n = = 3 | | n = = 2 ) { System . out . println ( 2 ) ; } else if ( n = = 1 ) { System . out . println ( 1 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; int K = Integer . parseInt ( s [ 0 ] ) ; int S = Integer . parseInt ( s [ 1 ] ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( k < = K & & k > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . lang . reflect . Array ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) , ret = 0 ; for ( int i = 0 ; i < = k ; i + + ) for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - i - j & & s - i - j < = k ) ret + = 1 ; } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; long ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j > = 0 & & s - i - j < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int a , b , c ; int five = 0 ; int seven = 0 ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; if ( a = = 5 ) { five + + ; } else if ( a = = 7 ) { seven + + ; } if ( b = = 5 ) { five + + ; } else if ( b = = 7 ) { seven + + ; } if ( c = = 5 ) { five + + ; } else if ( c = = 7 ) { seven + + ; } if ( five = = 2 ) { if ( seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long p = sc . nextLong ( ) ; long maxRoot = ( long ) Math . ceil ( Math . pow ( p , 1.0 / n ) ) ; for ( long l = maxRoot ; l > 0 ; l -- ) { if ( p % ( long ) Math . pow ( l , n ) = = 0 ) { System . out . println ( l ) ; break ; } } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int ans = 64 ; while ( num < ans ) { ans / = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int na = scan . nextInt ( ) ; int [ ] nb = new int [ na ] ; int i = 0 ; for ( i = 0 ; i < na ; i + + ) { nb [ i ] = scan . nextInt ( ) ; } int sum = 0 ; int rul = 0 ; for ( i = 0 ; i < na ; i + + ) { if ( i = = 0 ) { sum = sum + 1 ; rul = nb [ i ] ; } else if ( rul > nb [ i ] ) { sum = sum + 1 ; rul = nb [ i ] ; } } System . out . println ( sum ) ; } } import java . util . * ; public class Main { static final double H _ SPEED = 2 * Math . PI / 720 ; static final double M _ SPEED = 2 * Math . PI / 60 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double res = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( ( 60 * h + m ) * H _ SPEED - m * M _ SPEED ) ) ; System . out . println ( res ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { private static int N ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; for ( int a = 1 ; a < = 3500 ; a + + ) { for ( int b = 1 ; b < = 3500 ; b + + ) { double tmp = 4.0 / N - 1.0 / a - 1.0 / b ; if ( tmp < = 0 ) continue ; if ( isInt ( 1.0 / tmp ) ) { int c = ( int ) ( 1.0 / tmp ) ; System . out . println ( a + " " + b + " " + c ) ; return ; } } } } private static boolean isInt ( double a ) { return ( Math . abs ( a - ( int ) a ) < 0.00000001 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int standard = 1 ; while ( true ) { int target = standard * 2 ; if ( target < = n ) { standard = target ; } else { break ; } } System . out . println ( standard ) ; } } public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = s . nextInt ( ) ; int max = a [ 0 ] ; int min = a [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < = max & & a [ i ] < min ) { count + + ; min = a [ i ] ; } else { max = a [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; boolean ch = true ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; out : for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] < = k ) ch = true ; else { ch = false ; break out ; } } } if ( ch = = true ) System . out . print ( " Yay ! " ) ; else System . out . print ( " : ( " ) ; } } 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 [ ] sa = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( sa [ 0 ] ) ; long x = Integer . parseInt ( sa [ 1 ] ) ; sa = br . readLine ( ) . split ( " " ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sa [ i ] ) ; } br . close ( ) ; int [ ] mins = new int [ n ] ; System . arraycopy ( a , 0 , mins , 0 , n ) ; long ans = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { mins [ i ] = Math . min ( mins [ i ] , a [ minus ( i , k , n ) ] ) ; sum + = mins [ i ] ; } ans = Math . min ( ans , sum + k * x ) ; } System . out . println ( ans ) ; } static int minus ( int a , int b , int n ) { int c = a - b ; if ( c < 0 ) { c + = n ; } return c ; } static int plus ( int a , int b , int n ) { int c = a + b ; if ( c > = n ) { c - = n ; } return c ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int H = scan . nextInt ( ) ; int R = scan . nextInt ( ) ; int t ; t = H + R ; if ( t = = 0 ) { System . out . println ( 0 ) ; } else if ( t > 0 ) { System . out . println ( 1 ) ; } else if ( t < 0 ) { System . out . println ( - 1 ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . reflect . Array ; import java . util . * ; public class Main { static FastReader in ; static StringBuilder out ; public static double dist ( int x1 , int b , double angle ) { double x2 = b * Math . cos ( angle ) , y2 = b * Math . sin ( angle ) ; return Math . sqrt ( Math . pow ( ( x2 - x1 ) , 2 ) + y2 * y2 ) ; } public static void main ( String [ ] args ) { in = new FastReader ( ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) , h = in . nextInt ( ) , m = in . nextInt ( ) ; double minAn = 2 * Math . PI / 60 ; minAn = minAn * ( m % 60 ) ; double houAn = 2 * Math . PI / 720 ; houAn = houAn * ( ( ( h * 60 ) + m ) % 720 ) ; System . out . println ( dist ( a , b , Math . abs ( houAn - minAn ) ) ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . * ; public class Main { static void bubbleSort ( int [ ] arr ) { int n = arr . length ; int temp = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 1 ; j < ( n - i ) ; j + + ) { if ( arr [ j - 1 ] > arr [ j ] ) { temp = arr [ j - 1 ] ; arr [ j - 1 ] = arr [ j ] ; arr [ j ] = temp ; } } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; arr [ 0 ] = sc . nextInt ( ) ; arr [ 1 ] = sc . nextInt ( ) ; arr [ 2 ] = sc . nextInt ( ) ; bubbleSort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = N ; 0 < i ; i -- ) { for ( int j = 0 ; j < N ; j + + ) { if ( i = = Math . pow ( 2 , j ) ) { System . out . println ( i ) ; return ; } } } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . nextLine ( ) ) ; String line = scanner . nextLine ( ) ; String [ ] split = line . split ( " " ) ; List < Integer > intList = new ArrayList < Integer > ( ) ; for ( String s : split ) { intList . add ( Integer . parseInt ( s ) ) ; } int cnt = 1 ; int min = intList . get ( 0 ) ; for ( int i = 1 ; i < intList . size ( ) ; i + + ) { int target = intList . get ( i ) ; if ( target < = min ) { cnt + + ; min = target ; } } int result = cnt ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int tmp = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; if ( tmp > p [ i ] ) { tmp = p [ i ] ; count + + ; } } System . out . println ( count ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } boolean s = true ; for ( int i = 0 ; i < 6 ; i + + ) { for ( int j = i ; j < 6 ; j + + ) { if ( a [ 5 ] < Math . abs ( a [ i ] - a [ j ] ) ) { s = false ; break ; } } } System . out . println ( ( s ) ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; set . add ( s ) ; } char target = ' Y ' ; if ( set . contains ( String . valueOf ( target ) ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF _ 8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } Main ( BufferedReader in ) throws IOException { String [ ] tokens = in . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( tokens [ 0 ] ) ; int B = Integer . parseInt ( tokens [ 1 ] ) ; int H = Integer . parseInt ( tokens [ 2 ] ) ; int M = Integer . parseInt ( tokens [ 3 ] ) ; int totalMin = 60 * H + M ; double hourRatio = ( double ) totalMin / ( double ) ( 12 * 60 ) ; double hourX = ( double ) A * Math . sin ( 2 . * Math . PI * hourRatio ) ; double hourY = ( double ) A * Math . cos ( 2 . * Math . PI * hourRatio ) ; double minuteRatio = ( double ) M / ( double ) 60 ; double minuteX = ( double ) B * Math . sin ( 2 . * Math . PI * minuteRatio ) ; double minuteY = ( double ) B * Math . cos ( 2 . * Math . PI * minuteRatio ) ; double distance = Math . sqrt ( Math . pow ( hourX - minuteX , 2.0 ) + Math . pow ( hourY - minuteY , 2.0 ) ) ; System . out . println ( distance ) ; } void calc ( ) { } void showResult ( ) { } } import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < = 100 ; i + + ) { b [ 0 ] = i ; a [ 0 ] = c [ 0 ] [ 0 ] - i ; a [ 1 ] = c [ 1 ] [ 0 ] - i ; a [ 2 ] = c [ 2 ] [ 0 ] - i ; b [ 1 ] = c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] + i ; b [ 2 ] = c [ 0 ] [ 2 ] - c [ 0 ] [ 0 ] + i ; int d = 0 ; for ( int j = 1 ; j < = 2 ; j + + ) { for ( int k = 1 ; k < = 2 ; k + + ) { if ( a [ j ] + b [ k ] ! = c [ j ] [ k ] ) d + + ; } } if ( d = = 0 ) { out . println ( " Yes " ) ; break ; } else if ( i = = 100 ) out . println ( " No " ) ; } } } import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] word = new int [ 3 ] ; word [ 0 ] = sc . nextInt ( ) ; word [ 1 ] = sc . nextInt ( ) ; word [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( word ) ; String out ; if ( word [ 0 ] = = 5 & & word [ 1 ] = = 5 & & word [ 2 ] = = 7 ) { out = " YES " ; } else { out = " NO " ; } System . out . println ( out ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 1 ; while ( true ) { if ( i > N ) { break ; } i * = 2 ; } if ( i = = 1 ) { System . out . println ( " 1 " ) ; } else System . out . println ( i / 2 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; String answer = " Yay ! " ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antennas [ j ] - antennas [ i ] > k ) { answer = " : ( " ; } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( ( int ) ( Math . pow ( 2 , ( int ) ( Math . log10 ( n ) / Math . log10 ( 2 ) ) ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; if ( S . contains ( " 1 " ) & & S . contains ( " 9 " ) & & S . contains ( " 7 " ) & & S . contains ( " 4 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; ArrayList < Integer > p = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { p . add ( scanner . nextInt ( ) ) ; } int count = 0 ; int min = Collections . max ( p ) ; for ( int i = 0 ; i < n ; i + + ) { if ( p . get ( i ) < = min ) { min = p . get ( i ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; String p = " P " ; String w = " W " ; String g = " G " ; String y = " Y " ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( p . equals ( s [ i ] ) ) { count + + ; p = " " ; } if ( w . equals ( s [ i ] ) ) { count + + ; w = " " ; } if ( g . equals ( s [ i ] ) ) { count + + ; g = " " ; } if ( y . equals ( s [ i ] ) ) { count + + ; y = " " ; } } switch ( count ) { case 1 : System . out . println ( " One " ) ; break ; case 2 : System . out . println ( " Two " ) ; break ; case 3 : System . out . println ( " Three " ) ; break ; case 4 : System . out . println ( " Four " ) ; break ; default : break ; } } } import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; sum + = a [ i ] ; } int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; sum - = b [ i ] ; } if ( sum < 0 ) { System . out . println ( - 1 ) ; return ; } int d [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { d [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( d ) ; int i , ii ; long diff = 0 ; for ( i = 0 ; i < n ; i + + ) { if ( d [ i ] > = 0 ) break ; diff + = d [ i ] ; } for ( ii = n - 1 ; ii > = 0 ; ii -- ) { if ( diff > = 0 ) break ; diff + = d [ ii ] ; } System . out . println ( i + ( n - 1 - ii ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long gap = 0 ; long sum = 0 ; int n = 0 ; for ( int i = 0 ; i < N ; i + + ) { long Ai = scn . nextLong ( ) ; A [ i ] = Ai ; sum + = Ai ; } for ( int i = 0 ; i < N ; i + + ) { long Bi = scn . nextLong ( ) ; B [ i ] = Bi ; sum - = Bi ; if ( Bi > A [ i ] ) { gap + = Bi - A [ i ] ; n + + ; } C [ i ] = A [ i ] - B [ i ] ; } if ( sum > = 0 ) { Arrays . sort ( C ) ; for ( int i = C . length - 1 ; i > = 0 ; i -- ) { if ( gap < = 0 ) { break ; } gap - = C [ i ] ; n + + ; } } else { n = - 1 ; } System . out . println ( n ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = ( s - x - y ) & & ( s - x - y ) < = k ) { count + = 1 ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x5 = 0 ; int x7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int x = sc . nextInt ( ) ; if ( x = = 5 ) x5 + + ; else if ( x = = 7 ) x7 + + ; else System . out . println ( " NO " ) ; } if ( x5 = = 2 & & x7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] T = new int [ D ] ; for ( int i = 0 ; i < D ; + + i ) { T [ i ] = sc . nextInt ( ) ; } int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] C = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { A [ i ] = sc . nextInt ( ) ; B [ i ] = sc . nextInt ( ) ; C [ i ] = sc . nextInt ( ) ; } int [ ] [ ] dp = new int [ D ] [ N ] ; for ( int [ ] a : dp ) { Arrays . fill ( a , - 1 ) ; } for ( int i = 0 ; i < N ; + + i ) { if ( A [ i ] < = T [ 0 ] & & T [ 0 ] < = B [ i ] ) dp [ 0 ] [ i ] = 0 ; } for ( int i = 1 ; i < D ; + + i ) { for ( int j = 0 ; j < N ; + + j ) { if ( A [ j ] < = T [ i ] & & T [ i ] < = B [ j ] ) { for ( int k = 0 ; k < N ; + + k ) { if ( dp [ i - 1 ] [ k ] < 0 ) continue ; dp [ i ] [ j ] = Math . max ( dp [ i ] [ j ] , dp [ i - 1 ] [ k ] + Math . abs ( C [ j ] - C [ k ] ) ) ; } } } } int ans = 0 ; for ( int i = 0 ; i < N ; + + i ) { ans = Math . max ( ans , dp [ D - 1 ] [ i ] ) ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; int k ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int Z = S - i - j ; if ( Z > = 0 & & Z < = K ) { ans + + ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antenna = new int [ 5 ] ; boolean can = true ; for ( int i = 0 ; i < 5 ; i + + ) { antenna [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { int distance = antenna [ j ] - antenna [ i ] ; if ( distance > k ) { can = false ; break ; } } } if ( can ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; class Point { int x ; int y ; int z ; Point ( int a , int b , int c ) { this . x = a ; this . y = b ; this . z = c ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int [ ] [ ] V = new int [ 3 ] [ 3 ] ; V [ 0 ] [ 0 ] = 0 ; V [ 1 ] [ 0 ] = 0 ; V [ 2 ] [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( j > 0 ) { V [ i ] [ j ] = C [ i ] [ j ] - C [ i ] [ j - 1 ] ; } } } if ( V [ 0 ] [ 0 ] = = V [ 1 ] [ 0 ] & & V [ 1 ] [ 0 ] = = V [ 2 ] [ 0 ] ) { if ( V [ 0 ] [ 1 ] = = V [ 1 ] [ 1 ] & & V [ 1 ] [ 1 ] = = V [ 2 ] [ 1 ] ) { if ( V [ 0 ] [ 2 ] = = V [ 1 ] [ 2 ] & & V [ 1 ] [ 2 ] = = V [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] list = new int [ 5 ] ; Scanner sc = new Scanner ( System . in ) ; list [ 0 ] = sc . nextInt ( ) ; list [ 1 ] = sc . nextInt ( ) ; list [ 2 ] = sc . nextInt ( ) ; list [ 3 ] = sc . nextInt ( ) ; list [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String result = " Yay ! " ; boolean error = false ; for ( int i = 0 ; i < list . length ; i + + ) { for ( int j = i + 1 ; j < list . length ; j + + ) { if ( list [ j ] - list [ i ] > k ) { result = " : ( " ; error = true ; break ; } } if ( error ) break ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int sum = scanner . nextInt ( ) ; int count = 0 ; int i = 0 , j = 0 , k = 0 ; for ( i = 0 ; i < = n ; i + + ) { for ( j = 0 ; j < = n ; j + + ) { for ( k = 0 ; k < = n ; k + + ) { if ( i + j + k < = sum ) { k = Math . min ( n , sum - i - j ) ; if ( i + j + k < = sum ) { j = Math . min ( n , sum - i - k ) ; if ( i + j + k < = sum ) { i = Math . min ( n , sum - j - k ) ; } } } else { break ; } if ( ( i + j + k ) = = sum ) count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n = = 1 ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } int count = 0 ; int tmpCount = 0 ; int outputNum = 0 ; for ( int i = n ; i > 0 ; i -- ) { if ( i % 2 = = 0 ) { int tmp = i ; while ( true ) { if ( tmp % 2 = = 0 ) { tmp / = 2 ; tmpCount + + ; } else { break ; } } if ( count < tmpCount ) { outputNum = i ; count = tmpCount ; } } tmpCount = 0 ; } System . out . println ( outputNum ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long x , kk , ans ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; long [ ] [ ] dp = new long [ n + 500 ] [ n + 500 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 9000000000000000000L ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { dp [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = i - k ; if ( pi < = 0 ) pi = n + pi ; if ( dp [ i ] [ k - 1 ] > = a [ pi ] ) dp [ i ] [ k ] = a [ pi ] ; else dp [ i ] [ k ] = dp [ i ] [ k - 1 ] ; } } long sum = 0 ; for ( int k = 0 ; k < n ; k + + ) { sum = 0 ; for ( int i = 1 ; i < = n ; i + + ) { sum + = dp [ i ] [ k ] ; } if ( sum + k * x < ans ) ans = sum + k * x ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer Haiku [ ] = new Integer [ 3 ] ; int sum = 0 ; for ( int i = 0 ; i < Haiku . length ; i + + ) { Haiku [ i ] = scanner . nextInt ( ) ; sum + = Haiku [ i ] ; } String ans = " NO " ; if ( sum = = 17 & & Arrays . asList ( Haiku ) . contains ( 5 ) & & Arrays . asList ( Haiku ) . contains ( 7 ) ) { ans = " YES " ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int K2 = K * 2 ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { if ( K2 + X > = S ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int sxy = S - X - Y ; if ( 0 < = sxy & & sxy < = K ) { count + + ; } } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; boolean check = true ; if ( N > = 2 ) { while ( N > 0 ) { ans + + ; N = N / 2 ; } } else { check = false ; } if ( check = = false ) { System . out . println ( N ) ; } else { System . out . println ( ( int ) Math . pow ( 2 , ( ans - 1 ) ) ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . Arrays ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int [ ] unko = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { unko [ i ] = sc . nextInt ( ) ; } Arrays . sort ( unko ) ; if ( unko [ 0 ] = = 1 & & unko [ 1 ] = = 4 & & unko [ 2 ] = = 7 & & unko [ 3 ] = = 9 ) { pl ( " YES " ) ; } else { pl ( " NO " ) ; } } public static void pl ( Object o ) { System . out . println ( o ) ; } public static void pl ( ) { System . out . println ( ) ; } public static void p ( Object o ) { System . out . print ( o ) ; } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { 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 ( ) ; } long ans = A [ 0 ] - 1 ; int max = 2 ; for ( int i = 1 ; i < N ; i + + ) { if ( A [ i ] = = max ) max + + ; else if ( A [ i ] > max ) { ans + = ( A [ i ] - 1 ) / max ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z = sc . nextInt ( ) ; if ( x = = 5 & & y = = 7 & & z = = 5 ) { System . out . println ( " YES " ) ; } else if ( x = = 5 & & y = = 5 & & z = = 7 ) { System . out . println ( " YES " ) ; } else if ( x = = 7 & & y = = 5 & & z = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) { count + = 1 ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int k = scanner . nextInt ( ) , s = scanner . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = Math . max ( 0 , s - x - k ) ; y < = Math . min ( k , s - x ) ; y + + ) { int z = s - x - y ; if ( ( z > = 0 ) & & ( z < = k ) ) { count + + ; } } } System . out . println ( count ) ; } } } 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 [ ] inp = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( inp [ 0 ] ) ; int b = Integer . parseInt ( inp [ 1 ] ) ; int c = Integer . parseInt ( inp [ 2 ] ) ; if ( a < 5 | | a > 7 | | b < 5 | | b > 7 | | c < 5 | | c > 7 ) { System . out . println ( " NO " ) ; } else if ( ( a + b + c ) = = 17 ) { if ( a ! = 6 & & b ! = 6 & & c ! = 6 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = Math . abs ( Math . max ( Math . max ( a , b ) , c ) - Math . min ( Math . min ( a , b ) , c ) ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long k = 1 ; k < = 3500 ; k + + ) { if ( 4 * h * k - n * ( h + k ) = = 0 ) { continue ; } if ( n * h * k % ( 4 * h * k - n * ( h + k ) ) ! = 0 ) { continue ; } long w = n * h * k / ( 4 * h * k - n * ( h + k ) ) ; if ( w < = 0 ) { continue ; } System . out . printf ( " % d % d % d % n " , h , k , w ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scn = new Scanner ( System . in ) ) { int A = scn . nextInt ( ) ; int B = scn . nextInt ( ) ; int H = scn . nextInt ( ) ; int M = scn . nextInt ( ) ; double longAngle = M * 6 ; double shortAngle = H * ( 360 / 12 ) + M * 0.5 ; double angle = 0 ; if ( longAngle < shortAngle ) { longAngle = 360 + longAngle ; angle = longAngle - shortAngle ; } else { angle = longAngle - shortAngle ; } System . out . println ( Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int ans = a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ; System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . File ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static final long MOD = ( long ) 1e9 + 7 ; static final int MAX = ( int ) 1e5 + 1 ; public static void main ( String [ ] args ) throws IOException { MyScanner sc = new MyScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; long [ ] fact = new long [ MAX ] ; fact [ 0 ] = fact [ 1 ] = 1 ; for ( int i = 2 ; i < MAX ; i + + ) fact [ i ] = ( i * fact [ i - 1 ] ) % MOD ; if ( n = = m ) out . println ( ( ( ( fact [ n ] * fact [ m ] ) % MOD ) < < 1 ) % MOD ) ; else if ( n + 1 = = m | | n - 1 = = m ) out . println ( ( fact [ n ] * fact [ m ] ) % MOD ) ; else out . println ( 0 ) ; out . flush ( ) ; out . close ( ) ; } static class MyScanner { StringTokenizer st ; BufferedReader br ; public MyScanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public MyScanner ( String file ) throws IOException { br = new BufferedReader ( new FileReader ( new File ( file ) ) ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; boolean G = false , W = false , P = false , Y = false ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " G " ) & & ! G ) { G = true ; ans + + ; } if ( s . equals ( " P " ) & & ! P ) { P = true ; ans + + ; } if ( s . equals ( " W " ) & & ! W ) { W = true ; ans + + ; } if ( s . equals ( " Y " ) & & ! Y ) { Y = true ; ans + + ; } } if ( ans = = 3 ) System . out . println ( " Three " ) ; else if ( ans = = 4 ) System . out . println ( " Four " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > num = new ArrayList < Integer > ( ) ; ArrayList < String > param = new ArrayList < String > ( ) ; while ( sc . hasNext ( ) ) { if ( sc . hasNextInt ( ) ) { num . add ( sc . nextInt ( ) ) ; } else { param . add ( sc . nextLine ( ) ) ; } } Method ( num , param ) ; } static void Method ( ArrayList < Integer > num , ArrayList < String > param ) { int count = 0 ; if ( num . get ( 0 ) = = 7 ) count + = 7 ; if ( num . get ( 0 ) = = 5 ) count + = 5 ; if ( num . get ( 1 ) = = 7 ) count + = 7 ; if ( num . get ( 1 ) = = 5 ) count + = 5 ; if ( num . get ( 2 ) = = 7 ) count + = 7 ; if ( num . get ( 2 ) = = 5 ) count + = 5 ; if ( count = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ret = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ret + + ; } } } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; int c = input . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ansi = 1 ; int ans = 0 ; int tmp = 0 ; int X = 0 ; for ( int i = 1 ; i < N + 1 ; i + + ) { tmp = 0 ; X = i ; for ( ; X % 2 = = 0 ; ) { tmp + + ; X = X / 2 ; } if ( tmp > ans ) { ans = tmp ; ansi = i ; } } System . out . println ( ansi ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = n ; i * = 2 ) if ( n < i * 2 ) System . out . println ( i ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String [ ] strs = sc . nextLine ( ) . split ( " " ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { list . add ( Integer . parseInt ( strs [ i ] ) ) ; } Collections . sort ( list ) ; if ( list . get ( 0 ) = = 1 & & list . get ( 1 ) = = 4 & & list . get ( 2 ) = = 7 & & list . get ( 3 ) = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; double A = s . nextDouble ( ) ; double B = s . nextDouble ( ) ; double H = s . nextDouble ( ) ; double M = s . nextDouble ( ) ; double Atheta = ( ( 60 * H + M ) / 360 ) * Math . PI ; double Btheta = ( M / 30 ) * Math . PI ; double deltaA = Math . pow ( ( A * ( Math . cos ( Atheta ) ) - B * ( Math . cos ( Btheta ) ) ) , 2 ) ; double deltaB = Math . pow ( ( A * ( Math . sin ( Atheta ) ) - B * ( Math . sin ( Btheta ) ) ) , 2 ) ; System . out . println ( Math . sqrt ( deltaA + deltaB ) ) ; } } import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } Scanner sc = new Scanner ( System . in ) ; void run ( ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } PriorityQueue < Integer > pq = new PriorityQueue < Integer > ( ) ; long loss = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < b [ i ] ) { ans + + ; loss + = b [ i ] - a [ i ] ; } else { pq . add ( b [ i ] - a [ i ] ) ; } } if ( ans = = 0 ) { System . out . println ( 0 ) ; return ; } for ( ; ! pq . isEmpty ( ) ; ) { ans + + ; loss + = pq . poll ( ) ; if ( loss < = 0 ) { System . out . println ( ans ) ; return ; } } System . out . println ( - 1 ) ; } } 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 ) ; BHinaArare solver = new BHinaArare ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BHinaArare { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; boolean four = false ; for ( int i = 0 ; i < n ; i + + ) { char c = in . next ( ) . charAt ( 0 ) ; if ( c = = ' Y ' ) four = true ; } out . println ( four ? " Four " : " Three " ) ; } } 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 . * ; public class Main { public static void main ( String [ ] args ) { int k , s , l , cnt = 0 ; Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { l = s - ( i + j ) ; if ( l > = 0 & & l < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int ans = 1000 ; ans = Math . min ( ans , Math . abs ( a1 - a2 ) + Math . abs ( a1 - a3 ) ) ; ans = Math . min ( ans , Math . abs ( a2 - a1 ) + Math . abs ( a2 - a3 ) ) ; ans = Math . min ( ans , Math . abs ( a3 - a1 ) + Math . abs ( a3 - a2 ) ) ; System . out . println ( ans ) ; } } import java . util . stream . IntStream ; import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int [ ] a = IntStream . range ( 0 , 3 ) . map ( i - > Integer . parseInt ( sc . next ( ) ) ) . sorted ( ) . toArray ( ) ; int ans = 0 ; for ( int i = 1 ; i > = 0 ; i -- ) { ans + = ( int ) Math . abs ( a [ i ] - a [ i + 1 ] ) ; } out . println ( ans ) ; out . flush ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int sum1 = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; int sum2 = c [ 2 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] ; int sum3 = c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 0 ] [ 2 ] ; if ( sum1 = = sum2 & & sum2 = = sum3 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] a _ str = in . readLine ( ) . split ( " " ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = Integer . parseInt ( a _ str [ 0 ] ) ; a [ 1 ] = Integer . parseInt ( a _ str [ 1 ] ) ; a [ 2 ] = Integer . parseInt ( a _ str [ 2 ] ) ; int min = Math . min ( Math . min ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; int sum = a [ 0 ] + a [ 1 ] + a [ 2 ] ; int max = Math . max ( Math . max ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; System . out . println ( max - ( sum - min - max ) + ( sum - min - max ) - min ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . List ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) throws Exception { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < String > inputNumbers = Arrays . asList ( br . readLine ( ) . split ( " " ) ) ; List < Integer > numbers = new ArrayList < > ( ) ; for ( String inputNumber : inputNumbers ) { numbers . add ( Integer . parseInt ( inputNumber ) ) ; } numbers . sort ( ( i1 , i2 ) - > i1 - i2 ) ; int firstCost = numbers . get ( 1 ) - numbers . get ( 0 ) ; int secondCost = numbers . get ( 2 ) - numbers . get ( 1 ) ; int sumCost = firstCost + secondCost ; System . out . println ( sumCost ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TripletSum solver = new TripletSum ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TripletSum { public void solve ( int testNumber , FastReader fs , PrintWriter pw ) { int k = fs . nextInt ( ) , Sum = fs . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int p = Sum - i - j ; if ( p < 0 | | p > k ) continue ; ans + = 1 ; } } pw . println ( ans ) ; } } static class FastReader { BufferedReader bf ; StringTokenizer st ; public FastReader ( InputStream is ) { bf = new BufferedReader ( new InputStreamReader ( is ) ) ; st = null ; } public String next ( ) { try { while ( st = = null | | ! st . hasMoreTokens ( ) ) { String line = bf . readLine ( ) ; if ( line = = null ) return null ; st = new StringTokenizer ( line ) ; } } catch ( Exception e ) { } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String x = " NO " ; if ( a = = 5 ) { if ( ( b = = 5 ) & & ( c = = 7 ) ) { x = " YES " ; } else if ( ( b = = 7 ) & & ( c = = 5 ) ) { x = " YES " ; } } else if ( a = = 7 ) { if ( ( b = = 5 ) & & ( c = = 5 ) ) { x = " YES " ; } } System . out . println ( x ) ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int map [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int h = 0 ; h < 3 ; h + + ) { for ( int w = 0 ; w < 3 ; w + + ) { map [ h ] [ w ] = sc . nextInt ( ) ; } } int dw1 = map [ 0 ] [ 1 ] - map [ 0 ] [ 0 ] ; if ( dw1 ! = map [ 1 ] [ 1 ] - map [ 1 ] [ 0 ] | | dw1 ! = map [ 2 ] [ 1 ] - map [ 2 ] [ 0 ] ) { answer ( false ) ; return ; } int dw2 = map [ 0 ] [ 2 ] - map [ 0 ] [ 1 ] ; if ( dw2 ! = map [ 1 ] [ 2 ] - map [ 1 ] [ 1 ] | | dw2 ! = map [ 2 ] [ 2 ] - map [ 2 ] [ 1 ] ) { answer ( false ) ; return ; } int dh1 = map [ 1 ] [ 0 ] - map [ 0 ] [ 0 ] ; if ( dh1 ! = map [ 1 ] [ 1 ] - map [ 0 ] [ 1 ] | | dh1 ! = map [ 1 ] [ 2 ] - map [ 0 ] [ 2 ] ) { answer ( false ) ; return ; } int dh2 = map [ 2 ] [ 0 ] - map [ 1 ] [ 0 ] ; if ( dh2 ! = map [ 2 ] [ 1 ] - map [ 1 ] [ 1 ] | | dh2 ! = map [ 2 ] [ 2 ] - map [ 1 ] [ 2 ] ) { answer ( false ) ; return ; } answer ( true ) ; } private static void answer ( boolean ans ) { if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; if ( n [ 0 ] = = 1 & & n [ 1 ] = = 4 & & n [ 2 ] = = 7 & & n [ 3 ] = = 9 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int ans = 1 ; while ( N / 2 > 0 ) { ans * = 2 ; N / = 2 ; } System . out . println ( ans ) ; reader . close ( ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double hour = 2 * Math . PI * ( H / 12.0 + M / 60.0 / 12.0 ) ; double min = 2 * Math . PI * M / 60.0 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( hour - min ) ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( S [ i ] . equals ( " 5 " ) ) { count5 + + ; } else if ( S [ i ] . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( ( s - ( x + y ) ) > = 0 & & ( s - ( x + y ) ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } 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 ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] sa = br . readLine ( ) . split ( " " ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sa [ i ] ) ; } br . close ( ) ; int ans = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { ans + + ; min = p [ i ] ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) , ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int num = s - i - j ; if ( 0 < = num & & num < = k ) ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double hdeg = h / 12 * 360 + ( m / 60 ) * 30 ; double mdeg = m / 60 * 360 ; double deg = Math . min ( Math . abs ( hdeg - mdeg ) , Math . abs ( 360 - ( hdeg - mdeg ) ) ) ; double ans = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( deg ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int number [ ] = new int [ n ] ; int mini = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) number [ i ] = scan . nextInt ( ) ; scan . close ( ) ; for ( int j = 0 ; j < n ; j + + ) { mini = Math . min ( mini , number [ j ] ) ; if ( mini > = number [ j ] ) count + + ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double l = ( h / 6 + m / 360 ) ; double s = ( m / 30 ) ; double kakudo = Math . abs ( s - l ) * Math . PI ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( kakudo ) ) ; System . out . println ( ans ) ; } } 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 ) ) ; int line = Integer . parseInt ( br . readLine ( ) ) ; if ( line = = 1 ) { System . out . println ( line ) ; } else { int x = 1 ; for ( ; x < = line ; ) { x = x * 2 ; } x = x / 2 ; System . out . println ( x ) ; } } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { private static boolean debug = false ; private static boolean elapsed = false ; private static PrintWriter _ out = new PrintWriter ( System . out ) ; private static PrintWriter _ err = new PrintWriter ( System . err ) ; private void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; int max = - 1 ; int maxNum = - 1 ; for ( int i = 1 ; i < = n ; + + i ) { int ct = 0 ; int j = i ; while ( j % 2 = = 0 ) { + + ct ; j / = 2 ; } if ( ct > max ) { max = ct ; maxNum = i ; } } _ out . println ( maxNum ) ; } private static BigInteger C ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } for ( long i = r ; i > 1 ; -- i ) { res = res . divide ( BigInteger . valueOf ( i ) ) ; } return res ; } private static BigInteger P ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } return res ; } public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _ out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _ err . println ( ( G - S ) + " ms " ) ; } _ err . flush ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d , e , k , temp ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; e = sc . nextInt ( ) ; k = sc . nextInt ( ) ; if ( a - b > 0 ) { temp = a ; a = b ; b = temp ; } if ( a - c > 0 ) { temp = a ; a = b ; b = temp ; } if ( a - d > 0 ) { temp = a ; a = b ; b = temp ; } if ( a - e > 0 ) { temp = a ; a = b ; b = temp ; } if ( e - b < 0 ) { temp = e ; e = b ; b = temp ; } if ( e - c < 0 ) { temp = e ; e = b ; b = temp ; } if ( e - d < 0 ) { temp = e ; e = b ; b = temp ; } if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a < = k & & c - a < = k & & d - a < = k & & e - a < = k & & c - b < = k & & d - b < = k & & e - b < = k & & d - c < = k & & e - c < = k & & e - d < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int max = 999999 ; int tmp ; int c = 0 ; for ( int i = 0 ; i < n ; i + + ) { tmp = sc . nextInt ( ) ; if ( tmp < max ) { max = tmp ; c + + ; } } System . out . println ( c ) ; return ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = a [ 1 ] & & a [ 0 ] = = 5 & & a [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { static int gcd ( int a , int b ) { return b > 0 ? gcd ( b , a % b ) : a ; } static int mod = 998244353 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double Arad = H + ( double ) M / 60 ; double Brad = ( double ) M ; double Ax = A * Math . cos ( Math . toRadians ( 90 - Arad * 30 ) ) ; double Ay = A * Math . sin ( Math . toRadians ( 90 - Arad * 30 ) ) ; double Bx = B * Math . cos ( Math . toRadians ( 90 - Brad * 6 ) ) ; double By = B * Math . sin ( Math . toRadians ( 90 - Brad * 6 ) ) ; System . out . println ( Math . sqrt ( ( Bx - Ax ) * ( Bx - Ax ) + ( By - Ay ) * ( By - Ay ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < = 8 ; i + + ) { if ( Math . pow ( 2 , i ) < = N & & N < Math . pow ( 2 , i + 1 ) ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } } } } import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( Arrays . stream ( scanner . nextLine ( ) . split ( " " ) ) . sorted ( ) . collect ( Collectors . toList ( ) ) . equals ( Arrays . asList ( " 5 " , " 5 " , " 7 " ) ) ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 1 ; int ans = 1 ; while ( true ) { if ( n < num ) { break ; } else { ans = num ; num * = 2 ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int minNum = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int maxNum = sc . nextInt ( ) ; int limit = sc . nextInt ( ) ; String ans ; if ( maxNum - minNum > limit ) { ans = " : ( " ; } else { ans = " Yay ! " ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int con = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int item = sc . nextInt ( ) ; if ( min > item ) { min = item ; } if ( min > = item ) { con + + ; } } System . out . println ( con ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z < = K & & Z > = 0 ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; scanner . close ( ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { Integer bar [ ] = { 1 , 9 , 7 , 4 } ; int in _ bar [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { in _ bar [ i ] = sc . nextInt ( ) ; } int ok _ count = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = 0 ; j < 4 ; j + + ) { if ( bar [ i ] = = in _ bar [ j ] ) { ok _ count + + ; break ; } } } if ( ok _ count = = 4 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . charset . StandardCharsets ; import java . util . * ; public class Main { int [ ] inputArray ; public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int input = sc . nextInt ( ) ; int n = 1 ; while ( true ) { if ( n > input ) { n / = 2 ; break ; } n * = 2 ; } if ( input = = 1 ) System . out . println ( 1 ) ; else System . out . println ( n ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int hour = scan . nextInt ( ) ; int minute = scan . nextInt ( ) ; double rad = Math . PI * 2 * ( ( double ) hour / 12.0 + ( ( double ) minute / 60.0 ) / 12.0 - ( double ) minute / 60.0 ) ; double len = ( double ) ( b * b + a * a ) - ( double ) ( 2 * b * a ) * Math . cos ( rad ) ; System . out . printf ( " % .20f " , Math . sqrt ( len ) ) ; scan . close ( ) ; } } 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 ( ) ; ArrayList < Integer > numList = new ArrayList < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { numList . add ( sc . nextInt ( ) ) ; } int min = numList . get ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { if ( numList . get ( i ) < min ) { min = numList . get ( i ) ; } if ( numList . get ( i ) < = min ) { ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . HashMap ; import java . util . ArrayList ; import java . util . Scanner ; import java . util . regex . Pattern ; public class Main { public static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) throws Exception { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) , x = sc . nextLong ( ) ; long [ ] a = new long [ ( int ) N ] ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = sc . nextLong ( ) ; } long ans = 1L < < 60 ; long [ ] amemo = new long [ ( int ) N ] ; for ( int i = 0 ; i < N ; i + + ) { amemo [ i ] = 1L < < 60 ; } for ( long i = 0 ; i < N ; i + + ) { long memo = i * x ; for ( long j = 0 ; j < N ; j + + ) { amemo [ ( int ) j ] = Math . min ( amemo [ ( int ) j ] , a [ ( int ) ( ( j - i + N ) % N ) ] ) ; memo + = amemo [ ( int ) j ] ; } ans = Math . min ( ans , memo ) ; } 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 ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . * ; import java . math . * ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K & & S - i > = 0 ; i + + ) { int sum = S - i ; if ( sum < = K ) { count + = sum + 1 ; } else { int dif = Math . max ( 0 , 2 * K - sum + 1 ) ; count + = dif ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double hd = ( 60 * h + m ) * 0.5 ; double md = m * 6 ; double r = 0.000000000 ; if ( hd < md ) { r = md - hd ; if ( r > 180 ) { r = 360 - r ; } double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( r * Math . PI / 180 ) ) ; System . out . println ( ans ) ; } else if ( hd > md ) { r = hd - md ; if ( r > 180 ) { r = 360 - r ; } double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( r * Math . PI / 180 ) ) ; System . out . println ( ans ) ; } else { System . out . println ( Math . abs ( a - b ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveA ( ) ; } private void solveA ( ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( sc . nextInt ( ) ) { case 5 : five + + ; break ; case 7 : seven + + ; break ; default : } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( sc . next ( ) ) ; } } for ( int i = 0 ; i < = c [ 0 ] [ 0 ] ; i + + ) { int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; if ( c [ 1 ] [ 0 ] - b1 ! = c [ 1 ] [ 1 ] - b2 | | c [ 1 ] [ 1 ] - b2 ! = c [ 1 ] [ 2 ] - b3 ) { continue ; } if ( c [ 2 ] [ 0 ] - b1 ! = c [ 2 ] [ 1 ] - b2 | | c [ 2 ] [ 1 ] - b2 ! = c [ 2 ] [ 2 ] - b3 ) { continue ; } System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] P = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextLong ( ) ; } long min = Long . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < P . length ; i + + ) { if ( min > P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] pos = new int [ 5 ] ; int k ; String result ; for ( int i = 0 ; i < 5 ; i + + ) pos [ i ] = sc . nextInt ( ) ; k = sc . nextInt ( ) ; if ( pos [ 4 ] - pos [ 0 ] < = k ) result = " Yay ! " ; else result = " : ( " ; System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int c [ ] = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; + + i ) c [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < 2 ; + + i ) { int d = c [ i * 3 ] - c [ ( i + 1 ) * 3 ] ; for ( int j = 0 ; j < 3 ; + + j ) { if ( c [ i * 3 + j ] - c [ ( i + 1 ) * 3 + j ] ! = d ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 , max = 0 , ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { cnt = 0 ; int num = i ; while ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } if ( max < cnt ) { ans = i ; max = cnt ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Integer > set = new TreeSet < > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { set . add ( sc . nextInt ( ) ) ; } if ( set . contains ( 1 ) & & set . contains ( 9 ) & & set . contains ( 7 ) & & set . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N ] ; int C [ ] = new int [ N ] ; long sum _ A = 0 ; long sum _ B = 0 ; for ( int n = 0 ; n < N ; n + + ) { A [ n ] = sc . nextInt ( ) ; sum _ A + = A [ n ] ; } for ( int n = 0 ; n < N ; n + + ) { B [ n ] = sc . nextInt ( ) ; sum _ B + = B [ n ] ; C [ n ] = A [ n ] - B [ n ] ; } Arrays . sort ( C ) ; if ( sum _ A < sum _ B ) { System . out . println ( - 1 ) ; return ; } int arg = 0 ; long sum _ minus = 0 ; for ( int c : C ) { if ( c < 0 ) { sum _ minus + = Math . abs ( c ) ; arg + + ; } else { break ; } } if ( sum _ minus = = 0 ) { System . out . println ( 0 ) ; return ; } int tmp = 0 ; for ( int n = C . length - 1 ; n > 0 ; n -- ) { sum _ minus - = C [ n ] ; tmp + + ; if ( sum _ minus < = 0 ) { break ; } } System . out . println ( tmp + arg ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 0 ; int num = 1 ; while ( num < = N ) { i + + ; num * = 2 ; } i -- ; System . out . println ( ( 1 < < i ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( f - a > k ? " : ( " : " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( A = = 5 ) { five + + ; } else if ( A = = 7 ) { seven + + ; } if ( B = = 5 ) { five + + ; } else if ( B = = 7 ) { seven + + ; } if ( C = = 5 ) { five + + ; } else if ( C = = 7 ) { seven + + ; } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; boolean solved = false ; for ( long n = 1 ; n < 3501 ; n + + ) { if ( solved ) break ; for ( long w = 1 ; w < 3501 ; w + + ) { if ( solved ) break ; long denominator = 4 * n * w - N * n - N * w ; if ( denominator = = 0 ) continue ; long numerator = N * n * w ; if ( denominator > 0 & & numerator % denominator = = 0 ) { long h = numerator / denominator ; System . out . print ( h ) ; System . out . print ( " " ) ; System . out . print ( n ) ; System . out . print ( " " ) ; System . out . print ( w ) ; System . out . println ( " " ) ; solved = true ; } } } } } import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a , b , c ; a = s . nextInt ( ) ; b = s . nextInt ( ) ; c = s . nextInt ( ) ; int fiv = 0 , sev = 0 ; if ( a = = 5 ) fiv + + ; if ( a = = 7 ) sev + + ; if ( b = = 5 ) fiv + + ; if ( b = = 7 ) sev + + ; if ( c = = 5 ) fiv + + ; if ( c = = 7 ) sev + + ; if ( fiv = = 2 & & sev = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . FileNotFoundException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { new Main ( ) . run ( ) ; } final long MODULO = 1 _ 000 _ 000 _ 000 + 7 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( int h = 1 ; h < = 3500 ; + + h ) { for ( int w = 1 ; w < = 3500 ; + + w ) { if ( 4 * h * w - N * w - N * h > 0 & & N * h * w % ( 4 * h * w - N * w - N * h ) = = 0 ) { long n = N * h * w / ( 4 * h * w - N * w - N * h ) ; System . out . println ( h + " " + w + " " + n ) ; return ; } } } } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } public void solve ( ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int [ ] d = new int [ 11 ] ; d [ scan . nextInt ( ) ] + = 1 ; d [ scan . nextInt ( ) ] + = 1 ; d [ scan . nextInt ( ) ] + = 1 ; boolean answer = false ; if ( d [ 5 ] = = 2 & & d [ 7 ] = = 1 ) { answer = true ; } System . out . println ( answer ? " YES " : " NO " ) ; } } import java . util . Scanner ; class Main { static int breakNumber ( int n ) { if ( n % 2 = = 0 ) { int tmp = n ; int count = 0 ; while ( tmp > 0 ) { if ( tmp / 2 = = 1 ) { + + count ; break ; } tmp / = 2 ; + + count ; } return count ; } return 0 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 2 ; i < = N ; i + + ) ans = Math . max ( ans , breakNumber ( i ) ) ; System . out . println ( ( int ) Math . pow ( 2 , ans ) ) ; } } import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String args [ ] ) { try ( Scanner sc = new Scanner ( System . in ) ) { sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; Set < String > set = new HashSet < > ( Arrays . asList ( s ) ) ; System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] data = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { data [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( data [ i ] - data [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } int betwen = sc . nextInt ( ) ; int max = n [ 0 ] ; int min = n [ 0 ] ; for ( int i : n ) { if ( max < i ) { max = i ; } if ( min > i ) { min = i ; } } if ( max - min < = betwen ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int min = n + 1 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int next = scan . nextInt ( ) ; if ( min > next ) { min = next ; ans + + ; } } System . out . println ( ans ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean hasYellow = false ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { hasYellow = true ; break ; } } System . out . println ( hasYellow ? " Four " : " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int h = in . nextInt ( ) ; int m = in . nextInt ( ) ; double h _ ang = ( h * 30 ) + ( m * 0.5 ) ; double m _ ang = m * 6 ; double tmp = 0 ; if ( h > m ) { tmp = h _ ang - m _ ang ; } else { tmp = m _ ang - h _ ang ; } if ( tmp > 180 ) { tmp - = 360 ; } double cos = Math . cos ( Math . toRadians ( tmp ) ) ; double result = ( a * a ) + ( b * b ) - ( 2 * a * b * cos ) ; System . out . println ( Math . sqrt ( result ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - i - j & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( scanner . next ( ) ) ; } if ( set . size ( ) = = 3 ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] in = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { in [ i ] = sc . nextInt ( ) ; } Arrays . sort ( in ) ; if ( in [ 0 ] = = 5 & & in [ 1 ] = = 5 & & in [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 1 , low = arr [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i ] < low ) { sum + + ; low = arr [ i ] ; } } out . println ( sum ) ; out . close ( ) ; } 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 . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; scanner . close ( ) ; int [ ] bunsetsu = new int [ 3 ] ; bunsetsu [ 0 ] = A ; bunsetsu [ 1 ] = B ; bunsetsu [ 2 ] = C ; Arrays . sort ( bunsetsu ) ; if ( bunsetsu [ 0 ] ! = 5 | | bunsetsu [ 1 ] ! = 5 | | bunsetsu [ 2 ] ! = 7 ) { System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int a = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; int c = stdin . nextInt ( ) ; int [ ] d = IntStream . of ( a , b , c ) . sorted ( ) . toArray ( ) ; if ( d [ 0 ] = = 5 & & d [ 1 ] = = 5 & & d [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int i = 1 ; i < = 3 ; i + + ) { for ( int j = 1 ; j < = 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 = 0 ; int b1 = c [ 1 ] [ 1 ] - a1 ; int b2 = c [ 1 ] [ 2 ] - a1 ; int b3 = c [ 1 ] [ 3 ] - a1 ; boolean ans = c [ 2 ] [ 1 ] - b1 = = c [ 2 ] [ 2 ] - b2 & & c [ 2 ] [ 2 ] - b2 = = c [ 2 ] [ 3 ] - b3 & & c [ 3 ] [ 1 ] - b1 = = c [ 3 ] [ 2 ] - b2 & & c [ 3 ] [ 2 ] - b2 = = c [ 3 ] [ 3 ] - b3 ; System . out . println ( ans ? " Yes " : " No " ) ; } } import java . util . * ; import java . io . * ; class Main { void solve ( ) { int [ ] a = inintar ( 3 ) ; Arrays . sort ( a ) ; out . println ( a [ 2 ] - a [ 0 ] ) ; } public static Scanner in = new Scanner ( System . in ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } public int inint ( ) { return in . nextInt ( ) ; } public String instr ( ) { return in . next ( ) ; } public int [ ] inintar ( int num ) { int [ ] a = new int [ num ] ; for ( int i = 0 ; i < num ; i + + ) { a [ i ] = in . nextInt ( ) ; } return a ; } public char [ ] incharar ( ) { return in . next ( ) . toCharArray ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = 200000 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int current = sc . nextInt ( ) ; if ( min > = current ) { count + + ; min = current ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { new Main ( ) . exec ( sc ) ; } } public void exec ( Scanner sc ) { String s = " 575 " ; s = s . replaceFirst ( sc . next ( ) , " " ) ; s = s . replaceFirst ( sc . next ( ) , " " ) ; s = s . replaceFirst ( sc . next ( ) , " " ) ; System . out . println ( s . length ( ) = = 0 ? " YES " : " NO " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > all = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 9 ; i + + ) { all . add ( sc . nextInt ( ) ) ; } boolean takahashi = true ; Integer diff1 = all . get ( 3 ) - all . get ( 0 ) ; Integer diff2 = all . get ( 4 ) - all . get ( 1 ) ; Integer diff3 = all . get ( 5 ) - all . get ( 2 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } if ( takahashi ) { diff1 = all . get ( 6 ) - all . get ( 3 ) ; diff2 = all . get ( 7 ) - all . get ( 4 ) ; diff3 = all . get ( 8 ) - all . get ( 5 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } } if ( takahashi ) { diff1 = all . get ( 1 ) - all . get ( 0 ) ; diff2 = all . get ( 4 ) - all . get ( 3 ) ; diff3 = all . get ( 7 ) - all . get ( 6 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } } if ( takahashi ) { diff1 = all . get ( 2 ) - all . get ( 1 ) ; diff2 = all . get ( 5 ) - all . get ( 4 ) ; diff3 = all . get ( 8 ) - all . get ( 7 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } } if ( takahashi ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; Arrays . sort ( line ) ; int A = Integer . parseInt ( line [ 0 ] ) ; int B = Integer . parseInt ( line [ 1 ] ) ; int C = Integer . parseInt ( line [ 2 ] ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . nextLine ( ) ; StringTokenizer st = new StringTokenizer ( s ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; a + + ; int original = ( b + 2 ) * ( b + 1 ) / 2 ; if ( b > = a ) { original - = ( b - a + 2 ) * ( b - a + 1 ) * 3 / 2 ; } if ( b > = 2 * a ) { original + = ( b - 2 * a + 2 ) * ( b - 2 * a + 1 ) * 3 / 2 ; } System . out . println ( original ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( sc . nextInt ( ) * sc . nextInt ( ) * sc . nextInt ( ) = = 175 ? " YES " : " NO " ) ; } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { resolve ( System . in , System . out ) ; } static void resolve ( InputStream is , PrintStream pw ) { Scanner sc = new Scanner ( is ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int min = p [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int pi = p [ i ] ; if ( pi < = min ) { count + + ; } min = Math . min ( min , pi ) ; } pw . println ( count ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; list . add ( d ) ; Collections . sort ( list ) ; if ( list . get ( 0 ) = = 1 & & list . get ( 1 ) = = 4 & & list . get ( 2 ) = = 7 & & list . get ( 3 ) = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc168 _ c solver = new abc168 _ c ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class abc168 _ c { public void solve ( int testNumber , Scanner fin , PrintWriter fout ) { double a = fin . nextInt ( ) ; double b = fin . nextInt ( ) ; double h = fin . nextInt ( ) ; double m = fin . nextInt ( ) ; double minAng = ( m * 6.0 ) ; double hrAng = ( h * 30.0 + minAng / 12.0 ) ; double diffAngl = Math . abs ( hrAng - minAng ) ; fout . println ( Math . sqrt ( ( a * a + b * b - 2 * a * b * Math . cos ( ( Math . toRadians ( diffAngl ) ) ) ) ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int f = 0 ; int s = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int str = sc . nextInt ( ) ; if ( str = = 5 ) { f + + ; } else if ( str = = 7 ) { s + + ; } } if ( s = = 1 & & f = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int result = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { int now = sc . nextInt ( ) ; if ( min > now ) { result + + ; min = now ; } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { private static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int K = Integer . parseInt ( scan . next ( ) ) ; int S = Integer . parseInt ( scan . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { int XY = S - i ; if ( XY < 0 ) break ; if ( XY < = 2 * K ) { for ( int j = 0 ; j < = K ; j + + ) { int X = XY - j ; if ( X < 0 ) break ; if ( X < = K ) count + + ; } } } System . out . println ( count ) ; scan . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a , b , c , d , e , k ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; c = in . nextInt ( ) ; d = in . nextInt ( ) ; e = in . nextInt ( ) ; k = in . nextInt ( ) ; if ( e - a > k ) { out . println ( " : ( " ) ; } else { out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int tmp = 1 ; if ( n = = tmp ) { System . out . println ( " 1 " ) ; } else { while ( tmp < = n ) { tmp * = 2 ; } System . out . println ( tmp / 2 ) ; } } } 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 ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int A = in . Int ( ) ; int B = in . Int ( ) ; int H = in . Int ( ) ; int M = in . Int ( ) ; double hr = Math . toRadians ( H * 30.0 + M * 0.5 ) ; double mr = Math . toRadians ( M * 6.0 ) ; double hx = A * Math . sin ( hr ) ; double hy = A * Math . cos ( hr ) ; double mx = B * Math . sin ( mr ) ; double my = B * Math . cos ( mr ) ; double dx = hx - mx ; double dy = hy - my ; double ans = Math . sqrt ( dx * dx + dy * dy ) ; out . printf ( " % .14f " , ans ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl = = null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long t1 = sc . nextLong ( ) ; long t2 = sc . nextLong ( ) ; long a1 = sc . nextLong ( ) ; long a2 = sc . nextLong ( ) ; long b1 = sc . nextLong ( ) ; long b2 = sc . nextLong ( ) ; long c1 = a1 - b1 ; long c2 = a2 - b2 ; long total = c1 * t1 + c2 * t2 ; long mid = c1 * t1 ; if ( total = = 0 ) { System . out . println ( " infinity " ) ; } else if ( ( total > 0 & & mid > 0 ) | | ( total < 0 & & mid < 0 ) ) { System . out . println ( 0 ) ; } else if ( mid % total = = 0 ) { System . out . println ( - mid / total * 2 ) ; } else { System . out . println ( - mid / total * 2 + 1 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i ! = a + 1 ; i + + ) { for ( int j = 0 ; j ! = a + 1 ; j + + ) { if ( b - i - j > = 0 & & b - i - j < = a ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Comparator ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str = reader . readLine ( ) ; String s [ ] = str . split ( " " ) ; int h = Integer . parseInt ( s [ 0 ] ) ; int r = Integer . parseInt ( s [ 1 ] ) ; int top = h + r ; int bottom = h - r ; if ( top < 0 ) { System . out . println ( " -1 " ) ; } else if ( top = = 0 ) { System . out . println ( " 0 " ) ; } else if ( top > 0 ) { System . out . println ( " 1 " ) ; } reader . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int count = 0 ; int x = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { x = Math . min ( x , a [ i ] ) ; if ( x = = a [ i ] ) { count + + ; } } System . out . println ( count ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double h = 360 / 12 * H + 0.5 * M ; double m = 6 * M ; double kaku = h - m ; if ( kaku > 180 ) { kaku = 360 - kaku ; } mat ( A , B , Math . abs ( kaku ) ) ; } public static void mat ( double A , double B , double shita ) { double kakudo = Math . toRadians ( shita ) ; double ans = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( kakudo ) ; double Ans = Math . sqrt ( ans ) ; System . out . println ( Ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int a = 0 , b = 0 ; if ( A = = 5 ) { a + + ; } else if ( A = = 7 ) { b + + ; } if ( B = = 5 ) { a + + ; } else if ( B = = 7 ) { b + + ; } if ( C = = 5 ) { a + + ; } else if ( C = = 7 ) { b + + ; } if ( a = = 2 & & b = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String args [ ] ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean f = false ; for ( int i = 0 ; i < a . length ; i + + ) { for ( int j = i ; j < a . length ; j + + ) { if ( Math . abs ( a [ i ] - a [ j ] ) > k ) { f = true ; } } } if ( f ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { private static BufferedReader br ; private static StringTokenizer tokenizer ; private static void solve ( ) throws IOException { int n = nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = nextInt ( ) ; } int min = arr [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , arr [ i ] ) ; if ( min > = arr [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; solve ( ) ; } public static String next ( ) throws IOException { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { String line = br . readLine ( ) ; if ( line = = null ) throw new IOException ( ) ; tokenizer = new StringTokenizer ( line ) ; } return tokenizer . nextToken ( ) ; } public static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } } import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Integer > remaining = new HashSet < > ( Arrays . asList ( 1 , 9 , 7 , 4 ) ) ; for ( int i = 0 ; i < 4 ; i + + ) { int a = sc . nextInt ( ) ; if ( remaining . contains ( a ) ) { remaining . remove ( a ) ; } } System . out . println ( remaining . isEmpty ( ) ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { scanner . nextLine ( ) ; System . out . println ( scanner . nextLine ( ) . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean flag = false ; String arare [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arare [ i ] = sc . next ( ) ; } for ( int k = 0 ; k < arare . length ; k + + ) { if ( arare [ k ] . equals ( " Y " ) ) { flag = true ; } } if ( flag ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; int min = 101 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 3 ; i + + ) { int total = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { if ( i ! = j ) total + = Math . abs ( a [ i ] - a [ j ] ) ; } if ( total < min ) min = total ; } System . out . println ( min ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long point [ ] = new long [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { point [ i ] = sc . nextLong ( ) ; } System . out . println ( point [ 4 ] - point [ 0 ] > sc . nextLong ( ) ? " : ( " : " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int out = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) out + + ; } } System . out . println ( out ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) b [ i ] = c [ 0 ] [ i ] - a [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = c [ i ] [ 0 ] - b [ 0 ] ; boolean good = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) good = false ; } } System . out . println ( good ? " Yes " : " No " ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ ] ; for ( int i = 0 ; i < 3 ; i + + ) arr [ i ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) arr [ i ] [ j ] = scan . nextInt ( ) ; } int [ ] diff = new int [ 9 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) diff [ i * 3 + j ] = arr [ i ] [ j ] - arr [ i ] [ ( j + 1 ) % 3 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { if ( diff [ i ] ! = diff [ i + 3 ] | | diff [ i + 3 ] ! = diff [ i + 6 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner stdin = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ ] ; for ( int i = 0 ; i < 3 ; i + + ) { c [ i ] = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdin . nextInt ( ) ; } } String result = " No " ; int a2 = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; int a3 = c [ 2 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( ( c [ 1 ] [ 1 ] = = ( a2 + c [ 0 ] [ 1 ] ) ) & & ( c [ 1 ] [ 2 ] = = ( a2 + c [ 0 ] [ 2 ] ) ) & & ( c [ 2 ] [ 1 ] = = ( a3 + c [ 0 ] [ 1 ] ) ) & & ( c [ 2 ] [ 2 ] = = ( a3 + c [ 0 ] [ 2 ] ) ) ) { result = " Yes " ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = s . nextInt ( ) ; } int c1 = 0 ; int c2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( a [ i ] = = 5 ) { c1 + = 1 ; } if ( a [ i ] = = 7 ) { c2 + = 1 ; } } if ( c1 = = 2 & & c2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . equals ( " 5 7 5 " ) | | s . equals ( " 7 5 5 " ) | | s . equals ( " 5 5 7 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { static int k , s ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; long count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { if ( x > s ) { continue ; } for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { + + count ; } } } System . out . println ( count ) ; } } import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int n = sc . nextInt ( ) ; if ( n = = 1 ) { pr . println ( 1 ) ; } else { int p2 = 2 ; while ( p2 * 2 < = n ) { p2 * = 2 ; } pr . println ( p2 ) ; } } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; int n = sca . nextInt ( ) ; int [ ] pi = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { pi [ i ] = sca . nextInt ( ) ; } int ans = 0 ; int min = 300000 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > pi [ i ] ) { min = pi [ i ] ; ans + + ; } else { } } System . out . println ( ans ) ; sca . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import static java . math . BigDecimal . ROUND _ HALF _ UP ; public class Main { private static int MOD = 1000000007 ; public static void main ( String [ ] args ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; int [ ] abhm = readIntegers ( br ) ; int a = abhm [ 0 ] ; int b = abhm [ 1 ] ; int h = abhm [ 2 ] ; int m = abhm [ 3 ] ; double tan = ( h * 30 ) + ( 0.5 * m ) ; double tyou = m * 6 ; double kakudo = tyou - tan ; double rad = Math . toRadians ( kakudo ) ; double a _ sq = ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( rad ) ) ; System . out . println ( Math . sqrt ( a _ sq ) ) ; } private static int readInteger ( BufferedReader br ) throws IOException { return Integer . parseInt ( br . readLine ( ) ) ; } private static int [ ] readIntegers ( BufferedReader br ) throws IOException { String [ ] s = br . readLine ( ) . split ( " " ) ; int [ ] ret = new int [ s . length ] ; for ( int i = 0 ; i < s . length ; i + + ) { ret [ i ] = Integer . parseInt ( s [ i ] ) ; } return ret ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int max = Math . max ( b - a , c - a ) ; max = Math . max ( max , d - a ) ; max = Math . max ( max , e - a ) ; max = Math . max ( max , c - b ) ; max = Math . max ( max , d - b ) ; max = Math . max ( max , e - b ) ; max = Math . max ( max , d - c ) ; max = Math . max ( max , e - c ) ; max = Math . max ( max , e - d ) ; if ( max < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; import java . io . * ; import static java . lang . System . in ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; long ans = 2 ; for ( int i = 0 ; i < X ; i + + ) { ans = 2 * ans + 2 ; } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { long t1 , t2 , a1 , a2 , b1 , b2 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; t1 = sc . nextLong ( ) ; t2 = sc . nextLong ( ) ; a1 = sc . nextLong ( ) ; a2 = sc . nextLong ( ) ; b1 = sc . nextLong ( ) ; b2 = sc . nextLong ( ) ; if ( t1 * a1 + t2 * a2 = = t1 * b1 + t2 * b2 ) { System . out . println ( " infinity " ) ; return ; } if ( t1 * a1 < t1 * b1 & & t1 * a1 + t2 * a2 < t1 * b1 + t2 * b2 ) { System . out . println ( 0 ) ; return ; } if ( t1 * b1 < t1 * a1 & & t1 * b1 + t2 * b2 < t1 * a1 + t2 * a2 ) { System . out . println ( 0 ) ; return ; } long d = Math . abs ( t1 * a1 + t2 * a2 - t1 * b1 - t2 * b2 ) ; debug ( d , t1 * a1 , t1 * b1 , t1 * a1 + t2 * a2 , t1 * b1 + t2 * b2 ) ; long d2 = Math . abs ( t2 * a2 - t2 * b2 ) ; long d1 = Math . abs ( t1 * a1 - t1 * b1 ) ; debug ( d , d1 , d2 , t1 * a1 , t1 * b1 , t1 * a1 + t2 * a2 , t1 * b1 + t2 * b2 ) ; long cnt = 2 * ( d1 / d ) + 1 ; if ( d1 % d = = 0 ) cnt -- ; System . out . println ( cnt ) ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . io . * ; public class Main { final static long MOD = 1000000007 ; public static String [ ] Ws = null ; public static int wsIndx = 0 ; public static BufferedReader in = null ; public static void main ( String [ ] args ) throws Exception { int N = nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans = ans * 2 ; } System . out . println ( ans / 2 ) ; } public static void check ( ) throws Exception { if ( in = = null ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } if ( Ws = = null | | Ws . length < = wsIndx ) { Ws = in . readLine ( ) . split ( " " ) ; wsIndx = 0 ; } } public static int nextInt ( ) throws Exception { check ( ) ; return Integer . parseInt ( Ws [ wsIndx + + ] ) ; } public static long nextLong ( ) throws Exception { check ( ) ; return Long . parseLong ( Ws [ wsIndx + + ] ) ; } public static String nextString ( ) throws Exception { check ( ) ; return Ws [ wsIndx + + ] ; } public static int [ ] nextInts ( ) throws Exception { check ( ) ; int [ ] tmp = new int [ Ws . length ] ; for ( int i = 0 ; i < tmp . length ; i + + ) { tmp [ i ] = Integer . parseInt ( Ws [ i ] ) ; } wsIndx = Ws . length ; return tmp ; } public static long [ ] nextLongs ( ) throws Exception { check ( ) ; long [ ] tmp = new long [ Ws . length ] ; for ( int i = 0 ; i < tmp . length ; i + + ) { tmp [ i ] = Long . parseLong ( Ws [ i ] ) ; } wsIndx = Ws . length ; return tmp ; } public static String [ ] nextStrings ( ) throws Exception { check ( ) ; wsIndx = Ws . length ; return Ws ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N = = 1 ) { System . out . println ( " 1 " ) ; sc . close ( ) ; return ; } int max2 = 1 ; while ( max2 < N ) { max2 * = 2 ; } max2 / = 2 ; int count = 1 ; while ( max2 < = N ) { max2 * = count ; count + + ; } max2 / = -- count ; System . out . println ( max2 ) ; sc . close ( ) ; } } import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { int c [ ] [ ] = new int [ 3 ] [ 3 ] ; boolean F = false ; for ( int i = 0 ; i < 3 ; + + i ) { for ( int j = 0 ; j < 3 ; + + j ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int a1 = 0 ; a1 < = 100 & & ! F ; a1 + + ) { for ( int a2 = 0 ; a2 < = 100 & & ! F ; a2 + + ) { for ( int a3 = 0 ; a3 < = 100 & & ! F ; a3 + + ) { int b1 = c [ 0 ] [ 0 ] - a1 , b2 = c [ 0 ] [ 1 ] - a1 , b3 = c [ 0 ] [ 2 ] - a1 ; boolean L2 , L3 ; L2 = ( c [ 1 ] [ 0 ] = = a2 + b1 & & c [ 1 ] [ 1 ] = = a2 + b2 & & c [ 1 ] [ 2 ] = = a2 + b3 ) ; L3 = ( c [ 2 ] [ 0 ] = = a3 + b1 & & c [ 2 ] [ 1 ] = = a3 + b2 & & c [ 2 ] [ 2 ] = = a3 + b3 ) ; F = L2 & & L3 ; } } } System . out . println ( F ? " Yes " : " No " ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long N = input . nextLong ( ) ; boolean found = false ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long Num = N * h * w ; long Den = 4 * h * w - N * w - N * h ; if ( Den > 0 & & Num % Den = = 0 ) { long ans = Num / Den ; System . out . println ( h + " " + ans + " " + w ) ; found = true ; break ; } } if ( found ) break ; } } } import java . io . * ; import java . util . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String nyuA = sc . nextLine ( ) ; int n = Integer . parseInt ( nyuA ) ; int max = 0 ; int res = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int temp = i ; int count = 0 ; while ( true ) { if ( temp % 2 ! = 0 ) { if ( count > max ) { max = count ; res = i ; } break ; } temp / = 2 ; count + + ; } } if ( res = = 0 ) res = 1 ; System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int n4 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; list . add ( n1 ) ; list . add ( n2 ) ; list . add ( n3 ) ; list . add ( n4 ) ; if ( list . contains ( 1 ) ) { if ( list . contains ( 9 ) ) { if ( list . contains ( 7 ) ) { if ( list . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = scan . nextInt ( ) ; a [ 1 ] = scan . nextInt ( ) ; a [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int count = 0 ; int result = 0 ; int result _ count = 0 ; for ( int i = 1 ; i < = x ; i + + ) { count = 0 ; int now = i ; while ( now % 2 = = 0 ) { now = now / 2 ; count + + ; } if ( result _ count < = count ) { result _ count = count ; result = i ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String [ ] s = new String [ n ] ; Arrays . setAll ( s , i - > sc . next ( ) ) ; sc . close ( ) ; Set < String > set = new HashSet < > ( Arrays . asList ( s ) ) ; boolean judge = set . size ( ) = = 3 ; String result = judge ? " Three " : " Four " ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int num = 1 ; while ( num * 2 < = n ) { num = num * 2 ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int result = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { boolean isMacth = k > = s - ( x + y ) & & s - ( x + y ) > = 0 ; if ( isMacth ) { result + + ; } } } System . out . println ( result ) ; scanner . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { private static int countPower ( int n ) { int count = 0 ; while ( n % 2 = = 0 ) { + + count ; n / = 2 ; } return count ; } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int max = 0 ; for ( int i = 1 ; i < = n ; + + i ) { int count = countPower ( i ) ; if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . util . Collections ; import java . util . HashMap ; import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int h = in . nextInt ( ) ; int m = in . nextInt ( ) ; double hh = ( double ) h / 12 * 360 ; double mm = ( double ) m / 60 * 360 ; hh + = ( double ) m / 60 * 30 ; double angle = Math . abs ( mm - hh ) ; if ( angle > 180.0 ) { angle = 360.0 - angle ; } double ans ; if ( angle = = 0.0 ) { ans = Math . abs ( b - a ) ; } else if ( angle = = 180.0 ) { ans = a + b ; } else { ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = 0 , e = 0 , f = 0 ; d = Math . abs ( a - b ) ; e = Math . abs ( c - b ) ; f = Math . abs ( a - c ) ; int aa = Math . max ( d , e ) ; System . out . println ( Math . max ( aa , f ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int P = 0 ; int Q = 0 ; for ( int X = 0 ; X < K + 1 ; X + + ) { for ( int Y = 0 ; Y < K + 1 ; Y + + ) { P = S - X - Y ; if ( 0 < = P & & P < = K ) { Q + + ; } } } System . out . println ( Q ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double res = 0 ; double kaku = Math . abs ( H * 30 + ( double ) M / 2 - M * 6 ) ; double rad = Math . toRadians ( kaku ) ; res = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( rad ) ) ; System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double deg = 0 ; deg = ( 30 * h ) + ( 0.5 * m ) - ( 6 * m ) ; double ans = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( Math . toRadians ( deg ) ) ) ) ; System . out . println ( ans ) ; scan . close ( ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { 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 Scanner s = new Scanner ( System . in ) ; static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static long getLong ( ) { return Long . parseLong ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { long N = getLong ( ) ; for ( long h = 0 ; h < = 3500 ; + + h ) { for ( long n = 0 ; n < = 3500 ; + + n ) { long Nhn = N * h * n ; long v = 4 * h * n - N * n - N * h ; if ( v > 0 & & Nhn % v = = 0 ) { System . out . println ( h + " " + n + " " + ( Nhn / v ) ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { num [ i ] = Integer . parseInt ( sc . nextLine ( ) ) ; } if ( num [ 4 ] - num [ 0 ] < num [ 5 ] + 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : " + " ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] in = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) { in [ i ] = sc . nextInt ( ) ; } int b = 0 ; int c = in [ 0 ] ; for ( int i = 0 ; i < a ; i + + ) { c = Math . min ( c , in [ i ] ) ; if ( c > = in [ i ] ) { b + + ; } } System . out . println ( b ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Character > set = new HashSet < Character > ( ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( sc . next ( ) . charAt ( 0 ) ) ; } sc . close ( ) ; if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double A = scan . nextInt ( ) ; double B = scan . nextInt ( ) ; double H = scan . nextInt ( ) ; double M = scan . nextInt ( ) ; double hour = 2 * Math . PI * ( ( H * 60 + M ) / ( 12 * 60 ) ) ; double min = 2 * Math . PI * ( M / 60 ) ; double theta = Math . abs ( hour - min ) ; double length = Math . sqrt ( B * B + A * A - 2 * A * B * Math . cos ( theta ) ) ; System . out . println ( length ) ; scan . close ( ) ; } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( InputReader in = new InputReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ) { new Main ( ) . solve ( in , out ) ; out . flush ( ) ; } } private void solve ( InputReader in , PrintWriter out ) { int min = in . nextInt ( ) ; in . nextInt ( ) ; in . nextInt ( ) ; in . nextInt ( ) ; int max = in . nextInt ( ) ; int k = in . nextInt ( ) ; out . println ( ( max - min ) > k ? " : ( " : " Yay ! " ) ; } } class InputReader implements AutoCloseable { private final Scanner sc = new Scanner ( System . in ) ; String next ( ) { return this . sc . next ( ) ; } int nextInt ( ) { return Integer . parseInt ( this . sc . next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( this . sc . next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( this . sc . next ( ) ) ; } @ Override public void close ( ) { this . sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = c [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = c [ i ] [ 0 ] - y [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int N = sc . nextInt ( ) ; int d = 0 ; if ( N = = 0 ) { System . out . println ( " 0 " ) ; return ; } for ( int i = 0 ; i < 7 ; i + + ) { d = ( int ) Math . pow ( 2 , i ) ; if ( N / d = = 1 ) { break ; } } System . out . println ( d ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 | | A = = 5 & & B = = 7 & & C = = 5 | | A = = 7 & & B = = 5 & & C = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { long n = sc . nextLong ( ) ; List < Long > an = new ArrayList < > ( ) ; for ( long i = 0 ; i < n ; i + + ) { an . add ( sc . nextLong ( ) ) ; } long result = 0 ; long min = Integer . MAX _ VALUE ; for ( long l : an ) { if ( min > l ) { result + + ; min = l ; } } System . out . println ( result ) ; } } static long lcm ( long a , long b ) { long temp ; long c = a ; c * = b ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return c / b ; } static long gcd ( long a , long b ) { long temp ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return b ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int r = 0 ; r < 3 ; r + + ) { for ( int c = 0 ; c < 3 ; c + + ) { C [ r ] [ c ] = in . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] a2 = new int [ 3 ] [ 3 ] ; a [ 0 ] = 0 ; for ( int c = 0 ; c < 3 ; c + + ) { b [ c ] = C [ 0 ] [ c ] - a [ 0 ] ; } for ( int r = 0 ; r < 3 ; r + + ) { for ( int c = 0 ; c < 3 ; c + + ) { a2 [ r ] [ c ] = C [ r ] [ c ] - b [ c ] ; } } for ( int r = 0 ; r < 3 ; r + + ) { for ( int c = 1 ; c < 3 ; c + + ) { if ( a2 [ r ] [ c - 1 ] ! = a2 [ r ] [ c ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int a ; int b ; int cnt = 0 ; for ( a = 0 ; a < = K ; a + + ) { int qw = K ; if ( S - a < qw ) { qw = S - a ; } for ( b = 0 ; b < = qw ; b + + ) { if ( S - a - b < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; int z = 0 , y = 0 , fin = 0 , a1 = 0 , a2 = 0 ; while ( z < 3 ) { while ( y < 3 ) { c [ z ] [ y ] = stdIn . nextInt ( ) ; y + + ; } y = 0 ; z + + ; } z = 1 ; a1 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; a2 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; while ( z < 3 ) { if ( c [ z ] [ 0 ] - c [ z ] [ 1 ] ! = a1 ) { fin = 1 ; break ; } if ( c [ z ] [ 1 ] - c [ z ] [ 2 ] ! = a2 ) { fin = 1 ; break ; } z + + ; } if ( fin = = 1 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws Exception { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ? " YES " : " NO " ) ; } 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 stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int max = a ; int min = a ; if ( max < b ) { max = b ; } if ( min > b ) { min = b ; } if ( max < c ) { max = c ; } if ( min > c ) { min = c ; } System . out . println ( max - min ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] argv ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( str [ 0 ] ) ; int n = Integer . parseInt ( str [ 1 ] ) ; int x , y , cnt = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( ( 0 < = n - x - y ) & & ( n - x - y < = k ) ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { private static final int MOD = 1 _ 000 _ 000 _ 007 ; private static final String YES = " Yes " ; private static final String NO = " No " ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } System . out . println ( solve ( N , P ) ) ; } private static int solve ( int N , int [ ] P ) { int count = 0 ; int min = N + 1 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < min ) { min = P [ i ] ; count + + ; } } return count ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans * = 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = n + 1 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { min = p [ i ] ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( a * b * c = = 175 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int maxDis = sc . nextInt ( ) ; String res = " Yay ! " ; for ( int i = antena . length - 1 ; i > = 0 ; i -- ) { for ( int j = antena . length - 2 ; j > = 0 ; j -- ) { if ( antena [ i ] - antena [ j ] > maxDis ) { res = " : ( " ; } } } System . out . println ( res ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; if ( H = = 0 ) H = 12 ; double H2 = ( H * 60 + M ) * 0.5 ; double M2 = M * 6 ; if ( M2 = = 0 ) M2 = 360 ; double kakudo = 0 ; if ( M2 > H2 ) { kakudo = M2 - H2 ; } else { kakudo = H2 - M2 ; } kakudo = Math . min ( kakudo , 360 - kakudo ) ; double cos = Math . cos ( Math . toRadians ( kakudo ) ) ; double ans = Math . sqrt ( ( A * A ) + ( B * B ) - ( 2 * A * B * cos ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; return ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double turnA = ( ( H * 60 ) + M ) * 0.5 ; double turnB = M * 6.0 ; double d = Math . abs ( turnA - turnB ) ; double X = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * Math . cos ( Math . toRadians ( d ) ) ) ; X = Math . sqrt ( X ) ; System . out . println ( X ) ; } } import java . util . Scanner ; class Main { int [ ] abc ; Main ( int [ ] abc ) { this . abc = abc ; } String solve ( ) { final String YES = " YES " ; final String NO = " NO " ; int n5 = 0 ; int n7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( abc [ i ] = = 5 ) { n5 + + ; } else if ( abc [ i ] = = 7 ) { n7 + + ; } } if ( n5 = = 2 & & n7 = = 1 ) { return YES ; } else { return NO ; } } public static void main ( String args [ ] ) { int [ ] abc = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { abc [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; String greeting = new Main ( abc ) . solve ( ) ; System . out . println ( greeting ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int max = 0 ; int max _ num = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int tmp = i ; int count = 0 ; while ( true ) { if ( tmp % 2 = = 0 ) { count + + ; tmp / = 2 ; } else { break ; } } if ( count > max ) { max = count ; max _ num = i ; } } System . out . println ( max _ num ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( x + y < = s & & x + y + k > = s ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; N [ 0 ] = sc . nextInt ( ) ; N [ 1 ] = sc . nextInt ( ) ; N [ 2 ] = sc . nextInt ( ) ; N [ 3 ] = sc . nextInt ( ) ; boolean ans = solve ( N ) ; System . out . println ( ans ? " YES " : " NO " ) ; } private static boolean solve ( int [ ] N ) { Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 & & N [ 1 ] = = 4 & & N [ 2 ] = = 7 & & N [ 3 ] = = 9 ) { return true ; } return false ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 ; int a2 ; int a3 ; int HUNDRED = 100 ; boolean flag = false ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( a1 = 0 ; a1 < = HUNDRED & & ! flag ; a1 + + ) { int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; for ( a2 = 0 ; a2 < = HUNDRED & & ! flag ; a2 + + ) { if ( c [ 1 ] [ 0 ] = = a2 + b1 & & c [ 1 ] [ 1 ] = = a2 + b2 & & c [ 1 ] [ 2 ] = = a2 + b3 ) { for ( a3 = 0 ; a3 < = HUNDRED & & ! flag ; a3 + + ) { if ( c [ 2 ] [ 0 ] = = a3 + b1 & & c [ 2 ] [ 1 ] = = a3 + b2 & & c [ 2 ] [ 2 ] = = a3 + b3 ) { flag = true ; } } } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; int [ ] test = new int [ 5 ] ; test [ 0 ] = sc1 . nextInt ( ) ; test [ 1 ] = sc1 . nextInt ( ) ; test [ 2 ] = sc1 . nextInt ( ) ; test [ 3 ] = sc1 . nextInt ( ) ; test [ 4 ] = sc1 . nextInt ( ) ; int k = sc1 . nextInt ( ) ; Arrays . sort ( test ) ; if ( test [ 4 ] - test [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } sc1 . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String input = s . nextLine ( ) ; int n = Integer . parseInt ( input ) ; int m = n ; int pow = 0 ; do { m / = 2 ; pow + + ; } while ( m > 1 ) ; int result = 1 ; if ( m = = 1 ) { for ( int i = 0 ; i < pow ; i + + ) { result * = 2 ; } } else { result = n ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] num = new int [ 3 ] ; num [ 0 ] = scan . nextInt ( ) ; num [ 1 ] = scan . nextInt ( ) ; num [ 2 ] = scan . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; for ( int number : num ) { if ( number = = 5 ) { count5 + = 1 ; } else if ( number = = 7 ) { count7 + = 1 ; } } String result ; if ( count5 = = 2 & & count7 = = 1 ) { result = " YES " ; } else { result = " NO " ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { ArrayList < Integer > array = new ArrayList < Integer > ( ) ; Scanner scan = new Scanner ( System . in ) ; int val1 = scan . nextInt ( ) ; int val2 = scan . nextInt ( ) ; int val3 = scan . nextInt ( ) ; array . add ( val1 ) ; array . add ( val2 ) ; array . add ( val3 ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < array . size ( ) ; i + + ) { if ( array . get ( i ) = = 5 ) { five + + ; } if ( array . get ( i ) = = 7 ) { seven + + ; } else { } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int seki = a * b * c ; if ( seki = = ( 5 * 7 * 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; int K = Integer . parseInt ( line [ 0 ] ) ; int S = Integer . parseInt ( line [ 1 ] ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int target = S - x - y ; if ( target > = 0 & & target < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { private static final Scanner SCANNER = new Scanner ( System . in ) ; static int readOneInt ( ) { String line = SCANNER . nextLine ( ) ; return Integer . parseInt ( line ) ; } public static void main ( String [ ] args ) { int tc = 1 ; for ( int i = 0 ; i < tc ; + + i ) { String s = SCANNER . nextLine ( ) ; String [ ] str = s . split ( " " ) ; int [ ] ints = new int [ str . length ] ; for ( int j = 0 ; j < str . length ; + + j ) { ints [ j ] = Integer . parseInt ( str [ j ] ) ; } test ( ints [ 0 ] , ints [ 1 ] , ints [ 2 ] , ints [ 3 ] ) ; } } private static void test ( int a , int b , int h , int m ) { double full = 2 * Math . PI ; double ba = full * ( m / 60.0 ) ; double aa = full * ( h * 60 + m ) / 12.0 / 60.0 ; double ax = a * Math . sin ( aa ) ; double ay = a * Math . cos ( aa ) ; double bx = b * Math . sin ( ba ) ; double by = b * Math . cos ( ba ) ; double dx = bx - ax ; double dy = by - ay ; double d = Math . sqrt ( dx * dx + dy * dy ) ; System . out . println ( d ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int limit = 5 ; int [ ] list = new int [ limit ] ; for ( int i = 0 ; i < limit ; + + i ) { list [ i ] = Integer . parseInt ( sc . next ( ) ) ; } ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( list [ list . length - 1 ] - list [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z > = 0 & & z < = K ) ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . * ; import java . util . * ; public class Main { static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { try { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } public String next ( ) { if ( st . hasMoreTokens ( ) ) return st . nextToken ( ) ; try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { String line = " " ; if ( st . hasMoreTokens ( ) ) line = st . nextToken ( ) ; else try { return br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } while ( st . hasMoreTokens ( ) ) line + = " " + st . nextToken ( ) ; return line ; } } public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; boolean one = false , two = false , three = false , four = false ; for ( int i = 0 ; i < 4 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 1 ) one = true ; else if ( a = = 9 ) two = true ; else if ( a = = 7 ) three = true ; else if ( a = = 4 ) four = true ; } pw . println ( one & & two & & three & & four ? " YES " : " NO " ) ; pw . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int max = 0 ; int sum = 0 ; int num = 0 ; int tmp = 0 ; int N = scan . nextInt ( ) ; for ( int i = N ; i > 0 ; i -- ) { tmp = i ; while ( true ) { if ( tmp % 2 = = 0 & & tmp > 0 ) { sum + + ; tmp / = 2 ; } else { if ( max < = sum ) { max = sum ; num = i ; } sum = 0 ; break ; } } } System . out . println ( num ) ; scan . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 8 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int x = sc . nextInt ( ) ; a [ x ] + + ; } if ( a [ 5 ] = = 2 & & a [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count5 = 0 ; int count7 = 0 ; Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; for ( String n : line ) { if ( n . equals ( " 5 " ) ) { count5 + + ; } if ( n . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - i - j & & s - i - j < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BBreakNumber solver = new BBreakNumber ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BBreakNumber { public void solve ( int testNumber , Scanner in , PrintWriter out ) { out . println ( ( int ) Math . pow ( 2 , Math . floor ( Math . log ( in . nextInt ( ) ) / Math . log ( 2 ) ) ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int sum = scanner . nextInt ( ) ; int count = 0 ; int i = 0 , j = 0 , k = 0 ; for ( i = 0 ; i < = n ; i + + ) { for ( j = 0 ; j < = n ; j + + ) { for ( k = 0 ; k < = n ; k + + ) { if ( i + j + k < = sum ) { k = Math . min ( n , sum - i - j ) ; if ( i + j + k < = sum - n ) { j = Math . min ( n , sum - i - k ) ; if ( i + j + k < = sum - n ) { i = Math . min ( n , sum - j - k ) ; } } } else { break ; } if ( ( i + j + k ) = = sum ) count + + ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; import static java . lang . System . in ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; String [ ] lo = reader . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( lo [ 0 ] ) ; int B = Integer . parseInt ( lo [ 1 ] ) ; int H = Integer . parseInt ( lo [ 2 ] ) ; int M = Integer . parseInt ( lo [ 3 ] ) ; double angle = Math . abs ( ( H + M / ( double ) 60 ) * ( Math . PI / ( double ) 6 ) - M * ( Math . PI / ( double ) 30 ) ) ; double res = Math . sqrt ( ( double ) ( A * A ) + ( double ) ( B * B ) - 2 * A * B * Math . cos ( angle ) ) ; DecimalFormat dec = new DecimalFormat ( " # 0.000000000 " ) ; System . out . println ( dec . format ( res ) ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] points = new int [ 5 ] ; int distance = 0 ; for ( int i = 0 ; i < points . length ; i + + ) { points [ i ] = sc . nextInt ( ) ; } int upper = sc . nextInt ( ) ; loop : for ( int i = 0 ; i < 5 ; i + + ) { for ( int n = 0 ; n < 5 ; n + + ) { distance = points [ n ] - points [ i ] ; if ( distance > upper ) { System . out . println ( " : ( " ) ; break loop ; } } if ( i = = 4 ) { System . out . println ( " Yay ! " ) ; } } } } 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 . 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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; String [ ] s = in . nextStringArray ( n ) ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . charAt ( 0 ) = = ' Y ' ) { out . println ( " Four " ) ; return ; } } out . println ( " Three " ) ; } } 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 String [ ] nextStringArray ( int n ) { String [ ] res = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nextString ( ) ; } return res ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int w = 0 ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; for ( w = 0 ; w < = 100 ; w + + ) { a [ 0 ] = w ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { if ( b [ i ] < 0 ) { System . out . println ( " No " ) ; return ; } } int aa [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 1 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { aa [ i ] [ j ] = c [ i ] [ j ] - b [ j ] ; } } if ( aa [ 1 ] [ 0 ] ! = aa [ 1 ] [ 1 ] | | aa [ 1 ] [ 0 ] ! = aa [ 1 ] [ 2 ] | | aa [ 2 ] [ 0 ] ! = aa [ 2 ] [ 1 ] | | aa [ 2 ] [ 0 ] ! = aa [ 2 ] [ 2 ] ) { continue ; } System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } if ( arr [ 0 ] [ 0 ] - arr [ 0 ] [ 1 ] = = arr [ 1 ] [ 0 ] - arr [ 1 ] [ 1 ] & & arr [ 1 ] [ 0 ] - arr [ 1 ] [ 1 ] = = arr [ 2 ] [ 0 ] - arr [ 2 ] [ 1 ] ) { if ( arr [ 0 ] [ 1 ] - arr [ 0 ] [ 2 ] = = arr [ 1 ] [ 1 ] - arr [ 1 ] [ 2 ] & & arr [ 1 ] [ 1 ] - arr [ 1 ] [ 2 ] = = arr [ 2 ] [ 1 ] - arr [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int num = 0 ; int max = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int count = 0 ; int x = i ; while ( x % 2 = = 0 ) { count + + ; x / = 2 ; } if ( num < = count ) { max = i ; num = count ; } } System . out . println ( max ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int tmp = s - i - j ; if ( tmp < = k & & tmp > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean go = true ; if ( Math . abs ( a - b ) > k ) go = false ; if ( Math . abs ( a - c ) > k ) go = false ; if ( Math . abs ( a - d ) > k ) go = false ; if ( Math . abs ( a - e ) > k ) go = false ; if ( Math . abs ( b - c ) > k ) go = false ; if ( Math . abs ( b - d ) > k ) go = false ; if ( Math . abs ( b - e ) > k ) go = false ; if ( Math . abs ( c - d ) > k ) go = false ; if ( Math . abs ( c - e ) > k ) go = false ; if ( Math . abs ( d - e ) > k ) go = false ; if ( go ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String agrs [ ] ) { Scanner in = new Scanner ( System . in ) ; double a = in . nextDouble ( ) ; double b = in . nextDouble ( ) ; double h = in . nextDouble ( ) ; double m = in . nextDouble ( ) ; h * = 30 ; m * = 6 ; h + = m / 12 ; if ( m = = 0 ) { m = 360.0 ; } if ( h = = 0 ) { h = 360.0 ; } double angle = Math . min ( Math . abs ( h - m ) , Math . abs ( m - h ) ) ; angle / = 180 ; angle * = Math . PI ; double hyp = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( angle ) ) ; hyp = Math . sqrt ( hyp ) ; System . out . println ( hyp ) ; } } 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 ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double c = Math . cos ( Math . toRadians ( 30 * h + m / 2 - 6 * m ) ) ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * c ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ai [ ] = new int [ 3 ] ; ai [ 0 ] = sc . nextInt ( ) ; ai [ 1 ] = sc . nextInt ( ) ; ai [ 2 ] = sc . nextInt ( ) ; int c5 = 0 ; int c7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( ai [ i ] ) { case 5 : c5 + + ; break ; case 7 : c7 + + ; break ; } } if ( c5 = = 2 & & c7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 N = in . nextInt ( ) ; String ans = " Three " ; String str ; for ( int i = 0 ; i < N ; i + + ) { str = in . next ( ) ; if ( str . equals ( " Y " ) ) { ans = " Four " ; } } out . println ( ans ) ; } } 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 . Scanner ; class Main { int [ ] [ ] c ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . solve ( ) ; sc . close ( ) ; } Main ( Scanner sc ) { c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } } void solve ( ) { int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int min = Math . min ( c [ 0 ] [ 0 ] , Math . min ( c [ 0 ] [ 1 ] , c [ 0 ] [ 2 ] ) ) ; for ( int i = 0 ; i < = min ; i + + ) { a [ 0 ] = i ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 1 ] - b [ 1 ] ; check : for ( int j = 0 ; j < 3 ; j + + ) { for ( int k = 0 ; k < 3 ; k + + ) { if ( c [ j ] [ k ] ! = a [ j ] + b [ k ] ) break check ; if ( j = = 2 & & k = = 2 ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } } } System . out . println ( " No " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner input = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; + + i ) arr [ i ] = input . nextInt ( ) ; int k = input . nextInt ( ) ; boolean flag = false ; for ( int i = 0 ; i < 5 ; + + i ) { for ( int j = i + 1 ; j < 5 ; + + j ) { if ( arr [ j ] - arr [ i ] > k ) { flag = true ; break ; } } } if ( flag ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { new A ( ) . doIt ( ) ; } class A { void doIt ( ) { int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . * ; import java . math . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void run ( ) { int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int e = 0 ; for ( int i = 0 ; i < 1 ; i + + ) { if ( a [ i + 4 ] - a [ i ] > k ) e = 1 ; } if ( e = = 1 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int [ ] a = in . nextIntArray ( 4 ) ; Arrays . sort ( a ) ; int [ ] b = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = b [ i ] ) { out . println ( " NO " ) ; return ; } } out . println ( " YES " ) ; } } static class InputReader { private BufferedReader br ; private StringTokenizer st ; public InputReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; st = new StringTokenizer ( " " ) ; } public String nextString ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) , " " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] res = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nextInt ( ) ; } return res ; } } } import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double H = 5 * sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; H = H + M / 12 ; double RAD = Math . toRadians ( ( M - H ) * 6 ) ; double COS = Math . cos ( RAD ) ; double ans = ( A * A ) + ( B * B ) - ( 2 * A * B * COS ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; Double A = in . nextDouble ( ) ; Double B = in . nextDouble ( ) ; Double H = in . nextDouble ( ) ; double M = in . nextDouble ( ) ; double x = Math . abs ( 30 * H + M / 2 - 6 * M ) ; double X = Math . cos ( Math . toRadians ( x ) ) ; double C = Math . sqrt ( A * A + B * B - 2 * A * B * X ) ; System . out . println ( C ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; public class Main { static double a , b , h , m ; public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; String [ ] in = br . readLine ( ) . split ( " " ) ; a = Double . parseDouble ( in [ 0 ] ) ; b = Double . parseDouble ( in [ 1 ] ) ; h = Double . parseDouble ( in [ 2 ] ) ; m = Double . parseDouble ( in [ 3 ] ) ; br . close ( ) ; double ang = Math . PI * Math . abs ( 30.0 * h + 0.5 * m - 6.0 * m ) / 180.0 ; out . println ( Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( ang ) ) ) ; out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] antena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = Integer . parseInt ( in . next ( ) ) ; } int k = Integer . parseInt ( in . next ( ) ) ; for ( int i = 0 ; i < 5 ; i + + ) { int antena _ i = antena [ i ] ; for ( int comp = i ; comp < 5 ; comp + + ) { int dist = antena [ comp ] - antena _ i ; if ( k < dist ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < = 100 ; i + + ) { a [ 0 ] = i ; for ( int j = 0 ; j < 2 ; j + + ) { b [ j ] = c [ 0 ] [ j ] - a [ 0 ] ; } a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; if ( infomation ( a , b , c ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } public static boolean infomation ( int [ ] a , int [ ] b , int [ ] [ ] c ) { for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) { return false ; } } } return true ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( S - x - y < = K & & S > = x + y ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; if ( K > = E - A ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { private void solve ( InputReader in , PrintWriter out ) { int [ ] arr = { 5 , 5 , 7 } ; int [ ] arr2 = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { arr2 [ i ] = in . nextInt ( ) ; } Arrays . sort ( arr2 ) ; out . println ( Arrays . equals ( arr , arr2 ) ? " YES " : " NO " ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { try ( InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ) { solve ( in , out ) ; } } static class InputReader implements AutoCloseable { private BufferedReader reader ; private StringTokenizer tokenizer ; InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } @ Override public void close ( ) { } } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ans = 0 ; double hh = h * 30 + 0.5 * m ; double mm = 6 * m ; double hm = ( double ) Math . abs ( hh - mm ) ; double cos = ( double ) Math . cos ( Math . toRadians ( hm ) ) ; ans = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * cos ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; if ( min > = x ) { count + + ; min = x ; } } sc . close ( ) ; System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = b & & b = = 5 & & c = = 7 | | b = = c & & c = = 5 & & a = = 7 | | c = = a & & a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; if ( min > = P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int tmp = s - ( i + j ) ; if ( 0 < = tmp & & tmp < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = Integer . parseInt ( in . nextLine ( ) ) ; String [ ] params = in . nextLine ( ) . split ( " " ) ; int [ ] ps = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { ps [ i ] = Integer . parseInt ( params [ i ] ) ; } int ans = 0 ; int min = ps [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( ps [ i ] < = min ) { ans + + ; min = ps [ i ] ; } } 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 ( ) ; int [ ] p = new int [ n ] ; int [ ] m = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; + + i ) { p [ i ] = sc . nextInt ( ) ; m [ i ] = ( i = = 0 ) ? p [ i ] : Math . min ( p [ i ] , m [ i - 1 ] ) ; if ( p [ i ] = = m [ i ] ) + + ans ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double minutesHand = m * 6 ; double hourHand = h * 30 + m * 0.5 ; double longth = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( minutesHand - hourHand ) ) ) ; System . out . println ( longth ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] antenas = { a , b , c , d , e } ; boolean connect = true ; check : for ( int i = 0 ; i < antenas . length - 1 ; i + + ) { for ( int j = i + 1 ; j < antenas . length ; j + + ) { if ( antenas [ j ] - antenas [ i ] > k ) { connect = false ; break check ; } } } String output = connect ? " Yay ! " : " : ( " ; System . out . println ( output ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } if ( Arrays . asList ( s ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] numlist = new int [ 5 ] ; int k ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; if ( ( numlist [ 4 ] - numlist [ 0 ] ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } public void solve ( ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double hour _ unit = ( double ) 360 / ( 12 * 60 ) ; double minute _ unit = 360 / 60 ; double hours = hour _ unit * ( 60 * H + M ) ; double minutes = minute _ unit * M ; double hours _ pi = Math . PI * ( 360 - hours ) / 180 ; double minute _ pi = Math . PI * ( 360 - minutes ) / 180 ; double hours _ x = A * Math . cos ( hours _ pi ) ; double hours _ y = A * Math . sin ( hours _ pi ) ; double minutes _ x = B * Math . cos ( minute _ pi ) ; double minutes _ y = B * Math . sin ( minute _ pi ) ; double ans = ( hours _ x - minutes _ x ) * ( hours _ x - minutes _ x ) + ( hours _ y - minutes _ y ) * ( hours _ y - minutes _ y ) ; System . out . printf ( " % .12f \ n " , Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; String result = ( e - a < = sc . nextInt ( ) ) ? " Yay ! " : " : ( " ; System . out . println ( result ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int maxCount = 0 ; int maxN = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int count = 0 ; int tmp = i ; while ( tmp % 2 = = 0 ) { tmp / = 2 ; count + + ; } if ( count > maxCount ) { maxCount = count ; maxN = i ; } } System . out . println ( maxN ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) , r = sc . nextInt ( ) ; if ( h + r = = 0 ) { System . out . println ( 0 ) ; } else if ( h + r < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( 1 ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { String line = Io . read ( ) ; int [ ] nums = Arrays . stream ( line . split ( " " ) ) . mapToInt ( num - > Integer . parseInt ( num ) ) . toArray ( ) ; int count5 = 0 , count7 = 0 ; for ( int num : nums ) { if ( num = = 5 ) { count5 + + ; } else if ( num = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { Io . write ( " YES " ) ; } else { Io . write ( " NO " ) ; } } } class Io { public static String read ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; return line ; } public static void write ( String line ) { System . out . println ( line ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , ans = 1 ; int a [ ] ; a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = in . nextInt ( ) ; int mmin = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < mmin ) ans + + ; mmin = Math . min ( mmin , a [ i ] ) ; } System . out . printf ( " % d \ n " , ans ) ; in . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] points = new int [ 5 ] ; for ( int i = 0 ; i < points . length ; i + + ) { points [ i ] = sc . nextInt ( ) ; } int d = sc . nextInt ( ) ; boolean check = true ; for ( int j = 0 ; j < points . length ; j + + ) { for ( int k = 0 ; k < points . length ; k + + ) { if ( j > k ) { if ( ( points [ j ] - points [ k ] ) > d ) { check = false ; } } else { if ( ( points [ k ] - points [ j ] ) > d ) { check = false ; } } } } if ( check ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . print ( " : ( " ) ; } else { System . out . print ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int h = 0 ; h < = k ; h + + ) { if ( s - i - h < = k & & s > = i + h ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A * B * C = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 ( ) ; int ans = 1 ; while ( true ) { if ( ans * 2 > N ) break ; ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int i = 0 , input , total = 0 ; while ( i < 3 ) { input = Integer . parseInt ( sc . next ( ) ) ; total + = input ; i + + ; } if ( total % 10 = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 , i , j ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( i + j < = s & & s - ( i + j ) < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double shortA = sc . nextInt ( ) ; double longB = sc . nextInt ( ) ; double time = sc . nextInt ( ) ; double minute = sc . nextInt ( ) ; double all = 360 ; double ans = 0.0 ; double timeMinute = 60.0 * time + minute ; double shortaa = ( timeMinute / 720.0 ) * 360 ; double longaa = minute * 6 ; double angle = 0.0 ; if ( shortaa < longaa ) { angle = longaa - shortaa ; } else { angle = shortaa - longaa ; } if ( angle = = 360.0 ) { angle = 0.0 ; } else if ( angle > 180.0 ) { angle = 360.0 - angle ; } double cos = Math . cos ( Math . toRadians ( angle ) ) ; ans = Math . sqrt ( Math . pow ( shortA , 2 ) + Math . pow ( longB , 2 ) - 2.0 * shortA * longB * cos ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { System . out . println ( Integer . highestOneBit ( scanner . nextInt ( ) ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] argd ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int ar [ ] = { a , b , c , d , e } ; String flag = " Yay ! " ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( ar [ i ] - ar [ j ] ) > k ) { flag = " : ( " ; } } } System . out . println ( flag ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; int [ ] b = new int [ 4 ] ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int i = 1 ; i < = 3 ; i + + ) { for ( int j = 1 ; j < = 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } a [ 1 ] = c [ 1 ] [ 1 ] ; a [ 2 ] = c [ 2 ] [ 1 ] ; a [ 3 ] = c [ 3 ] [ 1 ] ; b [ 1 ] = 0 ; b [ 2 ] = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ; b [ 3 ] = c [ 1 ] [ 3 ] - c [ 1 ] [ 1 ] ; boolean ans = true ; int numbers [ ] = { 2 , 3 } ; for ( int i : numbers ) { for ( int j : numbers ) { if ( a [ i ] + b [ j ] = = c [ i ] [ j ] ) ; else ans = false ; } } if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; import java . io . PrintWriter ; import static java . lang . Integer . * ; import static java . lang . Long . * ; import static java . lang . Math . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; int k = parseInt ( sc . next ( ) ) ; int s = parseInt ( sc . next ( ) ) ; sc . close ( ) ; int cnt = 0 ; int z = 0 ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { z = s - ( i + j ) ; if ( 0 < = z & & z < = k ) cnt + + ; } } out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int K = s . nextInt ( ) ; int S = s . nextInt ( ) ; int Ans = 0 ; if ( S < = K ) Ans = ( S + 1 ) * ( S + 2 ) / 2 ; else if ( K < S & & S < = 2 * K ) Ans = ( K + 1 ) * ( K + 1 ) - ( 2 * K - S + 1 ) * ( 2 * K - S ) / 2 - ( S - K + 1 ) * ( S - K ) / 2 ; else if ( 2 * K < = S ) Ans = ( 3 * K - S + 1 ) * ( 3 * K - S + 2 ) / 2 ; 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 ) ; CLowElements solver = new CLowElements ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CLowElements { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] p = in . readIntArray ( n ) ; int answer = 0 ; for ( int i = 0 , min = Integer . MAX _ VALUE ; i < n ; i + + ) { if ( p [ i ] < min ) answer + + ; min = Math . min ( min , p [ i ] ) ; } out . println ( answer ) ; } } 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 ( ) ) ; } public int [ ] readIntArray ( int n ) { int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = nextInt ( ) ; } return x ; } } } import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { static int [ ] w = new int [ 100010 ] ; static int [ ] v = new int [ 100010 ] ; static int [ ] [ ] dp = new int [ 110 ] [ 100010 ] ; static int k ; static int chmin ( int a , int b ) { if ( a > b ) { a = b ; return a ; } return a ; } static int chmax ( int a , int b ) { if ( a < b ) { a = b ; return a ; } return a ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int a1a2 = Math . abs ( a1 - a2 ) ; int a1a3 = Math . abs ( a1 - a3 ) ; int a2a3 = Math . abs ( a2 - a3 ) ; if ( a1a2 > = a1a3 & & a1a2 > = a2a3 ) System . out . println ( a1a3 + a2a3 ) ; else if ( a1a3 > = a2a3 & & a1a3 > = a1a2 ) { System . out . println ( a2a3 + a1a2 ) ; } else System . out . println ( a1a2 + a1a3 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; double h = Double . parseDouble ( sc . next ( ) ) ; double m = Double . parseDouble ( sc . next ( ) ) ; double res = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . abs ( ( h + m / 60 ) / 12 - m / 60 ) * 2 * Math . PI ) ) ; System . out . println ( res ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] data = str . split ( " " ) ; int [ ] numdata = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { numdata [ i ] = Integer . parseInt ( data [ i ] ) ; } int a = 0 , b = 0 , c = 0 , d = 0 , e = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ! ( e = = 0 ) ) { e = 1 ; break ; } switch ( numdata [ i ] ) { case 1 : if ( a = = 0 ) { a = 1 ; } else { e = 1 ; } break ; case 9 : if ( b = = 0 ) { b = 1 ; } else { e = 1 ; } break ; case 7 : if ( c = = 0 ) { c = 1 ; } else { e = 1 ; } break ; case 4 : if ( d = = 0 ) { d = 1 ; } else { e = 1 ; } break ; default : e = 1 ; break ; } } if ( e = = 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = Math . max ( 0 , s - 2 * k ) ; x < = k ; x + + ) { for ( int y = Math . max ( 0 , s - k - x ) ; y < = Math . min ( k , s - x ) ; y + + ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; in . close ( ) ; int max = 1 ; int max1 = 1 ; for ( int i = n ; i > 1 ; i -- ) { int n _ i = calc ( i ) ; if ( max1 < = n _ i ) { max = i ; max1 = n _ i ; } } System . out . println ( max ) ; } public static int calc ( int n ) { if ( n % 2 = = 0 ) return 1 + calc ( n / 2 ) ; else return 0 ; } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws IOException { int n = 3 ; int s [ ] = new int [ n ] ; BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = scan . nextInt ( ) ; } int cnt5 = 0 ; int cnt7 = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] = = 5 ) { cnt5 + + ; } else if ( s [ i ] = = 7 ) { cnt7 + + ; } } if ( cnt5 = = 2 & & cnt7 = = 1 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } out . flush ( ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int n = getInput ( ) . get ( 0 ) ; ArrayList < Integer > p = getInput ( ) ; int count = 1 ; int tmin = Integer . MAX _ VALUE ; for ( int i = 1 ; i < n ; i + + ) { tmin = Math . min ( p . get ( i - 1 ) , tmin ) ; if ( p . get ( i ) < = tmin ) + + count ; } Print ( count ) ; } private static Scanner scanner = new Scanner ( System . in ) ; private static ArrayList < Integer > getInput ( ) { String in = scanner . nextLine ( ) ; ArrayList < Integer > result = new ArrayList < > ( ) ; for ( String t : in . split ( " " ) ) { result . add ( Integer . parseInt ( t ) ) ; } return result ; } private static void Print ( Object o ) { System . out . println ( o ) ; } private static void Print ( Object ... o ) { for ( Object i : o ) System . out . print ( i ) ; System . out . println ( ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . nextLine ( ) ; double t = ( double ) H * 5 + ( double ) M / 12 ; double sa = Math . abs ( t - M ) ; if ( sa > 30 ) { sa = 60 - sa ; } sa * = 6.0 ; double ans = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2.0 * A * B * Math . cos ( Math . toRadians ( sa ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CLowElements solver = new CLowElements ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CLowElements { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = in . nextInt ( ) ; } int min = arr [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] > min ) { count + + ; } min = Math . min ( min , arr [ i ] ) ; } out . println ( n - count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( x [ 4 ] - x [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else if ( x [ 4 ] - x [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int a , b , c ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; b = input . nextInt ( ) ; c = input . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; System . out . println ( judgeSun ( H , R ) ) ; sc . close ( ) ; } private static int judgeSun ( int H , int R ) { int x = 1 ; if ( Math . abs ( H ) = = R ) { if ( H < 0 ) { x = 0 ; } else { x = 1 ; } } else if ( Math . abs ( H ) > R ) { if ( H < 0 ) { x = - 1 ; } else { x = 1 ; } } return x ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count = 0 ; boolean sw = false ; int max = Integer . MIN _ VALUE ; int min = Integer . MAX _ VALUE ; double dMax = Double . MIN _ VALUE ; double dMin = Double . MAX _ VALUE ; Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( int i = 0 ; i < = k ; + + i ) { for ( int j = 0 ; j < = k ; + + j ) { int a = s - i - j ; if ( a < = k & & a > = 0 ) { + + count ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] nums = new int [ 4 ] [ 4 ] ; for ( int rIdx = 1 ; rIdx < = 3 ; rIdx + + ) { String [ ] inputs = scanner . nextLine ( ) . split ( " " ) ; for ( int cIdx = 1 ; cIdx < = 3 ; cIdx + + ) nums [ rIdx ] [ cIdx ] = Integer . parseInt ( inputs [ cIdx - 1 ] ) ; } boolean isRightInfo = true ; for ( int idx = 2 ; idx < = 3 ; idx + + ) { int diff = nums [ idx ] [ 1 ] - nums [ 1 ] [ 1 ] ; if ( diff ! = nums [ idx ] [ 2 ] - nums [ 1 ] [ 2 ] | | diff ! = nums [ idx ] [ 3 ] - nums [ 1 ] [ 3 ] ) isRightInfo = false ; diff = nums [ 1 ] [ idx ] - nums [ 1 ] [ 1 ] ; if ( diff ! = nums [ 2 ] [ idx ] - nums [ 2 ] [ 1 ] | | diff ! = nums [ 3 ] [ idx ] - nums [ 3 ] [ 1 ] ) isRightInfo = false ; } if ( isRightInfo ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 5 * 5 * 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Set < String > sSet = new HashSet < > ( 4 ) ; for ( int i = 0 ; i < n ; i + + ) { sSet . add ( sc . next ( ) ) ; } System . out . println ( sSet . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( n = = Math . pow ( 2 , i ) ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } else if ( n < Math . pow ( 2 , i ) ) { System . out . println ( ( int ) Math . pow ( 2 , i - 1 ) ) ; break ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ sc . nextInt ( ) ] + + ; } if ( n [ 1 ] = = 1 & & n [ 9 ] = = 1 & & n [ 7 ] = = 1 & & n [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; int max = Integer . parseInt ( s [ 0 ] ) ; int ans = Integer . parseInt ( s [ 1 ] ) ; int result = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int k = ans - ( i + j ) ; if ( 0 < = k & & k < = max ) result + + ; } } System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int r = 1 ; for ( int i = 2 ; i < = n ; i + + ) { int current = 0 ; if ( i % 2 = = 1 ) { continue ; } int j = i ; while ( true ) { j = j / 2 ; + + current ; if ( j = = 0 | | j % 2 = = 1 ) { break ; } } if ( current > count ) { count = current ; r = i ; } } System . out . println ( r ) ; sc . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; long [ ] q = new long [ a ] ; long [ ] p = new long [ a ] ; long count = 0 ; long sum = 0 ; long h = 0 ; ArrayList < Long > list = new ArrayList < Long > ( ) ; long o = 0 ; long s = 0 ; for ( int i = 0 ; i < a ; i + + ) { long c = sc . nextLong ( ) ; q [ i ] = c ; o + = c ; } for ( int i = 0 ; i < a ; i + + ) { long b = sc . nextLong ( ) ; p [ i ] = b ; s + = b ; } if ( o > = s ) { for ( int i = 0 ; i < a ; i + + ) { if ( q [ i ] > = p [ i ] ) { if ( q [ i ] - p [ i ] < = o - s ) { list . add ( q [ i ] - p [ i ] ) ; } h + + ; } } if ( h = = a ) { System . out . println ( 0 ) ; return ; } } else { System . out . println ( - 1 ) ; return ; } Collections . sort ( list ) ; for ( long k : list ) { if ( k + sum < = o - s ) { sum + = k ; count + + ; } } System . out . println ( a - count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { new Solver ( ) . run ( ) ; } } class Solver { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int v = N ; int ans = 1 ; int cnt = 0 ; while ( v > 1 ) { v > > = 1 ; cnt + + ; ans * = 2 ; } System . out . println ( ans ) ; return ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { String result = " NO " ; List < Integer > inputList = new ArrayList < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; inputList . add ( sc . nextInt ( ) ) ; inputList . add ( sc . nextInt ( ) ) ; inputList . add ( sc . nextInt ( ) ) ; int count7 = 0 ; int count5 = 0 ; for ( int input : inputList ) { if ( input = = 5 ) count5 + + ; if ( input = = 7 ) count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { result = " YES " ; } System . out . print ( result ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 6 ] ; int count = 0 ; for ( int i = 0 ; i < 6 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 6 - 1 ; i + + ) { for ( int j = i + 1 ; j < 6 ; j + + ) { if ( ( a [ j ] - a [ i ] ) > a [ 6 - 1 ] ) count + + ; } } if ( count > 0 ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double S = 30 * H + 0.5 * M ; double L = 6 * M ; double angle = Math . abs ( L - S ) ; if ( angle > 180 ) { angle = Math . abs ( angle - 360 ) ; } angle = Math . toRadians ( angle ) ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( angle ) ) ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( 0 < = z & & z < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int sum = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( ( z < = k ) & & ( z > = 0 ) ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] array = str . split ( " " ) ; int a = Integer . parseInt ( array [ 0 ] ) ; int b = Integer . parseInt ( array [ 1 ] ) ; int c = Integer . parseInt ( array [ 2 ] ) ; int d = Integer . parseInt ( array [ 3 ] ) ; int [ ] list = { a , b , c , d } ; Arrays . sort ( list ) ; int [ ] diff = { 1 , 4 , 7 , 9 } ; if ( Arrays . equals ( list , diff ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Character > set = new HashSet < Character > ( ) ; for ( int i = 0 ; i < n ; i + + ) set . add ( sc . next ( ) . charAt ( 0 ) ) ; String res = " " ; switch ( set . size ( ) ) { case 3 : res = " Three " ; break ; case 4 : res = " Four " ; } System . out . println ( res ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int cou = 1 ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = 999999999 ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , p [ i - 1 ] ) ; if ( p [ i ] < min ) { cou + + ; } } System . out . print ( cou ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; long base = ( long ) 1e9 + 7 ; long ans = 1 ; if ( Math . abs ( n - m ) = = 0 ) { ans * = 2 ; ans % = base ; } else if ( Math . abs ( n - m ) > 1 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } for ( int i = 1 ; i < = n ; i + + ) { ans * = i ; ans % = base ; } for ( int i = 1 ; i < = m ; i + + ) { ans * = i ; ans % = base ; } System . out . println ( ans ) ; } } import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { static class IO { BufferedReader br ; StringTokenizer st ; public IO ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { IO fs = new IO ( ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = fs . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int numlist [ ] = new int [ 5 ] ; int k = 0 ; boolean isOk = true ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; loop : for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ( numlist [ j ] - numlist [ i ] ) > k ) { isOk = false ; break loop ; } } } if ( isOk ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 1 ; int min = sc . nextInt ( ) ; for ( int i = 0 ; i < N - 1 ; i + + ) { int next = sc . nextInt ( ) ; if ( min > next ) { cnt + + ; } min = Math . min ( min , next ) ; } System . out . println ( cnt ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; long n = sc . nextLong ( ) ; long p = sc . nextLong ( ) ; long x = ( long ) Math . pow ( p , ( double ) 1 / n ) + 1 ; long ans = 1 ; if ( n = = 1 ) { ans = p ; } else { for ( long i = x ; i > = 1 ; i -- ) { if ( p % Math . pow ( i , n ) = = 0 ) { ans = i ; break ; } } } System . out . println ( ans ) ; } 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 . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] map = new int [ 3 ] [ 3 ] ; boolean ans = false ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { map [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { for ( int j = 0 ; j < = 100 ; j + + ) { for ( int k = 0 ; k < = 100 ; k + + ) { int ok = 0 ; int [ ] b = { map [ 0 ] [ 0 ] - i , map [ 1 ] [ 1 ] - j , map [ 2 ] [ 2 ] - k } ; if ( i + b [ 1 ] = = map [ 0 ] [ 1 ] ) ok + + ; if ( i + b [ 2 ] = = map [ 0 ] [ 2 ] ) ok + + ; if ( j + b [ 0 ] = = map [ 1 ] [ 0 ] ) ok + + ; if ( j + b [ 2 ] = = map [ 1 ] [ 2 ] ) ok + + ; if ( k + b [ 0 ] = = map [ 2 ] [ 0 ] ) ok + + ; if ( k + b [ 1 ] = = map [ 2 ] [ 1 ] ) ok + + ; if ( ok = = 6 ) ans = true ; } } } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int [ ] antenna = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antenna [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; boolean result = true ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > k ) { result = false ; break ; } } if ( result = = false ) { break ; } } if ( result ) { out . printf ( " Yay ! \ n " ) ; } else { out . printf ( " : ( \ n " ) ; } out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] values = sc . nextLine ( ) . split ( " " ) ; int countFor7 = 0 ; int countFor5 = 0 ; for ( String value : values ) { if ( " 7 " . equals ( value ) ) { countFor7 + + ; } else if ( " 5 " . equals ( value ) ) { countFor5 + + ; } } System . out . println ( ( countFor5 = = 2 & & countFor7 = = 1 ) ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; if ( min > = x ) { count + + ; min = x ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int H = s . nextInt ( ) ; int R = s . nextInt ( ) ; if ( H < 0 ) { int a = H + R ; if ( a < 0 ) { System . out . println ( " -1 " ) ; } else if ( a = = 0 ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " 1 " ) ; } } else { System . out . println ( " 1 " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int a = Integer . parseInt ( sc . nextLine ( ) ) ; int b = Integer . parseInt ( sc . nextLine ( ) ) ; int c = Integer . parseInt ( sc . nextLine ( ) ) ; int d = Integer . parseInt ( sc . nextLine ( ) ) ; int e = Integer . parseInt ( sc . nextLine ( ) ) ; int k = Integer . parseInt ( sc . nextLine ( ) ) ; if ( ( e - a ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 1 ; while ( i < = N ) { i = i * 2 ; } System . out . println ( i / 2 ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sr = new Scanner ( System . in ) ; int A = sr . nextInt ( ) ; int B = sr . nextInt ( ) ; int H = sr . nextInt ( ) ; int M = sr . nextInt ( ) ; double angleA = ( H * 60 + M ) * Math . PI / 360 ; double angleB = ( M * Math . PI ) / 30 ; double C = A * A + B * B - ( 2 * A * B * Math . cos ( Math . abs ( angleA - angleB ) ) ) ; System . out . println ( Math . sqrt ( C ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; Arrays . sort ( str ) ; sb . append ( " 557 " . equals ( str [ 0 ] + str [ 1 ] + str [ 2 ] ) ? " YES " : " NO " ) ; System . out . println ( sb ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] tmp = new int [ 6 ] ; int i = 0 ; for ( String str = br . readLine ( ) ; str ! = null ; str = br . readLine ( ) ) { tmp [ i + + ] = Integer . parseInt ( str ) ; } final int A = tmp [ 0 ] ; final int E = tmp [ 4 ] ; final int K = tmp [ 5 ] ; boolean communicationAvailable = false ; if ( E - A < = K ) { communicationAvailable = true ; } if ( communicationAvailable ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; n = ( int ) ( Math . log10 ( n ) / Math . log10 ( 2 ) ) ; System . out . println ( ( int ) Math . pow ( 2 , n ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( three ( K , S ) ) ; } private static int one ( int K , int S ) { return 0 < = S & & S < = K ? 1 : 0 ; } private static int two ( int K , int S ) { int result = 0 ; for ( int i = 0 ; i < = K ; i + + ) { result + = one ( K , S - i ) ; } return result ; } private static int three ( int K , int S ) { int result = 0 ; for ( int i = 0 ; i < = K ; i + + ) { result + = two ( K , S - i ) ; } return result ; } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; int max = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( max > p ) { ans + + ; max = p ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main implements Runnable { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Thread ( null , new Main ( ) , " " , 128 * 1024 * 1024 ) . start ( ) ; } public void run ( ) { int c [ ] [ ] = new int [ 3 ] [ 3 ] ; int a1 , a2 , a3 , b1 , b2 , b3 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } a1 = Math . min ( c [ 0 ] [ 0 ] , Math . min ( c [ 0 ] [ 1 ] , c [ 0 ] [ 2 ] ) ) ; a2 = Math . min ( c [ 1 ] [ 0 ] , Math . min ( c [ 1 ] [ 1 ] , c [ 1 ] [ 2 ] ) ) ; a3 = Math . min ( c [ 2 ] [ 0 ] , Math . min ( c [ 2 ] [ 1 ] , c [ 2 ] [ 2 ] ) ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int min = i = = 0 ? a1 : i = = 1 ? a2 : a3 ; c [ i ] [ j ] - = min ; } } for ( int j = 0 ; j < 3 ; j + + ) { int tmp = c [ 0 ] [ j ] ; for ( int i = 1 ; i < 3 ; i + + ) { if ( c [ i ] [ j ] ! = tmp ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double hDegree = 360.0 * ( h + m / 60.0 ) / 12 ; double mDegree = 360.0 * m / 60 ; double theta = Math . toRadians ( Math . max ( hDegree , mDegree ) - Math . min ( hDegree , mDegree ) ) ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( theta ) ) ; System . out . printf ( " % .12f " , ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] g = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { g [ i ] [ 0 ] = sc . nextInt ( ) ; g [ i ] [ 1 ] = sc . nextInt ( ) ; g [ i ] [ 2 ] = sc . nextInt ( ) ; } boolean ans = true ; for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( g [ i ] [ j ] - g [ i + 1 ] [ j ] ! = g [ i ] [ j + 1 ] - g [ i + 1 ] [ j + 1 ] ) { ans = false ; break ; } if ( g [ i ] [ j ] - g [ i ] [ j + 1 ] ! = g [ i + 1 ] [ j ] - g [ i + 1 ] [ j + 1 ] ) { ans = false ; break ; } } } if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } long ans = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { min = Math . min ( min , P [ i ] ) ; if ( min > = P [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = 7 ; i + + ) { if ( Math . pow ( 2 , i ) > n ) { System . out . print ( ( int ) Math . pow ( 2 , i - 1 ) ) ; break ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int maxCount = 0 ; int ans = 0 ; for ( int i = n ; i > = 1 ; i -- ) { int num = i ; int cnt = 0 ; while ( true ) { if ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } else { break ; } } if ( cnt > = maxCount ) { ans = i ; maxCount = cnt ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prod = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { prod * = sc . nextInt ( ) ; } if ( prod = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void Solver ( int A , int B , int C ) { int sevenCount = 0 ; int fiveCount = 0 ; if ( A = = 5 ) fiveCount + + ; if ( B = = 5 ) fiveCount + + ; if ( C = = 5 ) fiveCount + + ; if ( A = = 7 ) sevenCount + + ; if ( B = = 7 ) sevenCount + + ; if ( C = = 7 ) sevenCount + + ; if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; Solver ( input . nextInt ( ) , input . nextInt ( ) , input . nextInt ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int judge = 1 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) { judge -- ; } } } if ( judge = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int o = 0 ; int n = sc . nextInt ( ) ; int mini = 2000000 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < = mini ) { o + + ; mini = p ; } } System . out . println ( o ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; long n = 0 ; for ( int i = 0 ; i < = x ; i + + ) { n + + ; n * = 2 ; } System . out . println ( n ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( a , Math . max ( b , c ) ) - Math . min ( a , Math . min ( b , c ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int counter = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { counter + + ; } } } System . out . println ( counter ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; HashMap < String , Integer > HM = new HashMap ( ) ; int N = Input . nextInt ( ) ; for ( int I = 0 ; I < N ; I + + ) { String S = Input . next ( ) ; HM . put ( S , 0 ) ; } if ( HM . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else if ( HM . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int max = P [ 0 ] ; int min = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( max > = P [ i ] & & min > = P [ i ] ) { ans + = 1 ; } max = Math . max ( max , P [ i ] ) ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; if ( n _ customer > 1 ) { while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } } System . out . println ( sold ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { try ( Scanner sc = new Scanner ( System . in ) ) { int K = sc . nextInt ( ) , S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( 0 < = k & & k < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = Math . min ( s , k ) ; i + + ) { ans + = Math . max ( 0 , Math . min ( s - i + 1 , k + 1 ) - Math . max ( 0 , s - i - k ) ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j > = 0 & & s - i - j < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { double pwr = Math . pow ( 2 , i ) ; if ( pwr > n ) { System . out . println ( ( int ) ans ) ; return ; } ans = pwr ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int max = 0 ; int ans = 0 ; int cnt = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int j = i ; while ( j % 2 = = 0 ) { j / = 2 ; cnt + + ; } if ( cnt > = max ) { max = cnt ; ans = i ; } cnt = 0 ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int box = sc . nextInt ( ) ; int [ ] list = new int [ box ] ; for ( int i = 0 ; i < list . length ; + + i ) { list [ i ] = sc . nextInt ( ) ; } int intMin = list [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < list . length ; + + i ) { if ( intMin > list [ i ] ) { intMin = list [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextLong ( ) ; long [ ] [ ] dp = new long [ n ] [ n ] ; for ( int j = 0 ; j < n ; j + + ) { dp [ 0 ] [ j ] = scan . nextLong ( ) ; } for ( int i = 1 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { dp [ i ] [ j ] = Math . min ( dp [ i - 1 ] [ j ] , dp [ 0 ] [ ( j - i + n ) % n ] ) ; } } long result = 1L < < 60 ; for ( int i = 0 ; i < n ; i + + ) { long dummyResult = i * x ; for ( int j = 0 ; j < n ; j + + ) { dummyResult + = ( long ) dp [ i ] [ j ] ; } result = Math . min ( result , dummyResult ) ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int c = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( x + y = = s ) { c + + ; } else if ( s - ( x + y ) < = k & & x + y < s ) { c + + ; } } } System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; public class Main { static long T1 ; static long T2 ; static long A1 ; static long A2 ; static long B1 ; static long B2 ; static void swap ( long a , long b ) { long tmp = a ; a = b ; b = tmp ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; T1 = Long . parseLong ( sc . next ( ) ) ; T2 = Long . parseLong ( sc . next ( ) ) ; A1 = Long . parseLong ( sc . next ( ) ) ; A2 = Long . parseLong ( sc . next ( ) ) ; B1 = Long . parseLong ( sc . next ( ) ) ; B2 = Long . parseLong ( sc . next ( ) ) ; long ans = 0 ; long diff = 0 ; if ( ( A1 * T1 + A2 * T2 ) - ( B1 * T1 + B2 * T2 ) = = 0 ) { if ( A1 = = B1 ) System . out . println ( 0 ) ; else System . out . println ( " infinity " ) ; return ; } if ( ( A1 * T1 + A2 * T2 ) - ( B1 * T1 + B2 * T2 ) < 0 ) { long tmp _ aa = A1 ; A1 = B1 ; B1 = tmp _ aa ; long tmp _ bb = A2 ; A2 = B2 ; B2 = tmp _ bb ; } ans = 0L ; diff = ( A1 * T1 + A2 * T2 ) - ( B1 * T1 + B2 * T2 ) ; if ( A1 > = B1 ) { ans = 0 ; } else { ans = ( ( B1 * T1 ) - ( A1 * T1 ) ) / diff * 2 + 1 ; if ( ( ( B1 * T1 ) - ( A1 * T1 ) ) % diff = = 0 ) ans -- ; } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int last = s - i - j ; if ( last > = 0 & & last < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { int n ; int ans = 1 ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { in ( ) ; int mx = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int cnt = 0 , m = i ; while ( m % 2 = = 0 ) { cnt + + ; m / = 2 ; } if ( mx < cnt ) { mx = cnt ; ans = i ; } } out ( ) ; } void in ( ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; } void out ( ) { System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { long bunbo = 4 * h * n - N * n - N * h ; if ( bunbo = = 0 ) { continue ; } if ( ( N * h * n ) % bunbo = = 0 ) { long w = ( N * h * n ) / bunbo ; if ( w < = 0 ) { continue ; } System . out . println ( h + " " + n + " " + w ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { String str = sc . next ( ) ; if ( str . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final double A = Integer . parseInt ( sc . next ( ) ) ; final double B = Integer . parseInt ( sc . next ( ) ) ; final double H = Integer . parseInt ( sc . next ( ) ) ; final double M = Integer . parseInt ( sc . next ( ) ) ; final double parseH = H * 30d + ( 30d * ( M / 60d ) ) ; final double parseM = M * 6d ; double ang = Math . abs ( parseH - parseM ) ; final double ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2d * A * B * Math . cos ( Math . toRadians ( ang ) ) ) ; System . out . print ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < p . length ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = p [ 0 ] ; int count = 1 ; for ( int i = 0 ; i < p . length ; i + + ) { if ( min > p [ i ] ) { min = p [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class Solver { public void solve ( Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; int count = 0 ; int PjMin = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int Pi = in . nextInt ( ) ; if ( Pi < = PjMin ) { count + + ; } if ( PjMin > = Pi ) { PjMin = Pi ; } } out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double c2 = A * A + B * B - 2.0 * A * B * Math . cos ( ( 3.141592653589793238 * ( 300.0 * H - 55.0 * M ) ) / 1800.0 ) ; double c = Math . sqrt ( c2 ) ; System . out . printf ( " % .20f " , c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner as = new Scanner ( System . in ) ; int a = as . nextInt ( ) ; int b = as . nextInt ( ) ; int c ; int l = 0 ; if ( a < b ) { for ( int i = 0 ; i < = a ; i + + ) { c = b ; c - = i ; for ( int s = 0 ; s < = a ; s + + ) { c - = s ; if ( c < 0 ) { break ; } else { if ( c > a ) { c + = s ; } else { l + + ; c + = s ; } } } } } else { l + = ( b + 2 ) * ( b + 1 ) / 2 ; } System . out . println ( l ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { c [ i ] [ 0 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ i ] [ 1 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ i ] [ 2 ] = Integer . parseInt ( scanner . next ( ) ) ; } scanner . close ( ) ; for ( int i = 0 ; i < c . length ; i + + ) { int min = Integer . MAX _ VALUE ; for ( int j = 0 ; j < c [ i ] . length ; j + + ) { int num = c [ i ] [ j ] ; if ( min > num ) { min = num ; } } for ( int j = 0 ; j < c [ i ] . length ; j + + ) { c [ i ] [ j ] - = min ; } } for ( int i = 0 ; i < c . length ; i + + ) { if ( c [ 0 ] [ i ] ! = c [ 1 ] [ i ] | | c [ 1 ] [ i ] ! = c [ 2 ] [ i ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans * = 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int num [ ] = new int [ 5 ] ; for ( int i = 0 ; i < = 4 ; i + + ) { num [ i ] = scanner . nextInt ( ) ; } int k = scanner . nextInt ( ) ; for ( int i = 0 ; i < num . length ; i + + ) { if ( num [ num . length - i - 1 ] - num [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } System . out . println ( " Yay ! " ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int maxcount = 0 ; int ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int a = i ; int count = 0 ; while ( a % 2 = = 0 & & i > = 1 ) { a / = 2 ; count + + ; } if ( count > maxcount ) { maxcount = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; PriorityQueue < Integer > q = new PriorityQueue < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int now = sc . nextInt ( ) ; q . add ( now ) ; if ( now = = q . peek ( ) ) { ans + + ; } } System . out . println ( ans ) ; } } } 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 maxNum = 1 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int targetNum = i + 1 ; int tmpCount = 0 ; while ( targetNum % 2 = = 0 ) { targetNum = targetNum / 2 ; tmpCount + + ; } if ( tmpCount > count ) { count = tmpCount ; maxNum = i + 1 ; } } System . out . println ( maxNum ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; System . out . println ( E - A < = K ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String A = scan . next ( ) ; int a = Integer . parseInt ( A ) ; String B = scan . next ( ) ; int b = Integer . parseInt ( B ) ; String H = scan . next ( ) ; int h = Integer . parseInt ( H ) ; String M = scan . next ( ) ; int m = Integer . parseInt ( M ) ; double angle = Math . abs ( ( 30 * h + 0.5 * m ) - 6 * m ) ; double cos = Math . cos ( Math . toRadians ( angle ) ) ; double ans ; if ( angle = = 0 ) { ans = Math . abs ( a - b ) ; } else { ans = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * cos ) ) ; } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { String [ ] line = new Scanner ( System . in ) . nextLine ( ) . split ( " " , 3 ) ; int num [ ] = new int [ 3 ] ; num [ 0 ] = Integer . parseInt ( line [ 0 ] ) ; num [ 1 ] = Integer . parseInt ( line [ 1 ] ) ; num [ 2 ] = Integer . parseInt ( line [ 2 ] ) ; Arrays . sort ( num ) ; if ( num [ 0 ] = = 5 & & num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . StringTokenizer ; public class Main { private static PrintWriter out ; public static void main ( String [ ] args ) { Main main = new Main ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ( ) - > out . close ( ) ) ) ; try { main . run ( args ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private void run ( String [ ] arguments ) throws Exception { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int rest = S - x - y ; if ( rest > = 0 & & rest < = K ) { count + + ; } } } out . println ( count ) ; out . close ( ) ; } private class MyScanner { BufferedReader br ; StringTokenizer st ; 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 K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ! ( num [ i ] = = 1 | | num [ i ] = = 4 | | num [ i ] = = 7 | | num [ i ] = = 9 ) ) { System . out . println ( " NO " ) ; return ; } } int n = 21 ; for ( int i = 0 ; i < 4 ; i + + ) { n - = num [ i ] ; } if ( n = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( i < j ) { if ( Math . abs ( a [ i ] - a [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; Integer count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - ( i + j ) ; if ( 0 < = z & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String kotei [ ] = { " P " , " W " , " G " , " Y " } ; String s [ ] = new String [ n ] ; int count = 0 ; for ( int ii = 0 ; ii < n ; ii + + ) { s [ ii ] = sc . next ( ) ; } for ( int i = 0 ; i < 4 ; i + + ) { for ( int ii = 0 ; ii < n ; ii + + ) { if ( kotei [ i ] . equals ( s [ ii ] ) ) { count + + ; break ; } } } if ( count = = 4 ) { System . out . println ( " Four " ) ; } else if ( count = = 3 ) { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; if ( 5 = = num ) { count _ 5 + + ; } else if ( 7 = = num ) { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( a = = 5 ) { five + + ; } else if ( a = = 7 ) { seven + + ; } if ( b = = 5 ) { five + + ; } else if ( b = = 7 ) { seven + + ; } if ( c = = 5 ) { five + + ; } else if ( c = = 7 ) { seven + + ; } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } System . out . print ( count ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] input = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { input [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < input . length ; i + + ) { for ( int j = i + 1 ; j < input . length ; j + + ) { if ( input [ j ] - input [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double jiaoduH = h * 360 / 12 ; double jiaoduM = m * 360 / 60 ; if ( jiaoduM > 0 ) { jiaoduH + = m * 1.0 * 360 / ( 60 * 12 ) ; } double jiaodu = Math . abs ( jiaoduM - jiaoduH ) ; if ( jiaodu > 180 ) { jiaodu = 360 - jiaodu ; } Double c = a * a + b * b - 2 * a * b * Math . cos ( jiaodu * ( Math . PI ) / 180 ) ; System . out . println ( Math . sqrt ( c ) ) ; } } import java . util . * ; import java . util . stream . Stream ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String [ ] nums = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { nums [ i ] = sc . next ( ) ; } long result = Stream . of ( nums ) . distinct ( ) . count ( ) ; if ( result = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; System . out . println ( sc . nextInt ( ) - a > sc . nextInt ( ) ? " : ( " : " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; if ( k > = s ) { System . out . println ( ( s + 2 ) * ( s + 1 ) / 2 ) ; } else { int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int nums [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { nums [ i ] = sc . nextInt ( ) ; } int a = 0 , b = 0 ; for ( int i = 0 ; i < 3 ; + + i ) { if ( nums [ i ] = = 5 ) a + + ; if ( nums [ i ] = = 7 ) b + + ; } if ( a = = 2 & & b = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] task = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { task [ i ] = sc . nextInt ( ) ; } Arrays . sort ( task ) ; int sum = 0 ; for ( int i = 0 ; i < 2 ; i + + ) { sum + = task [ i + 1 ] - task [ i ] ; } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) y [ i ] = a [ 0 ] [ i ] ; x [ 1 ] = a [ 1 ] [ 0 ] - y [ 0 ] ; x [ 2 ] = a [ 2 ] [ 0 ] - y [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF _ 8 ) ; BufferedReader in = new BufferedReader ( reader ) ; List < Integer > positions = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; + + i ) { positions . add ( Integer . parseInt ( in . readLine ( ) ) ) ; } int K = Integer . parseInt ( in . readLine ( ) ) ; in . close ( ) ; int count = 0 ; for ( int i = 0 ; i < positions . size ( ) ; + + i ) { for ( int j = 0 ; j < positions . size ( ) ; + + j ) { if ( positions . get ( j ) - positions . get ( i ) > K ) { + + count ; } } } if ( count > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . Arrays ; public class Main { private static int [ ] pos = new int [ 5 ] ; private static int k ; private static String solver ( ) { int min = Arrays . stream ( pos ) . min ( ) . getAsInt ( ) ; int max = Arrays . stream ( pos ) . max ( ) . getAsInt ( ) ; if ( k > = max - min ) { return " Yay ! " ; } else { return " : ( " ; } } public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; try { for ( int i = 0 ; i < 5 ; i + + ) { String [ ] inputArray = br . readLine ( ) . split ( " " ) ; pos [ i ] = Integer . parseInt ( inputArray [ 0 ] ) ; } String [ ] inputArray = br . readLine ( ) . split ( " " ) ; k = Integer . parseInt ( inputArray [ 0 ] ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } System . out . println ( solver ( ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int first = scan . nextInt ( ) ; int second = scan . nextInt ( ) ; int third = scan . nextInt ( ) ; if ( ( first = = 5 | | first = = 7 ) & ( second = = 5 | | second = = 7 ) & ( third = = 5 | | third = = 7 ) & ( first + second + third = = 17 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( ( A = = 5 | | A = = 7 ) & & ( B = = 5 | | B = = 7 ) & & ( C = = 5 | | C = = 7 ) & & A + B + C = = 17 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( ( ( S - ( i + j ) ) < = K ) & & ( S - ( i + j ) > = 0 ) ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) System . out . println ( " YES " ) ; else if ( a = = 5 & & b = = 7 & & c = = 5 ) System . out . println ( " YES " ) ; else if ( a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; import java . io . * ; class Main { void solve ( ) { int k = inint ( ) , s = inint ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( 0 < = z & & z < = k ) & & x + y + z = = s ) count + + ; } } out . println ( count ) ; } public static Scanner in = new Scanner ( System . in ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } public int inint ( ) { return in . nextInt ( ) ; } public long inlong ( ) { return in . nextLong ( ) ; } public String instr ( ) { return in . next ( ) ; } public char inchar ( ) { return in . next ( ) . charAt ( 0 ) ; } public int [ ] inintar ( int num ) { int [ ] a = new int [ num ] ; for ( int i = 0 ; i < num ; i + + ) { a [ i ] = in . nextInt ( ) ; } return a ; } public char [ ] incharar ( ) { return in . next ( ) . toCharArray ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int min = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ( max - min ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] array = new Integer [ 5 ] ; for ( int i = 0 ; i < 5 ; + + i ) { int tmp = sc . nextInt ( ) ; array [ i ] = tmp ; } int k = Integer . parseInt ( sc . next ( ) ) ; if ( array [ 4 ] - array [ 0 ] < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; switch ( a ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : break ; } switch ( b ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : break ; } switch ( c ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : break ; } if ( 2 = = count5 & & 1 = = count7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { private static final String YES = " YES " ; private static final String NO = " NO " ; public static void main ( String [ ] args ) { new Main ( ) . execute ( ) ; } public void execute ( ) { Scanner sc = new Scanner ( System . in ) ; final int N1 = sc . nextInt ( ) ; final int N2 = sc . nextInt ( ) ; final int N3 = sc . nextInt ( ) ; final int N4 = sc . nextInt ( ) ; boolean [ ] b = new boolean [ 10 ] ; b [ N1 ] = true ; b [ N2 ] = true ; b [ N3 ] = true ; b [ N4 ] = true ; if ( b [ 1 ] & & b [ 9 ] & & b [ 7 ] & & b [ 4 ] ) { System . out . println ( YES ) ; } else { System . out . println ( NO ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; int flag = 0 ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { flag = 1 ; } } if ( flag = = 1 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] anArray = reader . readLine ( ) . split ( " " ) ; int counterFor7 = 0 ; int counterFor5 = 0 ; for ( int i = 0 ; i < anArray . length ; i + + ) { if ( Integer . parseInt ( anArray [ i ] ) = = 7 ) { counterFor7 + + ; } else if ( Integer . parseInt ( anArray [ i ] ) = = 5 ) { counterFor5 + + ; } } if ( counterFor7 = = 1 & & counterFor5 = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; sc . next ( ) ; sc . next ( ) ; sc . next ( ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int abc = a + b + c ; if ( abc = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] [ ] a = new int [ 3 ] [ 3 ] ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = true ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = a [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = a [ i ] [ 0 ] - y [ 0 ] ; } flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( x [ i ] + y [ j ] ! = a [ i ] [ j ] ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { final int n = 5 ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) ar [ i ] = in . nextInt ( ) ; int k = in . nextInt ( ) ; for ( int i = 0 ; i < n - 1 ; i + + ) for ( int j = i + 1 ; j < n ; j + + ) if ( Math . abs ( ar [ i ] - ar [ j ] ) > k ) { out . println ( " : ( " ) ; return ; } out . println ( " Yay ! " ) ; } } 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 , min = n , p ; i < n ; i + + ) { p = sc . nextInt ( ) ; if ( p < = min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; boolean ans = false ; switch ( a ) { case 5 : if ( b = = 7 ) { if ( c = = 5 ) { ans = true ; } } else if ( c = = 7 ) { if ( b = = 5 ) { ans = true ; } } break ; case 7 : if ( b = = 5 & & c = = 5 ) { ans = true ; } } System . out . println ( ans ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int y = 0 ; y < 3 ; y + + ) { for ( int x = 0 ; x < 3 ; x + + ) { c [ y ] [ x ] = sc . nextInt ( ) ; if ( y = = 0 ) b [ x ] = c [ y ] [ x ] ; else a [ y ] = c [ y ] [ x ] - b [ x ] ; } } boolean isAns = true ; for ( int y = 0 ; y < 3 ; y + + ) { for ( int x = 0 ; x < 3 ; x + + ) { if ( c [ y ] [ x ] ! = a [ y ] + b [ x ] ) { isAns = false ; break ; } } } System . out . println ( isAns ? " Yes " : " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int maxCount = 0 ; int ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int count = 0 ; int n = i ; while ( n % 2 = = 0 ) { n / = 2 ; count + + ; } if ( maxCount < count ) { maxCount = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; String s = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; out . println ( s . equals ( " 575 " ) | | s . equals ( " 557 " ) | | s . equals ( " 755 " ) ? " YES " : " NO " ) ; out . flush ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double mr = Math . toRadians ( m * 6 ) ; double hr = Math . toRadians ( 30 * h + m * 0.5 ) ; double sar = Math . abs ( mr - hr ) ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( sar ) ) ; System . out . println ( ans ) ; } } import java . io . * ; import java . util . Scanner ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int [ ] abcde = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { abcde [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( abcde [ j ] - abcde [ i ] < = k ) { cnt + + ; } } } if ( cnt < 10 ) { pr . println ( " : ( " ) ; } else { pr . println ( " Yay ! " ) ; } } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } static class Printer extends PrintWriter { Printer ( OutputStream out ) { super ( out ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 4 ] ; int [ ] Ans = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; boolean isAns = true ; for ( int i = 0 ; i < 4 ; i + + ) { if ( n [ i ] ! = Ans [ i ] ) isAns = false ; } System . out . println ( isAns ? " YES " : " NO " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; boolean isAB5C7 = ( a = = 5 & & b = = 5 & & c = = 7 ) ; boolean isBC5A7 = ( a = = 7 & & b = = 5 & & c = = 5 ) ; boolean isCA5B7 = ( a = = 5 & & b = = 7 & & c = = 5 ) ; if ( isCA5B7 | | isBC5A7 | | isAB5C7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF _ 8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } int [ ] [ ] c ; Main ( BufferedReader in ) throws IOException { c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { String [ ] tokens = in . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < 3 ; + + j ) { c [ i ] [ j ] = Integer . parseInt ( tokens [ j ] ) ; } } for ( int i = 0 ; i < 3 ; + + i ) { for ( int j = 1 ; j < 3 ; + + j ) { c [ j ] [ i ] - = c [ 0 ] [ i ] ; } } for ( int i = 0 ; i < 3 ; + + i ) { c [ 0 ] [ i ] = 0 ; } boolean enable = true ; for ( int i = 0 ; i < 3 ; + + i ) { boolean cond = true ; for ( int j = 1 ; j < 3 ; + + j ) { if ( c [ i ] [ j ] ! = c [ i ] [ 0 ] ) { cond = false ; } } if ( ! cond ) { enable = false ; break ; } } System . out . println ( ( enable ? " Yes " : " No " ) ) ; } void calc ( ) { } void showResult ( ) { } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; void solve ( ) throws IOException { int x = ni ( ) ; long ans = 2 ; for ( int i = 0 ; i < x ; i + + ) { ans + + ; ans * = 2 ; } out . println ( ans ) ; } String ns ( ) throws IOException { while ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) , " " ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( ns ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( ns ( ) ) ; } double nd ( ) throws IOException { return Double . parseDouble ( ns ( ) ) ; } String [ ] nsa ( int n ) throws IOException { String [ ] res = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ns ( ) ; } return res ; } int [ ] nia ( int n ) throws IOException { int [ ] res = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ni ( ) ; } return res ; } long [ ] nla ( int n ) throws IOException { long [ ] res = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nl ( ) ; } return res ; } public static void main ( String [ ] args ) throws IOException { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; tok = new StringTokenizer ( " " ) ; Main main = new Main ( ) ; main . solve ( ) ; out . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int num = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) num + + ; } } System . out . println ( num ) ; } } import java . util . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) { int x = 0 ; Scanner input = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = input . nextInt ( ) ; } for ( int j = 0 ; j < 3 ; j + + ) { x = x + a [ j ] ; } if ( x = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] ary = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) { ary [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int min = 2000000 ; int max = 0 ; for ( int i = 0 ; i < a ; i + + ) { if ( ary [ i ] < min ) { ans + + ; min = ary [ i ] ; } else if ( true ) { } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int oto [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { oto [ i ] = sc . nextInt ( ) ; } if ( oto [ 0 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 0 ] ; oto [ 0 ] = toriaezu ; } if ( oto [ 2 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 2 ] ; oto [ 2 ] = toriaezu ; } if ( oto [ 0 ] = = 5 & & oto [ 1 ] = = 7 & & oto [ 2 ] = = 5 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - i - j & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; sum = ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] level = new int [ n ] ; int count = 1 ; int min = 0 ; for ( int i = 0 ; i < n ; i + + ) { level [ i ] = input . nextInt ( ) ; if ( i = = 0 ) { min = level [ 0 ] ; } else { if ( level [ i ] < = min ) { count + + ; min = level [ i ] ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) for ( int j = 0 ; j < = k ; j + + ) if ( s - i - j > = 0 & & s - i - j < = k ) ans + + ; System . out . println ( ans ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double hk = ( ( h / 12 ) * 360 ) + ( ( m / 60 ) * 30 ) ; double mk = 360 * ( m / 60 ) ; double k = 0 ; if ( mk > = hk ) { k = mk - hk ; } else { k = hk - mk ; } if ( k > = 180 ) { k = 360 - k ; } double cosk = Math . cos ( Math . toRadians ( k ) ) ; double c = ( a * a ) + ( b * b ) - ( 2 * a * b * cosk ) ; System . out . println ( Math . sqrt ( c ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = Integer . parseInt ( in . next ( ) ) ; int [ ] [ ] ans = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i + + ) { int cnt = 0 ; int tmp = i + 1 ; while ( tmp > = 1 ) { if ( tmp % 2 = = 0 ) { cnt + + ; tmp / = 2 ; } else { break ; } } ans [ i ] [ 0 ] = i + 1 ; ans [ i ] [ 1 ] = cnt ; } Arrays . sort ( ans , ( x , y ) - > Integer . compare ( x [ 1 ] , y [ 1 ] ) ) ; out . println ( ans [ n - 1 ] [ 0 ] ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ab = Math . abs ( b - a ) ; int bc = Math . abs ( c - b ) ; int ca = Math . abs ( a - c ) ; if ( a < = b & & b < = c ) { System . out . println ( ab + bc ) ; } else if ( a < = c & & c < = b ) { System . out . println ( ca + bc ) ; } else if ( b < = a & & a < = c ) { System . out . println ( ab + ca ) ; } else if ( b < = c & & c < = a ) { System . out . println ( bc + ca ) ; } else if ( c < = a & & a < = b ) { System . out . println ( ca + ab ) ; } else if ( c < = b & & b < = a ) { System . out . println ( bc + ab ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k , s , ans = 0 ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 0 ; i < = k ; + + i ) { for ( int j = 0 ; j < = k ; + + j ) { int tmp = s - i - j ; if ( tmp > = 0 & & tmp < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i < = N ; i * = 2 ) { ans = Math . max ( ans , i ) ; } System . out . println ( ans ) ; } } 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 . math . BigDecimal ; import java . math . BigInteger ; import java . util . InputMismatchException ; import java . util . Scanner ; import java . util . StringTokenizer ; public class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws IOException { while ( in . hasNext ( ) ) { int [ ] a = new int [ 4 + 1 ] ; int [ ] vis = new int [ 11 ] ; for ( int i = 1 ; i < = 4 ; i + + ) { a [ i ] = in . nextInt ( ) ; vis [ a [ i ] ] + + ; } if ( vis [ 1 ] = = 1 & & vis [ 7 ] = = 1 & & vis [ 9 ] = = 1 & & vis [ 4 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] grid = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { grid [ i ] [ j ] = sc . nextInt ( ) ; } } boolean b = true ; for ( int i = 0 ; i < 3 ; i + + ) { int x = 0 ; int y = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { int bX = grid [ j ] [ i ] - grid [ j ] [ ( ( i + 1 ) % 3 ) ] ; int bY = grid [ i ] [ j ] - grid [ ( ( i + 1 ) % 3 ) ] [ j ] ; if ( j = = 0 ) { x = bX ; y = bY ; } else { b & = x = = bX ; b & = y = = bY ; } if ( ! b ) break ; } if ( ! b ) break ; } System . out . println ( b ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 6 ] ; for ( int i = 0 ; i < array . length ; i + + ) array [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( array [ j ] - array [ i ] > array [ array . length - 1 ] ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Set ; import java . util . function . Consumer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { String str [ ] = br . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( str [ j ] ) ; } } for ( int i = 0 ; i < 3 ; i + + ) { int s = c [ ( i + 1 ) % 3 ] [ 0 ] - c [ i ] [ 0 ] ; int t = c [ ( i + 1 ) % 3 ] [ 1 ] - c [ i ] [ 1 ] ; int u = c [ ( i + 1 ) % 3 ] [ 2 ] - c [ i ] [ 2 ] ; if ( s ! = t | | t ! = u | | u ! = s ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double theta = ( double ) Math . abs ( ( H * 30 + 0.5 * M ) - M * 6 ) ; if ( theta > = 180 ) { theta = ( double ) 360.0 - theta ; } double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( theta ) ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int res = 0 ; for ( int i = 0 ; i < N ; i + + ) { int P = sc . nextInt ( ) ; if ( P < = min ) { res + + ; min = P ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) , r = sc . nextInt ( ) ; int a = r - h ; if ( a = = 2 * r ) { System . out . println ( 0 ) ; } else if ( a > 2 * r ) { System . out . println ( - 1 ) ; } else { System . out . println ( 1 ) ; } } } public class Main { public static void main ( String [ ] args ) { java . util . Scanner s = new java . util . Scanner ( System . in ) ; Integer c [ ] [ ] = new Integer [ 3 ] [ 3 ] ; int max = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int pos = c [ i ] [ j ] = s . nextInt ( ) ; max = Math . max ( max , pos ) ; } } System . out . println ( Main . calc ( c , max ) ? " Yes " : " No " ) ; } public static boolean calc ( Integer c [ ] [ ] , int max ) { for ( int a1 = 0 ; a1 < = max & & a1 < = 100 ; a1 + + ) { int b1 = c [ 0 ] [ 0 ] - a1 ; if ( 0 > b1 | | b1 > 100 ) { continue ; } for ( int a2 = 0 ; a2 < = max & & a2 < = 100 ; a2 + + ) { int b2 = c [ 1 ] [ 1 ] - a2 ; if ( 0 > b2 | | b2 > 100 ) { continue ; } for ( int a3 = 0 ; a3 < = max & & a3 < = 100 ; a3 + + ) { int b3 = c [ 2 ] [ 2 ] - a3 ; if ( 0 > b3 | | b3 > 100 ) { continue ; } if ( c [ 0 ] [ 1 ] = = a1 + b2 & & c [ 0 ] [ 2 ] = = a1 + b3 & & c [ 1 ] [ 0 ] = = a2 + b1 & & c [ 2 ] [ 0 ] = = a3 + b1 & & c [ 2 ] [ 1 ] = = a3 + b2 & & c [ 1 ] [ 2 ] = = a2 + b3 ) { return true ; } } } } return false ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int current = sc . nextInt ( ) ; int mini = current , maxi = current , distance = 0 ; do { int res = Math . max ( Math . abs ( current - mini ) , Math . abs ( current - maxi ) ) ; if ( res > distance ) { distance = res ; } current = sc . nextInt ( ) ; } while ( sc . hasNext ( ) ) ; if ( distance > current ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int all = 1 ; while ( all < = N ) { all * = 2 ; } if ( all > N ) { System . out . println ( all / 2 ) ; } else { System . out . println ( all ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = " " ; int p = 0 ; int w = 0 ; int g = 0 ; int y = 0 ; for ( int i = 0 ; i < n ; i + + ) { s = sc . next ( ) ; if ( s . equals ( " P " ) & & p = = 0 ) { p = 1 ; } else if ( s . equals ( " W " ) & & w = = 0 ) { w = 1 ; } else if ( s . equals ( " G " ) & & g = = 0 ) { g = 1 ; } else if ( s . equals ( " Y " ) & & y = = 0 ) { y = 1 ; } } System . out . println ( ( p + w + g + y ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ar [ ] = new int [ 5 ] ; boolean what = true ; for ( int i = 0 ; i < 5 ; i + + ) { ar [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < ar . length - 1 ; i + + ) { for ( int j = i ; j < ar . length - 1 ; j + + ) { if ( Math . abs ( ( ar [ i ] - ar [ j + 1 ] ) ) > k ) { what = false ; break ; } } if ( what = = false ) break ; } if ( what = = false ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; + + i ) p [ i ] = sc . nextInt ( ) ; int ans = 0 ; int min = p [ 0 ] ; for ( int i = 0 ; i < n ; + + i ) { if ( p [ i ] < = min ) { min = p [ i ] ; + + ans ; } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( Math . abs ( a [ 1 ] - a [ 0 ] ) + Math . abs ( a [ 2 ] - a [ 1 ] ) ) ; } } public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; System . out . println ( e - a < = scanner . nextInt ( ) ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; x [ 0 ] = sc . nextInt ( ) ; x [ 1 ] = sc . nextInt ( ) ; x [ 2 ] = sc . nextInt ( ) ; x [ 3 ] = sc . nextInt ( ) ; x [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 - 1 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( x [ i ] - x [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( ! ( Z > = 0 & & Z < = K ) ) { continue ; } count + + ; } } System . out . println ( count ) ; } } } import java . util . * ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; solve ( scanner ) ; } static void solve ( Scanner scanner ) { int N = scanner . nextInt ( ) ; long X = scanner . nextLong ( ) ; scanner . nextLine ( ) ; int [ ] a = Arrays . stream ( scanner . nextLine ( ) . split ( " " ) ) . mapToInt ( Integer : : parseInt ) . toArray ( ) ; long [ ] [ ] min = new long [ N ] [ N ] ; for ( int i = 0 ; i < N ; i + + ) { Arrays . fill ( min [ i ] , Long . MAX _ VALUE / 2 ) ; min [ i ] [ i ] = a [ i ] ; } for ( int i = 1 ; i < N ; i + + ) { for ( int l = 0 ; l < N ; l + + ) { min [ l ] [ Math . floorMod ( l + i , N ) ] = Math . min ( min [ l ] [ Math . floorMod ( l + i - 1 , N ) ] , a [ Math . floorMod ( l + i , N ) ] ) ; } } long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { long tmp = i * X ; for ( int j = 0 ; j < N ; j + + ) { tmp + = min [ Math . floorMod ( j - i , N ) ] [ j ] ; } ans = Math . min ( ans , tmp ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > colors = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { colors . add ( sc . next ( ) ) ; } if ( colors . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 9 ] ; boolean key = false ; for ( int i = 0 ; i < 9 ; i + + ) num [ i ] = sc . nextInt ( ) ; for ( int a1 = 0 ; a1 < = 100 ; a1 + + ) { int b1 = num [ 0 ] - a1 ; int b2 = num [ 1 ] - a1 ; int b3 = num [ 2 ] - a1 ; int a2 = num [ 3 ] - b1 ; int a3 = num [ 6 ] - b1 ; if ( a2 + b2 = = num [ 4 ] & & a2 + b3 = = num [ 5 ] & & a3 + b2 = = num [ 7 ] & & a3 + b3 = = num [ 8 ] ) { key = true ; break ; } } System . out . println ( key ? " Yes " : " No " ) ; } } import java . time . chrono . MinguoChronology ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int count = 0 ; count < 4 ; count + + ) { list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; list . add ( d ) ; } int mitasu = 0 ; int countAns = 0 ; boolean one = false ; boolean seven = false ; boolean nine = false ; boolean forth = false ; for ( int youso : list ) { if ( youso = = 1 & & ! one ) { one = true ; countAns + + ; } if ( youso = = 7 & & ! seven ) { seven = true ; countAns + + ; } if ( youso = = 9 & & ! nine ) { nine = true ; countAns + + ; } if ( youso = = 7 & & ! forth ) { forth = true ; countAns + + ; } } if ( countAns = = 4 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double mm = h + ( m / 60.0 ) ; double cc = Math . cos ( ( 5 * mm - m ) * Math . PI / 30.0 ) ; double z = Math . sqrt ( a * a * 1.0 + b * b - 2.0 * a * b * cc ) ; System . out . println ( z ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int v [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) v [ i ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( ( v [ 4 ] - v [ 0 ] < = k ) ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double t = h * 60 + m ; double diff = Math . abs ( t / 720 - m / 60 ) ; diff = Math . min ( diff , 1 - diff ) ; double ans = a * a + b * b ; ans - = 2 * a * b * Math . cos ( diff * 2 * Math . PI ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner stdIn = new Scanner ( System . in ) ; double A = stdIn . nextInt ( ) ; double B = stdIn . nextInt ( ) ; double H = stdIn . nextInt ( ) ; double W = stdIn . nextInt ( ) ; double a = W * 6 - ( H * 30 + W * 0.5 ) ; a = Math . abs ( a ) ; if ( a > 180 ) a = 360 - a ; System . out . println ( Math . sqrt ( ( A * A + B * B ) - 2 * A * B * Math . cos ( Math . toRadians ( a ) ) ) ) ; } } import java . lang . reflect . Array ; import java . util . * ; public class Main { static int N ; static int K ; static long Q ; static int A ; static int B ; static long C ; static double min = 9999999 ; static long ans = 0 ; public static void main ( String [ ] args ) { if ( get ( ) ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } public static boolean get ( ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; int D = scanner . nextInt ( ) ; int E = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; if ( B - A > K ) return false ; if ( C - A > K ) return false ; if ( D - A > K ) return false ; if ( E - A > K ) return false ; if ( C - B > K ) return false ; if ( D - B > K ) return false ; if ( E - B > K ) return false ; if ( D - C > K ) return false ; if ( E - C > K ) return false ; if ( E - D > K ) return false ; return true ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputs = input . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( inputs [ 0 ] ) ; int B = Integer . parseInt ( inputs [ 1 ] ) ; int C = Integer . parseInt ( inputs [ 2 ] ) ; int [ ] syllables = new int [ ] { A , B , C } ; int numOf5 = 0 ; int numOf7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( syllables [ i ] = = 5 ) { numOf5 + = 1 ; } else if ( syllables [ i ] = = 7 ) { numOf7 + = 1 ; } } if ( numOf5 = = 2 & & numOf7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > dis = new ArrayList < Integer > ( ) ; String judge ; for ( int i = 0 ; i < 5 ; i + + ) { dis . add ( Integer . parseInt ( sc . next ( ) ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; int max = Collections . max ( dis ) ; int min = Collections . min ( dis ) ; int flag = max - min ; if ( flag > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Math . abs ( a - e ) < = k ) { System . out . println ( " Yay ! " ) ; return ; } System . out . println ( " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int cntmax = - 1 ; int cnt , ii ; int imax = 0 ; for ( int i = 1 ; i < = n ; i + + ) { cnt = 0 ; ii = i ; while ( true ) { if ( ii % 2 = = 1 ) break ; ii = ii / 2 ; cnt + + ; } if ( cnt > cntmax ) { cntmax = cnt ; imax = i ; } } System . out . println ( imax ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; int [ ] a = new int [ ] { A , B , C , } ; Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) , S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int l = S - i - j ; if ( l > = 0 & & l < = K & & i + j + l = = S ) { count + + ; } } } System . out . println ( count ) ; } public static int sample ( int n ) { return n ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int e = Integer . parseInt ( br . readLine ( ) ) ; int k = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; } } } import java . util . Scanner ; import java . util . InputMismatchException ; class Main { public static void main ( String args [ ] ) { int x [ ] = new int [ 6 ] ; try { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 6 ; i + + ) { x [ i ] = scanner . nextInt ( ) ; } scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( " error " ) ; } if ( x [ 4 ] - x [ 0 ] > x [ 5 ] ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int [ ] pArray = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { pArray [ i ] = sc . nextInt ( ) ; } int min = pArray [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( pArray [ i ] < min ) { count + + ; min = pArray [ i ] ; } } System . out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; if ( list . contains ( 5 ) ) { list . remove ( list . indexOf ( 5 ) ) ; if ( list . contains ( 5 ) ) { list . remove ( list . indexOf ( 5 ) ) ; if ( list . contains ( 7 ) ) { list . remove ( list . indexOf ( 7 ) ) ; System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long mins = h * 60 + m ; double fen = mins * 6 % 360 ; double shi = mins * 0.5 % 360 ; double diff = ( ( shi - fen + 360 ) % 360 ) ; double res = 0.0 ; if ( diff = = 0 ) { System . out . println ( Math . abs ( a - b ) ) ; return ; } else if ( diff = = 180 ) { System . out . println ( a + b ) ; return ; } else if ( diff > 180 ) { diff = 360 - diff ; } double res2 = a * a + b * b - 2.0 * a * b * Math . cos ( Math . toRadians ( diff ) ) ; System . out . println ( Math . sqrt ( res2 ) ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > plist = new ArrayList < > ( ) ; plist . add ( sc . nextInt ( ) ) ; plist . add ( sc . nextInt ( ) ) ; plist . add ( sc . nextInt ( ) ) ; plist . add ( sc . nextInt ( ) ) ; Collections . sort ( plist ) ; if ( plist . get ( 0 ) = = 1 & & plist . get ( 1 ) = = 4 & & plist . get ( 2 ) = = 7 & & plist . get ( 3 ) = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( ( 2 * ans ) < = n ) { ans * = 2 ; } else { break ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String line = in . nextLine ( ) ; in . close ( ) ; String [ ] ary = line . split ( " " ) ; boolean w7 = false ; boolean [ ] w5 = { false , false } ; for ( String w : ary ) { int intW = Integer . parseInt ( w . trim ( ) ) ; if ( intW ! = 5 & & intW ! = 7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 5 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 = = false ) { w7 = true ; } else if ( intW = = 5 ) { if ( w5 [ 0 ] = = false ) { w5 [ 0 ] = true ; } else if ( w5 [ 1 ] = = false ) { w5 [ 1 ] = true ; } } } if ( w7 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double ra = H / 12.0 ; double rb = M / 60.0 ; ra + = 1 / 12.0 * rb ; double a = ( Math . max ( ra , rb ) - Math . min ( ra , rb ) ) * 360 ; if ( a > 180 ) { a = 360 - a ; } double cosA = Math . cos ( Math . toRadians ( a ) ) ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * cosA ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int [ ] a = new int [ 3 ] ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; sum = ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( sum ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String a = " Three " ; for ( int i = 1 ; i < = n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) a = " Four " ; } System . out . println ( a ) ; } } import java . util . Scanner ; import java . util . Vector ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] sequence = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { sequence [ i ] = sc . nextInt ( ) ; } int koike = 1 ; int tanaka = 0 ; int min = sequence [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = sequence [ i ] ) { tanaka + + ; } min = Math . min ( min , sequence [ i ] ) ; } System . out . println ( tanaka ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) ; int A2 = sc . nextInt ( ) ; int A3 = sc . nextInt ( ) ; int max = Math . max ( Math . max ( A1 , A2 ) , Math . max ( A2 , A3 ) ) ; int min = Math . min ( Math . min ( A1 , A2 ) , Math . min ( A2 , A3 ) ) ; int mid = A1 + A2 + A3 - min - max ; System . out . println ( Math . abs ( min - mid ) + Math . abs ( mid - max ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] w = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; out : for ( int i = N ; i > 0 ; i -- ) { for ( int j = w . length - 1 ; j > = 0 ; j -- ) { if ( i = = w [ j ] ) { System . out . println ( w [ j ] ) ; break out ; } } } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] D = new int [ N ] ; long sumA = 0 ; long sumB = 0 ; long diff = 0 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; sumA + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; sumB + = B [ i ] ; D [ i ] = B [ i ] - A [ i ] ; if ( A [ i ] < B [ i ] ) { diff + = B [ i ] - A [ i ] ; count + + ; } } sc . close ( ) ; Arrays . sort ( D ) ; if ( sumA < sumB ) { System . out . println ( - 1 ) ; } else { int idx = 0 ; while ( diff > 0 ) { diff + = D [ idx ] ; count + + ; idx + + ; } System . out . println ( count ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) arr [ i ] = in . nextInt ( ) ; Arrays . sort ( arr ) ; if ( isHaiku ( arr ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static boolean isHaiku ( int [ ] arr ) { int [ ] haiku = { 5 , 5 , 7 } ; for ( int i = 0 ; i < 3 ; i + + ) if ( arr [ i ] ! = haiku [ i ] ) return false ; return true ; } static class InputReader { public BufferedReader br ; public StringTokenizer st ; public InputReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = null ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) counter + + ; } } System . out . println ( counter ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String abc = " " + a + b + c ; String ans = " NO " ; if ( a + b + c = = 17 ) { if ( abc . contains ( " 7 " ) & & abc . contains ( " 5 " ) ) { ans = " YES " ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double mangle = ( 360.0 / 60.0 ) * M ; double hangle = ( 30.0 * H ) + ( 30.0 / 360.0 ) * mangle ; double angle = Math . abs ( mangle - hangle ) ; if ( angle > 180 ) angle = 360 - angle ; double ans = A * A + B * B - 2 * A * B * Math . cos ( angle * ( Math . PI / 180 ) ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( scanner . next ( ) ) ; } int k = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; String message ; if ( Math . abs ( a [ 0 ] - a [ 4 ] ) < = k ) { message = " Yay ! " ; } else { message = " : ( " ; } System . out . println ( message ) ; System . out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double theta1 = 2 * Math . PI * ( h * 60 + m ) / 720 ; double theta2 = 2 * Math . PI * m / 60 ; double x1 = a * Math . cos ( theta1 ) ; double y1 = a * Math . sin ( theta1 ) ; double x2 = b * Math . cos ( theta2 ) ; double y2 = b * Math . sin ( theta2 ) ; System . out . println ( Math . sqrt ( Math . pow ( x1 - x2 , 2 ) + Math . pow ( y1 - y2 , 2 ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] antenna = { Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) } ; int range = Integer . parseInt ( sc . next ( ) ) ; boolean result = true ; for ( int i = 0 ; i < antenna . length - 1 ; i + + ) { for ( int j = i + 1 ; j < antenna . length ; j + + ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > range ) { result = false ; } } } System . out . println ( result ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] n = new int [ 4 ] ; for ( int i = 0 ; i < N ; i + + ) { String t = sc . next ( ) ; if ( t . compareTo ( " P " ) = = 0 ) n [ 0 ] + + ; if ( t . compareTo ( " W " ) = = 0 ) n [ 1 ] + + ; if ( t . compareTo ( " G " ) = = 0 ) n [ 2 ] + + ; if ( t . compareTo ( " Y " ) = = 0 ) n [ 3 ] + + ; } int res = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( n [ i ] > 0 ) res + + ; } if ( res = = 3 ) System . out . println ( " Three " ) ; else if ( res = = 4 ) System . out . println ( " Four " ) ; } } import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < Character , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { map . put ( sc . next ( ) . charAt ( 0 ) , 0 ) ; } Object [ ] array = map . keySet ( ) . toArray ( ) ; if ( array . length = = 4 ) System . out . println ( " Four " ) ; else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double angleM = ( ( double ) M / 60 ) * 360 ; double tmpM = ( ( double ) M / 60 ) * 30 ; ; double angleH = ( double ) ( H * 30 + tmpM ) ; double theta = angleH - angleM ; if ( theta > 180 ) theta = angleM - angleH ; double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( theta ) ) ; double r _ ans = Math . sqrt ( ans ) ; System . out . println ( r _ ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list ) ; System . out . println ( list . get ( 2 ) - list . get ( 0 ) ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int size = in . nextInt ( ) ; ArrayList < Long > list = new ArrayList < Long > ( ) ; for ( int x = 0 ; x < size ; x + + ) { list . add ( in . nextLong ( ) ) ; } long minimum = 2 ; long counter = list . get ( 0 ) - 1 ; for ( int x = 1 ; x < size ; x + + ) { long num = list . get ( x ) ; if ( num % minimum = = 0 ) { counter + = ( num / minimum ) - 1 ; list . set ( x , minimum ) ; } else { counter + = ( num / minimum ) ; list . set ( x , list . get ( x ) % minimum ) ; } if ( list . get ( x ) - minimum = = 0 & & num = = minimum ) { minimum + + ; } } System . out . println ( counter ) ; in . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int H = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; double x2 = A * A + B * B - 2 * A * B * ( Math . cos ( Math . toRadians ( 30 * H + ( double ) ( M / 2.0 ) - 6 * M ) ) ) ; double ans = Math . sqrt ( x2 ) ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; scan . close ( ) ; String [ ] ks = str . split ( " " ) ; int n = 0 ; int k = Integer . parseInt ( ks [ 0 ] ) ; int s = Integer . parseInt ( ks [ 1 ] ) ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { n + + ; } } } System . out . println ( n ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] anntena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { anntena [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " Yay ! " ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i ; j < 5 ; j + + ) { int distance = anntena [ j ] - anntena [ i ] ; if ( distance > k ) { ans = " : ( " ; break ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int K = keyboard . nextInt ( ) ; int S = keyboard . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - ( i + j ) & & S - ( i + j ) < = K ) { ans + + ; } } } System . out . println ( ans ) ; keyboard . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; boolean hasYellow = false ; for ( int i = 0 ; i < count ; i + + ) { String color = sc . next ( ) ; if ( color . equals ( " Y " ) ) hasYellow = true ; } if ( hasYellow ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { int input = sc . nextInt ( ) ; list . add ( input ) ; } Collections . sort ( list ) ; int diff = list . get ( 4 ) - list . get ( 0 ) ; int k = sc . nextInt ( ) ; if ( diff < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } class Pair < T1 , T2 > { private T1 left ; private T2 right ; public Pair ( T1 left , T2 right ) { this . left = left ; this . right = right ; } public T1 getLeft ( ) { return this . left ; } public T2 getRight ( ) { return this . right ; } @ Override public boolean equals ( Object object ) { Pair pair = ( Pair ) object ; if ( pair . getLeft ( ) . equals ( this . getLeft ( ) ) & & pair . getRight ( ) . equals ( this . getRight ( ) ) ) { return true ; } return false ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double degree = Math . abs ( 30 * h - 5.5 * m ) ; if ( degree > 180 ) { degree = 360 - degree ; } double hudu = degree * ( Math . PI / 180 ) ; double c = Math . sqrt ( b * b + a * a - 2 * a * b * Math . cos ( hudu ) ) ; System . out . println ( c ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . sort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double cosC = 0 ; double h = ( H * 30 ) + ( M * 0.5 ) ; double s = M * 6 ; if ( h > s ) { cosC = h - s ; } else if ( h < s ) { cosC = s - h ; } double C = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( cosC ) ) ) ; System . out . println ( C ) ; } } import java . util . Scanner ; public class Main { static boolean [ ] isPrime ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; sc . close ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; System . exit ( 0 ) ; } long ans = 1 ; long t = ( long ) Math . pow ( P , ( double ) 1 / N ) ; t + = 2 ; for ( long k = 2 ; k < = t ; k + + ) { long s = ( long ) Math . pow ( k , N ) ; if ( P % s = = 0 ) { ans = k ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int max = 0 ; int highest = 1 ; for ( int i = 1 ; i < n + 1 ; i + + ) { int x = i ; int ans = 0 ; while ( x % 2 = = 0 ) { x / = 2 ; ans + = 1 ; if ( x = = 0 ) { break ; } } if ( max < ans ) { max = ans ; highest = i ; } } System . out . print ( highest ) ; } } 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 ( ) ; sc . close ( ) ; long sum _ N = 1 ; long sum _ M = 1 ; long ans = 0 ; int l = ( int ) Math . pow ( 10 , 9 ) + 7 ; if ( Math . abs ( N - M ) < 2 ) { for ( int i = 1 ; i < = N ; i + + ) { sum _ N = sum _ N * i % l ; } for ( int j = 1 ; j < = M ; j + + ) { sum _ M = sum _ M * j % l ; } if ( N = = M ) { ans = ( sum _ N * sum _ M * 2 ) % l ; } else { ans = ( sum _ N * sum _ M ) % l ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 1 ; while ( num * 2 < = n ) { num = num * 2 ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( e - a > k ) flag = true ; if ( flag ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt = 0 ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; void solve ( ) throws IOException { int [ ] arr = nia ( 3 ) ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } String ns ( ) throws IOException { while ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) , " " ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( ns ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( ns ( ) ) ; } double nd ( ) throws IOException { return Double . parseDouble ( ns ( ) ) ; } String [ ] nsa ( int n ) throws IOException { String [ ] res = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ns ( ) ; } return res ; } int [ ] nia ( int n ) throws IOException { int [ ] res = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ni ( ) ; } return res ; } long [ ] nla ( int n ) throws IOException { long [ ] res = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nl ( ) ; } return res ; } public static void main ( String [ ] args ) throws IOException { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; tok = new StringTokenizer ( " " ) ; Main main = new Main ( ) ; main . solve ( ) ; out . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 0 ; int ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int count = 0 ; int temp = i ; while ( true ) { if ( temp % 2 = = 0 ) { temp = temp / 2 ; count + + ; } else { break ; } } if ( count > max ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . nextLine ( ) ; sc . close ( ) ; boolean judge = n . contains ( " 1 " ) & & n . contains ( " 9 " ) & & n . contains ( " 7 " ) & & n . contains ( " 4 " ) ; String result = judge ? " YES " : " NO " ; System . out . println ( result ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { num [ i ] = keyboard . nextInt ( ) ; } int K = keyboard . nextInt ( ) ; String ans = " Yay ! " ; for ( int j = 0 ; j < 4 ; j + + ) { for ( int k = 1 ; k < 5 ; k + + ) { if ( num [ k ] - num [ j ] > K ) { ans = " : ( " ; } } } System . out . println ( ans ) ; keyboard . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double ax , ay , bx , by , arad , brad ; arad = ( 1 / 2 - h / 6 - m / 360 ) * Math . PI ; brad = ( 1 / 2 - m / 30 ) * Math . PI ; ax = a * Math . cos ( arad ) ; bx = b * Math . cos ( brad ) ; ay = a * Math . sin ( arad ) ; by = b * Math . sin ( brad ) ; System . out . println ( Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int kari = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; if ( kari = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] & & kari = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) { kari = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; if ( kari = = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] & & kari = = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; boolean existsY = false ; for ( int i = 0 ; i < n ; i + + ) { if ( scanner . next ( ) . equals ( " Y " ) ) { existsY = true ; break ; } } if ( existsY ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int ans = 1 ; int count = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int divi = i ; int roop = 0 ; while ( divi % 2 = = 0 ) { divi = divi / 2 ; roop + + ; } if ( count < roop ) { count = roop ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 5 ] ; boolean t = true ; for ( int i = 0 ; i < 5 ; i + + ) { N [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int j = 0 ; j < 4 ; j + + ) { if ( Math . abs ( N [ 0 ] - N [ j + 1 ] ) > k ) { t = false ; } } for ( int j = 0 ; j < 3 ; j + + ) { if ( Math . abs ( N [ 1 ] - N [ j + 2 ] ) > k ) { t = false ; } } for ( int j = 0 ; j < 2 ; j + + ) { if ( Math . abs ( N [ 2 ] - N [ j + 3 ] ) > k ) { t = false ; } } if ( Math . abs ( N [ 3 ] - N [ 4 ] ) > k ) t = false ; if ( t = = true ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long K = sc . nextInt ( ) ; long S = sc . nextInt ( ) ; long res = 0 ; for ( long i = Math . min ( K , S ) ; i > = 0 ; i -- ) { long v = S - i ; if ( v < K ) res + = ( v + 1 ) ; else if ( v = = K ) res + = ( K + 1 ) ; else if ( v < = 2 * K ) { long a = v - K ; res + = K - a + 1 ; } } System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double o = 0 ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double x = sc . nextDouble ( ) ; double y = sc . nextDouble ( ) ; double d = 6 * y - ( 30 * x + y / 2 ) ; double cosin = Math . cos ( Math . toRadians ( d ) ) ; o = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * cosin ) ; System . out . println ( o ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 1 ; i < = N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Map . Entry ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; Scanner in = new Scanner ( System . in ) ; new Main ( ) . solve ( in , out ) ; in . close ( ) ; out . close ( ) ; } private void solve ( Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; HashMap < Integer , Integer > hash = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i < = N ; i + + ) { hash . put ( i , dividedCount ( i ) ) ; } List < Entry < Integer , Integer > > list _ entries = new ArrayList < Entry < Integer , Integer > > ( hash . entrySet ( ) ) ; Collections . sort ( list _ entries , new Comparator < Entry < Integer , Integer > > ( ) { public int compare ( Entry < Integer , Integer > obj1 , Entry < Integer , Integer > obj2 ) { return obj2 . getValue ( ) . compareTo ( obj1 . getValue ( ) ) ; } } ) ; System . out . println ( list _ entries . get ( 0 ) . getKey ( ) ) ; } private int dividedCount ( int n ) { if ( n % 2 ! = 0 | | n < = 1 ) return 0 ; return 1 + dividedCount ( n / 2 ) ; } } import static java . lang . System . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( in ) ; int n = s . nextInt ( ) ; int cur = 1 ; int max = 0 ; for ( int x = 2 ; x < = n ; x + + ) { int exp = 1 ; while ( x % Math . pow ( 2 , exp ) = = 0 & & Math . pow ( 2 , exp ) < x ) exp + + ; if ( exp > max ) { max = exp ; cur = x ; } } out . println ( cur ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Double A = sc . nextDouble ( ) ; Double B = sc . nextDouble ( ) ; Double H = sc . nextDouble ( ) ; Double M = sc . nextDouble ( ) ; Double R = Math . abs ( ( H * 30 + M * 0.5 ) - ( M * 6 ) ) ; if ( R > 180 ) { R = 360 - R ; } Double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( R ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { private void doit ( ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = 3 ; int [ ] [ ] data = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { data [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flg = false ; for ( int i = 0 ; i < 101 ; i + + ) { for ( int j = 0 ; j < 101 ; j + + ) { for ( int k = 0 ; k < 101 ; k + + ) { if ( data [ 0 ] [ 0 ] - i = = data [ 0 ] [ 1 ] - j & & data [ 0 ] [ 0 ] - i = = data [ 0 ] [ 2 ] - k & & data [ 0 ] [ 1 ] - j = = data [ 0 ] [ 2 ] - k ) { if ( data [ 1 ] [ 0 ] - i = = data [ 1 ] [ 1 ] - j & & data [ 1 ] [ 0 ] - i = = data [ 1 ] [ 2 ] - k & & data [ 1 ] [ 1 ] - j = = data [ 1 ] [ 2 ] - k ) { if ( data [ 2 ] [ 0 ] - i = = data [ 2 ] [ 1 ] - j & & data [ 2 ] [ 0 ] - i = = data [ 2 ] [ 2 ] - k & & data [ 2 ] [ 1 ] - j = = data [ 2 ] [ 2 ] - k ) { flg = true ; break ; } } } } if ( flg ) break ; } if ( flg ) break ; } System . out . println ( flg ? " Yes " : " No " ) ; } } private void debug ( Object ... o ) { System . out . println ( " debug = " + Arrays . deepToString ( o ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . doit ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double hr = ( ( ( h * 60 ) + m ) / 720 ) * 360 * Math . PI / 180 ; double mr = ( m / 60 ) * 360 * Math . PI / 180 ; double ax = a * Math . cos ( hr ) ; double ay = a * Math . sin ( hr ) ; double bx = b * Math . cos ( mr ) ; double by = b * Math . sin ( mr ) ; double result = Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ; System . out . println ( result ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > minus = new ArrayList < > ( ) ; long sumM = 0 ; long sumP = 0 ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; PriorityQueue < Integer > plus = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { int a1 = a [ i ] ; int b1 = b [ i ] ; if ( b1 > a1 ) { minus . add ( b1 - a1 ) ; sumM + = ( long ) ( b1 - a1 ) ; } if ( a1 > b1 ) { plus . add ( a1 - b1 ) ; sumP + = ( long ) ( a1 - b1 ) ; } } if ( sumM > sumP ) { System . out . println ( - 1 ) ; return ; } if ( sumM = = 0 ) { System . out . println ( 0 ) ; return ; } int carry = 0 ; int change = minus . size ( ) ; for ( int m : minus ) { while ( carry < m ) { carry + = plus . poll ( ) ; change + + ; } carry - = m ; } System . out . println ( change ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; if ( a = = 5 ) { count _ 5 + + ; } else if ( a = = 7 ) { count _ 7 + + ; } if ( b = = 5 ) { count _ 5 + + ; } else if ( b = = 7 ) { count _ 7 + + ; } if ( c = = 5 ) { count _ 5 + + ; } else if ( c = = 7 ) { count _ 7 + + ; } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] list = { sc . next ( ) , sc . next ( ) , sc . next ( ) } ; int five _ count = 0 ; int seven _ count = 0 ; for ( String l : list ) { if ( l . equals ( " 5 " ) ) five _ count + + ; else if ( l . equals ( " 7 " ) ) seven _ count + + ; } if ( five _ count = = 2 & & seven _ count = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; br . readLine ( ) ; br . readLine ( ) ; br . readLine ( ) ; int e = Integer . parseInt ( br . readLine ( ) ) ; int k = Integer . parseInt ( br . readLine ( ) ) ; if ( e - a < = k ) bw . write ( " Yay ! " ) ; else bw . write ( " : ( " ) ; bw . close ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private static Scanner sc = new Scanner ( System . in ) ; private void run ( ) { int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( b - a > k | | c - a > k | | d - a > k | | e - a > k | | c - b > k | | d - b > k | | e - b > k | | d - c > k | | e - c > k | | e - d > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ) ; IrohaAndHaikuABCEdition solver = new IrohaAndHaikuABCEdition ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class IrohaAndHaikuABCEdition { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int array [ ] = { a , b , c } ; Arrays . sort ( array ) ; if ( array [ 0 ] = = 5 & & array [ 1 ] = = 5 & & array [ 2 ] = = 7 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } 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 . * ; public class Main { int ni ( ) { return cin . nextInt ( ) ; } long nl ( ) { return cin . nextLong ( ) ; } String line ( ) { return cin . nextLine ( ) ; } void println ( String str ) { System . out . println ( str ) ; } void print ( String str ) { System . out . print ( str ) ; } static final int MOD = 1000000007 ; Scanner cin = new Scanner ( System . in ) ; String output ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } public void run ( ) { input ( ) ; int res = solve ( ) ; output = res + " " ; println ( output ) ; } int n , m ; long [ ] x ; long [ ] y ; void input ( ) { n = ni ( ) ; m = ni ( ) ; x = new long [ n ] ; y = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = nl ( ) ; } for ( int j = 0 ; j < m ; j + + ) { y [ j ] = nl ( ) ; } } int solve ( ) { long xsum = 0 , ysum = 0 ; for ( int i = 0 ; i < n ; i + + ) { xsum + = x [ i ] * i - x [ i ] * ( n - i - 1 ) ; xsum % = MOD ; } for ( int i = 0 ; i < m ; i + + ) { ysum + = y [ i ] * i - y [ i ] * ( m - i - 1 ) ; ysum % = MOD ; } return ( int ) ( ( xsum * ysum ) % MOD ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] arr = new int [ 19 ] ; int a = s . nextInt ( ) ; arr [ a ] + + ; a = s . nextInt ( ) ; arr [ a ] + + ; a = s . nextInt ( ) ; arr [ a ] + + ; if ( arr [ 5 ] = = 2 & & arr [ 7 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > hina = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hina . add ( sc . next ( ) ) ; } String ans = " Three " ; if ( hina . size ( ) = = 4 ) { ans = " Four " ; } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver solver = new Solver ( ) ; solver . init ( ) ; solver . readHead ( in . readLine ( ) ) ; } } class Solver { int N ; int cnt ; public void init ( ) { N = 0 ; cnt = 0 ; } public void readHead ( String str ) { String [ ] strArr = str . split ( " " ) ; int N1 = Integer . parseInt ( strArr [ 0 ] ) ; int N2 = Integer . parseInt ( strArr [ 1 ] ) ; int N3 = Integer . parseInt ( strArr [ 2 ] ) ; int N4 = Integer . parseInt ( strArr [ 3 ] ) ; boolean ans = true ; if ( N1 ! = 1 & & N2 ! = 1 & & N3 ! = 1 & & N4 ! = 1 ) ans = false ; if ( N1 ! = 9 & & N2 ! = 9 & & N3 ! = 9 & & N4 ! = 9 ) ans = false ; if ( N1 ! = 7 & & N2 ! = 7 & & N3 ! = 7 & & N4 ! = 7 ) ans = false ; if ( N1 ! = 4 & & N2 ! = 4 & & N3 ! = 4 & & N4 ! = 4 ) ans = false ; if ( ans ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public boolean hasNext ( ) { return cnt < N ; } public void readBody ( String str ) { cnt + + ; } public void solve ( ) { } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . text . DecimalFormat ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int jisin _ nagasa = sc . nextInt ( ) ; int hunsin _ nagasa = sc . nextInt ( ) ; int jikan = sc . nextInt ( ) ; int hun = sc . nextInt ( ) ; double jisin _ kakudo = ( jikan * 60 + hun ) * 0.5 ; double hunsin _ kakudo = hun * 6 ; double kakudo _ sa = 0 ; if ( jisin _ kakudo > hunsin _ kakudo ) { kakudo _ sa = jisin _ kakudo - hunsin _ kakudo ; } else { kakudo _ sa = hunsin _ kakudo - jisin _ kakudo ; } double b = jisin _ nagasa ; double c = hunsin _ nagasa ; double e = kakudo _ sa ; double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( c , 2 ) - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int j = 0 ; j = sc . nextInt ( ) ; if ( j = = 5 ) count5 + = 1 ; if ( j = = 7 ) count7 + = 1 ; } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int N = sc . nextInt ( ) ; int a = 0 , b = 0 , c = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int k = i ; while ( k % 2 = = 0 ) { k = k / 2 ; a + + ; } if ( b < a ) { b = a ; c = i ; } a = 0 ; } System . out . print ( c ) ; sc . close ( ) ; } } import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; final String [ ] sl = s . split ( " " ) ; int K = Integer . parseInt ( sl [ 0 ] ) ; int S = Integer . parseInt ( sl [ 1 ] ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( x + y < = S ) { int z = S - x - y ; if ( z < = K ) cnt + + ; } } } System . out . println ( cnt ) ; } } } import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws IOException { int n = in . nextInt ( ) ; long [ ] a = new long [ n + 1 ] ; long [ ] b = new long [ n + 1 ] ; ArrayList < Long > list = new ArrayList < Long > ( ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = in . nextLong ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = in . nextLong ( ) ; if ( a [ i ] < b [ i ] ) { sum + = b [ i ] - a [ i ] ; ans + + ; } if ( a [ i ] > b [ i ] ) list . add ( ( a [ i ] - b [ i ] ) ) ; } Collections . sort ( list ) ; int pos = list . size ( ) ; for ( int i = pos - 1 ; i > = 0 ; i -- ) { if ( sum < = 0 ) break ; ans + + ; sum - = list . get ( i ) . longValue ( ) ; } if ( sum < = 0 ) System . out . println ( ans ) ; else System . out . println ( - 1 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; double A = keyboard . nextDouble ( ) ; double B = keyboard . nextDouble ( ) ; int H = keyboard . nextInt ( ) ; int M = keyboard . nextInt ( ) ; double h = H * 30 + M * 0.5 ; double m = M * 6 ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( h - m ) ) ) ) ; keyboard . close ( ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; final int N = Integer . parseInt ( sc . next ( ) ) ; int ans ; if ( N = = 1 ) { ans = 1 ; } else if ( N < 4 ) { ans = 2 ; } else if ( N < 8 ) { ans = 4 ; } else if ( N < 16 ) { ans = 8 ; } else if ( N < 32 ) { ans = 16 ; } else if ( N < 64 ) { ans = 32 ; } else { ans = 64 ; } out . println ( ans ) ; out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; boolean OK = false ; for ( long n = 1 ; n < = 3500 ; n + + ) { for ( long h = 1 ; h < = 3500 ; h + + ) { if ( n * ( 2 * h - N ) + h * ( 2 * n - N ) < = 0 ) continue ; if ( n * h * N % ( ( long ) 4 * n * h - n * N - h * N ) = = 0 ) { System . out . println ( h + " " + n + " " + ( n * h * N / ( ( long ) 4 * n * h - n * N - h * N ) ) ) ; OK = true ; break ; } } if ( OK ) break ; } } } import com . sun . corba . se . impl . orbutil . ObjectUtility ; import java . io . * ; import java . lang . reflect . Array ; import java . util . * ; public class Main { Random rand = new Random ( ) ; public void solve ( ) throws IOException { int n = nextInt ( ) ; int cnt = 1 ; while ( cnt < = n ) { cnt * = 2 ; } out . print ( cnt > > 1 ) ; } BufferedReader br ; StringTokenizer sc ; PrintWriter out ; public static void main ( String [ ] args ) throws IOException { Locale . setDefault ( Locale . US ) ; new Main ( ) . run ( ) ; } void run ( ) throws IOException { try { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } String nextToken ( ) throws IOException { while ( sc = = null | | ! sc . hasMoreTokens ( ) ) { try { sc = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { return null ; } } return sc . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . sort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double jisin = ( double ) H / 12 + ( double ) M / 60 / 12 ; double funsin = ( double ) M / 60 ; double kakudo = Math . PI * 2 * ( jisin - funsin ) ; double C = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( kakudo ) ) ; System . out . println ( C ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int fiveCount = 0 ; int sevenCount = 0 ; int inputCount = 0 ; while ( inputCount < 3 ) { int abc = sc . nextInt ( ) ; if ( abc = = 5 ) { fiveCount + + ; } else if ( abc = = 7 ) { sevenCount + + ; } inputCount + + ; } if ( fiveCount = = 2 & & sevenCount = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } finally { sc . close ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; a . add ( 2 ) ; a . add ( 4 ) ; a . add ( 8 ) ; a . add ( 16 ) ; a . add ( 32 ) ; a . add ( 64 ) ; for ( int i = scan . nextInt ( ) ; i > = 1 ; i -- ) { if ( a . contains ( i ) ) { System . out . println ( i ) ; return ; } } System . out . println ( 1 ) ; scan . close ( ) ; } } import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( solve ( ) ) ; } public static int solve ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] arr = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } int sum = 0 ; Queue < Integer > q = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < arr . length ; i + + ) { q . add ( arr [ i ] ) ; if ( arr [ i ] < = q . peek ( ) ) { sum + + ; } } return sum ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int flag = 0 ; for ( int i = 0 ; i < a . length - 1 ; i + + ) { for ( int j = i ; j < a . length ; j + + ) { if ( a [ i ] - a [ j ] > k | | a [ j ] - a [ i ] > k ) { flag + + ; } } } if ( flag ! = 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; Integer [ ] numbs = { a , b , c , d } ; String strBl ; if ( Arrays . asList ( numbs ) . contains ( 1 ) & & Arrays . asList ( numbs ) . contains ( 9 ) & & Arrays . asList ( numbs ) . contains ( 7 ) & & Arrays . asList ( numbs ) . contains ( 4 ) ) { strBl = " YES " ; } else { strBl = " NO " ; } System . out . println ( strBl ) ; } } import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { private static String FOUR = " Four " ; private static String THREE = " Three " ; public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String number = sc . nextLine ( ) ; List < String > arares = Arrays . asList ( sc . nextLine ( ) . split ( " " ) ) ; for ( String mark : arares ) { if ( isYellow ( mark ) ) { System . out . println ( FOUR ) ; return ; } ; } System . out . println ( THREE ) ; } } private static boolean isYellow ( String mark ) { return mark . equals ( HinaArareKind . YELLOW . getMark ( ) ) ; } private enum HinaArareKind { PINK ( " P " ) , WHITE ( " W " ) , GREEN ( " G " ) , YELLOW ( " Y " ) ; private String mark ; private HinaArareKind ( String mark ) { this . mark = mark ; } private String getMark ( ) { return mark ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = 3 ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = scan . nextInt ( ) ; } Arrays . sort ( array ) ; System . out . println ( ( ( array [ 0 ] = = 5 & & array [ 1 ] = = 5 ) & & array [ 2 ] = = 7 ) ? " YES " : " NO " ) ; } } import java . util . * ; import java . lang . * ; import java . math . * ; public class Main { static int [ ] parent ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextInt ( ) ; long ans = 2 ; for ( int i = 0 ; i < x ; i + + ) { ans = ( ans + 1 ) * 2 ; } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int Pj = P [ 0 ] ; for ( int i = 0 ; i < N ; + + i ) { if ( P [ i ] < = Pj ) { + + count ; Pj = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( - sc . nextInt ( ) + ( sc . nextInt ( ) + sc . nextInt ( ) + sc . nextInt ( ) ) * 0 + sc . nextInt ( ) > sc . nextInt ( ) ? " : ( " : " Yay ! " ) ; } } import java . util . * ; import java . lang . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long inu = sc . nextLong ( ) ; long saru = sc . nextLong ( ) ; long ans = 1 ; if ( inu = = saru ) { for ( int i = 1 ; i < = inu ; i + + ) { ans = ( ans * i ) % 1000000007 ; } for ( int i = 1 ; i < = saru ; i + + ) { ans = ( ans * i ) % 1000000007 ; } ans = ( ans * 2 ) % 1000000007 ; System . out . println ( ans ) ; } else { if ( Math . abs ( inu - saru ) > = 2 ) { System . out . println ( 0 ) ; } else { for ( int i = 1 ; i < = inu ; i + + ) { ans = ( ans * i ) % 1000000007 ; } for ( int i = 1 ; i < = saru ; i + + ) { ans = ( ans * i ) % 1000000007 ; } System . out . println ( ans ) ; } } sc . close ( ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c1 = sc . nextInt ( ) ; int c2 = sc . nextInt ( ) ; int c3 = sc . nextInt ( ) ; int c4 = sc . nextInt ( ) ; int c5 = sc . nextInt ( ) ; int c6 = sc . nextInt ( ) ; int c7 = sc . nextInt ( ) ; int c8 = sc . nextInt ( ) ; int c9 = sc . nextInt ( ) ; int flag = 0 ; ArrayList < Integer > Aarray = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { Aarray . add ( 0 ) ; } ArrayList < Integer > Barray = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { Barray . add ( 0 ) ; } loop : for ( int i = 0 ; i < 100 ; i + + ) { Aarray . set ( 0 , i ) ; Barray . set ( 0 , c1 - Aarray . get ( 0 ) ) ; Barray . set ( 1 , c2 - Aarray . get ( 0 ) ) ; Barray . set ( 2 , c3 - Aarray . get ( 0 ) ) ; for ( int j = 0 ; j < 2 ; j + + ) { Aarray . set ( 1 , c4 - Barray . get ( j ) ) ; for ( int k = 0 ; k < 2 ; k + + ) { Aarray . set ( 2 , c7 - Barray . get ( k ) ) ; if ( Aarray . get ( 1 ) + Barray . get ( 1 ) = = c5 & & Aarray . get ( 1 ) + Barray . get ( 2 ) = = c6 & & Aarray . get ( 2 ) + Barray . get ( 1 ) = = c8 & & Aarray . get ( 2 ) + Barray . get ( 2 ) = = c9 ) { flag + + ; break loop ; } } } } if ( flag = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int s1 = c [ 0 ] [ 1 ] + c [ 0 ] [ 2 ] + c [ 1 ] [ 2 ] ; int s2 = c [ 1 ] [ 0 ] + c [ 2 ] [ 0 ] + c [ 2 ] [ 1 ] ; int s = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; if ( s1 + s2 = = 2 * s ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int N = gi ( ) ; int [ ] P = new int [ N ] ; int min = Integer . MAX _ VALUE ; int c = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = gi ( ) ; if ( min > P [ i ] ) { min = P [ i ] ; c + + ; } } System . out . println ( c ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ; ) { List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { list . add ( Integer . parseInt ( scan . next ( ) ) ) ; } int k = Integer . parseInt ( scan . next ( ) ) ; List < Integer > revList = new ArrayList < Integer > ( list ) ; for ( Integer num : list ) { for ( Integer rev : revList ) { if ( rev - num > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; boolean [ ] k = new boolean [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 1 ) k [ 0 ] = true ; if ( n = = 9 ) k [ 1 ] = true ; if ( n = = 7 ) k [ 2 ] = true ; if ( n = = 4 ) k [ 3 ] = true ; } boolean ans = true ; for ( int i = 0 ; i < 4 ; i + + ) { ans & = k [ i ] ; } System . out . println ( ans ? " YES " : " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] abc = { a , b , c } ; Arrays . sort ( abc ) ; boolean result = abc [ 0 ] = = 5 & & abc [ 1 ] = = 5 & & abc [ 2 ] = = 7 ; System . out . println ( result ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int m1 = Math . min ( a , Math . min ( b , c ) ) ; int m2 = Math . max ( a , Math . max ( b , c ) ) ; int n = a + b + c - m1 - m2 ; if ( m1 = = 5 & & n = = 5 & & m2 = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double ans = 0 ; for ( double i = 6 ; i > 0 ; i -- ) { if ( a > = Math . pow ( 2 , i ) ) { ans = Math . pow ( 2 , i ) ; break ; } } if ( a = = 1 ) { ans = 1 ; } System . out . println ( Math . round ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int N = scanner . nextInt ( ) ; int maxValue = 0 ; int maxIndex = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int ans = returnEvenCnt ( i , 0 ) ; if ( maxValue < = ans ) { maxIndex = i ; maxValue = ans ; } } System . out . println ( maxIndex ) ; } } private static int returnEvenCnt ( int n , int evenCnt ) { if ( n % 2 = = 1 ) { return evenCnt ; } n / = 2 ; evenCnt + + ; return returnEvenCnt ( n , evenCnt ) ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int matrix [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int j = 0 ; j < 2 ; j + + ) { for ( int i = 1 ; i < 3 ; i + + ) { if ( matrix [ i - 1 ] [ j ] - matrix [ i - 1 ] [ j + 1 ] ! = matrix [ i ] [ j ] - matrix [ i ] [ j + 1 ] ) { System . out . println ( " No " ) ; return ; } } } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 1 ; j < 3 ; j + + ) { if ( matrix [ i + 1 ] [ j - 1 ] - matrix [ i ] [ j - 1 ] ! = matrix [ i + 1 ] [ j ] - matrix [ i ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { private static final int VAL _ LIMIT = 3500 + 1 ; public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { final int N = in . nextInt ( ) ; int h0 = N / 4 + 1 ; for ( int h = h0 ; h < VAL _ LIMIT ; + + h ) { long a = ( h < < 2 ) - N ; long b = N * h ; int n0 = ( int ) ( b / a + 1 ) ; for ( int n = n0 ; n < VAL _ LIMIT ; + + n ) { long c = a * n - b ; long d = b * n ; long w = d / c ; if ( w * c = = d ) { System . out . printf ( " % d % d % d % n " , h , n , w ) ; return ; } } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int arrayMin = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { arrayMin = Math . min ( p [ i ] , arrayMin ) ; if ( arrayMin = = p [ i ] ) { count + + ; } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double radian _ H = Math . toRadians ( 30.0 * h + ( 6.0 * ( ( m ) / 15.0 ) ) ) ; double radian _ M = Math . toRadians ( 6.0 * m ) ; double hx = a * Math . cos ( Math . toRadians ( 30.0 * h + ( 6.0 * ( m / 12.0 ) ) ) ) ; double hy = a * Math . sin ( Math . toRadians ( 30.0 * h + ( 6.0 * ( m / 12.0 ) ) ) ) ; double mx = b * Math . cos ( Math . toRadians ( 6.0 * m ) ) ; double my = b * Math . sin ( Math . toRadians ( 6.0 * m ) ) ; double hsa = Math . abs ( hx - mx ) ; double msa = Math . abs ( hy - my ) ; double ans = Math . sqrt ( hsa * hsa + ( msa * msa ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int neL = scan . nextInt ( ) ; int neS = scan . nextInt ( ) ; int hour = scan . nextInt ( ) ; int minute = scan . nextInt ( ) ; System . out . println ( Math . sqrt ( Math . pow ( neL , 2 ) + Math . pow ( neS , 2 ) - 2 * neS * neL * Math . cos ( Math . toRadians ( Math . abs ( minute * 6 - ( 30 * hour + 0.5 * minute ) ) ) ) ) ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] math = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; + + i ) { math [ i ] = sc . nextInt ( ) ; } int a = math [ 1 ] - math [ 0 ] ; int b = math [ 4 ] - math [ 3 ] ; int c = math [ 7 ] - math [ 6 ] ; int d = math [ 2 ] - math [ 0 ] ; int e = math [ 5 ] - math [ 3 ] ; int f = math [ 8 ] - math [ 6 ] ; int g = math [ 3 ] - math [ 0 ] ; int h = math [ 4 ] - math [ 1 ] ; int i = math [ 5 ] - math [ 2 ] ; int j = math [ 6 ] - math [ 0 ] ; int k = math [ 7 ] - math [ 1 ] ; int l = math [ 8 ] - math [ 2 ] ; if ( ( a = = b & & b = = c & & c = = a ) & & ( d = = e & & e = = f & & f = = d ) & & ( g = = h & & h = = i & & i = = g ) & & ( j = = k & & k = = l & & l = = j ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int min = N ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { ans + + ; min = P [ i ] ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) , e = sc . nextInt ( ) , k = sc . nextInt ( ) ; String res = " Yay ! " ; if ( e - a > k ) { res = " : ( " ; } System . out . println ( res ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } if ( num [ 0 ] - num [ 3 ] = = num [ 1 ] - num [ 4 ] & & num [ 2 ] - num [ 5 ] = = num [ 1 ] - num [ 4 ] & & num [ 0 ] - num [ 3 ] = = num [ 2 ] - num [ 5 ] ) { if ( num [ 0 ] - num [ 6 ] = = num [ 1 ] - num [ 7 ] & & num [ 2 ] - num [ 8 ] = = num [ 1 ] - num [ 7 ] & & num [ 0 ] - num [ 6 ] = = num [ 2 ] - num [ 8 ] ) { if ( num [ 3 ] - num [ 6 ] = = num [ 4 ] - num [ 7 ] & & num [ 5 ] - num [ 8 ] = = num [ 4 ] - num [ 7 ] & & num [ 3 ] - num [ 6 ] = = num [ 5 ] - num [ 8 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] nums = { 64 , 32 , 16 , 8 , 4 , 2 , 1 } ; for ( int n : nums ) { if ( N > = n ) { System . out . println ( n ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 5 ] ; String s = " Yay ! " ; for ( int i = 0 ; i < = 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < = 4 ; i + + ) { for ( int j = 0 ; j < = 4 ; j + + ) { if ( Math . abs ( n [ i ] - n [ j ] ) > k ) { s = " : ( " ; } } } System . out . println ( s ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { int a = i ; int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; if ( c [ 1 ] [ 0 ] - b1 = = c [ 1 ] [ 1 ] - b2 & & c [ 1 ] [ 1 ] - b2 = = c [ 1 ] [ 2 ] - b3 ) { if ( c [ 2 ] [ 0 ] - b1 = = c [ 2 ] [ 1 ] - b2 & & c [ 2 ] [ 1 ] - b2 = = c [ 2 ] [ 2 ] - b3 ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int [ ] antennas = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scanner . nextInt ( ) ; } final int distance = scanner . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antennas [ j ] - antennas [ i ] > distance ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = { 0 , 0 , 0 , 0 , 0 , 0 } ; for ( int i = 0 ; i < x . length ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int judge = 0 ; for ( int i = 0 ; i < x . length - 1 ; i + + ) { for ( int j = 1 ; j < x . length ; j + + ) { if ( Math . abs ( x [ i ] - x [ j ] ) > x [ 5 ] ) { judge = 1 ; } } } if ( judge = = 1 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double kakudoTansin = 30 * H + 0.5 * M ; double kakudoTyousin = 6 * M ; double kakudo = Math . abs ( kakudoTansin - kakudoTyousin ) ; if ( kakudo > 180 ) { kakudo = 360 - kakudo ; } double cnizyou = A * A + B * B - 2 * A * B * Math . cos ( kakudo * ( Math . PI / 180 ) ) ; double c = Math . sqrt ( cnizyou ) ; System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; sc . close ( ) ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = 1 ; j < = 3500 ; j + + ) { long m = 4 * i * j - N * ( i + j ) ; if ( m < = 0 ) continue ; else { if ( N * i * j % m = = 0 & & N * i * j / m < = 3500 ) { System . out . println ( i + " " + j + " " + N * i * j / m ) ; return ; } } } } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; double A = s . nextDouble ( ) ; double B = s . nextDouble ( ) ; double H = s . nextDouble ( ) ; double M = s . nextDouble ( ) ; double arg = Math . abs ( 6.0 * M / 180.0 - ( 30.0 * H + ( M / 60 ) * 30 ) / 180.0 ) ; double A2 = Math . pow ( A , 2 ) ; double B2 = Math . pow ( B , 2 ) ; System . out . println ( Math . sqrt ( A2 + B2 - 2 * A * B * Math . cos ( arg * Math . PI ) ) ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { solve ( ) ; } public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long ans = 1 ; long mod = ( long ) Math . pow ( 10 , 9 ) + 7 ; if ( n = = m ) { for ( int i = n ; i > 0 ; i -- ) { ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ; } ans = ( ans * 2 ) % mod ; } else if ( ( int ) Math . abs ( n - m ) = = 1 ) { for ( int i = ( int ) Math . min ( n , m ) ; i > 0 ; i -- ) { ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ; } ans = ( ans * ( long ) Math . max ( n , m ) ) % mod ; } else { ans = 0 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ant = new int [ 5 ] ; int dis = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { ant [ i ] = sc . nextInt ( ) ; } dis = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ant [ j ] - ant [ i ] > dis ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static int five = 0 ; public static int seven = 0 ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . nextLine ( ) ; check ( text . split ( " " ) [ 0 ] ) ; check ( text . split ( " " ) [ 1 ] ) ; check ( text . split ( " " ) [ 2 ] ) ; System . out . println ( five = = 2 & & seven = = 1 ? " YES " : " NO " ) ; } public static void check ( String str ) { int number = Integer . parseInt ( str ) ; if ( number = = 5 ) five + + ; if ( number = = 7 ) seven + + ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] d = new int [ 3 ] ; d [ 0 ] = a ; d [ 1 ] = b ; d [ 2 ] = c ; Arrays . sort ( d ) ; if ( ( d [ 0 ] = = 5 & & d [ 1 ] = = 5 ) & & d [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int k = in . nextInt ( ) ; int s = in . nextInt ( ) ; int res = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( z > = 0 & & z < = k ) { res + + ; } } } System . out . println ( res ) ; } static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = new StringTokenizer ( " " ) ; } public String next ( ) throws IOException { if ( ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( br . readLine ( ) ) ; return next ( ) ; } return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int max = num ; int maxCount = 0 ; for ( int i = num ; i > 0 ; i -- ) { int tmp = checkCount ( i ) ; if ( maxCount < tmp ) { max = i ; maxCount = tmp ; } } System . out . println ( max ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } public static int checkCount ( int num ) { int ret = 0 ; while ( true ) { if ( num % 2 = = 0 ) { num = num / 2 ; ret + + ; } else { break ; } } return ret ; } } import java . util . Scanner ; public class Main { static Scanner in = new Scanner ( System . in ) ; static void run ( ) { int A = in . nextInt ( ) , B = in . nextInt ( ) , H = in . nextInt ( ) , M = in . nextInt ( ) ; double m = 2.0 * Math . PI * M / 60 ; double h = 2.0 * Math . PI * ( H * 60 + M ) / ( 60 * 12 ) ; double a = Math . max ( m , h ) - Math . min ( m , h ) ; if ( a > = Math . PI ) a = 2 * Math . PI - a ; double d = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( a ) ) ; System . out . println ( d ) ; } public static void main ( String [ ] args ) { run ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scn = new Scanner ( System . in ) ; boolean [ ] n = new boolean [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int a = scn . nextInt ( ) ; switch ( a ) { case 1 : n [ 0 ] = true ; break ; case 9 : n [ 1 ] = true ; break ; case 7 : n [ 2 ] = true ; break ; case 4 : n [ 3 ] = true ; break ; default : break ; } } boolean ans = true ; for ( int i = 0 ; i < 4 ; i + + ) { ans & = n [ i ] ; } System . out . println ( ans ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i + + ) { sb . append ( sc . next ( ) ) ; } System . out . println ( sb . toString ( ) . indexOf ( ' Y ' ) > = 0 ? " Four " : " Three " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; double xr = ( x * 60 + y ) / 2.0 ; double yr = 6.0 * y ; double e = Math . max ( xr - yr , yr - xr ) ; double r = Math . sqrt ( b * b + c * c - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } import java . util . * ; public class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int sum = scan . nextInt ( ) + scan . nextInt ( ) ; if ( sum < 0 ) { System . out . println ( - 1 ) ; } else if ( sum = = 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( 1 ) ; } } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . print ( " : ( " ) ; } else { System . out . print ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int K = sc . nextInt ( ) ; final int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( 0 < = z & & z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int hm = h * 60 + m ; System . out . println ( Math . sqrt ( ( double ) a * a + ( double ) b * b - 2.0 * a * b * Math . cos ( Math . toRadians ( ( double ) hm / ( 12.0 * 60.0 ) * 360.0 - ( double ) m / 60.0 * 360.0 ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int num = 2 ; if ( n = = 1 ) { System . out . println ( 1 ) ; } else { while ( num < = n ) num * = 2 ; System . out . println ( num / 2 ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double HAngle = H * 30 + M * 0.5 ; double MAngle = M * 6 ; double angle = HAngle - MAngle ; if ( angle < - 90 | | 90 < angle ) { angle = 360 - Math . abs ( angle ) ; } double cosA = Math . cos ( Math . toRadians ( angle ) ) ; double answer = Math . sqrt ( A * A + B * B - ( 2 * A * B * cosA ) ) ; System . out . println ( answer ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double num = Math . abs ( 30 * h - 5.5 * m ) ; double cos = Math . cos ( Math . toRadians ( num ) ) ; double ans = b * b + a * a - 2 * a * b * cos ; System . out . println ( Math . sqrt ( ans ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveA ( ) ; } private void solveA ( ) { Scanner sc = new Scanner ( System . in ) ; char nums [ ] = sc . nextLine ( ) . toCharArray ( ) ; int five = 0 ; int seven = 0 ; for ( char c : nums ) { if ( Character . getNumericValue ( c ) = = 5 ) { five + + ; } else if ( Character . getNumericValue ( c ) = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } private void solveB ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveC ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveD ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveE ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveF ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; boolean isA = false , isB = false , isC = false , isD = false ; int [ ] index = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { index [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < 4 ; i + + ) { int idx = index [ i ] ; if ( idx = = 1 ) { isA = true ; } else if ( idx = = 9 ) { isB = true ; } else if ( idx = = 7 ) { isC = true ; } else if ( idx = = 4 ) { isD = true ; } } System . out . println ( isA & & isB & & isC & & isD ? " YES " : " NO " ) ; } } import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) ; int H = sc . nextInt ( ) , M = sc . nextInt ( ) ; double theta = ( double ) 2 * Math . PI * ( ( double ) M / 60.0 - ( ( 60.0 * ( double ) H + M ) / 720.0 ) ) ; double sqr = Math . sqrt ( ( double ) ( A * A + B * B ) - 2 * ( double ) ( A * B ) * Math . cos ( theta ) ) ; System . out . println ( sqr ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double s = ( h * 60 + m ) * ( 0.5 ) ; double l = m * 6 ; double kaku = s - l ; if ( kaku > 180 ) { kaku = 360 - kaku ; } double cos = Math . cos ( Math . toRadians ( kaku ) ) ; double result2 = a * a + b * b - 2 * a * b * cos ; double result = Math . sqrt ( result2 ) ; System . out . println ( result ) ; } } import java . util . * ; public class Main { static boolean sort ( int [ ] n ) { int temp ; Arrays . sort ( n ) ; int [ ] s = { 5 , 5 , 7 } ; Arrays . sort ( s ) ; if ( Arrays . equals ( n , s ) ) { return true ; } return false ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } if ( sort ( n ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int t = 0 ; t < = k ; t + + ) { int z = s - i - t ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextInt ( ) ; double b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double a _ w = ( 30 * h ) + ( 0.5 * m ) ; double b _ w = 6 * m ; double w = 0 ; double ans = 0 ; if ( a _ w > = b _ w ) { w = a _ w - b _ w ; } else { w = b _ w - a _ w ; } if ( w > 180 ) { w = 360 - w ; } ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( Math . toRadians ( w ) ) ) ) ; System . out . printf ( " % .20f " , ans ) ; } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { static Scanner in ; static PrintWriter out ; static String INPUT = " " ; public static void main ( String [ ] args ) throws Exception { in = INPUT . isEmpty ( ) ? new Scanner ( System . in ) : new Scanner ( INPUT ) ; out = new PrintWriter ( System . out ) ; int N = ni ( ) ; int M = ni ( ) ; Long combi = N = = M ? 2L : 1L ; if ( N - M > 1 | | N - M < - 1 ) combi = 0L ; else { int i ; for ( i = N ; i > = 1 ; i -- ) { combi * = i ; combi = combi % 1000000007 ; } for ( i = M ; i > = 1 ; i -- ) { combi * = i ; combi = combi % 1000000007 ; } } out . println ( combi ) ; out . flush ( ) ; } static int ni ( ) { return Integer . parseInt ( in . next ( ) ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] array = new Integer [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { int tmp = sc . nextInt ( ) ; array [ i ] = tmp ; } Arrays . sort ( array ) ; int sum = Math . abs ( array [ 0 ] - array [ 1 ] ) + Math . abs ( array [ 1 ] - array [ 2 ] ) ; System . out . println ( sum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int c5 = 0 ; int c7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int input = sc . nextInt ( ) ; if ( input = = 5 ) { c5 + + ; } else if ( input = = 7 ) { c7 + + ; } } if ( c5 = = 2 & & c7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } catch ( Exception e ) { System . out . println ( " 入力値が不正です " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { final Scanner scanner = new Scanner ( System . in ) ; final int a = scanner . nextInt ( ) ; final int b = scanner . nextInt ( ) ; final int c = scanner . nextInt ( ) ; final int d = scanner . nextInt ( ) ; final int e = scanner . nextInt ( ) ; final int k = scanner . nextInt ( ) ; final int min = Math . min ( Math . min ( Math . min ( Math . min ( a , b ) , c ) , d ) , e ) ; final int max = Math . max ( Math . max ( Math . max ( Math . max ( a , b ) , c ) , d ) , e ) ; System . out . println ( max - min < = k ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long [ ] c = new long [ n ] ; long sum = 0 ; int cnt = 0 ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; c [ i ] = a [ i ] - b [ i ] ; if ( c [ i ] > 0 ) list . add ( ( int ) c [ i ] ) ; else if ( c [ i ] = = 0 ) { } else { sum + = ( - 1 ) * c [ i ] ; cnt + + ; } } Collections . sort ( list , Collections . reverseOrder ( ) ) ; int sb = list . size ( ) ; while ( sum > 0 & & list . size ( ) > 0 ) { long h = ( long ) list . get ( 0 ) ; list . remove ( 0 ) ; if ( h < = sum ) { sum - = h ; } else { sum = 0 ; } } int sa = list . size ( ) ; if ( sum > 0 ) System . out . println ( - 1 ) ; else System . out . println ( cnt + sb - sa ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) < = k & & 0 < = s - ( i + j ) ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( sc . nextInt ( ) * sc . nextInt ( ) * sc . nextInt ( ) = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; boolean judge = false ; list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; Collections . sort ( list ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( i = = 0 ) { if ( list . get ( i ) = = 5 ) { judge = true ; } else { judge = false ; } } if ( i = = 1 ) { if ( judge & & list . get ( i ) = = 5 ) { judge = true ; } else { judge = false ; } } if ( i = = 2 ) { if ( judge & & list . get ( i ) = = 7 ) { judge = true ; } else { judge = false ; } } } if ( judge ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; } sc . close ( ) ; String result = " Three " ; for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { result = " Four " ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) { count5 + + ; } else if ( n = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; KEYENCE2019 _ A solver = new KEYENCE2019 _ A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class KEYENCE2019 _ A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String [ ] c = new String [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { c [ i ] = in . next ( ) ; } Arrays . sort ( c ) ; if ( String . join ( " " , c ) . equals ( " 1479 " ) ) { out . print ( " YES " ) ; } else { out . print ( " NO " ) ; } } } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double HourLength = input . nextDouble ( ) ; double MinLength = input . nextDouble ( ) ; double H = input . nextDouble ( ) ; double M = input . nextDouble ( ) ; double Htheta = ( H / 12 ) * 360.0 ; double Mtheta = ( M / 60 ) * 360.0 ; Htheta + = 30.0 * ( Mtheta / 360.0 ) ; double ans = HourLength * HourLength + MinLength * MinLength ; double TotalAngle = Math . abs ( Htheta - Mtheta ) ; double cos = Math . cos ( Math . toRadians ( TotalAngle ) ) ; ans - = 2 * HourLength * MinLength * cos ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = false ; for ( int x = 0 ; x < = 100 ; x + + ) { int a1 = c [ 0 ] [ 0 ] - x ; int a2 = c [ 0 ] [ 1 ] - x ; int a3 = c [ 0 ] [ 2 ] - x ; int b1 = x ; int b2 = c [ 1 ] [ 0 ] - a1 ; int b3 = c [ 2 ] [ 0 ] - a1 ; if ( c [ 1 ] [ 1 ] = = a2 + b2 & & c [ 1 ] [ 2 ] = = a3 + b2 & & c [ 2 ] [ 1 ] = = a2 + b3 & & c [ 2 ] [ 2 ] = = a3 + b3 ) { flag = true ; break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String result = ( a + b + c ) = = 17 ? " YES " : " NO " ; System . out . println ( result ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N ; N = sc . nextInt ( ) ; ArrayList < String > List = new ArrayList < String > ( ) ; for ( int a = 0 ; a < N ; a + + ) { String moji = sc . next ( ) ; List . add ( moji ) ; } if ( List . contains ( " Y " ) = = true ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { static public void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; num [ 0 ] = sc . nextInt ( ) ; num [ 1 ] = sc . nextInt ( ) ; num [ 2 ] = sc . nextInt ( ) ; int count5 = 0 , count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( num [ i ] = = 5 ) { count5 + + ; } else if ( num [ i ] = = 7 ) { count7 + + ; } else { System . out . println ( " NO " ) ; } } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = sc . nextInt ( ) ; int min = P [ 0 ] ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( min > = P [ i ] ) { cnt + + ; min = P [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int A , B , C ; A = input . nextInt ( ) ; B = input . nextInt ( ) ; C = input . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int [ ] si = { Math . abs ( A - B ) , Math . abs ( C - B ) , Math . abs ( A - C ) } ; Arrays . sort ( si ) ; System . out . println ( si [ 0 ] + si [ 1 ] ) ; } } import java . util . Scanner ; class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; boolean hasY = false ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { hasY = true ; } } System . out . println ( hasY ? " Four " : " Three " ) ; } } import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Scanner ; class Main { static final int MOD = 1000000007 ; static final int INF = 1 < < 30 ; Main ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean ok = false ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) ok = true ; } System . out . println ( ok ? " Four " : " Three " ) ; } public static void main ( String [ ] args ) { new Main ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long [ ] d = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; d [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( d ) ; long [ ] matcher = d . clone ( ) ; int r = n - 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( d [ i ] > = 0 ) { break ; } while ( d [ i ] < 0 ) { if ( d [ r ] < = 0 ) { System . out . println ( - 1 ) ; return ; } if ( d [ r ] + d [ i ] > 0 ) { d [ r ] + = d [ i ] ; d [ i ] = 0 ; } else { d [ i ] + = d [ r ] ; d [ r ] = 0 ; r -- ; } } } int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( d [ i ] ! = matcher [ i ] ) ans + + ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String [ ] sArray = s . split ( " " ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( sArray [ i ] . equals ( " 5 " ) ) { five + + ; } else if ( sArray [ i ] . equals ( " 7 " ) ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String colorNumber = " Three " ; for ( int i = 0 ; i < N ; i + + ) { String str = sc . next ( ) ; if ( str . equals ( " Y " ) ) { colorNumber = " Four " ; break ; } } System . out . println ( colorNumber ) ; } } import java . util . Scanner ; public class Main { public int n = 3 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] in = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { in [ i ] = sc . nextInt ( ) ; } int cnt5 = 0 ; int cnt7 = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( in [ i ] = = 5 ) { cnt5 + + ; } else if ( in [ i ] = = 7 ) { cnt7 + + ; } } if ( cnt5 = = 2 & & cnt7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antena = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int limit = antena [ 5 ] ; boolean isJumming = false ; for ( int i = 0 ; i < 6 ; i + + ) { for ( int j = i + 1 ; j < 6 ; j + + ) { if ( ( antena [ j ] - antena [ i ] ) > limit ) { isJumming = true ; } } } System . out . println ( isJumming ? " : ( " : " Yay ! " ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double hour = H * 360 / 12.0 + M * 360 / 60.0 / 12.0 ; double min = M * 360 / 60.0 ; double diff = Math . abs ( hour - min ) ; double degree = Math . min ( diff , 360 - diff ) ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( A + B + C = = 17 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int K = sc . nextInt ( ) ; final int S = sc . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( 0 < = k & & k < = K ) { counter + + ; } } } System . out . println ( counter ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; import java . util . stream . * ; public class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; long x = s . nextInt ( ) ; long [ ] [ ] a = new long [ n ] [ n ] ; Arrays . setAll ( a [ 0 ] , i - > s . nextLong ( ) ) ; for ( int j = 0 ; j < n ; + + j ) { for ( int i = 1 ; i < n ; + + i ) { a [ i ] [ j ] = Math . min ( a [ i - 1 ] [ j ] , a [ 0 ] [ ( j - i + n ) % n ] ) ; } } System . out . println ( IntStream . range ( 0 , n ) . mapToLong ( i - > i * x + Arrays . stream ( a [ i ] ) . sum ( ) ) . min ( ) . getAsLong ( ) ) ; } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = p [ 0 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = p [ i ] ) { ans + + ; } min = Math . min ( min , p [ i ] ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; boolean s = false ; if ( a = = 5 ) { if ( ( b = = 5 & & c = = 7 ) | | ( b = = 7 & & c = = 5 ) ) { s = true ; } } else if ( a = = 7 ) { if ( b = = 5 & & c = = 5 ) { s = true ; } } if ( s = = true ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] [ ] c = new int [ N ] [ N ] ; IntStream . range ( 0 , N ) . forEach ( i - > IntStream . range ( 0 , N ) . forEach ( j - > c [ i ] [ j ] = scanner . nextInt ( ) ) ) ; boolean result = true ; for ( int i = 0 ; i < N - 1 ; i + + ) { int diff1 = c [ i + 1 ] [ 0 ] - c [ i ] [ 0 ] ; int diff2 = c [ 0 ] [ i + 1 ] - c [ 0 ] [ i ] ; for ( int j = 1 ; j < N ; j + + ) { if ( ( c [ i + 1 ] [ j ] - c [ i ] [ j ] ) ! = diff1 ) { result = false ; break ; } if ( ( c [ j ] [ i + 1 ] - c [ j ] [ i ] ) ! = diff2 ) { result = false ; break ; } } } System . out . println ( result ? " Yes " : " No " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; int count = 0 ; int min = 99999999 ; while ( n -- > 0 ) { int num = sc . nextInt ( ) ; if ( num < min ) { count + + ; min = num ; } } System . out . println ( count ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angH = 30 * h + 0.5 * m ; double angM = 6 * m ; double disAng = Math . abs ( angH - angM ) ; if ( disAng = = 0 ) { System . out . println ( Math . abs ( a - b ) ) ; return ; } double angC = disAng ; if ( disAng > 180 ) angC = 360 - disAng ; double cosC = Math . cos ( Math . toRadians ( angC ) ) ; double c = a * a + b * b - 2 * a * b * cosC ; System . out . println ( Math . sqrt ( c ) ) ; } static class MyScanner { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) , 1 < < 15 ) ; StringTokenizer tokenizer ; String next ( ) { try { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } } catch ( IOException ignored ) { } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Reader r = new Reader ( ) ; int [ ] [ ] c = new int [ 3 ] [ ] ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) c [ i ] = r . ii ( ) ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) sum + = c [ i ] [ j ] ; boolean flag = true ; loop : for ( int i = 0 ; i < 3 ; i + + ) { for ( int d = 1 ; d < 3 ; d + + ) { int j = ( i + d ) % 3 ; int k = 3 - i - j ; int s = c [ 0 ] [ i ] + c [ 1 ] [ j ] + c [ 2 ] [ k ] ; if ( 3 * s ! = sum ) { flag = false ; break loop ; } } } println ( flag ? " Yes " : " No " ) ; } static void print ( Object o ) { System . out . print ( o . toString ( ) ) ; } static void println ( Object o ) { System . out . println ( o . toString ( ) ) ; } static class Reader extends BufferedReader { Reader ( ) { super ( new InputStreamReader ( System . in ) ) ; } String s ( ) throws IOException { return readLine ( ) ; } String [ ] ss ( ) throws IOException { return s ( ) . split ( " " ) ; } int Int ( String s ) { return Integer . parseInt ( s ) ; } int i ( ) throws IOException { return Int ( s ( ) ) ; } int [ ] ii ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; int [ ] ii = new int [ size ] ; for ( int j = 0 ; j < size ; j + + ) ii [ j ] = Int ( ss [ j ] ) ; return ii ; } } } import java . util . Scanner ; import java . util . Set ; import java . util . HashSet ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . next ( ) ; Set < String > set = new HashSet < > ( ) ; while ( sc . hasNext ( ) ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) > 3 ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 , z ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { z = s - ( x + y ) ; if ( k > = z & & z > = 0 ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ret = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int t = s - i - j ; if ( 0 < = t & & t < = k ) ret + + ; } } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; int [ ] A = new int [ 2 ] ; int [ ] B = new int [ 2 ] ; Arrays . fill ( A , 101 ) ; Arrays . fill ( B , 101 ) ; String ans = " Yes " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = reader . nextInt ( ) ; } } A [ 0 ] = arr [ 0 ] [ 0 ] - arr [ 1 ] [ 0 ] ; A [ 1 ] = arr [ 1 ] [ 0 ] - arr [ 2 ] [ 0 ] ; B [ 0 ] = arr [ 0 ] [ 0 ] - arr [ 0 ] [ 1 ] ; B [ 1 ] = arr [ 0 ] [ 1 ] - arr [ 0 ] [ 2 ] ; for ( int i = 1 ; i < 3 ; i + + ) { for ( int j = 1 ; j < 3 ; j + + ) { if ( arr [ i - 1 ] [ j ] - A [ i - 1 ] ! = arr [ i ] [ j ] | | arr [ i ] [ j - 1 ] - B [ j - 1 ] ! = arr [ i ] [ j ] ) { ans = " No " ; } } } System . out . print ( ans ) ; reader . close ( ) ; } } import java . util . * ; import java . util . function . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; int H = s . nextInt ( ) ; int M = s . nextInt ( ) ; BigDecimal lenax = BigDecimal . valueOf ( A * Math . cos ( ( Math . PI / 6 ) * H + ( Math . PI / 360 ) * M ) ) ; BigDecimal lenay = BigDecimal . valueOf ( A * Math . sin ( ( Math . PI / 6 ) * H + ( Math . PI / 360 ) * M ) ) ; BigDecimal lenbx = BigDecimal . valueOf ( B * Math . cos ( ( Math . PI / 30 ) * M ) ) ; BigDecimal lenby = BigDecimal . valueOf ( B * Math . sin ( ( Math . PI / 30 ) * M ) ) ; BigDecimal x = lenax . subtract ( lenbx ) . pow ( 2 ) ; BigDecimal y = lenay . subtract ( lenby ) . pow ( 2 ) ; System . out . println ( x . add ( y ) . sqrt ( MathContext . DECIMAL128 ) ) ; } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int tmp = 0 ; int count = 0 ; int maxCount = 0 ; int result = 0 ; for ( int i = 1 ; i < = N ; i + + ) { tmp = i ; while ( tmp > 0 ) { tmp = tmp / 2 ; count + + ; } if ( count > maxCount ) { maxCount = count ; result = i ; } tmp = 0 ; count = 0 ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( result ) ; out . flush ( ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; if ( num = = 5 ) { five + + ; } else if ( num = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] list = { a , b , c } ; Arrays . sort ( list ) ; System . out . println ( list [ 2 ] - list [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; scanner . nextLine ( ) ; String [ ] c = scanner . nextLine ( ) . split ( " " ) ; for ( int i = 0 ; i < N ; i + + ) { if ( c [ i ] . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int [ ] min = new int [ n ] ; min [ 0 ] = p [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { min [ i ] = Math . min ( min [ i - 1 ] , p [ i ] ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < = min [ i ] ) ans + + ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = c [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = c [ i ] [ 0 ] - y [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } boolean ans = true ; for ( int i = 0 ; i < 2 ; i + + ) { int left = c [ i + 1 ] [ 0 ] - c [ i ] [ 0 ] ; int center = c [ i + 1 ] [ 1 ] - c [ i ] [ 1 ] ; int right = c [ i + 1 ] [ 2 ] - c [ i ] [ 2 ] ; if ( left ! = center | | center ! = right | | right ! = left ) { ans = false ; } } for ( int j = 0 ; j < 2 ; j + + ) { int up = c [ 0 ] [ j + 1 ] - c [ 0 ] [ j ] ; int center = c [ 1 ] [ j + 1 ] - c [ 1 ] [ j ] ; int down = c [ 2 ] [ j + 1 ] - c [ 2 ] [ j ] ; if ( up ! = down | | up ! = center | | down ! = center ) { ans = false ; } } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < arr . length ; i + + ) arr [ i ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; System . out . println ( ( arr [ 2 ] - arr [ 1 ] ) + ( arr [ 1 ] - arr [ 0 ] ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; int H = s . nextInt ( ) ; int M = s . nextInt ( ) ; double Hx = A * Math . cos ( Math . toRadians ( 90 - 30 * H - ( double ) M / 2 ) ) ; double Hy = A * Math . sin ( Math . toRadians ( 90 - 30 * H - ( double ) M / 2 ) ) ; double Mx = B * Math . cos ( Math . toRadians ( 90 - 6 * M ) ) ; double My = B * Math . sin ( Math . toRadians ( 90 - 6 * M ) ) ; double d = Math . sqrt ( ( Hx - Mx ) * ( Hx - Mx ) + ( Hy - My ) * ( Hy - My ) ) ; System . out . print ( d ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double rads = 2.0 * Math . PI * ( ( double ) m / 60.0 ) ; double radl = ( Math . PI / 6 ) * h + ( Math . PI / 6.0 ) * ( ( double ) m / 60.0 ) ; double rad = 0.0 ; if ( Math . abs ( rads - radl ) < Math . PI ) rad = Math . abs ( rads - radl ) ; else rad = 2.0 * Math . PI - Math . abs ( rads - radl ) ; double c = Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( rad ) ) ; System . out . println ( c ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j < = k & & s - j - i > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = Integer . parseInt ( sc . next ( ) ) ; int a2 = Integer . parseInt ( sc . next ( ) ) ; int a3 = Integer . parseInt ( sc . next ( ) ) ; int b1 = Integer . parseInt ( sc . next ( ) ) ; int b2 = Integer . parseInt ( sc . next ( ) ) ; int b3 = Integer . parseInt ( sc . next ( ) ) ; int c1 = Integer . parseInt ( sc . next ( ) ) ; int c2 = Integer . parseInt ( sc . next ( ) ) ; int c3 = Integer . parseInt ( sc . next ( ) ) ; boolean flg = true ; if ( a1 - a2 ! = b1 - b2 | | a1 - a3 ! = b1 - b3 | | a1 - a2 ! = c1 - c2 | | a1 - a3 ! = c1 - c3 | | a1 - b1 ! = a2 - b2 | | a1 - b1 ! = a3 - b3 | | a1 - c1 ! = a2 - c2 | | a1 - c1 ! = a3 - c3 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > arr = new ArrayList < > ( Arrays . asList ( sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) ) ) ; if ( arr . contains ( 5 ) ) { arr . remove ( arr . indexOf ( 5 ) ) ; if ( arr . contains ( 5 ) ) { arr . remove ( arr . indexOf ( 5 ) ) ; if ( arr . contains ( 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int n = scan . nextInt ( ) ; if ( n = = 1 ) { System . out . println ( 1 ) ; return ; } int answer = 0 ; while ( n ! = 1 ) { answer + = 1 ; n / = 2 ; } System . out . println ( ( int ) Math . pow ( 2 , answer ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int first = scan . nextInt ( ) ; int second = scan . nextInt ( ) ; int therd = scan . nextInt ( ) ; if ( ( first = = 5 | | first = = 7 ) & ( second = = 5 | | second = = 7 ) & ( therd = = 5 | | therd = = 7 ) & ( first + second + therd = = 17 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 1 & & a [ 1 ] = = 4 & & a [ 2 ] = = 7 & & a [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) , a = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) a + + ; } } System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) count5 + + ; if ( n = = 7 ) count7 + + ; } sc . close ( ) ; if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; char c [ ] = S [ i ] . toCharArray ( ) ; if ( c [ 0 ] = = ' Y ' ) { System . out . println ( " Four " ) ; sc . close ( ) ; return ; } } sc . close ( ) ; System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int n = 1 ; for ( int i = 0 ; i > = 0 ; i + + ) { n = n * 2 ; if ( n > s ) { int nn = n / 2 ; System . out . println ( nn ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] count = new int [ N ] ; for ( int i = 1 ; i < = N ; i + + ) { int x = i ; while ( i ! = 0 ) { if ( x % 2 = = 0 ) { count [ i - 1 ] + + ; x = x / 2 ; } else { break ; } } } int max = count [ 0 ] ; int soeji = 0 ; for ( int i = 1 ; i < N ; i + + ) { if ( count [ i ] > max ) { max = count [ i ] ; soeji = i ; } } System . out . println ( soeji + 1 ) ; } } import java . util . * ; public class Main { static int [ ] a ; static boolean res ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) a [ i ] = sc . nextInt ( ) ; dfs ( " " ) ; System . out . println ( res ? " YES " : " NO " ) ; } public static void dfs ( String current ) { if ( res ) { return ; } if ( current . length ( ) = = 4 ) { if ( current . equals ( " 1974 " ) ) { res = true ; } return ; } dfs ( current + a [ 0 ] ) ; dfs ( current + a [ 1 ] ) ; dfs ( current + a [ 2 ] ) ; dfs ( current + a [ 3 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int leftTop = sc . nextInt ( ) ; int middleTop = sc . nextInt ( ) ; int rightTop = sc . nextInt ( ) ; int leftMiddle = sc . nextInt ( ) ; int middleMiddle = sc . nextInt ( ) ; int rightMiddle = sc . nextInt ( ) ; int leftDown = sc . nextInt ( ) ; int middleDown = sc . nextInt ( ) ; int rightDown = sc . nextInt ( ) ; String ans = " Yes " ; int [ ] aTop = { 0 , leftTop - middleTop , leftTop - rightTop } ; int [ ] aMiddle = { 0 , leftMiddle - middleMiddle , leftMiddle - rightMiddle } ; int [ ] aDown = { 0 , leftDown - middleDown , leftDown - rightDown } ; int [ ] bLeft = { 0 , leftTop - leftMiddle , leftTop - leftDown } ; int [ ] bMiddle = { 0 , middleTop - middleMiddle , middleTop - middleDown } ; int [ ] bRight = { 0 , rightTop - rightMiddle , rightTop - rightDown } ; if ( ! Arrays . equals ( aTop , aMiddle ) | | ! Arrays . equals ( aTop , aDown ) ) { ans = " No " ; } if ( ! Arrays . equals ( bLeft , bMiddle ) | | ! Arrays . equals ( bLeft , bRight ) ) { ans = " No " ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; double hh = 2 * Math . PI * h / 12.0 ; hh + = 2 * Math . PI * m / 720.0 ; double mm = 2 * Math . PI * m / 60.0 ; double hm = Math . abs ( hh - mm ) ; if ( hm > Math . PI ) { hm = 2 * Math . PI - hm ; } double ans = Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( hm ) ) ; System . out . println ( ans ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double l = m * 6 ; double s = h * 30 + m * 0.5 ; double cos ; if ( Math . abs ( l - s ) > 180 ) { cos = 360 - Math . abs ( l - s ) ; } else { cos = Math . abs ( l - s ) ; } double c2 = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( cos ) ) ; double c = Math . sqrt ( c2 ) ; System . out . println ( c ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) , s = scan . nextInt ( ) , a = 0 , i , j ; scan . close ( ) ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( i + j > s ) break ; if ( k > = s - i - j ) a + + ; } } System . out . print ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; boolean hanbetsu = false ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { hanbetsu = true ; break ; } } if ( hanbetsu ) System . out . print ( " Four " ) ; else System . out . print ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int A = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; int sum = A + B + C ; if ( sum = = 17 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " NO " ; int [ ] setu = new int [ 3 ] ; for ( int i = 0 ; i < setu . length ; i + + ) { setu [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < setu . length ; i + + ) { for ( int j = i ; j < setu . length ; j + + ) { if ( setu [ i ] > setu [ j ] ) { int hoge = setu [ i ] ; setu [ i ] = setu [ j ] ; setu [ j ] = hoge ; } } } if ( setu [ 0 ] = = 5 & & setu [ 1 ] = = 5 & & setu [ 2 ] = = 7 ) { ans = " YES " ; } System . out . println ( ans ) ; if ( ! ( sc = = null ) ) sc . close ( ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; + + i ) a [ i ] = sc . nextLong ( ) ; long ans = 0 ; long c = 1 ; for ( int i = 0 ; i < n ; + + i ) { long q = ( a [ i ] - 1 ) / c ; ans + = q ; if ( q > 0 ) a [ i ] = 1 ; c = Math . max ( c , a [ i ] + 1 ) ; } out . println ( ans ) ; out . close ( ) ; } 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 . Scanner ; public class Main { private static double LONG _ ANGLE = 0.5 ; private static double SHORT _ ANGLE = 6.0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angleH = LONG _ ANGLE * ( h * 60 + m ) ; double angleM = SHORT _ ANGLE * m ; double angle = 0 ; if ( angleH > angleM ) { angle = angleH - angleM ; } else { angle = angleM - angleH ; } System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double wm = 360 / 60 ; double wh1 = 360 / 12 ; double wh2 = 30.0 / 60.0 ; double m _ angle = ( double ) M * wm ; double h _ angle = ( double ) H * wh1 + ( double ) M * wh2 ; double angle _ a = m _ angle > h _ angle ? m _ angle - h _ angle : h _ angle - m _ angle ; if ( angle _ a > 180 ) angle _ a = 360 - angle _ a ; double b = Math . pow ( A , 2 ) ; double c = Math . pow ( B , 2 ) ; double a = Math . sqrt ( b + c - 2 * A * B * Math . cos ( Math . toRadians ( angle _ a ) ) ) ; System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; break ; } if ( i = = N - 1 ) { System . out . println ( " Three " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ! ( e - a > k ) ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = " " ; if ( b - a > k ) { s = " : ( " ; } else if ( c - a > k ) { s = " : ( " ; } else if ( d - a > k ) { s = " : ( " ; } else if ( e - a > k ) { s = " : ( " ; } else if ( c - b > k ) { s = " : ( " ; } else if ( d - b > k ) { s = " : ( " ; } else if ( e - b > k ) { s = " : ( " ; } else if ( d - c > k ) { s = " : ( " ; } else if ( e - c > k ) { s = " : ( " ; } else if ( e - d > k ) { s = " : ( " ; } else { s = " Yay ! " ; } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int min = Integer . MAX _ VALUE ; int minpos = 0 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] < min ) { min = a [ i ] ; minpos = i ; } } sc . close ( ) ; long ans = 0 ; int [ ] [ ] b = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { ans + = b [ 0 ] [ i ] = a [ i ] ; } for ( int i = 1 ; i < n ; i + + ) { long mans = i * x + min ; b [ i ] [ minpos ] = min ; for ( int j = 1 ; j < n ; j + + ) { int mpos = minpos + j ; if ( mpos > = n ) mpos - = n ; { int npos = mpos - i ; if ( npos < 0 ) npos + = n ; mans + = b [ i ] [ mpos ] = Math . min ( b [ i - 1 ] [ mpos ] , a [ npos ] ) ; } } if ( mans < ans ) ans = mans ; } System . out . println ( ans ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] in = br . readLine ( ) . split ( " " ) ; long n = Long . parseLong ( in [ 0 ] ) ; long p = Long . parseLong ( in [ 1 ] ) ; br . close ( ) ; Map < Long , Integer > prime = new HashMap < > ( ) ; for ( long i = 2 ; i * i < = p ; i + + ) { int cnt = 0 ; while ( p % i = = 0 ) { p / = i ; cnt + + ; } if ( cnt > 0 ) { prime . put ( i , cnt ) ; } } if ( p > 1 ) prime . put ( p , 1 ) ; long ans = 1 ; for ( Map . Entry < Long , Integer > e : prime . entrySet ( ) ) { int t = e . getValue ( ) ; while ( t > = n ) { ans * = e . getKey ( ) ; t - = n ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int count = 0 ; while ( N ! = 1 ) { N = N / 2 ; count = count + 1 ; } System . out . println ( ( int ) Math . pow ( 2 , count ) ) ; scanner . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & S - i - j > = 0 ) { ans + + ; } else if ( S - i - j < = 0 ) { break ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . io . PrintWriter ; import static java . lang . Integer . * ; import static java . lang . Long . * ; import static java . lang . Double . * ; import static java . lang . Math . * ; import static java . lang . System . * ; public class Main { public static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; double a = parseDouble ( sc . next ( ) ) ; double b = parseDouble ( sc . next ( ) ) ; double h = parseDouble ( sc . next ( ) ) ; double m = parseDouble ( sc . next ( ) ) ; sc . close ( ) ; double dx = cos ( PI * ( h / 6 + m / 360 ) ) * a - cos ( PI * m / 30 ) * b ; double dy = sin ( PI * ( h / 6 + m / 360 ) ) * a - sin ( PI * m / 30 ) * b ; double ans = sqrt ( dx * dx + dy * dy ) ; out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; String result = " NO " ; if ( ( A = = 7 & & B = = 5 & & C = = 5 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 5 & & B = = 5 & & C = = 7 ) ) { result = " YES " ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antena [ j ] - antena [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " G " ) ) a [ 0 ] + + ; if ( s . equals ( " W " ) ) a [ 1 ] + + ; if ( s . equals ( " Y " ) ) a [ 2 ] + + ; if ( s . equals ( " P " ) ) a [ 3 ] + + ; } int count = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = 0 ) count + + ; } System . out . println ( count = = 4 ? " Four " : " Three " ) ; sc . close ( ) ; } void debug ( Object ... o ) { System . out . println ( Arrays . deepToString ( o ) ) ; } long combination ( int n , int r , int m ) { long [ ] [ ] Combination = new long [ n + 1 ] [ n + 1 ] ; for ( int i = 0 ; i < = n ; i + + ) { Combination [ i ] [ 0 ] = 1 ; for ( int j = 1 ; j < = i ; j + + ) { Combination [ i ] [ j ] = ( Combination [ i - 1 ] [ j - 1 ] + Combination [ i - 1 ] [ j ] ) % m ; } } return Combination [ n ] [ r ] ; } int gcd ( int a , int b ) { if ( a < b ) { int c = a ; a = b ; b = c ; } if ( b = = 0 ) return a ; else return gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) < = k & & s - ( i + j ) > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; String [ ] list = { a , b , c } ; Arrays . sort ( list ) ; if ( " 5 " . equals ( list [ 0 ] ) & & " 5 " . equals ( list [ 1 ] ) & & " 7 " . equals ( list [ 2 ] ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; System . out . println ( sc . nextLine ( ) . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] list = reader . readLine ( ) . split ( " " ) ; int [ ] l = new int [ 3 ] ; int t = 0 ; for ( String p : list ) { l [ t ] = Integer . parseInt ( p ) ; t + + ; } Arrays . sort ( l ) ; if ( l [ 0 ] = = 5 & & l [ 1 ] = = 5 & & l [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String arare [ ] = new String [ N ] ; boolean answer = false ; for ( int i = 0 ; i < N ; i + + ) { arare [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( arare [ i ] . equals ( " Y " ) ) { answer = true ; } } if ( answer = = true ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { int A = 0 ; int B = 0 ; int C = 0 ; int w = 0 ; Scanner scan = new Scanner ( System . in ) ; A = scan . nextInt ( ) ; B = scan . nextInt ( ) ; C = scan . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; w + + ; } if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; w + + ; } if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; w + + ; } if ( w = = 0 ) System . out . println ( " NO " ) ; } } import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashSet < String > list = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { list . add ( sc . next ( ) ) ; } if ( list . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] c = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { c [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; if ( c [ 3 ] - c [ 0 ] = = c [ 4 ] - c [ 1 ] & & c [ 3 ] - c [ 0 ] = = c [ 5 ] - c [ 2 ] & & c [ 6 ] - c [ 3 ] = = c [ 7 ] - c [ 4 ] & & c [ 6 ] - c [ 3 ] = = c [ 8 ] - c [ 5 ] & & c [ 1 ] - c [ 0 ] = = c [ 4 ] - c [ 3 ] & & c [ 1 ] - c [ 0 ] = = c [ 7 ] - c [ 6 ] & & c [ 2 ] - c [ 1 ] = = c [ 5 ] - c [ 4 ] & & c [ 2 ] - c [ 1 ] = = c [ 8 ] - c [ 7 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . parallelSort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; if ( Math . abs ( N - M ) > = 2 ) { System . out . println ( 0 ) ; return ; } long mod = ( long ) ( 1e9 + 7 ) ; if ( N < M ) { int swap = N ; N = M ; M = swap ; } long res = 1 ; if ( N = = M ) { res = 2 ; } int NM = N + M ; for ( int i = 0 ; i < NM ; i + + ) { if ( i % 2 = = 0 ) { res * = N ; res % = mod ; N -- ; } else { res * = M ; res % = mod ; M -- ; } } System . out . println ( res ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = 200000 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int P = sc . nextInt ( ) ; min = Math . min ( min , P ) ; if ( min = = P ) cnt + + ; } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N [ ] = new int [ 4 ] ; for ( int n = 0 ; n < 4 ; n + + ) { N [ n ] = sc . nextInt ( ) ; } boolean a = false ; boolean b = false ; boolean c = false ; boolean d = false ; for ( int n = 0 ; n < 4 ; n + + ) { if ( N [ n ] = = 1 ) { a = true ; } if ( N [ n ] = = 9 ) { b = true ; } if ( N [ n ] = = 7 ) { c = true ; } if ( N [ n ] = = 4 ) { d = true ; } } if ( a & & b & & c & & d ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . text . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; int MOD = ( int ) 998244353 ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double [ ] sh = { 0 , a } ; double [ ] lo = { 0 , b } ; double mit = 60 * h + m ; double hourkaku = ( 360 - ( 360 * h / 12 + 30 * m / 60 ) ) ; double mkaku = ( ( 360 - 360 * m / 60 ) % 360 ) ; double shx = sh [ 0 ] * Math . cos ( hourkaku * Math . PI / 180 ) - sh [ 1 ] * Math . sin ( hourkaku * Math . PI / 180 ) ; double shy = sh [ 0 ] * Math . sin ( hourkaku * Math . PI / 180 ) + sh [ 1 ] * Math . cos ( hourkaku * Math . PI / 180 ) ; double lox = lo [ 0 ] * Math . cos ( mkaku * Math . PI / 180 ) - lo [ 1 ] * Math . sin ( mkaku * Math . PI / 180 ) ; double loy = lo [ 0 ] * Math . sin ( mkaku * Math . PI / 180 ) + lo [ 1 ] * Math . cos ( mkaku * Math . PI / 180 ) ; double dis = Math . sqrt ( Math . pow ( shx - lox , 2 ) + Math . pow ( shy - loy , 2 ) ) ; System . out . println ( dis ) ; } } import java . util . * ; import java . io . * ; import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int N4 = sc . nextInt ( ) ; if ( ( N1 = = 1 | | N2 = = 1 | | N3 = = 1 | | N4 = = 1 ) & & ( N1 = = 9 | | N2 = = 9 | | N3 = = 9 | | N4 = = 9 ) & & ( N1 = = 7 | | N2 = = 7 | | N3 = = 7 | | N4 = = 7 ) & & ( N1 = = 4 | | N2 = = 4 | | N3 = = 4 | | N4 = = 4 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; Map < Integer , Integer > input = new HashMap < Integer , Integer > ( ) ; int in = 0 ; int x = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { in = scan . nextInt ( ) ; if ( input . get ( in ) ! = null ) { x = input . get ( in ) ; x = x + 1 ; input . put ( in , x ) ; } else { input . put ( in , 1 ) ; } } int number5 = 0 ; int number7 = 0 ; String ans = " NO " ; number5 = input . get ( 5 ) ; if ( number5 ! = 0 ) { if ( number5 = = 2 ) { number7 = input . get ( 7 ) ; if ( number7 ! = 0 ) { if ( number7 = = 1 ) { ans = " YES " ; } } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = 10000000 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String A = " Three " ; for ( int i = 0 ; i < N ; i + + ) { String S = sc . next ( ) ; if ( S . equals ( " Y " ) ) { A = " Four " ; break ; } } System . out . println ( A ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = 0 ; Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) for ( int y = 0 ; y < = k ; y + + ) if ( s - x - y > = 0 & & s - x - y < = k ) ans + + ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A _ 1 = sc . nextInt ( ) ; int A _ 2 = sc . nextInt ( ) ; int A _ 3 = sc . nextInt ( ) ; int [ ] S = new int [ ] { A _ 1 , A _ 2 , A _ 3 } ; Arrays . sort ( S ) ; System . out . println ( ( S [ 2 ] - S [ 1 ] ) + ( S [ 1 ] - S [ 0 ] ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . UncheckedIOException ; 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 ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C4N solver = new C4N ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C4N { public void solve ( int testNumber , LightScanner in , PrintWriter out ) { long n = in . ints ( ) ; for ( int h = 1 ; h < = 3500 ; h + + ) { for ( int w = h ; w < = 3500 ; w + + ) { long c = n * h * w ; long m = 4 * h * w - n * ( w + h ) ; if ( m > 0 & & c % m = = 0 ) { out . print ( h ) ; out . print ( ' ' ) ; out . print ( c / m ) ; out . print ( ' ' ) ; out . println ( w ) ; return ; } } } } } static class LightScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public LightScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String string ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int ints ( ) { return Integer . parseInt ( string ( ) ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int s = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s > = i + j & & s - ( i + j ) < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; scanner . close ( ) ; int combination = 0 ; int k ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { k = S - i - j ; if ( i + j + k = = S & & i > = 0 & & j > = 0 & & k > = 0 & & k < = K ) { combination + + ; } } } System . out . println ( combination ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] strlist = str . split ( " " ) ; int k = Integer . parseInt ( strlist [ 0 ] ) ; int s = Integer . parseInt ( strlist [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count = count + 1 ; continue ; } } } System . out . println ( count ) ; } } import java . io . BufferedInputStream ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int a = sc . nextInt ( ) ; int m [ ] = new int [ a ] ; int min = a ; int count = 0 ; for ( int i = 0 ; i < a ; i + + ) { m [ i ] = sc . nextInt ( ) ; if ( m [ i ] < min ) min = m [ i ] ; if ( m [ i ] < = min ) count + + ; } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int A = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; final int H = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; sc . close ( ) ; double omega _ h = 2 * Math . PI / 12 ; double omega _ m = 2 * Math . PI / 60 ; double dig _ h = omega _ h * H + M * Math . PI / 360 ; double dig _ m = omega _ m * M ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . abs ( dig _ h - dig _ m ) ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int answer = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( 0 < = z ) & & ( z < = k ) ) { answer + = 1 ; } } } System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = 7 ; i + + ) { if ( Math . pow ( 2 , i ) > n ) { System . out . print ( ( int ) Math . pow ( 2 , i - 1 ) ) ; break ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Math . abs ( a - b ) < = k & & Math . abs ( a - c ) < = k & & Math . abs ( a - d ) < = k & & Math . abs ( a - e ) < = k & & Math . abs ( b - c ) < = k & & Math . abs ( b - d ) < = k & & Math . abs ( b - e ) < = k & & Math . abs ( c - d ) < = k & & Math . abs ( c - e ) < = k & & Math . abs ( d - e ) < = k ) { System . out . println ( " Yay ! " ) ; return ; } System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] temp = scanner . nextLine ( ) . split ( " " ) ; int [ ] list = new int [ temp . length ] ; for ( int i = 0 ; i < 3 ; i + + ) { list [ i ] = Integer . parseInt ( temp [ i ] ) ; if ( list [ 0 ] > list [ i ] ) { int te = list [ 0 ] ; list [ 0 ] = list [ i ] ; list [ i ] = te ; } } int ans = 0 ; if ( list [ 2 ] > list [ 1 ] ) { ans = ( list [ 1 ] - list [ 0 ] ) + ( list [ 2 ] - list [ 1 ] ) ; } else { ans = ( list [ 2 ] - list [ 0 ] ) + ( list [ 1 ] - list [ 2 ] ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] temp = scanner . nextLine ( ) . split ( " " ) ; int tmp = 0 ; int count = 0 ; int min = Integer . parseInt ( temp [ 0 ] ) ; for ( int i = 1 ; i < n ; i + + ) { tmp = Integer . parseInt ( temp [ i ] ) ; if ( tmp = = Math . min ( min , tmp ) ) { count + + ; min = tmp ; } } System . out . println ( count + 1 ) ; } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; int s = Integer . parseInt ( st . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { if ( i > s ) break ; for ( int j = 0 ; j < = k ; j + + ) { if ( i + j > s ) break ; if ( ( s - ( i + j ) ) < = k ) count + = 1 ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] line = new int [ 4 ] ; line [ 0 ] = sc . nextInt ( ) ; line [ 1 ] = sc . nextInt ( ) ; line [ 2 ] = sc . nextInt ( ) ; line [ 3 ] = sc . nextInt ( ) ; String ans ; if ( ! isIn ( line , 1 ) ) { ans = " NO " ; } else if ( ! isIn ( line , 9 ) ) { ans = " NO " ; } else if ( ! isIn ( line , 7 ) ) { ans = " NO " ; } else if ( ! isIn ( line , 4 ) ) { ans = " NO " ; } else { ans = " YES " ; } System . out . println ( ans ) ; } public static boolean isIn ( int [ ] line , int x ) { for ( int n = 0 ; n < 4 ; n + + ) { if ( line [ n ] = = x ) { line [ n ] = 0 ; return true ; } } return false ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int P [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = scanner . nextInt ( ) ; } int min = N + 1 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { InputStream in = System . in ; Scanner sc = new Scanner ( in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int num = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int z = S - i - j ; if ( z > = 0 & & z < = K ) { num + + ; } } } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] n = new int [ 4 ] ; n [ 0 ] = 0 ; n [ 1 ] = 0 ; n [ 2 ] = 0 ; n [ 3 ] = 0 ; String StringLine = sc . nextLine ( ) ; StringLine = StringLine . replace ( " " , " " ) ; char [ ] array = StringLine . toCharArray ( ) ; for ( int i = 0 ; i < num ; i + + ) { switch ( array [ i ] ) { case ' P ' : n [ 0 ] + + ; break ; case ' W ' : n [ 1 ] + + ; break ; case ' G ' : n [ 2 ] + + ; break ; case ' Y ' : n [ 3 ] + + ; break ; } } int rc = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( n [ i ] = = 0 ) { rc + + ; } } switch ( rc ) { case 0 : System . out . println ( " Four " ) ; break ; case 1 : System . out . println ( " Three " ) ; break ; case 2 : System . out . println ( " Two " ) ; break ; case 3 : System . out . println ( " One " ) ; break ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int bn = 1 ; while ( bn < = n ) bn * = 2 ; System . out . println ( bn / 2 ) ; } } import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static PrintWriter out ; public static void main ( String [ ] args ) { Main . run ( ) ; } private static void run ( ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; Scanner sc = new Scanner ( System . in ) ; out . println ( count ( Integer . parseInt ( sc . next ( ) ) ) ) ; out . close ( ) ; sc . close ( ) ; } private static int count ( int pnum ) { int result = 0 ; for ( int i = 0 ; ( int ) Math . pow ( 2 , i ) < = pnum ; i + + ) { result = ( int ) Math . pow ( 2 , i ) ; } return result ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( scanner . nextInt ( ) ) ; } scanner . close ( ) ; int count = 0 ; int min = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( list . get ( i ) . compareTo ( min ) = = 1 ) { continue ; } count + = 1 ; min = list . get ( i ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int H = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; double Hdeg = H * 30 + M * 0.5 ; double Mdeg = M * 6 ; double deg = Hdeg - Mdeg ; if ( deg > 180 ) { deg = 360 - deg ; } deg = Math . abs ( deg ) ; double cSquare = A * A + B * B - ( 2 * A * B * Math . cos ( deg * Math . PI / 180 ) ) ; System . out . println ( Math . sqrt ( cSquare ) ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int tmp = sc . nextInt ( ) ; if ( tmp < min ) { min = Math . min ( min , tmp ) ; cnt + + ; } } System . out . print ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( k > = e - a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( str [ 0 ] ) ; int s = Integer . parseInt ( str [ 1 ] ) ; int cnt = 0 ; int x = 0 ; int y = 0 ; int z = 0 ; for ( x = k ; x > - 1 ; -- x ) { int rest = s - x ; if ( rest > 2 * k | | rest < 0 ) continue ; if ( rest > k ) { cnt + = - ( rest - 2 * k ) + 1 ; } else { cnt + = rest + 1 ; } } sb . append ( cnt ) ; System . out . println ( sb ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; sc . close ( ) ; double perMinRad = 360.0000 / 60.0000 ; double perHourRad = 360.0000 / ( 12.0000 * 60.0000 ) ; double minRad = perMinRad * M ; double hourRad = ( H * 60 * perHourRad ) + ( M * perHourRad ) ; double rad = hourRad - minRad ; if ( rad > 180 ) { rad = 360.0000 - rad ; } if ( rad = = 180.0 ) { System . out . println ( A + B ) ; } else { rad = Math . toRadians ( rad ) ; double cosRad = Math . cos ( rad ) ; double res = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * cosRad ) ) ; System . out . println ( res ) ; } } } import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = s . nextInt ( ) , SUM = s . nextInt ( ) , sum = 0 ; for ( int a = 0 ; a < = k ; a + + ) if ( a < = SUM ) for ( int b = 0 ; b < = k ; b + + ) if ( SUM - a - b > = 0 & & SUM - a - b < = k ) sum + + ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int tmp = 1 ; if ( n = = tmp ) { System . out . println ( " 1 " ) ; } else { while ( tmp < = n ) { tmp * = 2 ; } System . out . println ( tmp / 2 ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; if ( Arrays . stream ( s ) . filter ( e - > e . equals ( " Y " ) ) . count ( ) > 0L ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } sc . close ( ) ; } } import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int ans = 0 ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) ans + + ; } } out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = Integer . parseInt ( sc . next ( ) ) ; if ( n = = 5 ) five + + ; else if ( n = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { private static final int ANTENNA _ COUNT = 5 ; public static void main ( String [ ] args ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int [ ] antennas = new int [ ANTENNA _ COUNT ] ; for ( int i = 0 ; i < ANTENNA _ COUNT ; + + i ) { antennas [ i ] = Integer . parseInt ( reader . readLine ( ) ) ; } int maxDistance = Integer . parseInt ( reader . readLine ( ) ) ; test ( antennas , maxDistance ) ; } } public static void test ( int [ ] antennas , int maxDistance ) { int offset = 0 ; for ( int a = 0 ; a < ANTENNA _ COUNT ; + + a ) { + + offset ; for ( int b = offset ; b < ANTENNA _ COUNT ; + + b ) { int distance = antennas [ b ] - antennas [ a ] ; if ( distance > maxDistance ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { new Thread ( null , new Runnable ( ) { public void run ( ) { solve ( ) ; } } , " 1 " , 1 < < 26 ) . start ( ) ; } static void solve ( ) { FastReader fr = new FastReader ( ) ; PrintWriter op = new PrintWriter ( System . out ) ; int i = fr . nextInt ( ) , j = fr . nextInt ( ) ; double a = i * i , b = j * j ; int h = fr . nextInt ( ) , m = fr . nextInt ( ) ; double H = h * 30.0 + ( m * 30.0 ) / 60.0 , M = m * 6.0 , ang = Math . abs ( H - M ) ; ang = Math . min ( ang , 360.0 - ang ) ; double rad = Math . PI / 180.0 ; rad * = ang ; double c = a + b - ( 2.0 * i * j * Math . cos ( rad ) ) ; c = Math . sqrt ( c ) ; op . println ( c ) ; op . flush ( ) ; op . close ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ( ! st . hasMoreElements ( ) ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; import java . math . BigInteger ; public class Main { public static final int MOD = ( int ) 1e9 + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; double h = Integer . parseInt ( sc . next ( ) ) ; double m = Integer . parseInt ( sc . next ( ) ) ; double hs = h / 12 + m / 60 / 12 ; double ms = m / 60 ; double e = Math . abs ( hs - ms ) * 360 ; double c = a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( e ) ) ; System . out . println ( Math . sqrt ( c ) ) ; } } import java . util . Arrays ; import java . util . List ; 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 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( Math . abs ( n - m ) > = 2 ) { System . out . println ( 0 ) ; return ; } long ans = ( m = = n ) ? 2 : 1 ; for ( int i = 1 ; i < = n ; i + + ) { ans = ( ans * i ) % ( 1 _ 000 _ 000 _ 000 + 7 ) ; } for ( int i = 1 ; i < = m ; i + + ) { ans = ( ans * i ) % ( 1 _ 000 _ 000 _ 000 + 7 ) ; } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j < 0 | | s - i - j > k ) { continue ; } cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String color [ ] = new String [ N ] ; boolean or = false ; for ( int i = 0 ; i < N ; i + + ) { color [ i ] = sc . next ( ) ; if ( color [ i ] . equals ( " Y " ) ) or = true ; } if ( ! or ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; sc . close ( ) ; } } import java . util . * ; import java . io . * ; public class Main { BufferedReader br ; PrintWriter out ; StringTokenizer stok ; String nextToken ( ) throws IOException { while ( stok = = null | | ! stok . hasMoreTokens ( ) ) { String s = br . readLine ( ) ; if ( s = = null ) { return null ; } stok = new StringTokenizer ( s ) ; } return stok . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; } char nextChar ( ) throws IOException { return ( char ) ( br . read ( ) ) ; } String nextLine ( ) throws IOException { return br . readLine ( ) ; } final double EPS = 1e-10 ; void solve ( ) throws IOException { double N = nextInt ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { double w = N * h * n / ( 4 * h * n - N * ( n + h ) ) ; if ( w > 0.1 & & Math . abs ( w - Math . round ( w ) ) < EPS ) { out . println ( h + " " + n + " " + ( ( long ) Math . round ( w ) ) ) ; return ; } } } } void run ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; br . close ( ) ; out . close ( ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } } import java . io . * ; import java . util . * ; public class Main { void submit ( ) { int N = nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = nextInt ( ) ; } int count = 1 ; if ( N = = 1 ) { out . println ( count ) ; return ; } int min = P [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( min > = P [ i ] ) { min = P [ i ] ; count + + ; } } out . println ( count ) ; } void preCalc ( ) { } void stress ( ) { } void test ( ) { } Main ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; preCalc ( ) ; submit ( ) ; out . close ( ) ; } static final Random rng = new Random ( ) ; static int rand ( int l , int r ) { return l + rng . nextInt ( r - l + 1 ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) ; } BufferedReader br ; PrintWriter out ; StringTokenizer st ; String nextToken ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } String nextString ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } int nextInt ( ) { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( nextToken ( ) ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Integer x = 5 ; Integer y = 7 ; boolean b = false ; Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > inputs = new ArrayList < Integer > ( ) { { add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; } } ; if ( inputs . remove ( x ) & & inputs . size ( ) = = 2 ) { if ( inputs . remove ( x ) & & inputs . size ( ) = = 1 ) { if ( inputs . remove ( y ) & & inputs . size ( ) = = 0 ) { b = true ; } } } if ( b ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int H _ degree = 30 * H ; int M _ degree = 6 * M ; double radian = Math . PI * 2 * ( H / 12.0 + ( M / 60.0 ) / 12.0 - M / 60.0 ) ; double cos = Math . cos ( radian ) ; double ans = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * cos ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c5 = 0 ; int c7 = 0 ; int a = sc . nextInt ( ) ; if ( a = = 7 ) c7 + + ; else if ( a = = 5 ) c5 + + ; int b = sc . nextInt ( ) ; if ( b = = 7 ) c7 + + ; else if ( b = = 5 ) c5 + + ; int c = sc . nextInt ( ) ; if ( c = = 7 ) c7 + + ; else if ( c = = 5 ) c5 + + ; if ( c5 = = 2 & & c7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer n = sc . nextInt ( ) ; Integer x = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n + 1 ] ; Integer [ ] [ ] b = new Integer [ n + 1 ] [ n ] ; Long result ; Long cost = 0L ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = sc . nextInt ( ) ; b [ i ] [ 0 ] = a [ i ] ; cost + = b [ i ] [ 0 ] ; } result = cost ; for ( int k = 1 ; k < n ; k + + ) { cost = ( long ) k * x ; for ( int i = 1 ; i < = n ; i + + ) { if ( i > k ) { b [ i ] [ k ] = Math . min ( b [ i ] [ k - 1 ] , a [ i - k ] ) ; } else { b [ i ] [ k ] = Math . min ( b [ i ] [ k - 1 ] , a [ i - k + n ] ) ; } cost + = b [ i ] [ k ] ; } if ( cost < result ) { result = cost ; } } System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; double radian = Math . PI * 2 * ( C / 12.0 + ( D / 60.0 ) / 12.0 - D / 60.0 ) ; System . out . println ( Math . sqrt ( ( double ) ( ( A * A ) + ( B * B ) - ( 2 * A * B * Math . cos ( radian ) ) ) ) ) ; } } 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 i = 0 ; while ( true ) { if ( ( 1 < < ( i + 1 ) ) < = N ) i + + ; else break ; } System . out . println ( 1 < < i ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( ) ; System . out . println ( ( a * b * c ) % 175 = = 0 ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] p = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( p [ j ] - p [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Map ; import java . util . HashMap ; public class Main { int k , s ; public static void main ( String args [ ] ) { new Main ( ) . solve ( ) ; } void solve ( ) { in ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int n = s - i - j ; if ( n > = 0 & & n < = k ) cnt + + ; } } out ( cnt ) ; } void in ( ) { Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; } void out ( ) { } void out ( int n ) { System . out . println ( n ) ; } void out ( char c ) { System . out . print ( c ) ; } void out ( String s ) { System . out . println ( s ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 0 ; while ( N ! = 1 ) { N = N > > 1 ; cnt + + ; } System . out . println ( N < < cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) x [ i ] = sc . nextInt ( ) ; sc . close ( ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; + + i ) if ( x [ i ] = = 5 ) + + count5 ; else if ( x [ i ] = = 7 ) + + count7 ; if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int number1 = 0 ; int number2 = 0 ; int number3 = 0 ; String anser = " NO " ; Scanner scan = new Scanner ( System . in ) ; number1 = scan . nextInt ( ) ; number2 = scan . nextInt ( ) ; number3 = scan . nextInt ( ) ; if ( checkFiveOrSeven ( number1 ) ) { if ( checkFiveOrSeven ( number2 ) ) { if ( checkFiveOrSeven ( number3 ) ) { if ( number1 + number2 + number3 = = 17 ) { anser = " YES " ; } } } } System . out . println ( anser ) ; } private static boolean checkFiveOrSeven ( int number ) { if ( number = = 5 | | number = = 7 ) { return true ; } return false ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; boolean flag = false ; for ( int i = 0 ; i < N ; i + + ) { String a = scanner . next ( ) ; if ( a . equals ( " Y " ) ) { flag = true ; } } if ( flag = = true ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { long n = sc . nextLong ( ) ; long p = sc . nextLong ( ) ; long max = ( long ) Math . pow ( p , 1.0 / n ) + 1 ; System . out . println ( getAns ( n , p , max ) ) ; } long getAns ( long n , long p , long max ) { for ( long i = max ; i > = 1 ; i -- ) { if ( p % ( long ) Math . pow ( i , n ) = = 0 ) return i ; } return 1 ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } import java . util . * ; class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s [ ] = new String [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { s [ i ] = sc . next ( ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; int antn [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antn [ i ] = Integer . parseInt ( s [ i ] ) ; } for ( int r = 0 ; r < 5 ; r + + ) { for ( int t = 0 ; t < 4 ; t + + ) { if ( Math . abs ( antn [ r ] - antn [ t ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final long MOD = 1000000007 ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; if ( Math . abs ( N - M ) > 1 ) { System . out . println ( 0 ) ; } else { long ans = 1 ; for ( int i = 2 ; i < = N ; i + + ) ans = ( ans * i ) % MOD ; for ( int i = 2 ; i < = M ; i + + ) ans = ( ans * i ) % MOD ; if ( N = = M ) ans = ( ans * 2 ) % MOD ; System . out . println ( ans ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner teclado = new Scanner ( System . in ) ; int A , B , C , D , E ; A = teclado . nextInt ( ) ; B = teclado . nextInt ( ) ; C = teclado . nextInt ( ) ; D = teclado . nextInt ( ) ; E = teclado . nextInt ( ) ; int k = teclado . nextInt ( ) ; if ( B - A < = k & & C - A < = k & & D - A < = k & & E - A < = k & & C - B < = k & & D - B < = k & & E - B < = k & & D - C < = k & & E - C < = k & & E - D < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) a [ i ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ( a [ j ] - a [ i ] ) > k ) { c + + ; System . out . println ( " : ( " ) ; break ; } } if ( c > 0 ) break ; } if ( c = = 0 ) System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] arg ) { int [ ] count = new int [ 10 + 1 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int len = sc . nextInt ( ) ; count [ len ] + + ; } System . out . println ( count [ 5 ] = = 2 & & count [ 7 ] = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String s2 = sc . next ( ) ; String s3 = sc . next ( ) ; String s4 = sc . next ( ) ; String t = s + s2 + s3 + s4 ; if ( t . contains ( " 1 " ) & & t . contains ( " 9 " ) & & t . contains ( " 7 " ) & & t . contains ( " 4 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } System . out . println ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < array . length ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean flag = true ; for ( int i = 0 ; i < array . length ; i + + ) { for ( int j = i + 1 ; j < array . length ; j + + ) { if ( array [ j ] - array [ i ] > k ) { System . out . println ( " : ( " ) ; flag = false ; break ; } } if ( ! flag ) { break ; } } if ( flag ) { System . out . println ( " Yay ! " ) ; } } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { final int [ ] a = new int [ 3 ] ; try ( Scanner scan = new Scanner ( System . in ) ) { a [ 0 ] = scan . nextInt ( ) ; a [ 1 ] = scan . nextInt ( ) ; a [ 2 ] = scan . nextInt ( ) ; } int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( a [ i ] = = 5 ) { count5 + + ; } else if ( a [ i ] = = 7 ) { count7 + + ; } } final boolean result = count5 = = 2 & & count7 = = 1 ; out . println ( result ? " YES " : " NO " ) ; out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 4 ; j > = 0 + ( i + 1 ) ; j -- ) { if ( Math . max ( a [ i ] , a [ j ] ) - Math . min ( a [ i ] , a [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { nums [ i ] = scanner . nextInt ( ) ; } int sum = 0 ; int count = 0 ; for ( int i = 0 ; i < nums . length ; i + + ) { if ( nums [ i ] = = 5 ) { sum + + ; } else if ( nums [ i ] = = 7 ) { count + + ; } else { sum + = 0 ; count + = 0 ; } } if ( sum = = 2 & & count = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] antenas = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int dist = sc . nextInt ( ) ; boolean res = true ; for ( int i = 0 ; i < antenas . length - 1 ; i + + ) { for ( int j = i ; j + i < antenas . length - 1 ; j + + ) { if ( antenas [ j + 1 ] - antenas [ i ] > dist ) { res = false ; break ; } } if ( ! res ) break ; } System . out . println ( res ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = 0 ; if ( a = = b ) { if ( a < c ) { d = 1 ; } } else if ( a = = c ) { if ( a < b ) { d = 1 ; } } else if ( c = = b ) { if ( c < a ) { d = 1 ; } } if ( d = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) , e = sc . nextInt ( ) , k = sc . nextInt ( ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; } } import java . util . * ; import java . io . * ; public class Main { static long mod = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long a = 0 ; for ( int i = 0 ; i < n ; i + + ) { long x = sc . nextLong ( ) ; a = ( a + x * i ) % mod ; a = ( a - x * ( n - 1 - i ) ) % mod ; if ( a < 0 ) a + = mod ; } long b = 0 ; for ( int i = 0 ; i < m ; i + + ) { long x = sc . nextLong ( ) ; b = ( b + x * i ) % mod ; b = ( b - x * ( m - 1 - i ) ) % mod ; if ( b < 0 ) b + = mod ; } out . println ( ( a * b ) % mod ) ; out . close ( ) ; } 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 N = sc . nextInt ( ) ; int [ ] p = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; int pj = p [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( p [ i ] < = pj ) { + + count ; pj = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A , B , H , M ; A = Integer . parseInt ( in . next ( ) ) ; B = Integer . parseInt ( in . next ( ) ) ; H = Integer . parseInt ( in . next ( ) ) ; M = Integer . parseInt ( in . next ( ) ) ; double pi = Math . PI ; double alpha = 2 * pi * H / 12 + 2 * pi * M / 720 ; double beta = 2 * pi * M / 60 ; double ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( alpha - beta ) ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static Long gcd ( Long num1 , Long num2 ) { if ( num2 = = 0 ) return num1 ; else return gcd ( num2 , num1 % num2 ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int ans = a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 0 ; for ( int i = N ; i > 0 ; i -- ) { if ( Check ( i ) ) { result = i ; break ; } } System . out . println ( result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static boolean Check ( int n ) { while ( n % 2 = = 0 ) { n = n / 2 ; } if ( n = = 1 ) return true ; return false ; } } import java . io . * ; import java . util . * ; class Main { static Scanner scanner = new Scanner ( ) ; static long mod = 1000000007 ; public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scanner . nextInt ( ) ; if ( i > 0 ) { x [ i ] - = sum ; } sum + = x [ i ] ; } sum = 0 ; for ( int i = 0 ; i < m ; i + + ) { y [ i ] = scanner . nextInt ( ) ; if ( i > 0 ) { y [ i ] - = sum ; } sum + = y [ i ] ; } long c = 0 ; for ( int i = 1 ; i < m ; i + + ) { c = ( c + y [ i ] * i % mod * ( m - i ) % mod ) % mod ; } long ans = 0 ; for ( int i = 1 ; i < n ; i + + ) { ans = ( ans + c * x [ i ] % mod * i % mod * ( n - i ) % mod ) % mod ; } System . out . println ( ans ) ; } static class Scanner { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) , 32768 ) ; StringTokenizer tokenizer ; String next ( ) { try { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str ; while ( ( str = br . readLine ( ) ) ! = null ) { String [ ] sp = str . split ( " " ) ; int h = Integer . parseInt ( sp [ 0 ] ) ; int r = Integer . parseInt ( sp [ 1 ] ) ; if ( h + r = = 0 ) { System . out . println ( 0 ) ; } else if ( h + r > 0 ) { System . out . println ( 1 ) ; } else { System . out . println ( - 1 ) ; } } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int c = scn . nextInt ( ) ; int [ ] arr = { a , b , c } ; Arrays . parallelSort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long t1 = sc . nextLong ( ) ; long t2 = sc . nextLong ( ) ; long a1 = sc . nextLong ( ) ; long a2 = sc . nextLong ( ) ; long b1 = sc . nextLong ( ) ; long b2 = sc . nextLong ( ) ; long sub1 = ( a1 - b1 ) * t1 ; long sub2 = ( a2 - b2 ) * t2 ; if ( sub1 + sub2 = = 0 ) { System . out . println ( " infinity " ) ; return ; } else if ( sub1 > 0 & & sub2 > 0 ) { System . out . println ( 0 ) ; return ; } else if ( sub1 < 0 & & sub2 < 0 ) { System . out . println ( 0 ) ; return ; } if ( sub1 < 0 ) { sub1 = - sub1 ; sub2 = - sub2 ; } long dist = sub1 + sub2 ; if ( dist < 0 ) { if ( ( sub1 % ( - dist ) = = 0 ) ) { System . out . println ( ( sub1 / ( - dist ) ) * 2 ) ; return ; } System . out . println ( ( sub1 / ( - dist ) ) * 2 + 1 ) ; return ; } System . out . println ( 0 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int bucket [ ] = new int [ 15 ] ; for ( int i = 0 ; i < 3 ; i + + ) { bucket [ sc . nextInt ( ) ] + + ; } System . out . println ( bucket [ 5 ] = = 2 & & bucket [ 7 ] = = 1 ? " YES " : " NO " ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > A = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { A . add ( Integer . parseInt ( sc . next ( ) ) ) ; } Collections . sort ( A ) ; System . out . println ( A . get ( 2 ) - A . get ( 0 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] dx = new int [ 3 ] [ 2 ] ; int [ ] [ ] dy = new int [ 2 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { dx [ i ] [ 0 ] = ( c [ i ] [ 0 ] - c [ i ] [ 1 ] ) ; dx [ i ] [ 1 ] = ( c [ i ] [ 1 ] - c [ i ] [ 2 ] ) ; } for ( int j = 0 ; j < 3 ; j + + ) { dy [ 0 ] [ j ] = Math . abs ( c [ 0 ] [ j ] - c [ 1 ] [ j ] ) ; dy [ 1 ] [ j ] = Math . abs ( c [ 1 ] [ j ] - c [ 2 ] [ j ] ) ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( dy [ i ] [ 0 ] ! = dy [ i ] [ 1 ] | | dy [ i ] [ 0 ] ! = dy [ i ] [ 2 ] ) { System . out . println ( " No " ) ; return ; } } for ( int j = 0 ; j < 2 ; j + + ) { if ( dx [ 0 ] [ j ] ! = dx [ 1 ] [ j ] | | dx [ 0 ] [ j ] ! = dx [ 2 ] [ j ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static int [ ] N = new int [ 10 ] ; public static void main ( String [ ] args ) { for ( int i = 0 ; i < 4 ; i + + ) { N [ sc . nextInt ( ) ] = 1 ; } if ( N [ 1 ] = = 1 & & N [ 7 ] = = 1 & & N [ 4 ] = = 1 & & N [ 9 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Comparator ; import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; PriorityQueue < Integer > surplus = new PriorityQueue < > ( Comparator . reverseOrder ( ) ) ; int count = 0 ; long shortage = 0L ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] = = b [ i ] ) continue ; if ( a [ i ] > b [ i ] ) { surplus . add ( a [ i ] - b [ i ] ) ; } else { shortage + = b [ i ] - a [ i ] ; count + + ; } } while ( shortage > 0 ) { Integer i = surplus . poll ( ) ; if ( i = = null ) { System . out . println ( - 1 ) ; return ; } shortage - = i ; count + + ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int max = 0 ; for ( int i = 0 ; i < = N ; i + + ) { int count = 0 ; for ( int j = 0 ; j < N ; j + + ) { if ( Math . pow ( 2 , j ) = = i ) { count = j ; } } max = ( max < count ) ? count : max ; } System . out . println ( ( int ) Math . pow ( 2 , max ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k > = e - a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( k > = 0 & & k < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int a , b , c ; int count = 0 ; for ( a = 0 ; a < = k ; a + + ) { for ( b = 0 ; b < = k ; b + + ) { c = s - a - b ; if ( c > = 0 & & c < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int N = in . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = in . next ( ) ; } HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( S [ i ] ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = std . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = std . nextInt ( ) ; } int max = p [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int value = p [ i ] ; if ( value < = max ) { count + + ; } max = Math . min ( max , value ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int value = a + b + c ; int product = a * b * c ; if ( value = = 5 + 5 + 7 & product = = 5 * 5 * 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] nums = sc . nextLine ( ) . split ( " " ) ; int cont = 1 ; int bump = Integer . parseInt ( nums [ 0 ] ) ; for ( int i = 1 ; i < nums . length ; i + + ) { if ( Integer . parseInt ( nums [ i ] ) < bump ) { bump = Integer . parseInt ( nums [ i ] ) ; cont + + ; } } System . out . println ( cont ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { static String [ ] ANS = { " Three " , " Four " } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( ANS [ set . size ( ) - 3 ] ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] a = IntStream . range ( 0 , N ) . map ( i - > scanner . nextInt ( ) ) . toArray ( ) ; System . out . println ( permutation ( a ) ) ; } } private static int permutation ( int [ ] seed ) { int [ ] perm = new int [ seed . length ] ; boolean [ ] used = new boolean [ seed . length ] ; return buildPerm ( seed , perm , used , 0 ) ; } private static int buildPerm ( int [ ] seed , int [ ] perm , boolean [ ] used , int index ) { if ( seed . length = = index ) { return procPerm ( perm ) ; } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < seed . length ; + + i ) { if ( ! used [ i ] ) { perm [ index ] = seed [ i ] ; used [ i ] = true ; min = Math . min ( min , buildPerm ( seed , perm , used , index + 1 ) ) ; used [ i ] = false ; } } return min ; } private static int procPerm ( int [ ] perm ) { return IntStream . range ( 1 , perm . length ) . map ( i - > Math . abs ( perm [ i ] - perm [ i - 1 ] ) ) . sum ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 3 ] ; n [ 0 ] = sc . nextInt ( ) ; n [ 1 ] = sc . nextInt ( ) ; n [ 2 ] = sc . nextInt ( ) ; if ( n [ 0 ] * n [ 1 ] * n [ 2 ] = = 25 * 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = p [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( p [ i ] < min ) { ans + + ; min = p [ i ] ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . io . * ; class Main { void solve ( ) { int n = inint ( ) ; int [ ] a = inintar ( n ) ; int count = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( min , a [ i ] ) ; if ( min > = a [ i ] ) count + + ; } out . println ( count ) ; } public static Scanner in = new Scanner ( System . in ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } public int inint ( ) { return in . nextInt ( ) ; } public long inlong ( ) { return in . nextLong ( ) ; } public double indouble ( ) { return in . nextDouble ( ) ; } public String instr ( ) { return in . next ( ) ; } public char inchar ( ) { return in . next ( ) . charAt ( 0 ) ; } public int [ ] inintar ( int num ) { int [ ] a = new int [ num ] ; for ( int i = 0 ; i < num ; i + + ) { a [ i ] = in . nextInt ( ) ; } return a ; } public char [ ] incharar ( ) { return in . next ( ) . toCharArray ( ) ; } public char [ ] [ ] incharmap ( int h , int w ) { char [ ] [ ] a = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { String temp = in . next ( ) ; for ( int j = 0 ; j < w ; j + + ) { a [ i ] [ j ] = temp . charAt ( j ) ; } } return a ; } } import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } if ( set . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { String line = " " ; try { line = readLine ( ) ; StringTokenizer st = new StringTokenizer ( line , " " ) ; String k = st . nextToken ( ) ; String s = st . nextToken ( ) ; int k1Value = Integer . parseInt ( k ) ; int sValue = Integer . parseInt ( s ) ; int cnt = 0 ; int x = 0 ; for ( int i = 0 ; i < sValue + 1 ; i + + ) { if ( i > k1Value ) { continue ; } for ( int j = 0 ; j < sValue + 1 ; j + + ) { if ( j > k1Value ) { continue ; } else if ( sValue - i - j > k1Value ) { continue ; } if ( i + j < = sValue ) { cnt + + ; } } } System . out . println ( cnt ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static String readLine ( ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return br . readLine ( ) ; } } import java . util . Scanner ; public class Main { static int ans = 1 ; static int min ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } min = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { check ( n , a , i ) ; } System . out . println ( ans ) ; } public static void check ( int n , int [ ] a , int i ) { if ( a [ i ] < min ) { min = a [ i ] ; ans + + ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] [ ] c2 = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; c2 [ i ] [ j ] = c [ i ] [ j ] ; } } for ( int i = 0 ; i < 3 ; i + + ) { c [ i ] [ 2 ] - = c [ i ] [ 0 ] ; c [ i ] [ 1 ] - = c [ i ] [ 0 ] ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( c [ 0 ] [ i + 1 ] ! = c [ 1 ] [ i + 1 ] | | c [ 2 ] [ i + 1 ] ! = c [ 1 ] [ i + 1 ] ) { System . out . println ( " No " ) ; return ; } } for ( int i = 0 ; i < 3 ; i + + ) { c2 [ 2 ] [ i ] - = c2 [ 0 ] [ i ] ; c2 [ 1 ] [ i ] - = c2 [ 0 ] [ i ] ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( c2 [ i + 1 ] [ 0 ] ! = c2 [ i + 1 ] [ 1 ] | | c2 [ i + 1 ] [ 2 ] ! = c2 [ i + 1 ] [ 1 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; int k = 0 ; for ( int i = 0 ; i < 6 & & s . hasNextLine ( ) ; i + + ) { if ( i < 5 ) { antennas [ i ] = Integer . parseInt ( s . nextLine ( ) ) ; } else if ( i = = 5 ) { k = Integer . parseInt ( s . nextLine ( ) ) ; } else { System . exit ( - 1 ) ; } } if ( available ( antennas , k ) ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } public static boolean available ( int [ ] antennas , int k ) { for ( int i = 0 ; i < antennas . length ; i + + ) { for ( int j = i + 1 ; j < antennas . length ; j + + ) { int distance = Math . abs ( antennas [ i ] - antennas [ j ] ) ; if ( distance > k ) { return false ; } } } return true ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = in . nextInt ( ) ; } int k = in . nextInt ( ) ; for ( int i = 0 ; i < a . length ; i + + ) { for ( int j = i + 1 ; j < a . length ; j + + ) { if ( a [ j ] - a [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; try { while ( ( line = br . readLine ( ) ) ! = null ) { StringTokenizer token = new StringTokenizer ( line ) ; while ( token . hasMoreElements ( ) ) { if ( Integer . parseInt ( token . nextElement ( ) . toString ( ) ) = = 7 ) sevenCounter + + ; else fiveCounter + + ; } } } catch ( Exception ex ) { } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 1 ] [ 1 ] = = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] & & c [ 1 ] [ 2 ] = = c [ 1 ] [ 0 ] + c [ 0 ] [ 2 ] - c [ 0 ] [ 0 ] & & c [ 2 ] [ 1 ] = = c [ 2 ] [ 0 ] + c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] & & c [ 2 ] [ 2 ] = = c [ 2 ] [ 0 ] + c [ 0 ] [ 2 ] - c [ 0 ] [ 0 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static int lcm ( int x , int y ) { return x * y / gcd ( x , y ) ; } public static int gcd ( int x , int y ) { if ( x < y ) return gcd ( y , x ) ; if ( y = = 0 ) return x ; return gcd ( y , x % y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean [ ] b = new boolean [ 4 ] ; for ( int i = 0 ; i < n ; i + + ) { char a = sc . next ( ) . charAt ( 0 ) ; switch ( a ) { case ' P ' : b [ 0 ] = true ; break ; case ' W ' : b [ 1 ] = true ; break ; case ' G ' : b [ 2 ] = true ; break ; case ' Y ' : b [ 3 ] = true ; break ; } } int cnt = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( b [ i ] ) { cnt + + ; } } if ( cnt = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int day , numberOfTypes , bestShowy = 0 ; day = sc . nextInt ( ) ; numberOfTypes = sc . nextInt ( ) ; int temperature [ ] = new int [ day ] ; int clothesInfo [ ] [ ] = new int [ numberOfTypes ] [ 3 ] ; for ( int i = 0 ; i < day ; i + + ) { temperature [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < numberOfTypes ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { clothesInfo [ i ] [ j ] = sc . nextInt ( ) ; } } int showy [ ] [ ] = new int [ day ] [ numberOfTypes ] ; for ( int i = 0 ; i < day ; i + + ) { for ( int j = 0 ; j < numberOfTypes ; j + + ) { if ( clothesInfo [ j ] [ 0 ] < = temperature [ i ] & & clothesInfo [ j ] [ 1 ] > = temperature [ i ] ) { showy [ i ] [ j ] = 0 ; } else { showy [ i ] [ j ] = - 1 ; } } } for ( int i = 1 ; i < day ; i + + ) { for ( int j = 0 ; j < numberOfTypes ; j + + ) { if ( showy [ i ] [ j ] = = 0 ) { for ( int k = 0 ; k < numberOfTypes ; k + + ) { if ( showy [ i - 1 ] [ k ] ! = - 1 ) { showy [ i ] [ j ] = Math . max ( showy [ i ] [ j ] , showy [ i - 1 ] [ k ] + Math . abs ( clothesInfo [ k ] [ 2 ] - clothesInfo [ j ] [ 2 ] ) ) ; } } } } } for ( int p = 0 ; p < numberOfTypes ; p + + ) { bestShowy = Math . max ( bestShowy , showy [ day - 1 ] [ p ] ) ; } System . out . println ( bestShowy ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) , temp = t , counter = 0 ; for ( int count = 0 ; count < t ; count + + ) { int x = scan . nextInt ( ) ; if ( x < = temp ) { temp = x ; counter + + ; } } System . out . println ( counter ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int q = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( q > p ) { count + + ; q = p ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double t = ( double ) ( h * 30 + ( double ) ( m / 2 ) ) ; double ak = Math . toRadians ( t ) ; double bk = Math . toRadians ( m * 6 ) ; double ax = a * Math . sin ( ak ) ; double ay = a * Math . cos ( ak ) ; double bx = b * Math . sin ( bk ) ; double by = b * Math . cos ( bk ) ; System . out . println ( Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } public void solve ( ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int N = scan . nextInt ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long x = 4 * h * w - N * w - N * h ; if ( x < = 0 ) { continue ; } long y = N * h * w ; if ( y % x = = 0 ) { System . out . printf ( " % d % d % d \ n " , h , w , y / x ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int antenas [ ] = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { antenas [ i ] = Integer . parseInt ( sc . nextLine ( ) ) ; } sc . close ( ) ; boolean isConnect = true ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = 1 ; j < 5 ; j + + ) { if ( antenas [ j ] - antenas [ i ] > antenas [ 5 ] ) { isConnect = false ; } } } if ( isConnect ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner s = new Scanner ( System . in ) ) { final int A = s . nextInt ( ) , B = s . nextInt ( ) , H = s . nextInt ( ) , M = s . nextInt ( ) ; double hAngle = 2 * Math . PI * ( H * 60 + M ) / ( 60 * 12 ) ; double mAngle = 2 * Math . PI * M / 60 ; double theta = Math . abs ( hAngle - mAngle ) ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( theta ) ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = 3 ; Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list ) ; if ( ( list . get ( 0 ) = = 5 ) & & ( list . get ( 1 ) = = 5 ) & & ( list . get ( 2 ) = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { private Scanner sc ; public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { sc = new Scanner ( System . in ) ; int num = Integer . parseInt ( sc . nextLine ( ) ) ; int ans = 1 ; while ( ans < = num ) { ans = ans * 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] arsg ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = { a , b , c , d , e } ; String ans = " Yay ! " ; out : for ( int i = 0 ; i < l . length - 1 ; i + + ) { for ( int x = 1 ; x < l . length ; x + + ) { if ( Math . abs ( l [ i ] - l [ x ] ) > k ) { ans = " : ( " ; break out ; } } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String yellow = " Y " ; String [ ] color = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { color [ i ] = scan . next ( ) ; if ( color [ i ] . contains ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { static boolean [ ] isPrime ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; sc . close ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; System . exit ( 0 ) ; } long ans = 1 ; long t = ( long ) Math . pow ( P , ( double ) 1 / N ) + 1 ; for ( long k = 2 ; k < = t ; k + + ) { long s = ( long ) Math . pow ( k , N ) ; if ( P % s = = 0 ) { ans = k ; } } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; List < String > ss = new ArrayList < String > ( ) ; try { ss . add ( sc . next ( ) ) ; ss . add ( sc . next ( ) ) ; ss . add ( sc . next ( ) ) ; Collections . sort ( ss ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( ( i = = 0 | | i = = 1 ) & & ! " 5 " . equals ( ss . get ( i ) ) ) { System . out . println ( " NO " ) ; throw new Exception ( ) ; } else if ( i = = 3 & & ! " 7 " . equals ( ss . get ( i ) ) ) { System . out . println ( " NO " ) ; throw new Exception ( ) ; } } System . out . println ( " YES " ) ; } catch ( Exception e ) { } finally { sc . close ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 9 ; i + + ) c [ i / 3 ] [ i % 3 ] = sc . nextInt ( ) ; System . out . println ( c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] = = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] & & c [ 0 ] [ 2 ] + c [ 2 ] [ 0 ] = = c [ 0 ] [ 0 ] + c [ 2 ] [ 2 ] & & c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] = = c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ? " Yes " : " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int th = sc . nextInt ( ) ; int diff = a [ 4 ] - a [ 0 ] ; if ( diff > th ) { System . out . println ( " : ( " ) ; sc . close ( ) ; } else { System . out . println ( " Yay ! " ) ; sc . close ( ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int antennaAmounts = 5 ; int [ ] antennas = new int [ antennaAmounts ] ; for ( int i = 0 ; i < antennaAmounts ; i + + ) { antennas [ i ] = sc . nextInt ( ) ; } int inputK = sc . nextInt ( ) ; sc . close ( ) ; if ( antennas [ antennaAmounts - 1 ] - antennas [ 0 ] < = inputK ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; String result = " " ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { result = " YES " ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { result = " YES " ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { result = " YES " ; } else { result = " NO " ; } System . out . println ( result ) ; } } import java . math . BigDecimal ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; BigDecimal hourY = new BigDecimal ( a * Math . sin ( Math . toRadians ( ( double ) ( ( 60 * h ) + m ) * 0.5 ) ) ) ; BigDecimal hourX = new BigDecimal ( a * Math . cos ( Math . toRadians ( ( double ) ( ( 60 * h ) + m ) * 0.5 ) ) ) ; BigDecimal minuteY = new BigDecimal ( b * Math . sin ( Math . toRadians ( 6 * m ) ) ) ; BigDecimal minuteX = new BigDecimal ( b * Math . cos ( Math . toRadians ( 6 * m ) ) ) ; BigDecimal x = hourX . subtract ( minuteX ) ; BigDecimal y = hourY . subtract ( minuteY ) ; BigDecimal xx = x . multiply ( x ) ; BigDecimal yy = y . multiply ( y ) ; BigDecimal preResult = xx . add ( yy ) ; System . out . println ( Math . sqrt ( preResult . doubleValue ( ) ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] ag ) { Scanner sc = new Scanner ( System . in ) ; int lastN = 0 ; int a = sc . nextInt ( ) ; for ( int i = 0 ; i < 32 ; i + + ) { if ( a % 2 = = 1 ) { lastN = i ; } a / = 2 ; } int res = 1 ; for ( int i = 0 ; i < lastN ; i + + ) { res * = 2 ; } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputs = sc . nextInt ( ) ; int num ; int count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < inputs ; i + + ) { num = sc . nextInt ( ) ; if ( min > num ) { min = num ; } if ( min = = num ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; String [ ] s = new String [ N ] ; int truefalse = 0 ; for ( int i = 0 ; i < N ; i + + ) { s [ i ] = scanner . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { System . out . println ( " Four " ) ; truefalse + + ; break ; } } if ( truefalse = = 0 ) { System . out . println ( " Three " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; boolean yellow = false ; int N = s . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( s . next ( ) . charAt ( 0 ) = = ' Y ' ) yellow = true ; } if ( yellow ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double shortHand = m * 6 ; double longHand = h * 30 + m * 0.5 ; double angle = Math . max ( longHand , shortHand ) - Math . min ( longHand , shortHand ) ; double distance = Math . sqrt ( b * b + a * a - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( distance ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int grid [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { grid [ i ] [ j ] = sc . nextInt ( ) ; } } String ans = " No " ; for ( int i = 0 ; i < = grid [ 0 ] [ 0 ] ; i + + ) { int a0 = i ; int b0 = grid [ 0 ] [ 0 ] - a0 ; int a1 = grid [ 1 ] [ 0 ] - b0 ; int a2 = grid [ 2 ] [ 0 ] - b0 ; boolean isOK = true ; for ( int y = 1 ; y < 3 ; y + + ) { int by1 = grid [ 0 ] [ y ] - a0 ; int by2 = grid [ 1 ] [ y ] - a1 ; int by3 = grid [ 2 ] [ y ] - a2 ; if ( by1 < 0 | | by2 < 0 | | by3 < 0 ) { isOK = false ; break ; } if ( by1 ! = by2 | | by2 ! = by3 ) { isOK = false ; break ; } } if ( isOK ) { ans = " Yes " ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { static int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < k + 1 ; i + + ) for ( int j = 0 ; j < k + 1 ; j + + ) { if ( i + j < = s & & i + j + k > = s ) ans + + ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static int p [ ] ; public static int min = 2 * 10 * 10 * 10 * 10 * 10 + 1 ; private static boolean judge ( int i ) { if ( min > p [ i - 1 ] ) { min = p [ i - 1 ] ; return true ; } else { return false ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( judge ( i ) ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int max = 0 ; int ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int count = 0 ; for ( int j = i ; j % 2 = = 0 ; j / = 2 ) { count + + ; } if ( max < = count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( min > p ) ans + + ; min = Math . min ( p , min ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { for ( java . util . Scanner scan : new java . util . Scanner [ ] { new java . util . Scanner ( System . in ) } ) { for ( int a : new int [ ] { scan . nextInt ( ) } ) { for ( int b : new int [ ] { scan . nextInt ( ) } ) { for ( int c : new int [ ] { scan . nextInt ( ) } ) { if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) { if ( System . out . printf ( " % s " , " YES " ) = = null ) { } } else { if ( System . out . printf ( " % s " , " NO " ) = = null ) { } } } } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int k = stdIn . nextInt ( ) ; int s = stdIn . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - ( i + j ) & & s - ( i + j ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { private int N ; private char [ ] S ; public void inputData ( ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; S = new char [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) . charAt ( 0 ) ; } } public void printAnswer ( ) { for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] = = ' Y ' ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } public void run ( ) { inputData ( ) ; printAnswer ( ) ; } public static void main ( String [ ] args ) { ( new Main ( ) ) . run ( ) ; } } 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 [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int r = n ; int max = p [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( max < p [ i ] ) { r -- ; } else { max = p [ i ] ; } } System . out . println ( r ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = 3 ; int [ ] [ ] t = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { t [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int dif0 = t [ i ] [ 0 ] - t [ i + 1 ] [ 0 ] ; for ( int j = 1 ; j < n ; j + + ) { int difj = t [ i ] [ j ] - t [ i + 1 ] [ j ] ; if ( dif0 ! = difj ) { System . out . println ( " No " ) ; return ; } } } for ( int j = 0 ; j < n - 1 ; j + + ) { int dif0 = t [ 0 ] [ j ] - t [ 0 ] [ j + 1 ] ; for ( int i = 1 ; i < n ; i + + ) { int difi = t [ i ] [ j ] - t [ i ] [ j + 1 ] ; if ( dif0 ! = difi ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 64 ; while ( N < ans ) { ans / = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double ah = 0 ; double am = 0 ; am = m * 6 ; ah = h * 30 + m / 2 ; double angle = Math . abs ( am - ah ) ; if ( angle > 180 ) { angle = 360 - angle ; } double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( a , 2 ) - 2 * b * a * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( r ) ; } } import java . util . Scanner ; public class Main { static int c [ ] [ ] = new int [ 3 ] [ 3 ] ; @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { if ( judge ( i ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } private static boolean judge ( int i ) { int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; boolean jua2 = false ; boolean jua3 = false ; for ( int j = 0 ; j < = 100 ; j + + ) { if ( c [ 1 ] [ 0 ] - b1 = = j & & c [ 1 ] [ 1 ] - b2 = = j & & c [ 1 ] [ 2 ] - b3 = = j ) jua2 = true ; } for ( int j = 0 ; j < = 100 ; j + + ) { if ( c [ 2 ] [ 0 ] - b1 = = j & & c [ 2 ] [ 1 ] - b2 = = j & & c [ 2 ] [ 2 ] - b3 = = j ) jua3 = true ; } if ( 0 < = b1 & & b1 < = 100 & & 0 < = b2 & & b2 < = 100 & & 0 < = b3 & & b3 < = 100 & & jua2 & & jua3 ) return true ; else return false ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K & & x < = S ; x + + ) { for ( int y = 0 ; y < = K & & y < = S ; y + + ) { if ( S - x - y > = 0 & & S - x - y < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } a [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) b [ i ] = arr [ 0 ] [ i ] - a [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = arr [ i ] [ 0 ] - b [ 0 ] ; boolean isGood = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( arr [ i ] [ j ] ! = a [ i ] + b [ j ] ) { isGood = false ; } } } System . out . println ( isGood ? " Yes " : " No " ) ; } } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { resolve ( System . in , System . out ) ; } static void resolve ( InputStream is , PrintStream pw ) { Scanner sc = new Scanner ( is ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; double hRad = ( double ) 90 - 360 * ( double ) h / 12 - 30 * ( ( double ) m % 60 ) / 60 ; double hX = ( double ) a * Math . cos ( Math . toRadians ( hRad ) ) ; double hY = ( double ) a * Math . sin ( Math . toRadians ( hRad ) ) ; double mRad = ( double ) 90 - 360 * ( ( double ) m % 60 ) / 60 ; double mX = ( double ) b * Math . cos ( Math . toRadians ( mRad ) ) ; double mY = ( double ) b * Math . sin ( Math . toRadians ( mRad ) ) ; double diffX = hX - mX ; double diffY = hY - mY ; pw . println ( Math . sqrt ( diffX * diffX + diffY * diffY ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String A [ ] = new String [ N ] ; int a = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . next ( ) ; if ( A [ i ] . equals ( " Y " ) ) { a = 1 ; } } if ( a = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int number = 5 ; int max = 0 , min = 123 ; while ( number -- > 0 ) { int k = in . nextInt ( ) ; max = Math . max ( k , max ) ; min = Math . min ( k , min ) ; } int j = in . nextInt ( ) ; if ( max - min > j ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strs = br . readLine ( ) . split ( " " ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < strs . length ; i + + ) { nums [ i ] = Integer . parseInt ( strs [ i ] ) ; } Arrays . sort ( nums ) ; System . out . println ( ( nums [ 2 ] - nums [ 1 ] ) + ( nums [ 1 ] - nums [ 0 ] ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { int T1 = sc . nextInt ( ) ; int T2 = sc . nextInt ( ) ; long A1 = sc . nextLong ( ) ; long A2 = sc . nextLong ( ) ; long B1 = sc . nextLong ( ) ; long B2 = sc . nextLong ( ) ; if ( ( A1 * T1 + A2 * T2 ) = = ( B1 * T1 + B2 * T2 ) ) { System . out . println ( " infinity " ) ; return ; } if ( A1 > B1 ) { A1 = A1 - B1 ; B2 = B2 - A2 ; } else { A1 = B1 - A1 ; B2 = A2 - B2 ; } long d1 = A1 * T1 ; long d2 = B2 * T2 ; if ( d1 - d2 > 0 ) { System . out . println ( 0 ) ; return ; } long ans = ( d1 / ( d2 - d1 ) ) * 2 ; if ( d1 % ( d2 - d1 ) ! = 0 ) { ans + + ; } System . out . println ( ans ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( final var stdin = new InputStreamReader ( System . in ) ; final var br = new BufferedReader ( stdin ) ) { final var line = Arrays . stream ( br . readLine ( ) . split ( " " ) ) . mapToInt ( Integer : : parseInt ) . sorted ( ) . toArray ( ) ; System . out . println ( line [ 0 ] = = 5 & & line [ 1 ] = = 5 & & line [ 2 ] = = 7 ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < 10 ; i + + ) { if ( Math . pow ( 2 , i ) > N ) { System . out . println ( ( int ) Math . pow ( 2 , i - 1 ) ) ; return ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double tan = 0 ; tan = ( H * 30 ) + ( M * 0.5 ) ; double tyo = 0 ; tyo = ( M * 6 ) ; double kaku = 0 ; kaku = ( tan - tyo ) ; double radi = Math . toRadians ( kaku ) ; double C = 0 ; C = Math . cos ( radi ) ; C = Math . sqrt ( ( ( A * A ) + ( B * B ) ) - ( ( 2 * A * B ) * C ) ) ; System . out . println ( C ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = k ; + + y ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; bw . flush ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskATCG004B solver = new TaskATCG004B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskATCG004B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; int x = in . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = in . nextInt ( ) ; } long minSum = 0 ; int m [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { m [ i ] = a [ i ] ; minSum + = m [ i ] ; } for ( int k = 1 ; k < = N - 1 ; k + + ) { long sum = ( long ) k * x ; for ( int i = 0 ; i < N ; i + + ) { int p = ( i - k ) % N ; if ( p < 0 ) p + = N ; m [ i ] = Math . min ( m [ i ] , a [ p ] ) ; sum + = m [ i ] ; } minSum = Math . min ( sum , minSum ) ; } out . println ( minSum ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int a = 0 ; while ( ans < = n ) { ans = ans * 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = n ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = c [ 0 ] [ i ] ; } a [ 0 ] = 0 ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; boolean wronganswer = false ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { wronganswer = true ; } ; } } if ( wronganswer ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 1 ; while ( result < = N ) { result = result * 2 ; } System . out . println ( result / 2 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; s = r . readLine ( ) ; String sl [ ] = s . split ( " " ) ; System . out . println ( s . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A _ 1 = sc . nextInt ( ) ; int A _ 2 = sc . nextInt ( ) ; int A _ 3 = sc . nextInt ( ) ; int [ ] S = new int [ ] { A _ 1 , A _ 2 , A _ 3 } ; Arrays . sort ( S ) ; System . out . println ( S [ 2 ] - S [ 0 ] ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a = Integer . parseInt ( in . next ( ) ) ; int b = Integer . parseInt ( in . next ( ) ) ; int h = Integer . parseInt ( in . next ( ) ) ; int m = Integer . parseInt ( in . next ( ) ) ; double rect _ l = m * 360.0 / 60.0 ; double rect _ s = h * 30.0 + m * 0.5 ; double diff = rect _ s - rect _ l ; if ( diff > 180 ) diff = 360 - diff ; double ans = Math . sqrt ( ( a * a ) + ( b * b ) - 2 * a * b * Math . cos ( Math . toRadians ( diff ) ) ) ; out . printf ( " % .13f \ n " , ans ) ; } } } import java . io . * ; import java . util . * ; import java . lang . * ; import java . text . DecimalFormat ; public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { DecimalFormat df = new DecimalFormat ( " 0.000000000 " ) ; String lines = br . readLine ( ) ; String [ ] strs = lines . trim ( ) . split ( " \ \ s + " ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < strs . length ; i + + ) { a [ i ] = Integer . parseInt ( strs [ i ] ) ; } double radian = Math . PI * 2 * ( ( double ) a [ 2 ] / 12.0 + ( ( double ) a [ 3 ] / 60.0 ) / 12.0 - ( double ) a [ 3 ] / 60.0 ) ; double ans = ( double ) ( a [ 0 ] * a [ 0 ] + a [ 1 ] * a [ 1 ] ) - ( double ) ( 2 * a [ 0 ] * a [ 1 ] ) * Math . cos ( radian ) ; System . out . println ( df . format ( Math . sqrt ( ans ) ) ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final double pi = 3.14159265358979323846 ; Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double dist = A * A + B * B - A * B * Math . cos ( 2 * pi * ( M / 60 - ( H * 60 + M ) / 720 ) ) * 2 ; System . out . println ( Math . sqrt ( dist ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int ans = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean f = false ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int tmp = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( i = = 0 ) { tmp = a [ i ] ; continue ; } if ( tmp > = a [ i ] ) { tmp = a [ i ] ; ans + + ; } } ans + + ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n [ ] [ ] = new int [ 3 ] [ 3 ] ; int total = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int a = sc . nextInt ( ) ; total + = a ; n [ i ] [ j ] = a ; } } String ans = " Yes " ; for ( int i = 0 ; i < 1 ; i + + ) { if ( total % 3 ! = 0 ) { ans = " No " ; break ; } total / = 3 ; if ( ( n [ 0 ] [ 0 ] + n [ 1 ] [ 1 ] + n [ 2 ] [ 2 ] ) ! = total | | ( n [ 0 ] [ 2 ] + n [ 1 ] [ 1 ] + n [ 2 ] [ 0 ] ) ! = total ) { ans = " No " ; break ; } } 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 [ ] args ) { Scanner sc = new Scanner ( in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; int temp = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( temp < = Integer . numberOfTrailingZeros ( i ) ) { ans = i ; temp = Integer . numberOfTrailingZeros ( i ) ; } } out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 0 ; for ( i = 1 ; i < = n ; i = i * 2 ) { } i = i / 2 ; System . out . println ( i ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double t1 = ( h + m / 60.0 ) / 12.0 ; double t2 = m / 60.0 ; double r = Math . toRadians ( Math . abs ( t2 - t1 ) * 360.0 ) ; double ans = a * a + b * b - 2 * a * b * Math . cos ( r ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N > = 64 ) { System . out . println ( 64 ) ; } else if ( N > = 32 ) { System . out . println ( 32 ) ; } else if ( N > = 16 ) { System . out . println ( 16 ) ; } else if ( N > = 8 ) { System . out . println ( 8 ) ; } else if ( N > = 4 ) { System . out . println ( 4 ) ; } else if ( N > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; e = sc . nextInt ( ) ; e = sc . nextInt ( ) ; e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a * b * c = = 175 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int p [ ] = new int [ n ] ; int num = 1 ; int min = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = scan . nextInt ( ) ; if ( i = = 0 ) { min = p [ i ] ; continue ; } if ( p [ i ] < min ) { num + + ; min = p [ i ] ; } } System . out . println ( num ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double X = ( M * 11 / 360 - H / 6 ) * Math . PI ; System . out . println ( Math . pow ( A * A + B * B - 2 * A * B * Math . cos ( X ) , 0.5 ) ) ; } } import java . io . * ; import java . util . * ; public class Main { void run ( ) { int [ ] need = new int [ ] { 1 , 4 , 7 , 9 } ; int [ ] a = new int [ need . length ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( Arrays . equals ( a , need ) ? " YES " : " NO " ) ; } static MyScanner in ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { boolean stdStreams = true ; String fileName = Main . class . getSimpleName ( ) . replaceFirst ( " _ . * " , " " ) . toLowerCase ( ) ; String inputFileName = fileName + " .in " ; String outputFileName = fileName + " .out " ; Locale . setDefault ( Locale . US ) ; BufferedReader br ; if ( stdStreams ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; } else { br = new BufferedReader ( new FileReader ( inputFileName ) ) ; out = new PrintWriter ( outputFileName ) ; } in = new MyScanner ( br ) ; int tests = 1 ; for ( int test = 0 ; test < tests ; test + + ) { new Main ( ) . run ( ) ; } br . close ( ) ; out . close ( ) ; } static class MyScanner { BufferedReader br ; StringTokenizer st ; MyScanner ( BufferedReader br ) { this . br = br ; } void findToken ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } } String next ( ) { findToken ( ) ; return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } if ( set . contains ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( num [ 4 ] - num [ 0 ] > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int s = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s > = i + j & & s - ( i + j ) < = k ) { count + + ; } if ( s < i + j ) break ; } if ( s < i ) break ; } out . write ( String . valueOf ( count ) ) ; out . write ( " \ n " ) ; out . close ( ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] values = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { values [ i ] = Integer . parseInt ( input . readLine ( ) ) ; } int k = Integer . parseInt ( input . readLine ( ) ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( values [ i ] - values [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 2 ; i < = N ; i * = 2 ) { ans = i ; } 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 ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < = 100 ; i + + ) { for ( int j = 0 ; j < = 100 ; j + + ) { for ( int k = 0 ; k < = 100 ; k + + ) { a [ 0 ] = i ; a [ 1 ] = j ; a [ 2 ] = k ; b [ 0 ] = c [ 0 ] [ 0 ] - i ; b [ 1 ] = c [ 0 ] [ 1 ] - i ; b [ 2 ] = c [ 0 ] [ 2 ] - i ; if ( check ( a , b , c ) ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } static boolean check ( int a [ ] , int b [ ] , int c [ ] [ ] ) { for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) { return false ; } } } return true ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int min = 0 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } min = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( min > = P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] list = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " Yay ! " ; for ( int i = 0 ; i < 5 ; i + + ) { int value = list [ i ] ; for ( int index = i + 1 ; index < 5 ; index + + ) { if ( Math . abs ( value - list [ index ] ) > k ) { ans = " : ( " ; break ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a , b , h , m ; a = sc . nextDouble ( ) ; b = sc . nextDouble ( ) ; h = sc . nextDouble ( ) ; m = sc . nextDouble ( ) ; double angle = Math . min ( Math . abs ( h * 30 + m * 0.5 - m * 6 ) , 360 - Math . abs ( h * 30 + m * 0.5 - m * 6 ) ) ; double pi = angle / 180 * Math . PI ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( pi ) ) ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > c1 = new ArrayList < > ( ) ; List < Integer > c2 = new ArrayList < > ( ) ; List < Integer > c3 = new ArrayList < > ( ) ; IntStream . range ( 0 , 3 ) . forEach ( i - > c1 . add ( sc . nextInt ( ) ) ) ; IntStream . range ( 0 , 3 ) . forEach ( i - > c2 . add ( sc . nextInt ( ) ) ) ; IntStream . range ( 0 , 3 ) . forEach ( i - > c3 . add ( sc . nextInt ( ) ) ) ; int a1 = 0 ; int b1 = c1 . get ( 0 ) - a1 ; int a2 = c2 . get ( 0 ) - b1 ; int b2 = c2 . get ( 1 ) - a2 ; int a3 = c3 . get ( 0 ) - b1 ; int b3 = c3 . get ( 2 ) - a3 ; if ( c1 . get ( 0 ) = = a1 + b1 & & c1 . get ( 1 ) = = a1 + b2 & & c1 . get ( 2 ) = = a1 + b3 & & c2 . get ( 0 ) = = a2 + b1 & & c2 . get ( 1 ) = = a2 + b2 & & c2 . get ( 2 ) = = a2 + b3 & & c3 . get ( 0 ) = = a3 + b1 & & c3 . get ( 1 ) = = a3 + b2 & & c3 . get ( 2 ) = = a3 + b3 ) { System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( scanner . nextInt ( ) ) ; } scanner . close ( ) ; int count = 0 ; int min = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( list . get ( i ) . compareTo ( min ) = = 1 ) { continue ; } count + = 1 ; min = list . get ( i ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = Math . max ( 0 , s - x - k ) ; y < = Math . min ( k , s - x ) ; y + + ) { int z = s - x - y ; if ( ( z > = 0 ) & & ( z < = k ) ) { count + + ; } } } System . out . println ( count ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( 1 < n & & n < 4 ) { System . out . println ( 2 ) ; } else if ( 4 < = n & & n < 8 ) { System . out . println ( 4 ) ; } else if ( 8 < = n & & n < 16 ) { System . out . println ( 8 ) ; } else if ( 16 < = n & & n < 32 ) { System . out . println ( 16 ) ; } else if ( 32 < = n & & n < 64 ) { System . out . println ( 32 ) ; } else if ( n = = 1 ) { System . out . println ( 1 ) ; } else { System . out . println ( 64 ) ; } } } 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 N = in . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i < = N ; i + + ) { if ( i = = 1 | | i = = 2 | | i = = 4 | | i = = 8 | | i = = 16 | | i = = 32 | | i = = 64 ) { ans = i ; } } out . println ( ans ) ; } } 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 char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int X , Y = 0 , Z ; int sum = 0 ; for ( Z = 0 ; Z < = K ; Z + + ) { S - = Z ; for ( X = 0 ; X < = K & & X < = S ; X + + ) { Y = S - X ; if ( Y > K ) continue ; sum + + ; } S + = Z ; } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String arare [ ] = new String [ 100 ] ; for ( int i = 0 ; i < n ; i + + ) { arare [ i ] = sc . next ( ) ; if ( arare [ i ] . equals ( " Y " ) ) { System . out . println ( " Four " ) ; break ; } else if ( i = = n - 1 ) { System . out . println ( " Three " ) ; break ; } } } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; int number = 1 ; while ( number * 2 < = n ) { number * = 2 ; } System . out . println ( number ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( list [ i ] , min ) ; if ( min < list [ i ] ) { continue ; } ans + + ; } 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 ( ) ; HashSet < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; set . add ( s ) ; } if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String arge [ ] ) { Scanner scan = new Scanner ( System . in ) ; int i = scan . nextInt ( ) ; String [ ] a ; a = new String [ i ] ; String ans = " Three " ; for ( int j = 0 ; j < i ; j + + ) { a [ j ] = scan . next ( ) ; if ( a [ j ] . equals ( " Y " ) ) { ans = " Four " ; } } System . out . print ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int [ ] [ ] a = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { int now = 0 ; for ( int k = 0 ; k < h ; k + + ) { for ( int l = 0 ; l < w ; l + + ) { now + = Math . min ( Math . abs ( i - k ) , Math . abs ( j - l ) ) * a [ k ] [ l ] ; } } ans = Math . min ( ans , now ) ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Math . abs ( a - e ) < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int min = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int limit = sc . nextInt ( ) ; if ( max - min < = limit ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; return ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Set < String > list = new HashSet < String > ( ) ; int num = sc . nextInt ( ) ; for ( int i = 0 ; i < num ; i + + ) { list . add ( sc . next ( ) ) ; } if ( list . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else if ( list . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int x [ ] = new int [ 10 ] ; x [ 0 ] = Math . abs ( a - b ) ; x [ 1 ] = Math . abs ( a - c ) ; x [ 2 ] = Math . abs ( a - d ) ; x [ 3 ] = Math . abs ( a - e ) ; x [ 4 ] = Math . abs ( b - c ) ; x [ 5 ] = Math . abs ( b - d ) ; x [ 6 ] = Math . abs ( b - e ) ; x [ 7 ] = Math . abs ( c - d ) ; x [ 8 ] = Math . abs ( c - e ) ; x [ 9 ] = Math . abs ( d - e ) ; for ( int i = 0 ; i < x . length ; i + + ) { if ( x [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } static long power ( long x , int n ) { long mod = 1000000007 ; long ans = 1 ; while ( n > 0 ) { if ( ( n & 1 ) = = 1 ) { ans = ( ans * x ) % mod ; } x = ( x * x ) % mod ; n > > = 1 ; } return ans ; } static int gcd ( int a , int b ) { int temp ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return b ; } static class UF { static int size = 51 ; static int [ ] par = new int [ size ] ; static void init ( ) { for ( int i = 1 ; i < size ; i + + ) { par [ i ] = i ; } } static int root ( int x ) { if ( par [ x ] = = x ) { return x ; } else { return par [ x ] = root ( par [ x ] ) ; } } static boolean same ( int x , int y ) { return root ( x ) = = root ( y ) ; } static void unite ( int x , int y ) { x = root ( x ) ; y = root ( y ) ; if ( x = = y ) return ; par [ x ] = y ; } } } import java . util . * ; class Main { public static void main ( String [ ] arg ) { Scanner stdIn = new Scanner ( System . in ) ; int A = stdIn . nextInt ( ) ; int B = stdIn . nextInt ( ) ; int C = stdIn . nextInt ( ) ; int max = Math . max ( A , Math . max ( B , C ) ) ; int min = Math . min ( A , Math . min ( B , C ) ) ; if ( A + B + C = = 17 & & max = = 7 & & min = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; int K = Input . nextInt ( ) ; int S = Input . nextInt ( ) ; int Counter = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( 0 < = S - ( X + Y ) & & S - ( X + Y ) < = K ) { Counter + + ; } } } System . out . println ( Counter ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double num1 = 0.5 * m + 30 * h ; double num2 = 6 * m ; double num3 = 0 ; if ( num1 > num2 ) { num3 = num1 - num2 ; } else if ( num2 > num1 ) { num3 = num2 - num1 ; } if ( num3 > 180 ) { num3 = 360 - num3 ; } double cos = Math . cos ( Math . toRadians ( num3 ) ) ; double c = ( a * a + b * b ) - ( 2 * a * b * cos ) ; double ans = Math . sqrt ( c ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a > k | | c - a > k | | d - a > k | | e - a > k | | c - b > k | | d - b > k | | e - b > k | | d - c > k | | e - c > k | | e - d > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { static long inf = ( long ) 1e17 ; public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = Integer . parseInt ( in . next ( ) ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( in . next ( ) ) ; } long min = inf ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { min = p [ i ] ; ans + + ; } } out . println ( ans ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long sumA = 0 ; long sumB = 0 ; Pair [ ] pairs = new Pair [ n ] ; int [ ] aa = new int [ n ] ; int [ ] ba = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { aa [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { ba [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { int a = aa [ i ] ; int b = ba [ i ] ; int dif = a - b ; sumA + = a ; sumB + = b ; Pair pair = new Pair ( ) ; pair . a = a ; pair . b = b ; pair . dif = dif ; pairs [ i ] = pair ; } if ( sumA < sumB ) { System . out . println ( - 1 ) ; return ; } Arrays . sort ( pairs ) ; long difTotal = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( pairs [ i ] . dif < 0 ) { difTotal + = pairs [ i ] . dif ; count + + ; } } for ( int i = n - 1 ; i > = 0 ; i -- ) { if ( difTotal < 0 ) { difTotal + = pairs [ i ] . dif ; count + + ; } else { System . out . println ( count ) ; return ; } } System . out . println ( count ) ; } } class Pair implements Comparable < Object > { int a ; int b ; int dif ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return dif - otherpair . dif ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ( e - a ) < = k ) { System . out . println ( " Yay ! " ) ; return ; } System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . nio . file . * ; import java . nio . charset . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set s = new HashSet ( ) ; for ( int i = 0 ; i < n ; i + + ) { s . add ( sc . next ( ) ) ; } if ( s . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { final String PINK = " P " ; final String WHITE = " W " ; final String GREEN = " G " ; final String YELLOW = " Y " ; boolean hasFourColors = false ; Scanner sc = new Scanner ( System . in ) ; int arareNum = sc . nextInt ( ) ; while ( sc . hasNext ( ) ) { String color = sc . next ( ) ; if ( color . equals ( YELLOW ) ) { hasFourColors = true ; break ; } } String result = null ; if ( hasFourColors ) { result = " Four " ; } else { result = " Three " ; } System . out . println ( result ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; public class Main { static int n ; static ArrayList < ArrayList < Integer > > edge ; static boolean used [ ] ; static boolean flag = false ; static int ans ; public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; n = Integer . parseInt ( br . readLine ( ) ) ; String str [ ] = br . readLine ( ) . split ( " " ) ; int a [ ] = new int [ n ] ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( str [ i ] ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( a [ i ] , min ) ; if ( min < a [ i ] ) { } else { ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int two [ ] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; int max = 0 ; for ( int i = 0 ; i < 7 ; i + + ) { if ( two [ i ] > N ) break ; max = i ; } System . out . println ( two [ max ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int num [ ] = new int [ 5 ] ; for ( int i = 0 ; i < n ; i + + ) num [ i ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean po = true ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( Math . abs ( num [ i ] - num [ j ] ) > k ) po = false ; } } System . out . println ( ( po ) ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 ) { count5 + + ; } if ( a = = 7 ) { count7 + + ; } if ( b = = 5 ) { count5 + + ; } if ( b = = 7 ) { count7 + + ; } if ( c = = 5 ) { count5 + + ; } if ( c = = 7 ) { count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { MyScanner sc = new MyScanner ( System . in ) ; int n ; long x ; n = sc . nextInt ( ) ; x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; long [ ] b = a . clone ( ) ; long ans = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long acc = 0 ; long xk = ( ( long ) x ) * k ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i - k + n ) % n ] ) ; acc + = b [ i ] ; } ans = Math . min ( ans , acc + xk ) ; } System . out . println ( ans ) ; } static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int temp = 0 ; for ( int i = 0 ; i < ( t - 1 ) ; i + + ) { int k = sc . nextInt ( ) ; if ( k < min ) { min = k ; temp + + ; } } System . out . println ( temp + 1 ) ; } } import java . math . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] np = scanner . nextLine ( ) . split ( " " , 2 ) ; long n = Long . parseLong ( np [ 0 ] ) ; long p = Long . parseLong ( np [ 1 ] ) ; long remP = p ; long limit = ( long ) Math . sqrt ( p ) + 1 ; if ( n = = 1 ) { System . out . println ( p ) ; return ; } long answer = 1 ; for ( long i = 2 ; i < = limit ; i + + ) { long cnt = 0 ; while ( remP % i = = 0 ) { remP / = i ; cnt + + ; } for ( long j = 0 ; j < cnt / n ; j + + ) { answer * = i ; } if ( remP = = 1 ) { break ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double A = scan . nextDouble ( ) ; double B = scan . nextDouble ( ) ; double H = scan . nextDouble ( ) ; double M = scan . nextDouble ( ) ; double hour , minute , c , co , ans ; hour = H * 30 + M * 0.5 ; minute = M * 6 ; c = hour - minute ; if ( c > 180 ) { c = 360 - c ; } else if ( c < 0 ) { c = 360 + c ; } co = Math . cos ( Math . toRadians ( c ) ) ; ans = A * A + B * B - 2 * A * B * co ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String ans = " Yes " ; for ( int i = 0 ; i < 2 ; i + + ) { if ( ! ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] = = c [ 1 ] [ i ] - c [ 1 ] [ i + 1 ] & & c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] = = c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] ) ) { ans = " No " ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t1 = sc . nextInt ( ) ; int t2 = sc . nextInt ( ) ; long a1 = sc . nextLong ( ) ; long a2 = sc . nextLong ( ) ; long b1 = sc . nextLong ( ) ; long b2 = sc . nextLong ( ) ; if ( a1 * t1 + a2 * t2 = = b1 * t1 + b2 * t2 ) { System . out . println ( " infinity " ) ; System . exit ( 0 ) ; } long dif1 = a1 * t1 - b1 * t1 ; long dif2 = a2 * t2 - b2 * t2 ; long ans ; if ( ( dif1 > 0 & & dif1 + dif2 < 0 ) | | ( dif1 < 0 & & dif1 + dif2 > 0 ) ) { if ( - dif1 % ( dif1 + dif2 ) = = 0 ) { ans = - dif1 / ( dif1 + dif2 ) * 2 ; } else { ans = - dif1 / ( dif1 + dif2 ) * 2 + 1 ; } } else { ans = 0 ; } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int A = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; final int H = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; sc . close ( ) ; double rad = Math . toRadians ( ( 60 * H + M ) * 0.5 - M * 6 ) ; double ans = Math . sqrt ( Math . pow ( A , 2.0 ) + Math . pow ( B , 2.0 ) - 2 * A * B * Math . cos ( rad ) ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; switch ( A ) { case 5 : if ( B = = 5 & & C = = 7 | | B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; return ; case 7 : if ( B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; return ; default : System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int ans = 1 ; while ( true ) { ans * = 2 ; if ( ans > n ) { break ; } } System . out . println ( ans / 2 ) ; } } import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { out . println ( " : ( " ) ; return ; } out . println ( " Yay ! " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int [ ] sMinusZ = new int [ K + 1 ] ; for ( int i = 0 ; i < = K ; i + + ) { sMinusZ [ i ] = S - i ; } Arrays . sort ( sMinusZ ) ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( Arrays . binarySearch ( sMinusZ , i + j ) > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; String [ ] cmd = s . split ( " " ) ; double a = Double . valueOf ( cmd [ 0 ] ) ; double b = Double . valueOf ( cmd [ 1 ] ) ; double c = Double . valueOf ( cmd [ 2 ] ) ; double d = Double . valueOf ( cmd [ 3 ] ) ; double x = ( ( c * 60 + d ) * 6 ) % 360 ; double y = c * 30 + ( d * 1.0 ) / 2 ; double an = Math . abs ( x - y ) ; if ( an > 180 ) an = 360 - an ; double a1 = a * a + b * b ; double a2 = 2 * a * b ; double a3 = a1 - a2 * Math . cos ( ( an * Math . PI ) / 180 ) ; System . out . println ( Math . sqrt ( a3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int check = 0 ; int [ ] a = new int [ 9 ] ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = scn . nextInt ( ) ; } int x1 = a [ 3 ] - a [ 0 ] ; int x2 = a [ 6 ] - a [ 3 ] ; if ( a [ 4 ] ! = a [ 1 ] + x1 ) { check = 1 ; } if ( a [ 5 ] ! = a [ 2 ] + x1 ) { check = 1 ; } if ( a [ 7 ] ! = a [ 4 ] + x2 ) { check = 1 ; } if ( a [ 8 ] ! = a [ 5 ] + x2 ) { check = 1 ; } if ( check = = 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int cnt = 1 ; for ( int i = 1 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < = min ) { cnt + + ; } if ( p < min ) min = p ; } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int wa = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = x ; i + + ) { for ( int j = 0 ; j < = x ; j + + ) { if ( 0 < = wa - i - j & & wa - i - j < = x ) { ans + + ; } } } System . out . println ( ans ) ; sc . close ( ) ; } public static void saiki ( int a , String b ) { if ( a = = 0 ) { System . out . println ( b ) ; } else { for ( char ch = ' a ' ; ch < = ' c ' ; ch + + ) { saiki ( a - 1 , b + ch ) ; } } } public static int gcd ( int a , int b ) { if ( a < b ) { int tmp = a ; a = b ; b = tmp ; } int r = - 1 ; while ( r ! = 0 ) { r = a % b ; a = b ; b = r ; } return a ; } } import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ; import java . util . List ; import java . util . NoSuchElementException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] S = new int [ N ] ; boolean flg = false ; for ( int i = 0 ; i < N ; i + + ) { flg | = s . next ( ) . equals ( " Y " ) ; } System . out . println ( flg ? " Four " : " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( Z < = K & & Z > = 0 ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int p = 1 ; while ( p < = n ) { p * = 2 ; } System . out . println ( p / 2 ) ; } } import java . util . * ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import java . util . Arrays ; import java . util . Collections ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) , s = scanner . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { int sum = 0 ; for ( int j = 0 ; j < = k ; j + + ) { sum = i + j ; if ( ( s - sum ) > = 0 & & ( s - sum ) < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . TreeMap ; import java . util . ArrayDeque ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double tan = 360.0 * H / 12 + 0.5 * M ; double tyo = 360.0 * M / 60 ; double c = Math . abs ( tan - tyo ) ; if ( c > 180 ) { c = 360 - c ; } double C = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( c ) ) ; System . out . println ( Math . sqrt ( C ) ) ; } } import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int cnt = 1 ; ; for ( int i = 0 ; i < n ; i + + ) p [ i ] = sc . nextInt ( ) ; int tmp = p [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( tmp > p [ i ] ) cnt + + ; if ( p [ i ] < tmp ) tmp = p [ i ] ; } System . out . println ( cnt ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader bu = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s [ ] = bu . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( s [ 0 ] ) , b = Integer . parseInt ( s [ 1 ] ) , h = Integer . parseInt ( s [ 2 ] ) , m = Integer . parseInt ( s [ 3 ] ) ; double hr = 0.5 * ( h * 60 + m ) , min = 6 * m , angle = Math . abs ( hr - min ) ; angle = Math . min ( 360 - angle , angle ) ; double d = Math . cos ( Math . toRadians ( angle ) ) ; double ans = Math . sqrt ( - 2.0 * a * b * d + a * a + b * b ) ; System . out . print ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int a = 128 ; for ( ; a > n ; a / = 2 ) ; System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - d > k | | e - c > k | | e - b > k | | e - a > k | | d - c > k | | d - b > k | | d - a > k | | c - b > k | | c - a > k | | b - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; boolean s [ ] = { false , false , false , false } ; String c ; for ( int i = 0 ; i < N ; i + + ) { c = sc . next ( ) ; if ( " P " . equals ( c ) ) s [ 0 ] = true ; else if ( " W " . equals ( c ) ) s [ 1 ] = true ; else if ( " G " . equals ( c ) ) s [ 2 ] = true ; else if ( " Y " . equals ( c ) ) s [ 3 ] = true ; if ( s [ 0 ] & & s [ 1 ] & & s [ 2 ] & & s [ 3 ] ) { sc . close ( ) ; System . out . println ( " Four " ) ; return ; } } sc . close ( ) ; System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { private static final int IROHA = 17 ; public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { String input = scan . nextLine ( ) ; String [ ] arr = input . split ( " \ \ s " ) ; String result = " YES " ; try { int sum = 0 ; for ( String s : arr ) { if ( s . matches ( " ^ [ 57 ] $ " ) ) { sum + = Integer . parseInt ( s ) ; } else { result = " NO " ; } } if ( sum ! = IROHA ) { result = " NO " ; } } catch ( NumberFormatException e ) { result = " NO " ; throw e ; } System . out . println ( result ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = 0 ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 7 ) { i + + ; } if ( b = = 7 ) { i + + ; } if ( c = = 7 ) { i + + ; } if ( i = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int g = 0 ; int na = 0 ; if ( A = = 5 ) { g + + ; } else if ( A = = 7 ) { na + + ; } if ( B = = 5 ) { g + + ; } else if ( B = = 7 ) { na + + ; } if ( C = = 5 ) { g + + ; } else if ( C = = 7 ) { na + + ; } if ( g = = 2 & & na = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; long d [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; d [ i ] = b [ i ] - a [ i ] ; } Arrays . sort ( d ) ; long sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) if ( d [ i ] > 0 ) { sum + = d [ i ] ; ans + + ; } long sum2 = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( sum2 > = sum ) { System . out . println ( ans + i ) ; return ; } sum2 - = d [ i ] ; } System . out . println ( - 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = n ; int cnt = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; min = Math . min ( min , p ) ; if ( p < = min ) cnt + + ; } System . out . println ( cnt ) ; sc . close ( ) ; } } import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double s ; double sA = 30 * H + 0.5 * M ; double sB = 6 * M ; if ( sA < = sB ) { s = sB - sA ; } else { s = sA - sB ; } double ans2 = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( s ) ) ; System . out . println ( Math . sqrt ( ans2 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean isAns = true ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) isAns = false ; } } System . out . println ( isAns ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; long count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int z = S - i - j ; if ( z > = 0 & & z < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int sum = a + b + c ; if ( sum = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; public class Main { void solve ( InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int ans = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; + + i ) { int x = in . nextInt ( ) ; if ( x < min ) { + + ans ; } min = Math . min ( min , x ) ; } out . println ( ans ) ; } public static void main ( String [ ] args ) throws Exception { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Main solver = new Main ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class InputReader { BufferedReader in ; StringTokenizer st ; public InputReader ( InputStream is ) { in = new BufferedReader ( new InputStreamReader ( is ) ) ; } public String next ( ) { try { while ( st = = null | | ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = n ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; boolean b = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = s . nextInt ( ) ; } } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( b ) { b = c [ i ] [ j ] - c [ i ] [ j + 1 ] = = c [ i + 1 ] [ j ] - c [ i + 1 ] [ j + 1 ] ; } } } String str = b ? " Yes " : " No " ; System . out . println ( str ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int minDistance = Integer . MAX _ VALUE ; int resident [ ] [ ] = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { resident [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { minDistance = Math . min ( minDistance , calcDistance ( i , j , resident ) ) ; } } System . out . println ( minDistance ) ; } public static int calcDistance ( int a , int b , int [ ] [ ] c ) { int total = 0 ; for ( int i = 0 ; i < c . length ; i + + ) { for ( int j = 0 ; j < c [ 0 ] . length ; j + + ) { total + = c [ i ] [ j ] * Math . min ( Math . abs ( a - i ) , Math . abs ( b - j ) ) ; } } return total ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = Integer . parseInt ( scanner . next ( ) ) ; int p = Integer . MAX _ VALUE ; int r = 0 ; for ( int i = 0 ; i < n ; i + + ) { int pp = Integer . parseInt ( scanner . next ( ) ) ; if ( pp < = p ) r + + ; p = Integer . min ( p , pp ) ; } System . out . println ( r ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int read ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { read = sc . nextInt ( ) ; if ( read = = 5 ) { five + + ; } else if ( read = = 7 ) { seven + + ; } } String ans = " NO " ; if ( five = = 2 | | seven = = 1 ) { ans = " YES " ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxCnt = 0 ; int cntNum = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int cnt = 0 ; int num = i ; while ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } if ( cnt > = maxCnt ) { maxCnt = cnt ; cntNum = i ; } } System . out . println ( cntNum ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String data [ ] = str . split ( " " , 0 ) ; int a [ ] = new int [ 3 ] ; int sum = 0 ; int s = 0 ; for ( int i = 0 ; i < data . length ; i + + ) { sum + = Integer . parseInt ( data [ i ] ) ; a [ i ] = Integer . parseInt ( data [ i ] ) ; } if ( sum ! = 17 ) { } else { if ( a [ 0 ] = = 5 | | a [ 0 ] = = 7 ) { if ( a [ 1 ] = = 5 | | a [ 1 ] = = 7 ) { if ( a [ 2 ] = = 5 | | a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; s + + ; } } } } if ( s = = 0 ) { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = scan . nextInt ( ) ; } int max = Integer . MIN _ VALUE ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { max = Math . max ( max , Math . abs ( a [ j ] - a [ i ] ) ) ; } } System . out . println ( max ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) ; int A2 = sc . nextInt ( ) ; int A3 = sc . nextInt ( ) ; int ans = Math . max ( A1 , Math . max ( A2 , A3 ) ) - Math . min ( A1 , Math . min ( A2 , A3 ) ) ; System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; String [ ] s = in . readLine ( ) . split ( " " ) ; boolean yellow _ flg = false ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . charAt ( 0 ) = = ' Y ' ) yellow _ flg = true ; } System . out . println ( yellow _ flg = = true ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int K = s . nextInt ( ) ; int S = s . nextInt ( ) ; int count = 0 ; int i = 0 , j = 0 ; for ( i = 0 ; i < = K ; i + + ) { for ( j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & S - i - j > = 0 ) count + + ; } } System . out . print ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; scan . close ( ) ; int x [ ] = { a , b , c } ; int cnt [ ] = { 0 , 0 } ; for ( int i = 0 ; i < 3 ; i + + ) { if ( x [ i ] = = 5 ) cnt [ 0 ] + = 1 ; if ( x [ i ] = = 7 ) cnt [ 1 ] + = 1 ; } if ( cnt [ 0 ] = = 2 & & cnt [ 1 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n1 = Integer . parseInt ( in . next ( ) ) ; int n2 = Integer . parseInt ( in . next ( ) ) ; int n3 = Integer . parseInt ( in . next ( ) ) ; int n4 = Integer . parseInt ( in . next ( ) ) ; boolean ok = false ; String tmp = new String ( Integer . toString ( n1 ) + Integer . toString ( n2 ) + Integer . toString ( n3 ) + Integer . toString ( n4 ) ) ; if ( tmp . contains ( " 1 " ) & & tmp . contains ( " 9 " ) & & tmp . contains ( " 7 " ) & & tmp . contains ( " 4 " ) ) ok = true ; out . println ( ok ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] pos = new int [ 5 ] ; int max = Integer . MIN _ VALUE ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = scanner . nextInt ( ) ; max = Math . max ( max , tmp ) ; min = Math . min ( min , tmp ) ; } int k = scanner . nextInt ( ) ; if ( max - min > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . ArrayDeque ; import java . util . Arrays ; import java . util . Queue ; import java . util . Random ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; static long mod = 1000000007 ; public static void main ( String [ ] args ) { double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double t2 = H * 30 + M / 2 ; double t1 = 6 * M ; double cos = Math . min ( 360 - Math . abs ( t2 - t1 ) , Math . abs ( t2 - t1 ) ) ; double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( cos ) ) ; ans = Math . pow ( ans , 0.5 ) ; p ( ans ) ; } public static long lcm ( long a , long b ) { return a / gcd ( a , b ) * b ; } public static long gcd ( long a , long b ) { return b = = 0 ? a : gcd ( b , a % b ) ; } static void p ( String ans ) { System . out . println ( ans ) ; } ; static void p ( int ans ) { System . out . println ( ans ) ; } ; static void p ( ) { System . out . println ( ) ; } ; static void p ( long ans ) { System . out . println ( ans ) ; } ; static void p ( double ans ) { 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 ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String message = " " ; if ( ( a * b * c ) = = ( 5 * 7 * 5 ) ) { message = " YES " ; } else { message = " NO " ; } System . out . println ( message ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int result = 0 ; int A [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; result + = Math . abs ( A [ 1 ] - A [ 0 ] ) ; result + = Math . abs ( A [ 1 ] - A [ 2 ] ) ; System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( A = = 7 & & B = = 5 & & C = = 5 | | A = = 5 & & B = = 7 & & C = = 5 | | A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int A [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 1 ; int min = A [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( min > = A [ i ] ) { cnt + + ; min = A [ i ] ; } } System . out . println ( cnt ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " , 0 ) ; int K = Integer . parseInt ( s [ 0 ] ) ; int S = Integer . parseInt ( s [ 1 ] ) ; int X , Y , Z ; int count = 0 ; for ( X = 0 ; X < = K ; X + + ) { for ( Y = 0 ; Y < = K ; Y + + ) { Z = S - X - Y ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] cnt = new int [ 11 ] ; for ( int i = 0 ; i < 3 ; + + i ) cnt [ in . nextInt ( ) ] + + ; if ( cnt [ 5 ] = = 2 & & cnt [ 7 ] = = 1 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . execute ( ) ; } private void execute ( ) { Scanner sc = new Scanner ( System . in ) ; final long N = sc . nextLong ( ) ; final long P = sc . nextLong ( ) ; long maxGcd = 0 ; if ( N = = 1 ) { maxGcd = P ; } else { for ( int i = 1 ; ; i + + ) { long g = ( long ) Math . pow ( i , N ) ; if ( g > P ) { break ; } if ( P % g = = 0 ) { maxGcd = i ; } } } System . out . println ( maxGcd ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int dif = array [ 4 ] - array [ 0 ] ; if ( dif < = array [ 5 ] ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int count = 0 ; int n = sc . nextInt ( ) ; int mini = 200001 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( mini > = p ) count + + ; mini = ( int ) Math . min ( p , mini ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] a = new int [ N ] ; IntStream . range ( 0 , N ) . forEach ( i - > a [ i ] = scanner . nextInt ( ) ) ; System . out . println ( permutation ( a ) ) ; } } private static int permutation ( int [ ] seed ) { int [ ] perm = new int [ seed . length ] ; boolean [ ] used = new boolean [ seed . length ] ; return buildPerm ( seed , perm , used , 0 ) ; } private static int buildPerm ( int [ ] seed , int [ ] perm , boolean [ ] used , int index ) { if ( seed . length = = index ) { return procPerm ( perm ) ; } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < seed . length ; + + i ) { if ( ! used [ i ] ) { perm [ index ] = seed [ i ] ; used [ i ] = true ; min = Math . min ( min , buildPerm ( seed , perm , used , index + 1 ) ) ; used [ i ] = false ; } } return min ; } private static int procPerm ( int [ ] perm ) { return IntStream . range ( 1 , perm . length ) . map ( i - > Math . abs ( perm [ i ] - perm [ i - 1 ] ) ) . sum ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans * = 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int j = 0 ; a = Math . abs ( a ) ; b = Math . abs ( b ) ; c = Math . abs ( c ) ; d = Math . abs ( d ) ; e = Math . abs ( e ) ; if ( Math . max ( a , b ) - Math . min ( a , b ) > k ) { j + = 1 ; } if ( Math . max ( a , c ) - Math . min ( c , a ) > k ) { j + = 1 ; } if ( Math . max ( a , d ) - Math . min ( d , a ) > k ) { j + = 1 ; } if ( Math . max ( a , e ) - Math . min ( e , a ) > k ) { j + = 1 ; } if ( Math . max ( b , c ) - Math . min ( c , b ) > k ) { j + = 1 ; } if ( Math . max ( b , d ) - Math . min ( d , b ) > k ) { j + = 1 ; } if ( Math . max ( b , e ) - Math . min ( e , b ) > k ) { j + = 1 ; } if ( Math . max ( c , d ) - Math . min ( d , c ) > k ) { j + = 1 ; } if ( Math . max ( d , e ) - Math . min ( d , e ) > k ) { j + = 1 ; } if ( j > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double tmp1 = sc . nextDouble ( ) ; double tmp2 = sc . nextDouble ( ) ; double h = tmp1 / 6 . * Math . PI + tmp2 / 30 . * Math . PI / 12 . ; double m = tmp2 / 30 . * Math . PI + tmp1 / 6 . * Math . PI * 12 . ; double rad = h - m ; double res = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 . * a * b * Math . cos ( rad ) ) ) ; System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a < = k & & c - a < = k & & d - a < = k & & e - a < = k & & c - b < = k & & d - b < = k & & e - b < = k & & d - c < = k & & e - c < = k & & e - d < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABC051 _ B solver = new ABC051 _ B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABC051 _ B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int k = in . nextInt ( ) ; int s = in . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = k ; + + i ) { for ( int j = 0 ; j < = k ; + + j ) { int l = s - ( i + j ) ; if ( l > = 0 & & l < = k ) + + counter ; else continue ; ; } } out . println ( counter ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; int max = - 1 ; int val = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int element = i ; boolean ok = true ; while ( ok ) { if ( element % 2 = = 0 ) { cnt + + ; element = element / 2 ; } else { ok = false ; } } if ( max < cnt ) { max = cnt ; val = i ; } cnt = 0 ; } System . out . println ( val ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] & & c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 0 ] ) { if ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) { if ( c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] & & c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] ) { if ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] grid = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) grid [ i ] [ j ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( grid [ i ] [ j ] + grid [ i + 1 ] [ j + 1 ] ! = grid [ i ] [ j + 1 ] + grid [ i + 1 ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int N = input . nextInt ( ) ; int lo = Integer . MAX _ VALUE ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int x = input . nextInt ( ) ; if ( x < lo ) { cnt + + ; lo = x ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > li = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { li . add ( sc . nextInt ( ) ) ; } Collections . sort ( li ) ; System . out . println ( li . get ( 2 ) - li . get ( 0 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int h = Integer . parseInt ( scan . next ( ) ) ; int m = Integer . parseInt ( scan . next ( ) ) ; double theta _ short = h * 30 + m * 0.5 ; double theta _ long = m * 6 ; double theta = Math . min ( Math . abs ( theta _ long - theta _ short ) , 360 - Math . abs ( theta _ long - theta _ short ) ) ; System . out . print ( Math . pow ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( theta ) ) , 0.5 ) ) ; } } import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int max = Math . max ( a , Math . max ( b , Math . max ( c , Math . max ( d , e ) ) ) ) ; int min = Math . min ( a , Math . min ( b , Math . min ( c , Math . min ( d , e ) ) ) ) ; if ( max - min < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . List ; import java . util . StringTokenizer ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; public class Main { public static void main ( final String [ ] args ) { final FastScanner scanner = new FastScanner ( System . in ) ; final int n = scanner . nextInt ( ) ; final List < Integer > list = IntStream . range ( 0 , n ) . mapToObj ( i - > scanner . nextInt ( ) ) . collect ( Collectors . toList ( ) ) ; long sum = list . get ( 0 ) - 1 ; long min = 2 ; for ( int i = 1 ; i < n ; i + + ) { final int value = list . get ( i ) ; if ( value < min ) { continue ; } else if ( value = = min ) { min + + ; continue ; } sum + = ( value - 1 ) / min ; } System . out . println ( sum ) ; } private static class FastScanner { private final BufferedReader reader ; private StringTokenizer tokenizer ; FastScanner ( final InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( final IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) | | ( a = = 5 & & b = = 5 & & c = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . math . BigInteger ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; for ( int i = 6 ; i > = 0 ; i -- ) { if ( Math . pow ( 2 , i ) < = x ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } } } } import java . io . * ; import java . util . * ; import java . math . * ; public class Main { FastReader sc ; void solve ( ) throws IOException { int n = sc . ni ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . ni ( ) ; } int min = a [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < = min ) ans + + ; min = Math . min ( min , a [ i ] ) ; } System . out . println ( ans ) ; } Main ( ) { try { sc = new FastReader ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static void main ( String [ ] args ) throws IOException { new Main ( ) . solve ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } FastReader ( String s ) { try { br = new BufferedReader ( new FileReader ( s ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } String ns ( ) { if ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } return st . nextToken ( ) ; } int ni ( ) { return Integer . parseInt ( ns ( ) ) ; } long nl ( ) { return Long . parseLong ( ns ( ) ) ; } double nd ( ) { return Double . parseDouble ( ns ( ) ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = 0 ; n = sc . nextInt ( ) ; String ans = " Three " ; char [ ] letters = new char [ n ] ; String [ ] sLetters = new String [ n ] ; String string = sc . nextLine ( ) ; sLetters = string . split ( " " ) ; for ( int l = 0 ; l < letters . length ; l + + ) { if ( sLetters [ l ] . equals ( " Y " ) ) { ans = " Four " ; } } out . println ( ans ) ; out . close ( ) ; } 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 ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int pass _ time = H * 60 + M ; double a = ( ( double ) 360 / 60 / 12 * ( double ) pass _ time ) % 360 ; double b = ( 360 / 60 * pass _ time ) % 360 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Math . abs ( a - b ) ) ) ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a > = 5 & & b > = 5 & & c > = 5 ) { int total = a + b + c ; if ( ( a > = 7 | | b > = 7 | | c > = 7 ) & & total = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { static final Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = s . nextInt ( ) , r = 1 ; while ( r * 2 < = n ) r * = 2 ; System . out . println ( r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; + + i ) { for ( int j = 0 ; j < = K ; + + j ) { if ( S - i - j > = 0 & & S - i - j < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . StringTokenizer ; public class Main { FastScanner in ; PrintWriter out ; class FastScanner { BufferedReader br ; StringTokenizer st ; private FastScanner ( File f ) { try { br = new BufferedReader ( new FileReader ( f ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } private FastScanner ( InputStream f ) { br = new BufferedReader ( new InputStreamReader ( f ) ) ; } 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 ( ) ) ; } } private void solve ( ) { int num , l = 0 , r = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { num = in . nextInt ( ) ; if ( num = = 5 ) { l + = 1 ; } else if ( num = = 7 ) { r + = 1 ; } } if ( l = = 2 & & r = = 1 ) { out . print ( " YES " ) ; } else { out . print ( " NO " ) ; } } private void run ( ) { in = new FastScanner ( System . in ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final String [ ] NUMBERS = { " " , " One " , " Two " , " Three " , " Four " } ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( NUMBERS [ ( int ) IntStream . range ( 0 , n ) . mapToObj ( i - > scanner . next ( ) ) . distinct ( ) . count ( ) ] ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } int [ ] total = new int [ 6 ] ; total [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; total [ 1 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] ; total [ 2 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; total [ 3 ] = c [ 0 ] [ 1 ] + c [ 2 ] [ 0 ] + c [ 1 ] [ 2 ] ; total [ 4 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; total [ 5 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; if ( total [ 0 ] = = total [ 1 ] & & total [ 1 ] = = total [ 2 ] & & total [ 2 ] = = total [ 3 ] & & total [ 3 ] = = total [ 4 ] & & total [ 4 ] = = total [ 5 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int maxNum = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int num = i ; int count = 0 ; while ( true ) { if ( num % 2 = = 0 ) { num = num / 2 ; count + + ; } else { if ( count > max ) { max = count ; maxNum = i ; } break ; } } } System . out . println ( maxNum ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double degree = getDegree ( H , M ) ; double result = cosFormula ( A , B , degree ) ; System . out . println ( result ) ; } public static double getDegree ( int H , int M ) { double degH = 30 * H + 0.5 * M ; double degM = 6 * M ; double degHM = 0 ; if ( degH < = degM ) { degHM = degM - degH ; } else { degHM = degH - degM ; } if ( degHM > 180 ) { degHM = 360 - degHM ; } return degHM ; } public static double cosFormula ( int A , int B , double degree ) { double hen = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; return hen ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int sum = 0 , max = 5 , min = 7 ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = sc . nextInt ( ) ; sum + = num [ i ] ; max = Math . max ( max , num [ i ] ) ; min = Math . min ( min , num [ i ] ) ; } if ( ( sum = = 17 ) & & ( max = = 7 ) & & ( min = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) arr [ i ] [ j ] = in . nextInt ( ) ; for ( int i = 0 ; i < = 100 ; i + + ) { int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; boolean ok = true ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = arr [ j ] [ 0 ] - i ; for ( int j = 0 ; j < 3 ; j + + ) b [ j ] = arr [ 0 ] [ j ] - a [ 0 ] ; for ( int k = 0 ; k < 3 ; k + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( arr [ k ] [ j ] ! = a [ k ] + b [ j ] ) ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) { ans + = 1 ; } if ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) { ans + = 1 ; } if ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) { ans + = 1 ; } if ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ) { ans + = 1 ; } if ( ans = = 4 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int X , Y , Z ; int count = 0 ; for ( X = 0 ; X < = K ; X + + ) { for ( Y = 0 ; Y < = K ; Y + + ) { if ( X + Y < = S & & S - ( X + Y ) < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int [ ] antenna = new int [ 5 ] ; for ( int i = 0 ; i < antenna . length ; + + i ) { antenna [ i ] = in . nextInt ( ) ; } int k = in . nextInt ( ) ; boolean canDirect = true ; for ( int i = 0 ; i < antenna . length & & canDirect ; + + i ) { for ( int j = i + 1 ; j < antenna . length ; + + j ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > k ) { canDirect = false ; break ; } } } if ( canDirect ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String result = " NO " ; int [ ] a = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int count1 = 0 ; int count2 = 0 ; for ( int i : a ) { if ( i = = 5 ) { count1 + + ; } else if ( i = = 7 ) { count2 + + ; } } if ( count1 = = 2 & & count2 = = 1 ) result = " YES " ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int count = 0 ; for ( int i = n ; i > 0 ; i -- ) { int countA = 0 ; int a = two ( i ) ; while ( a ! = - 1 ) { countA + + ; a = two ( a ) ; } if ( countA > count ) { ans = i ; count = countA ; } } System . out . println ( ans ) ; } static int two ( int n ) { if ( n % 2 = = 0 ) { return n / 2 ; } else { return - 1 ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdIn . nextInt ( ) ; } } int s1 = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] ; int s2 = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ; int s3 = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ; int s4 = c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] ; int s5 = c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] ; int s6 = c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] ; int s7 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; int s8 = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ; int s9 = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ; int s10 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; int s11 = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ; int s12 = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ; if ( s1 = = s2 & & s2 = = s3 & & s4 = = s5 & & s5 = = s6 & & s7 = = s8 & & s8 = = s9 & & s10 = = s11 & & s11 = = s12 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " Yes " ; int list [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int num = sc . nextInt ( ) ; list [ i ] [ j ] = num ; } } int tmpListA [ ] = new int [ 3 ] ; int tmpListB [ ] = new int [ 3 ] ; tmpListA [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { tmpListB [ i ] = list [ 0 ] [ i ] - tmpListA [ 0 ] ; tmpListA [ i ] = list [ i ] [ 0 ] - tmpListB [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( list [ i ] [ j ] = = ( tmpListA [ i ] + tmpListB [ j ] ) ) { continue ; } else { ans = " No " ; break ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . Random ; import java . util . Arrays ; import java . util . Comparator ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . HashMap ; import java . time . format . DateTimeFormatter ; import java . time . temporal . ChronoUnit ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] s = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { s [ i ] = sc . nextInt ( ) ; } if ( s [ 0 ] + s [ 4 ] + s [ 8 ] = = s [ 1 ] + s [ 5 ] + s [ 6 ] & & s [ 1 ] + s [ 5 ] + s [ 6 ] = = s [ 2 ] + s [ 3 ] + s [ 7 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 9 ] ; int ans = 0 ; for ( int i = 0 ; i < 9 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int b11 = a [ 0 ] - a [ 1 ] ; int b12 = a [ 3 ] - a [ 4 ] ; int b13 = a [ 6 ] - a [ 7 ] ; int b21 = a [ 1 ] - a [ 2 ] ; int b22 = a [ 4 ] - a [ 5 ] ; int b23 = a [ 7 ] - a [ 8 ] ; int b31 = a [ 2 ] - a [ 0 ] ; int b32 = a [ 5 ] - a [ 3 ] ; int b33 = a [ 8 ] - a [ 6 ] ; if ( b11 = = b12 ) { if ( b12 = = b13 ) { if ( b21 = = b22 ) { if ( b22 = = b23 ) { if ( b31 = = b32 ) { if ( b32 = = b33 ) { ans + + ; } } } } } } if ( ans = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; if ( A = = 5 ) { if ( B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else if ( B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) p [ i ] = scan . nextInt ( ) ; int out = 1 ; int min = Integer . MAX _ VALUE ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , Math . min ( p [ i ] , p [ i - 1 ] ) ) ; if ( min > = p [ i ] ) out + + ; } System . out . println ( out ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] point = new int [ 5 ] ; int k ; String ans = " Yay ! " ; for ( int i = 0 ; i < point . length ; i + + ) { point [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; cmp : for ( int i = 0 ; i < point . length ; i + + ) { for ( int j = i + 1 ; j < point . length ; j + + ) { int p = point [ i ] ; int q = point [ j ] ; if ( ( q - p ) > k ) { ans = " : ( " ; break cmp ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; System . out . println ( search ( N ) ) ; } public static int search ( int N ) { int work _ n ; int ans = 1 ; int count = 0 ; int max _ count = 0 ; for ( int n = 1 ; n < = N ; n + + ) { count = 0 ; work _ n = n ; while ( ( work _ n % 2 = = 0 ) & & ( work _ n > 0 ) ) { work _ n / = 2 ; count + + ; } if ( max _ count < count ) { ans = n ; max _ count = count ; } } return ans ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = 2 ; int c = 2 ; if ( a = = 1 ) { c = 1 ; } while ( b < a ) { b * = 2 ; if ( b < = a ) { c = b ; } } System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] s = new int [ 5 ] ; s [ 0 ] = sc . nextInt ( ) ; s [ 1 ] = sc . nextInt ( ) ; s [ 2 ] = sc . nextInt ( ) ; s [ 3 ] = sc . nextInt ( ) ; s [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flg = true ; for ( int n = 0 ; n < 4 & & flg ; n + + ) { for ( int m = n + 1 ; m < 5 & & flg ; m + + ) { if ( s [ m ] - s [ n ] > k ) flg = false ; } } System . out . println ( flg ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " Three " ; String Y = " Y " ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { String S = sc . next ( ) ; if ( S . equals ( Y ) ) { ans = " Four " ; } } System . out . println ( ans ) ; } } import java . util . * ; public final class Main { private static int solution ( int [ ] array ) { int current = 1 ; int score = 1 ; int minimum = array [ 0 ] ; while ( current < array . length ) { if ( array [ current ] < minimum ) { minimum = array [ current ] ; score + + ; } current + + ; } return score ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } System . out . println ( solution ( array ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; long ans = 0 ; if ( Math . abs ( N - M ) = = 0 ) { long a = 2 ; for ( long i = 1 ; i < = ( long ) N ; i + + ) { a = ( a * i ) % MOD ; } for ( long i = 1 ; i < = ( long ) M ; i + + ) { a = ( a * i ) % MOD ; } ans = a ; } else if ( Math . abs ( N - M ) = = 1 ) { long a = 1 ; for ( long i = 1 ; i < = ( long ) N ; i + + ) { a = ( a * i ) % MOD ; } for ( long i = 1 ; i < = ( long ) M ; i + + ) { a = ( a * i ) % MOD ; } ans = a ; } 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 ( ) ; int ans = 0 ; int m = 1000000 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; m = Math . min ( m , p ) ; if ( p = = m ) ans + + ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Integer . parseInt ; public class Main { static int [ ] nums ; static boolean [ ] used ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; String [ ] words ; words = br . readLine ( ) . split ( " " ) ; nums = new int [ 9 ] ; used = new boolean [ 10 ] ; for ( int i = 0 ; i < words . length ; i + + ) { nums [ i ] = parseInt ( words [ i ] ) ; if ( nums [ i ] ! = - 1 ) used [ nums [ i ] ] = true ; } System . out . println ( solve ( 0 ) ) ; } static int solve ( int idx ) { if ( idx = = nums . length ) { if ( check ( ) ) return 1 ; else return 0 ; } int ret = 0 ; if ( nums [ idx ] = = - 1 ) { for ( int k = 1 ; k < = 9 ; k + + ) { if ( ! used [ k ] ) { nums [ idx ] = k ; used [ k ] = true ; ret + = solve ( idx + 1 ) ; nums [ idx ] = - 1 ; used [ k ] = false ; } } } else { ret = solve ( idx + 1 ) ; } return ret ; } static boolean check ( ) { return nums [ 0 ] + nums [ 1 ] * 10 + nums [ 2 ] + nums [ 3 ] * 100 + nums [ 4 ] * 10 + nums [ 5 ] = = nums [ 6 ] * 100 + nums [ 7 ] * 10 + nums [ 8 ] ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; while ( input . hasNext ( ) ) { String [ ] numberStr = input . nextLine ( ) . split ( " " ) ; int count5 = 0 , count7 = 0 ; for ( int i = 0 ; i < numberStr . length ; + + i ) { if ( Integer . valueOf ( numberStr [ i ] ) = = 5 ) { + + count5 ; } if ( Integer . valueOf ( numberStr [ i ] ) = = 7 ) { + + count7 ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double kakudo = Math . toRadians ( Math . abs ( ( h * 30 + m * 0.5 ) - ( m * 6 ) ) ) ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( kakudo ) ) ; 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 ( ) ; int mini = 1000000 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int a = sc . nextInt ( ) ; if ( a < = mini ) { mini = a ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String agr [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Main implements Runnable { private void solve ( ) throws IOException { int [ ] arr = new int [ ] { nextInt ( ) , nextInt ( ) , nextInt ( ) } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { writer . println ( " YES " ) ; } else writer . println ( " NO " ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter writer ; public void run ( ) { try { reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; tokenizer = null ; writer = new PrintWriter ( System . out ) ; solve ( ) ; reader . close ( ) ; writer . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; } String nextToken ( ) throws IOException { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputs = input . readLine ( ) . split ( " " ) ; int K = Integer . parseInt ( inputs [ 0 ] ) ; int S = Integer . parseInt ( inputs [ 1 ] ) ; int [ ] xPlusY = new int [ 2 * K + 1 ] ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { xPlusY [ x + y ] + = 1 ; } } int count = 0 ; for ( int z = 0 ; z < = K ; z + + ) { int sMinusZ = S - z ; if ( sMinusZ < = 2 * K & & sMinusZ > = 0 ) { count + = xPlusY [ sMinusZ ] ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; Arrays . sort ( str ) ; System . out . println ( str [ 0 ] . equals ( " 5 " ) & & str [ 1 ] . equals ( " 5 " ) & & str [ 2 ] . equals ( " 7 " ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int A , B , C ; A = input . nextInt ( ) ; B = input . nextInt ( ) ; C = input . nextInt ( ) ; if ( A = = 5 & B = = 5 & C = = 7 ) System . out . println ( " YES " ) ; else if ( A = = 7 & B = = 5 & C = = 5 ) System . out . println ( " YES " ) ; else if ( A = = 5 & B = = 7 & C = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = K ; i + + ) { if ( i > S ) { break ; } for ( int j = i ; j < = K ; j + + ) { if ( i + j > S ) { break ; } for ( int l = j ; l < = K ; l + + ) { if ( i + j + l = = S ) { if ( i < j & & j < l ) { answer = answer + 6 ; } else if ( ( i = = j & & j < l ) | | ( i < j & & j = = l ) ) { answer = answer + 3 ; } else { answer + + ; } break ; } } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . equals ( " 5 5 7 " ) | | s . equals ( " 5 7 5 " ) | | s . equals ( " 7 5 5 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . OutputStream ; import java . util . StringTokenizer ; import java . io . Writer ; 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 ) ; OutputWriter out = new OutputWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , InputReader in , OutputWriter out ) { int n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = in . next ( ) ; if ( s . charAt ( 0 ) = = ' Y ' ) { out . println ( " Four " ) ; return ; } } out . println ( " Three " ) ; } } static class OutputWriter extends PrintWriter { public OutputWriter ( OutputStream out ) { super ( out ) ; } public OutputWriter ( Writer out ) { super ( out ) ; } public void close ( ) { super . close ( ) ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int l ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { l = s - i - j ; if ( ! ( l < 0 | | k < l ) & & i + j + l = = s ) { count + + ; } } } System . out . println ( count ) ; } } 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 ) ; AFiveAntennas solver = new AFiveAntennas ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AFiveAntennas { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int min = Integer . MAX _ VALUE ; int max = Integer . MIN _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int x = in . nextInt ( ) ; min = Math . min ( min , x ) ; max = Math . max ( max , x ) ; } int k = in . nextInt ( ) ; String answer = ( max - min ) > k ? " : ( " : " Yay ! " ; out . println ( answer ) ; } } 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int x = Math . abs ( a [ 1 ] - a [ 0 ] ) ; int y = Math . abs ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( x + y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; if ( Math . abs ( M - N ) > = 2 ) { System . out . println ( 0 ) ; return ; } long MOD = 1000 _ 000 _ 007 ; long ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { ans = ( ans * i ) % MOD ; } for ( int i = 1 ; i < = M ; i + + ) { ans = ( ans * i ) % MOD ; } if ( N = = M ) { ans = ( 2 * ans ) % MOD ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] org = new int [ ] { 1 , 4 , 7 , 9 } ; int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( arr [ i ] ! = org [ i ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long count = 1 ; long l = 0 , x = 0 ; long [ ] array = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } x = array [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( array [ i ] < = x ) { count + + ; x = array [ i ] ; } } if ( count = = 0 ) { System . out . println ( 1 ) ; } else { System . out . println ( count ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( a = = 5 | | a = = 7 | | b = = 5 | | b = = 7 | | c = = 5 | | c = = 7 ) if ( a + b + c = = 17 ) System . out . printf ( " YES " ) ; else System . out . printf ( " NO " ) ; else System . out . printf ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int cnt = 1 ; for ( int i = 1 ; i < n ; i + + ) { int temp = Integer . parseInt ( sc . next ( ) ) ; if ( a > = temp ) { a = temp ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = stdIn . next ( ) ; } Arrays . sort ( s ) ; int cnt = 1 ; for ( int i = 0 ; i < n - 1 ; i + + ) { if ( ! s [ i ] . equals ( s [ i + 1 ] ) ) { cnt + + ; } } if ( cnt = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int value = input . nextInt ( ) ; if ( value = = 5 ) a + + ; else if ( value = = 7 ) b + + ; } if ( a = = 2 & & b = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . parallelSort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; solve ( s ) ; s . close ( ) ; } public static void solve ( Scanner s ) { int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; if ( a = = 5 ) { count5 + + ; } else if ( a = = 7 ) { count7 + + ; } if ( b = = 5 ) { count5 + + ; } else if ( b = = 7 ) { count7 + + ; } if ( c = = 5 ) { count5 + + ; } else if ( c = = 7 ) { count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { ans + = sc . nextInt ( ) ; } System . out . println ( ans = = 17 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = scan . nextInt ( ) ; } } int min = C [ 0 ] [ 0 ] ; for ( int i = 0 ; i < 2 ; i + + ) { if ( C [ 0 ] [ i ] < min ) min = C [ 0 ] [ i ] ; } int check ; for ( int a1 = 0 ; a1 < = min ; a1 + + ) { int c11 = C [ 0 ] [ 0 ] - a1 ; int a2 = C [ 1 ] [ 0 ] - c11 ; int a3 = C [ 2 ] [ 0 ] - c11 ; boolean flag = true ; for ( int i = 1 ; i < 3 ; i + + ) { check = C [ 0 ] [ i ] - a1 ; if ( C [ 1 ] [ i ] - a2 ! = check | | C [ 2 ] [ i ] - a3 ! = check ) { flag = false ; break ; } } if ( flag = = true ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; if ( A [ 0 ] = = A [ 1 ] & & A [ 1 ] = = 5 & & A [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { static int words [ ] = new int [ 3 ] ; private static int COUNT _ 5 , COUNT _ 7 ; public static void main ( String [ ] args ) { setData ( ) ; calc ( ) ; System . out . println ( COUNT _ 5 = = 2 & & COUNT _ 7 = = 1 ? " YES " : " NO " ) ; } private static void setData ( ) { Scanner sc = new Scanner ( System . in ) ; words [ 0 ] = sc . nextInt ( ) ; words [ 1 ] = sc . nextInt ( ) ; words [ 2 ] = sc . nextInt ( ) ; } private static void calc ( ) { for ( int word : words ) { if ( word = = 5 ) { COUNT _ 5 + + ; } else if ( word = = 7 ) { COUNT _ 7 + + ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Ne - Na < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double minAngle = ( double ) M * 6 ; double onlyHour = ( double ) H * 30 ; double hourAngle = onlyHour + ( double ) M * 0.5 ; double angle = Math . abs ( minAngle - hourAngle ) ; if ( angle > 180 ) angle = 360 - angle ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( ans ) ; } } import java . io . BufferedInputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { int [ ] antena = new int [ 5 ] ; int k = 0 ; try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { antena [ 0 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 1 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 2 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 3 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 4 ] = Integer . parseInt ( br . readLine ( ) ) ; k = Integer . parseInt ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } boolean result = true ; parent : for ( int i = 0 ; i < antena . length - 1 ; i + + ) { for ( int j = i + 1 ; j < = antena . length - 1 ; j + + ) { if ( k < antena [ j ] - antena [ i ] ) { result = false ; break parent ; } } } if ( result ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( e - a > k ) { flag = true ; } if ( flag ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; System . out . println ( arr [ 4 ] - arr [ 0 ] > k ? " : ( " : " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int array [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( array [ 4 ] - array [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 , ans = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int cnt = 0 ; int ii = i ; while ( ii % 2 = = 0 ) { ii / = 2 ; cnt + + ; if ( cnt > count ) { count = cnt ; ans = i ; } } } if ( N = = 1 ) System . out . println ( 1 ) ; else System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int max = a ; if ( max < b ) max = b ; if ( max < c ) max = c ; int min = a ; if ( min > b ) min = b ; if ( min > c ) min = c ; System . out . println ( max - min ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Set ; import java . util . HashSet ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; Set s = new HashSet < String > ( ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < n ; i + + ) { s . add ( str [ i ] ) ; } System . out . println ( s . size ( ) = = 4 ? " Four " : " Three " ) ; } } import java . util . Arrays ; import java . util . LinkedList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; int d [ ] = new int [ n ] ; int count = 0 ; long wa = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; d [ i ] = a [ i ] - b [ i ] ; if ( d [ i ] < 0 ) { wa + = d [ i ] ; count + + ; } } Arrays . sort ( d ) ; int ans = 0 ; for ( int i = n - 1 ; i > = 0 ; i -- ) { if ( wa > = 0 ) { break ; } wa + = d [ i ] ; ans + + ; } if ( wa < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( ans + count ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double angle = 0 ; double h = ( H * 30 ) + ( M * 0.5 ) ; double s = M * 6 ; if ( h > s ) { angle = h - s ; } else if ( h < s ) { angle = s - h ; } double side = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( side ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; Long [ ] a = new Long [ n ] ; Long [ ] b = new Long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Long . parseLong ( sc . next ( ) ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Long . parseLong ( sc . next ( ) ) ; } sc . close ( ) ; long sumA = Arrays . stream ( a ) . mapToLong ( i - > i ) . sum ( ) ; long sumB = Arrays . stream ( b ) . mapToLong ( i - > i ) . sum ( ) ; int result = 0 ; if ( sumA < sumB ) { result = - 1 ; } else { PriorityQueue < Long > overNumberQueue = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; PriorityQueue < Long > lackNumberQueue = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i + + ) { long diff = a [ i ] - b [ i ] ; if ( 0 < diff ) { overNumberQueue . add ( diff ) ; } else if ( diff < 0 ) { lackNumberQueue . add ( diff * - 1 ) ; } } long over = 0 ; while ( ! lackNumberQueue . isEmpty ( ) ) { long lack = lackNumberQueue . poll ( ) ; over - = lack ; result + + ; while ( over < 0 ) { over + = overNumberQueue . poll ( ) ; result + + ; } } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String ans = " Yay ! " ; if ( ( e - a ) > k ) ans = " : ( " ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; int cnt = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int tmp = i ; int tmpCnt = 0 ; while ( true ) { if ( tmp % 2 = = 0 ) { tmp = tmp / 2 ; tmpCnt + + ; } else { break ; } } if ( Math . max ( cnt , tmpCnt ) = = tmpCnt ) { ans = i ; cnt = tmpCnt ; } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; n [ 0 ] = sc . nextInt ( ) ; n [ 1 ] = sc . nextInt ( ) ; n [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( n ) ; if ( n [ 0 ] = = 5 & & n [ 1 ] = = 5 & & n [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( solve ( N ) ) ; sc . close ( ) ; } static int solve ( int N ) { return Integer . highestOneBit ( N ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double radius = ( h / 12 + m / ( 60 * 12 ) - m / 60 ) * Math . PI * 2.0 ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( radius ) ) ; 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 ( ) ; int m = sc . nextInt ( ) ; long mod = 1 _ 000 _ 000 _ 007L ; long x [ ] = new long [ n ] ; long y [ ] = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < m ; i + + ) { y [ i ] = sc . nextInt ( ) ; } long X = 0 ; for ( int i = 0 ; i < n - 1 ; i + + ) { X = add ( X , mult ( mult ( i + 1 , n - i - 1 , mod ) , x [ i + 1 ] - x [ i ] , mod ) , mod ) ; } long ans = 0 ; for ( int i = 0 ; i < m - 1 ; i + + ) { ans = add ( ans , mult ( mult ( mult ( i + 1 , m - i - 1 , mod ) , y [ i + 1 ] - y [ i ] , mod ) , X , mod ) , mod ) ; } System . out . println ( ans ) ; } static long add ( long x , long y , long mod ) { return ( x + y ) % mod ; } static long mult ( long x , long y , long mod ) { return ( x * y ) % mod ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws Exception { int antenna [ ] = new int [ 5 ] ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i < antenna . length ; i + + ) { antenna [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } int k = Integer . parseInt ( br . readLine ( ) ) ; if ( antenna [ 4 ] - antenna [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < k + 1 ; x + + ) { for ( int y = 0 ; y < k + 1 ; y + + ) { if ( s - x - y < k + 1 & & s - x - y > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int fiveNum = ( a = = 5 ? 1 : 0 ) + ( b = = 5 ? 1 : 0 ) + ( c = = 5 ? 1 : 0 ) ; int sevenNum = ( a = = 7 ? 1 : 0 ) + ( b = = 7 ? 1 : 0 ) + ( c = = 7 ? 1 : 0 ) ; System . out . println ( ( fiveNum = = 2 & & sevenNum = = 1 ) ? " YES " : " NO " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import static java . lang . Integer . parseInt ; import static java . lang . Long . parseLong ; import static java . lang . System . exit ; class Main { static void solve ( ) throws Exception { int fc = 0 , sc = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int f = scanInt ( ) ; if ( f = = 5 ) fc + + ; else if ( f = = 7 ) sc + + ; } out . println ( fc = = 2 & & sc = = 1 ? " YES " : " NO " ) ; } static int scanInt ( ) throws IOException { return parseInt ( scanString ( ) ) ; } static long scanLong ( ) throws IOException { return parseLong ( scanString ( ) ) ; } static String scanString ( ) throws IOException { while ( tok = = null | | ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) ) ; } return tok . nextToken ( ) ; } static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; public static void main ( String [ ] args ) { try { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; in . close ( ) ; out . close ( ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; exit ( 1 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int squ = 1 ; while ( n / 2 > = squ ) { squ * = 2 ; } System . out . println ( squ ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static final MyScanner in = new MyScanner ( ) ; public static void main ( String [ ] args ) { double A = in . nextInt ( ) ; double B = in . nextInt ( ) ; double H = in . nextInt ( ) ; double M = in . nextInt ( ) ; double mS = 360.0 / 60 * M ; double hS = ( 360.0 / 12 * H ) + ( 360.0 / 12 / 60 * M ) ; hS = s ( hS ) ; mS = s ( mS ) ; hS = Math . toRadians ( hS ) ; mS = Math . toRadians ( mS ) ; double answer = Math . sqrt ( Math . pow ( B * Math . cos ( mS ) - A * Math . cos ( hS ) , 2 ) + Math . pow ( B * Math . sin ( mS ) - A * Math . sin ( hS ) , 2 ) ) ; System . out . println ( answer ) ; } public static double s ( double d ) { if ( d < = 90 ) { return 90 - d ; } else { return 90 + 360 - d ; } } public static class MyScanner { Scanner sc = new Scanner ( System . in ) ; String next ( ) { return sc . next ( ) ; } int nextInt ( ) { return Integer . valueOf ( sc . next ( ) ) ; } long nextLong ( ) { return Long . valueOf ( sc . next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k & & x < = s ; x + + ) { for ( int y = 0 ; y < = k & & x + y < = s ; y + + ) { if ( s - x - y < = k ) cnt + + ; } } System . out . println ( cnt ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] = = 5 ) { count + + ; } } if ( count = = 1 | | count = = 3 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double dig1 = ( ( h + m / 60 ) / 12.0 ) * 2 * Math . PI ; double dig2 = m / 60.0 * 2 * Math . PI ; double cos = Math . cos ( Math . abs ( dig1 - dig2 ) ) ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * cos ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = in . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { out . println ( " Four " ) ; return ; } } out . println ( " Three " ) ; } } } public class Main { public static void main ( String [ ] args ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int sum = 1 ; p [ 0 ] = sc . nextInt ( ) ; int min = p [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; if ( p [ i ] < min ) { min = p [ i ] ; sum + + ; } } System . out . println ( sum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int cont1 = 0 , cont2 = 0 ; int n1 = scn . nextInt ( ) ; if ( n1 = = 5 ) cont1 + + ; else if ( n1 = = 7 ) cont2 + + ; n1 = scn . nextInt ( ) ; if ( n1 = = 5 ) cont1 + + ; else if ( n1 = = 7 ) cont2 + + ; n1 = scn . nextInt ( ) ; if ( n1 = = 5 ) cont1 + + ; else if ( n1 = = 7 ) cont2 + + ; if ( cont1 = = 2 & cont2 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; scn . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( sc . next ( ) ) ; } List < String > list2 = new ArrayList < String > ( new HashSet < > ( list ) ) ; if ( list2 . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > set1 = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set1 . add ( sc . next ( ) ) ; } int ans = set1 . size ( ) ; if ( ans = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean flg = true ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) { flg = false ; break ; } } if ( ! flg ) break ; } if ( flg ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = 0 ; ArrayList < Integer > List = new ArrayList < > ( ) ; for ( int a = 0 ; a < 4 ; a + + ) List . add ( sc . nextInt ( ) ) ; if ( List . contains ( 1 ) = = true ) num + + ; if ( List . contains ( 9 ) = = true ) num + + ; if ( List . contains ( 7 ) = = true ) num + + ; if ( List . contains ( 4 ) = = true ) num + + ; if ( num = = 4 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int P [ ] = new int [ N ] ; int min = 0 ; int answer = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } min = P [ 0 ] ; answer = answer + 1 ; for ( int i = 1 ; i < N ; i + + ) { if ( P [ i ] < min ) { answer = answer + 1 ; min = P [ i ] ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] e = new int [ 10 ] ; e [ 1 ] = 0 ; e [ 9 ] = 0 ; e [ 4 ] = 0 ; e [ 7 ] = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 1 | | a = = 9 | | a = = 7 | | a = = 4 ) { e [ a ] + + ; } } if ( e [ 1 ] > = 1 & & e [ 9 ] > = 1 & & e [ 7 ] > = 1 & & e [ 4 ] > = 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } 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 . 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 ) { long n = in . nextLong ( ) ; long m = in . nextLong ( ) ; if ( Math . abs ( n - m ) > = 2 ) { out . println ( 0 ) ; return ; } long ans = 1 ; long MOD = 1 _ 000 _ 000 _ 007 ; for ( int i = 1 ; i < = n ; i + + ) { ans = ( ans * i ) % MOD ; } for ( int i = 1 ; i < = m ; i + + ) { ans = ( ans * i ) % MOD ; } if ( n = = m ) ans = ( ans * 2 ) % MOD ; out . println ( ans ) ; } } 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 long nextLong ( ) { return Long . parseLong ( nextString ( ) ) ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double a = input . nextDouble ( ) ; double b = input . nextDouble ( ) ; double h = input . nextDouble ( ) ; double m = input . nextDouble ( ) ; double radian = Math . PI * 2 * ( h / 12.0 + ( m / 60.0 ) / 12.0 - m / 60.0 ) ; double rsq = ( a * a + b * b ) - ( 2 * a * b ) * Math . cos ( radian ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int i = 1 ; while ( i < = n ) { ans = i ; i * = 2 ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int i = 1 ; i < = 3 ; i + + ) { for ( int j = 1 ; j < = 3 ; j + + ) c [ i ] [ j ] = sc . nextInt ( ) ; } if ( ( ( c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) ) & & ( ( c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) = = ( c [ 3 ] [ 2 ] - c [ 3 ] [ 1 ] ) ) & & ( ( c [ 1 ] [ 3 ] - c [ 1 ] [ 2 ] ) = = ( c [ 2 ] [ 3 ] - c [ 2 ] [ 2 ] ) ) & & ( ( c [ 1 ] [ 3 ] - c [ 1 ] [ 2 ] ) = = ( c [ 3 ] [ 3 ] - c [ 3 ] [ 2 ] ) ) & & ( ( c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) ) & & ( ( c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 3 ] - c [ 1 ] [ 3 ] ) ) & & ( ( c [ 3 ] [ 1 ] - c [ 2 ] [ 1 ] ) = = ( c [ 3 ] [ 2 ] - c [ 2 ] [ 2 ] ) ) & & ( ( c [ 3 ] [ 1 ] - c [ 2 ] [ 1 ] ) = = ( c [ 3 ] [ 3 ] - c [ 2 ] [ 3 ] ) ) ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; return ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; aLoop : for ( int a = 0 ; a < = k ; a + + ) { bLoop : for ( int b = 0 ; b < = k ; b + + ) { int abSum = a + b ; if ( abSum > s ) { continue aLoop ; } else if ( s - abSum < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; int F = sc . nextInt ( ) ; int G = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int I = sc . nextInt ( ) ; int sum = A + E + I ; Main main = new Main ( ) ; if ( main . checkSum ( sum , A , H , F ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , D , B , I ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , D , H , C ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , G , E , C ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , G , B , F ) = = false ) { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } public boolean checkSum ( int sum , int A , int B , int C ) { if ( A + B + C = = sum ) return true ; return false ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( S - X - Y > = 0 & & S - X - Y < = K ) { count + + ; } } } System . out . print ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) a [ i ] = scan . nextInt ( ) ; scan . close ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 5 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] n = IntStream . range ( 0 , 5 ) . map ( i - > scanner . nextInt ( ) ) . sorted ( ) . toArray ( ) ; int k = scanner . nextInt ( ) ; System . out . println ( ( n [ N - 1 ] - n [ 0 ] > k ) ? " : ( " : " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k & & e - a > 0 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; import java . util . * ; public class Main { private static boolean debug = false ; private static boolean elapsed = false ; private static PrintWriter _ out = new PrintWriter ( System . out ) ; private static PrintWriter _ err = new PrintWriter ( System . err ) ; private void solve ( Scanner sc ) { int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { + + cnt ; } } } _ out . println ( cnt ) ; } private long C ( long n , long r ) { long res = 1 ; for ( long i = n ; i > n - r ; -- i ) { res * = i ; } for ( long i = r ; i > 1 ; -- i ) { res / = i ; } return res ; } private long P ( long n , long r ) { long res = 1 ; for ( long i = n ; i > n - r ; -- i ) { res * = i ; } return res ; } public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _ out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _ err . println ( ( G - S ) + " ms " ) ; } _ err . flush ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { private static final int MOD = 1000000007 ; public static long sum ( long [ ] x , int n ) { long s = 0 ; for ( int i = 0 ; i < n ; i + + ) { s + = i * x [ i ] % MOD ; s - = ( n - 1 - i ) * x [ i ] % MOD ; s = ( s + MOD ) % MOD ; } return s ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextLong ( ) ; } for ( int j = 0 ; j < m ; j + + ) { y [ j ] = sc . nextLong ( ) ; } Arrays . sort ( x ) ; Arrays . sort ( y ) ; System . out . println ( sum ( x , n ) * sum ( y , m ) % MOD ) ; } } import java . util . * ; final class Solver { static final Solver INSTANCE = new Solver ( ) ; void solve ( Iterator < String > sc ) { int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int sum = 0 ; for ( int x = 0 ; x < = K & & x < = S ; x + + ) { int remaining = S - x ; sum + = Math . max ( Math . min ( remaining , K ) - Math . max ( remaining - K , 0 ) + 1 , 0 ) ; } System . out . println ( sum ) ; } } class Main { public static void main ( String ... args ) { Solver . INSTANCE . solve ( new Scanner ( System . in ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { private static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = Integer . parseInt ( scan . next ( ) ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ? " YES " : " NO " ) ; scan . close ( ) ; } } import java . io . IOException ; import java . util . NoSuchElementException ; import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; int N = Integer . parseInt ( s ) ; int mx = 0 ; int x = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int t = i ; int c = 0 ; while ( 0 < t ) { if ( ( t & 1 ) = = 1 ) break ; t = t > > 1 ; c + + ; } if ( mx < = c ) { mx = c ; x = i ; } } System . out . println ( x ) ; } } } import java . util . * ; import static java . lang . Integer . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { int i ; Scanner sc = new Scanner ( in ) ; int [ ] a = new int [ 3 ] ; for ( i = 0 ; i < a . length ; i + + ) { a [ i ] = parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( a ) ; out . println ( ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = Integer . parseInt ( scanner . next ( ) ) ; int s = Integer . parseInt ( scanner . next ( ) ) ; int res = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( 0 < = z & & z < = k ) res + + ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void debug ( String str ) { System . out . println ( str ) ; } public static void main ( String [ ] args ) { int A ; int B ; int C ; try ( Scanner sc = new Scanner ( System . in ) ) { A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; } if ( A ! = 5 & & A ! = 7 ) { System . out . println ( " NO " ) ; return ; } if ( B ! = 5 & & B ! = 7 ) { System . out . println ( " NO " ) ; return ; } if ( C ! = 5 & & C ! = 7 ) { System . out . println ( " NO " ) ; return ; } if ( A + B + C ! = 17 ) { System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int day = sc . nextInt ( ) , n = sc . nextInt ( ) ; int [ ] high = new int [ day ] ; for ( int i = 0 ; i < day ; i + + ) { high [ i ] = sc . nextInt ( ) ; } int [ ] ht = new int [ n ] ; int [ ] lt = new int [ n ] ; int [ ] loud = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { lt [ i ] = sc . nextInt ( ) ; ht [ i ] = sc . nextInt ( ) ; loud [ i ] = sc . nextInt ( ) ; } int [ ] [ ] dp = new int [ day ] [ n ] ; for ( int i = 0 ; i < day ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { dp [ i ] [ j ] = 0 ; } } int ans = 0 ; for ( int i = 1 ; i < day ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( lt [ j ] < = high [ i ] & & high [ i ] < = ht [ j ] ) ; else continue ; for ( int k = 0 ; k < n ; k + + ) { if ( lt [ k ] < = high [ i - 1 ] & & high [ i - 1 ] < = ht [ k ] ) ; else continue ; dp [ i ] [ j ] = Math . max ( dp [ i ] [ j ] , Math . abs ( loud [ j ] - loud [ k ] ) + dp [ i - 1 ] [ k ] ) ; ans = Math . max ( ans , dp [ i ] [ j ] ) ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double hx = A * Math . sin ( Math . toRadians ( H * 30 + M * 0.5 ) ) ; double hy = A * Math . cos ( Math . toRadians ( H * 30 + M * 0.5 ) ) ; double mx = B * Math . sin ( Math . toRadians ( M * 6 ) ) ; double my = B * Math . cos ( Math . toRadians ( M * 6 ) ) ; double dist = Math . sqrt ( ( hx - mx ) * ( hx - mx ) + ( hy - my ) * ( hy - my ) ) ; System . out . println ( dist ) ; } } import java . io . File ; import java . io . IOException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long Count = 0l ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int ch = sc . nextInt ( ) ; if ( ch < = min ) { Count + + ; min = ch ; } } System . out . println ( Count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; System . out . println ( e - a < = k ? " Yay ! " : " : ( " ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int five _ count = 0 ; int seven _ count = 0 ; int a = - 1 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { a = sc . nextInt ( ) ; if ( a = = 5 ) { five _ count + + ; } else if ( a = = 7 ) { seven _ count + + ; } else { System . out . println ( " NO " ) ; break ; } } if ( five _ count = = 2 & & seven _ count = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] [ ] b = new int [ 3 ] [ 3 ] ; for ( int x = 0 ; x < 3 ; x + + ) { String [ ] foo = br . readLine ( ) . split ( " " ) ; for ( int y = 0 ; y < 3 ; y + + ) { b [ x ] [ y ] = Integer . parseInt ( foo [ y ] ) ; } } int a2 = 0 ; int a3 = 0 ; int b1 = 0 ; int b2 = 0 ; int b3 = 0 ; for ( int a1 = 0 ; a1 < 100 ; a1 + + ) { b1 = b [ 0 ] [ 0 ] - a1 ; b2 = b [ 0 ] [ 1 ] - a1 ; b3 = b [ 0 ] [ 2 ] - a1 ; int [ ] bls = { b1 , b2 , b3 } ; for ( int x = 0 ; x < 3 ; x + + ) { if ( x = = 0 ) { a2 = b [ 1 ] [ x ] - bls [ x ] ; a3 = b [ 2 ] [ x ] - bls [ x ] ; } else { if ( a2 ! = b [ 1 ] [ x ] - bls [ x ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } if ( a3 ! = b [ 2 ] [ x ] - bls [ x ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } a2 = b [ 1 ] [ x ] - bls [ x ] ; a3 = b [ 2 ] [ x ] - bls [ x ] ; } } } System . out . println ( " Yes " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( ; n > 0 ; n -- ) { int x = sc . nextInt ( ) ; if ( x < min ) { ans + + ; min = x ; } } System . out . println ( ans ) ; } static class FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public String nextLine ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \ n " ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , m = Integer . parseInt ( st . nextToken ( ) ) ; if ( Math . abs ( n - m ) > 1 ) { System . out . println ( 0 ) ; return ; } long a = 1 , b = 1 ; int mod = 1000000007 ; for ( int i = 2 ; i < = n ; i + + ) { a * = i ; a = a % mod ; } for ( int i = 2 ; i < = m ; i + + ) { b * = i ; b = b % mod ; } if ( Math . abs ( n - m ) = = 1 ) { System . out . println ( ( a * b ) % mod ) ; return ; } System . out . println ( 2 * ( ( a * b ) % mod ) % mod ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int b1 = a [ 0 ] ; int b2 = a [ 1 ] ; int b3 = a [ 2 ] ; int a1 = 0 ; int a2 = a [ 3 ] - b1 ; int a3 = a [ 6 ] - b1 ; int check = 0 ; if ( a [ 4 ] ! = a2 + b2 | | a [ 5 ] ! = a2 + b3 | | a [ 7 ] ! = a3 + b2 | | a [ 8 ] ! = a3 + b3 ) { check + + ; } if ( check = = 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] array = new int [ ] { s . nextInt ( ) , s . nextInt ( ) , s . nextInt ( ) } ; Arrays . sort ( array ) ; System . out . println ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } 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 ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int A = in . Int ( ) ; int B = in . Int ( ) ; int H = in . Int ( ) ; int M = in . Int ( ) ; double hp = H * 30 + M * 0.5 ; double mp = M * 6 ; double rad = Math . toRadians ( hp - mp ) ; double ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2L * A * B * Math . cos ( rad ) ) ; out . println ( ans ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl = = null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int [ ] ns = new int [ 4 ] ; for ( int i = 0 ; i < ns . length ; i + + ) { int n = std . nextInt ( ) ; ns [ i ] = n ; } Arrays . sort ( ns ) ; boolean requiredCondition = ns [ 0 ] = = 1 & & ns [ 1 ] = = 4 & & ns [ 2 ] = = 7 & & ns [ 3 ] = = 9 ; if ( requiredCondition ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } Arrays . sort ( nums ) ; if ( nums [ 0 ] = = 5 & & nums [ 1 ] = = 5 & & nums [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; if ( s . contains ( " 1 " ) & & s . contains ( " 9 " ) & & s . contains ( " 4 " ) & & s . contains ( " 7 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int PjMin = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int Pi = sc . nextInt ( ) ; if ( Pi < = PjMin ) { count + + ; } if ( PjMin > = Pi ) { PjMin = Pi ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] haiku = { a , b , c } ; int temp = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( haiku [ i ] < haiku [ j ] ) { temp = haiku [ i ] ; haiku [ i ] = haiku [ j ] ; haiku [ j ] = temp ; } } } if ( haiku [ 0 ] = = 5 & & haiku [ 1 ] = = 5 & & haiku [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long N = input . nextLong ( ) ; boolean found = false ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long Num = N * h * w ; long Den = 4 * h * w - N * w - N * h ; if ( Den > 0 & & Num % Den = = 0 ) { long ans = Num / Den ; System . out . println ( h + " " + ans + " " + w ) ; found = true ; break ; } } if ( found ) break ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Integer . parseInt ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; String [ ] words ; line = br . readLine ( ) ; int H , R ; H = parseInt ( line . substring ( 0 , line . indexOf ( ' ' ) ) ) ; R = parseInt ( line . substring ( line . indexOf ( ' ' ) + 1 ) ) ; if ( H > - R ) { System . out . println ( 1 ) ; } else if ( H = = - R ) { System . out . println ( 0 ) ; } else { System . out . println ( - 1 ) ; } } } import java . io . * ; import java . util . * ; public class Main { private static FastReader in = new FastReader ( System . in ) ; private static PrintWriter out = new PrintWriter ( System . out ) ; private static final long MOD = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) { solve ( ) ; out . flush ( ) ; } private static void solve ( ) { int n = in . nextInt ( ) ; int [ ] p = in . nextIntArray ( n ) ; int ans = 0 ; int min = p [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( min , p [ i ] ) ; if ( p [ i ] < = min ) { ans + + ; } } out . println ( ans ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; FastReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num1 = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( num1 [ i ] = = 5 ) { count + + ; } else if ( num1 [ i ] = = 7 ) { count + = 2 ; } else { System . out . println ( " NO " ) ; return ; } } System . out . println ( count = = 4 ? " YES " : " NO " ) ; } } import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ; import java . io . OutputStream ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . math . BigDecimal ; 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 N = in . nextInt ( ) ; int a [ ] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; int res = 0 ; for ( int i = 0 ; i < 7 ; i + + ) { if ( N > = a [ i ] ) { res = a [ i ] ; } } out . println ( res ) ; } } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int Z = S - x - y ; if ( Z > = 0 & & Z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long n = 0 , h = 0 , w = 0 ; for ( int i = 1 ; i < 3501 ; i + + ) { for ( int j = 1 ; j < 3501 ; j + + ) { long a = N * i * j ; long b = 4 * i * j - N * i - N * j ; if ( 0 < b & & b < a & & a % b = = 0 ) { h = i ; w = j ; n = a / b ; break ; } } } System . out . println ( n + " " + h + " " + w ) ; sc . close ( ) ; } } import java . util . * ; import java . util . stream . Collectors ; public class Main implements Runnable { private static int MOD = 1 _ 000 _ 000 _ 007 ; public static void main ( String [ ] args ) { Thread thread = new Thread ( null , new Main ( ) , " " , 16 * 1024 * 1024 ) ; thread . start ( ) ; } @ Override public void run ( ) { final Scanner scanner = new Scanner ( System . in ) ; solve ( scanner ) ; } static void solve ( Scanner scanner ) { int a = Integer . parseInt ( scanner . nextLine ( ) ) ; scanner . nextLine ( ) ; scanner . nextLine ( ) ; scanner . nextLine ( ) ; int e = Integer . parseInt ( scanner . nextLine ( ) ) ; int k = Integer . parseInt ( scanner . nextLine ( ) ) ; System . out . println ( e - a < = k ? " Yay ! " : " : ( " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static long [ ] A = new long [ N ] ; static long [ ] B = new long [ N ] ; static long [ ] D = new long [ N ] ; static { Arrays . setAll ( A , i - > sc . nextLong ( ) ) ; Arrays . setAll ( B , i - > sc . nextLong ( ) ) ; Arrays . setAll ( D , i - > A [ i ] - B [ i ] ) ; } public static void main ( String [ ] args ) { long [ ] remains = Arrays . stream ( D ) . filter ( i - > i > 0 ) . sorted ( ) . toArray ( ) ; long [ ] shortages = Arrays . stream ( D ) . filter ( i - > i < 0 ) . toArray ( ) ; long shortage = Arrays . stream ( shortages ) . sum ( ) ; int ans = shortages . length ; for ( int j = remains . length - 1 ; j > - 1 ; j -- ) { if ( shortage > = 0 ) { break ; } shortage + = remains [ j ] ; ans + + ; } if ( shortage < 0 ) { ans = - 1 ; } System . out . println ( ans ) ; } } import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . Map . Entry ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n = = 1 ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } Map < Integer , Integer > an = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i < = n ; i + + ) { int j = i ; int c = 0 ; while ( j % 2 = = 0 ) { c + = 1 ; j / = 2 ; } an . put ( i , c ) ; } int ans = 0 ; int max = 0 ; for ( Entry < Integer , Integer > e : an . entrySet ( ) ) { if ( e . getValue ( ) > max ) { max = e . getValue ( ) ; ans = e . getKey ( ) ; } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] a = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; array [ 0 ] = sc . nextInt ( ) ; array [ 1 ] = sc . nextInt ( ) ; array [ 2 ] = sc . nextInt ( ) ; array [ 3 ] = sc . nextInt ( ) ; array [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( array [ i ] - array [ j ] ) > k ) { count = 1 ; break ; } } if ( count = = 1 ) break ; } if ( count = = 1 ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int a , b , c ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { var scaner = new Scanner ( System . in ) ; var a = scaner . nextInt ( ) ; var b = scaner . nextInt ( ) ; var h = scaner . nextInt ( ) ; var m = scaner . nextInt ( ) ; var x = 30 * h + 0.5 * m ; var y = 6 * m ; var r = Math . max ( x , y ) - Math . min ( x , y ) ; var ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b ) * Math . cos ( Math . toRadians ( r ) ) ) ; System . out . println ( ans ) ; scaner . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Map ; import java . util . Scanner ; import java . util . HashMap ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , Scanner in , PrintWriter out ) { double a = in . nextDouble ( ) ; double b = in . nextDouble ( ) ; double H = in . nextDouble ( ) ; double M = in . nextDouble ( ) ; double HH = H * 30 + M / 2 ; double MM = M * 6 ; double ang = Math . abs ( HH - MM ) ; ang = Math . min ( 360 - ang , ang ) ; double result = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( Math . toRadians ( ang ) ) ) ) ; out . println ( String . format ( " % .10f " , result ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double c = angle ( h % 12 , m ) ; c = Math . toRadians ( c ) ; double ss = Math . sqrt ( ( double ) Math . pow ( a , 2 ) + ( double ) Math . pow ( b , 2 ) - ( ( double ) 2 * ( double ) a * ( double ) b * ( double ) Math . cos ( c ) ) ) ; System . out . println ( ss ) ; } public static double angle ( int hour , int minute ) { if ( hour < 0 | | minute < 0 ) { return - 1 ; } if ( hour = = 12 ) { hour = 0 ; } if ( minute = = 60 ) { minute = 0 ; hour + = 1 ; } double hourAngle = ( hour * 60 + minute ) * 0.5 ; double minAngle = minute * 6 ; double bwAngle = Math . abs ( hourAngle - minAngle ) ; return Math . min ( 360 - bwAngle , bwAngle ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner inp = new Scanner ( System . in ) ; int a = inp . nextInt ( ) ; int b = inp . nextInt ( ) ; int c = inp . nextInt ( ) ; boolean flag = false ; if ( a = = 5 & & b = = 5 & & c = = 7 ) flag = true ; if ( a = = 5 & & b = = 7 & & c = = 5 ) flag = true ; if ( a = = 7 & & b = = 5 & & c = = 5 ) flag = true ; if ( flag ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . ArrayDeque ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int book [ ] = new int [ 4 ] ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { book [ i ] = 0 ; } for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " P " ) ) { book [ 0 ] = 1 ; } else if ( s . equals ( " W " ) ) { book [ 1 ] = 1 ; } else if ( s . equals ( " G " ) ) { book [ 2 ] = 1 ; } else { book [ 3 ] = 1 ; } } int sum = book [ 0 ] + book [ 1 ] + book [ 2 ] + book [ 3 ] ; if ( sum = = 3 ) System . out . println ( " Three " ) ; else { System . out . println ( " Four " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { private static class FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public String nextLine ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \ n " ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; int [ ] a = sc . nextIntArray ( 3 ) ; Arrays . sort ( a ) ; int result = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { result + = a [ i ] - a [ i - 1 ] ; } System . out . println ( result ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Sample { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num1 = Integer . parseInt ( str ) ; double num2 = Math . pow ( num1 , 2 ) ; int num3 = ( int ) num2 ; System . out . println ( num3 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; System . out . println ( getCubed ( line ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static long getCubed ( String line ) { long x = Long . parseLong ( line ) ; return ( short ) Math . pow ( x , 3 ) ; } } public class Main { public static void main ( String [ ] args ) { if ( args . length = = 1 ) { int num = Integer . parseInt ( args [ 0 ] ) ; Cube cube = new Cube ( num ) ; } else { System . out . println ( " 引数が不正です 。 " ) ; } } } public c l s u e { Cu e ( int num ) yste m .ou .pr i n ln ( num * num * num ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int result ; x = Integer . parseInt ( br . readLine ( ) ) ; result = x * x * x ; System . out . println ( result ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io , * class Main { public static void main ( String [ ] args ) throws IOException { Buffered reader br = new Bufferedreader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int a = parseInt ( str ) ; System . out . print ( a * a * a ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) { int x ; InputStreamReader sir = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String but = br . readLine ( ) ; x = Integer . parseInt ( but ) ; if ( x > = 0 & & x < = 100 ) { x = x * x * x ; } } } package internship ; import java . util . Scanner ; public class test1 { public static void main ( String [ ] args ) { int x = 0 , temp , tot ; Scanner sc = new Scanner ( System . in ) ; while ( x ! = 0 ) { temp = sc . nextInt ( ) ; if ( 1 > = temp | | 100 < = temp ) { x = temp ; } tot = x * x * x ; System . out . println ( tot ) ; System . out . println ( ) ; } } } public class HelloWorld { public static void main ( String [ ] args ) { int line ; double mass ; try { line = Integer . parseInt ( args [ 0 ] ) ; if ( line > = 1 & line < = 100 ) { mass = Math . pow ( ( double ) line , ( double ) 3 ) ; System . out . println ( 1 ) ; } } catch ( Exception e ) { System . out . println ( " Exception : " + e ) ; } } } package DATE20200311 ; import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int flg = 0 ; for ( int j = 0 ; j < i ; j + + ) { if ( P [ i ] > P [ j ] ) { flg = 1 ; } } if ( flg = = 0 ) { count = count + 1 ; } } System . out . println ( count ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . println ( args [ 0 ] * args [ 0 ] * args [ 0 ] ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * * 2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int sum ; String x ; do { x = scan . nextLine ( ) ; if ( x . equals ( " 0 " ) ) break ; sum = 0 ; for ( int i = 0 ; i < x . length ( ) ; i + + ) { char c = x . charAt ( i ) ; sum + = ( int ) c - 48 ; } System . out . println ( sum ) ; } while ( true ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Xcubic { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BufferedReader br = new BufferedReader ( isr ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String buf = br . readLine ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int ? ? ? = Integer . parseInt ? ? ? buf ? ? ? ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( x * x * x ) : } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( SYSTEM > IN ) ; String str = sc . next ( ) ; String result = str . replace ( " ? " , " D " ) ; System . out . println ( result ) ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; system . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ; class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; Set < Character > set = new HashSet < > ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { char [ ] ch = sc . next ( ) . toCharArray ( ) ; set . add ( ch [ 0 ] ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } import java . io . * ; import java . util . Scanner ; class Main { public static void mian ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . print ( x * x * x ) } } public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int A = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; int sum = A + B + C ; if ( sum = = 17 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class B { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { StringBuffer sb = new StringBuffer ( sc . next ( ) ) ; for ( int i = 0 ; i < sb . length ( ) - 1 ; i + + ) { char c = sb . charAt ( i ) ; if ( c = = ' ? ' ) { if ( sb . charAt ( i + 1 ) = = ' ? ' ) { sb . setCharAt ( i , ' P ' ) ; sb . setCharAt ( i + 1 , ' D ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' D ' ) { sb . setCharAt ( i , ' P ' ) ; } else { sb . setCharAt ( i , ' D ' ) ; } } else { sb . setCharAt ( i , c ) ; } } if ( sb . charAt ( sb . length ( ) - 1 ) = = ' ? ' ) { sb . setCharAt ( sb . length ( ) - 1 , ' D ' ) ; } System . out . println ( sb . toString ( ) ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String s = sc . next ( ) ; int x = 0 ; int max = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( s . charAt ( i ) . equals ( ' I ' ) ) { x + + ; } else { x -- ; } if ( max < x ) { max = x ; } } System . out . println ( max ) ; } } 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 k ; if ( a > 13 ) { k = b ; } else if ( a < = 6 ) { k = b / 2 ; } else if ( a > 6 ) { k = 0 ; } System . out . println ( k ) ; } } class aoj1 { public static void main ( String [ ] args ) throws IOException { int n ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; n = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( n , 3 ) ) ; } } import java . util . Scanner ; public class team _ formation1 _ b { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( ( n + m ) > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] a ) { Scanner x = new Scanner ( System . in ) ; a = x . nextInt ( ) ; double b = 3 ; int c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } import java . lang . Object ; class Test { public static void main ( String [ ] args ) throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . * ; public static void main ( String [ ] args ) throws ParseException { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; SimpleDateFormat s = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date date1 = s . parse ( S ) ; Date date = s . parse ( " 2019 / 04 / 30 " ) ; if ( date1 . before ( date ) ) { System . out . print ( " Heisei " ) ; } else if ( date1 . after ( date ) ) { System . out . print ( " TBD " ) ; } } import java . util , * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; if ( 1 < = A > = 5 & & 1 < = B > = 7 & & 1 < = C > = 5 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long H = sc . nextLong ( ) ; long W = sc . nextLong ( ) ; long h = sc . nextLong ( ) ; long w = sc . nextLong ( ) ; long x = ( - 10000000 ) * ( h * w - 1 ) - 1 ; String [ ] ans = new String [ H ] ; for ( int i = 0 ; i < H ; + + i ) { ans [ i ] = " " ; } long sum = 0 ; for ( int i = 1 ; i < = H ; + + i ) { StringBuilder sb = new StringBuilder ( ) ; for ( int j = 1 ; j < = W ; j + + ) { if ( i % h = = 0 & & j % w = = 0 ) { sb . append ( x ) ; sb . append ( " " ) ; sum + = x ; } else { sb . append ( 10000000 ) ; sb . append ( " " ) ; sum + = 10000000 ; } } sb . deleteCharAt ( sb . length ( ) - 1 ) ; ans [ i - 1 ] = sb . toString ( ) ; } if ( sum < = 0 ) System . out . println ( " No " ) ; else { System . out . println ( " Yes " ) ; for ( int i = 0 ; i < H ; i + + ) { System . out . println ( ans [ i ] ) ; } } return ; } } class main1 { public void Main ( ) { int i = Integer . parseInt ( S ) ; if ( i < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } package test ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = new String ( in . readLine ( ) ) ; int a = Integer . parseInt ( str ) ; System . out . println ( Math . pow ( a , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; if ( a < = 0 ) { a = a * - 1 ; } if ( ( V - W ) * T > = a | | a = = 0 ) { System . out . println ( " YES " ) ; } else ( a < 0 ) { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { if ( ( x - 500 * i - 100 * j ) % 50 = = 0 ) cnt + + ; } } System , out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; for ( int i = 0 ; i < a . length ; i + + ) { x [ i ] = scn . nextInt ( ) ; y [ i ] = scn . nextInt ( ) ; } double nnn = 1 ; for ( int i = 1 ; i < = n ; i + + ) { nnn * = i ; } double way = 0 ; for ( int i = 1 ; i < n ; i + + ) { way + = i ; } double count = nnn * ( n - 1 ) / way ; double ave = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { ave + = ( Math . sqrt ( Math . pow ( Math . abs ( x [ i ] - x [ j ] ) , 2 ) + Math . pow ( Math . abs ( y [ i ] - y [ j ] ) , 2 ) ) ) / nnn ; } } ave * = count ; System . out . println ( ave ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . charset . StandardCharsets ; import java . util . * ; public class Main { int [ ] inputArray ; public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int input = sc . nextInt ( ) ; int n = 1 ; while ( true ) { if ( n > = input ) { n / = 2 ; break ; } n * = 2 ; } S stem.o u t.p r intln ( n ) ; } } import java . util . Scanner ; public class AOJ { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * x * x ) ; } } public class Hello { public static void Main ( ) { string [ ] input = System . Console . ReadLine ( ) . Split ( ' ' ) ; int A = int . Parse ( input [ 0 ] ) ; int B = int . Parse ( input [ 1 ] ) ; int C = int . Parse ( input [ 2 ] ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . Console . WriteLine ( " YES " ) ; } else { System . Console . WriteLine ( " NO " ) ; } } } import java . util . Scanner ; public class MainA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int haikuarray [ ] = new int [ 3 ] ; for ( int i = 0 ; haikuarray . length > i ; i + + ) { haikuarray [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; boolean j = retHaiku ( haikuarray ) ; if ( j = = true ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static boolean retHaiku ( int harray [ ] ) { int sevencnt = 0 ; int fivecnt = 0 ; for ( int i = 0 ; harray . length > i ; i + + ) { if ( harray [ i ] = = 7 & & sevencnt = = 0 ) { sevencnt + + ; } else if ( harray [ i ] = = 5 & & fivecnt < 2 ) { fivecnt + + ; } else { return false ; } } return true ; } } package syokora _ p ; import java . util . Scanner ; public class P { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } 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 k ; if ( a > 13 ) { k = b ; } else if ( a < = 6 ) { k = b / 2 ; } else if ( a > 6 ) { k = 0 } System . out . println ( k ) ; } } import java . util . Scanner ; class main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; System . out . println ( x * x * x \ n ) ; } } import java . util . Scanner ; public class Restaurant { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . close ( ) ; int x = ( n - ( n % 15 ) ) / 15 ; int amount = 800 * n - 200 * x ; System . out . println ( amount ) ; } } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( ) ; String str = " " ; str = sc . next ( ) ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; } String [ ] str2 = str . split ( " " ) ; int num1 = Integer . parseInt ( str2 [ 0 ] ) ; int num2 = Integer . parseInt ( str2 [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( String . valueOf ( num2 ) ) ; } else if ( num1 > = 6 ) { System . out . println ( String . valueOf ( num2 / 2 ) ) ; } else { System . out . println ( String . valueOf ( 0 ) ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } boolean [ ] list = new boolean [ N ] ; Arrays . fill ( list , true ) ; for ( int i = 0 ; i < N - 1 ; i + + ) { flg = true ; for ( int j = 1 ; j < N ; j + + ) { if ( P [ j ] > P [ i ] ) { flg = false ; } else { list [ j ] = false ; } } if ( flg ) { list [ i ] = ( true & & list [ i ] ) ; } } System . out . println ( ans ) ; } } import java . awt . Point ; import java . io . IOException ; import java . util . HashMap ; import java . util . Scanner ; import java . util . TreeMap ; public class Solution { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; sc . nextInt ( ) ; int M = sc . nextInt ( ) ; HashMap < Integer , TreeMap < Integer , Integer > > order = new HashMap < > ( ) ; Point [ ] data = new Point [ M ] ; for ( int i = 0 ; i < M ; i + + ) { int pref = sc . nextInt ( ) ; int year = sc . nextInt ( ) ; TreeMap < Integer , Integer > pData = order . get ( pref ) ; if ( pData = = null ) { pData = new TreeMap < Integer , Integer > ( ) ; } pData . put ( year , i ) ; order . put ( pref , pData ) ; data [ i ] = new Point ( pref , year ) ; } for ( int i = 0 ; i < M ; i + + ) { int pref = data [ i ] . x ; int year = data [ i ] . y ; int yRank = 1 ; for ( int j : order . keySet ( ) ) { if ( j = = pref ) { TreeMap < Integer , Integer > pData = order . get ( j ) ; for ( int k : pData . keySet ( ) ) { if ( k = = year ) { break ; } yRank + + ; } break ; } } String result = String . format ( " % 06d " , pref ) + String . format ( " % 06d " , yRank ) ; System . out . println ( result ) ; } sc . close ( ) ; } } public class exe { public static int main ( int i ) { int j = i * i * i ; return j ; } } public class Main { public static void main ( String [ ] args ) { int x = x * x * x System . out . println ( 1 < x < 100 ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader kbd = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int A = kdb . readLine ( ) ; int B = kbd . readLine ( ) ; int C = kbd . readLine ( ) ; int X = kbd . readLine ( ) ; int count = 0 ; int a ; int b ; int c ; int total ; for ( a = 0 ; a < = A ; a + + ) { for ( b = 0 ; b < = B ; b + + ) { for ( c = 0 ; c < = c ; c + + ) { total = 500 * a + 100 * b + 50 * c ; if ( total = = X ) count + + ; } } } System . out . println ( count ) ; } } import java . until . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io ; class Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamreader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( a * a * a ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . io . IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String hoge = input . readLine ( ) ; int x = Integer . parseInt ( hoge ) ; system . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { char arr [ ] = new Scanner ( System . in ) . next ( ) . toCharArray ( ) ; int sum = 0 ; int counter = 0 ; for ( int i = 0 ; i < arr . length ; i + + ) { if ( Integer . parseInt ( String . valueOf ( arr [ i ] ) ) > = 1 & & Integer . parseInt ( String . valueOf ( arr [ i ] ) ) < = 10 ) counter + + ; } if ( counter = = arr . length ) { for ( int i = 0 ; i < arr . length ; i + + ) { sum + = Integer . parseInt ( String . valueOf ( arr [ i ] ) ) ; } if ( sum = = 17 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class atcoder103 _ 1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 3 ] ; int t = 0 ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < 2 ; j + + ) { for ( int i = 0 ; i < 2 - j ; i + + ) { if ( n [ i + 1 ] - n [ i ] < 0 ) { t = n [ i ] ; n [ i ] = n [ i + 1 ] ; n [ i + 1 ] = t ; } } } for ( int i = 0 ; i < 2 ; i + + ) { ans + = n [ i + 1 ] - n [ i ] ; } System . out . println ( ans ) ; } } public class Main { ? ? public static void main ( String [ ] args ) { ? ? int x = new java . util . Scannner ( System . in ) . nextInt ( ) ; ? ? int i = x * x * x ; ? ? System . out . println ( i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int c = 0 ; int ans = 0 ; for ( int a = 0 ; a < = k ; a + + ) { for ( int b = 0 ; b < = k ; b + + ) { c = s - a - b ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; return ; } } import java . util . Scanner ; class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( r , 2 ) ) ; sc . close ( ) ; } } import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( a > = 13 ) { ans = b ; } else if ( a > = 6 ) { ans = b / 2 ; } else { } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . prinln ( " x * x * x " ) ; } } import java . util . Scanner ; 2 . 3. public class Main { 4. public static void main ( String [ ] args ) { 5 . Scanner sc = new Scanner ( System . in ) ; 6. int n = sc . nextInt ( ) ; 7. int x = 800 * n ; 8. int y = 200 * ( n / 15 ) ; 9 . System . out . oriintin ( x - y ) ; 10 . } 11 . } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; if ( V > W ) { if ( sp * T > = def ) { System . out . println ( " YES " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class MainC { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double theta = Math . abs ( h * 30 - m * 6 ) ; double c = a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( theta ) ) ; System . out . println ( Math . sqrt ( c ) ) ; sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { int i = 2 ; cul ( i ) ; i = 3 ; cul ( i ) ; } public static void cul ( int x ) { System . out . println ( x * x * x ) ; } } e import java . io . * ; class StillTBD { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String S = br . readLine ( ) ; String [ ] ymd = S . split ( " / " ) ; int [ ] ymd _ num = new int [ ymd . length ] ; int cont = 0 ; for ( String t : ymd ) { ymd _ num [ cont ] = Integer . parseInt ( t ) ; cont = cont + 1 ; } if ( ymd _ num [ 0 ] < = 2018 ) { System . out . println ( " heisei " ) ; } else if ( ymd _ num [ 0 ] = = 2019 & & ymd _ num [ 1 ] < = 4 ) { System . out . println ( " heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . Scanner . * class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; a = sc . NextInt ( ) ; b = sc . NextInt ( ) ; c = sc . NextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long V = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long W = sc . nextLong ( ) ; long T = sc . nextLong ( ) ; boolean catched = false ; long dist = Math . abs ( A - B ) ; long dv = V - W ; if ( dv < = 0 ) { catched = false ; } else if ( dv > = dist / T ) { catched = true ; } if ( catched ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int A = 0 ; int B = 0 ; for ( int i = 0 ; i < X ; i + + ) { for ( int j = j < X ; i + + ) { if ( ( i * i * i * i * i ) - ( j * j * j * j * j ) = = 33 ) { A = i ; B = j ; } } } System . out . println ( A + " " + B ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer \ n ) ; } } } public class XCubic { } public class Main { public static void main ( String [ ] args ) { run ( ) ; } static void run ( ) { int xc = readInput ( ) ; printCubic ( xc ) ; } static int readInput ( ) { Scanner sc = new Scanner ( System . in ) ; return sc . nextInt ( ) ; } static void printCubic ( int x ) { System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextLine ( ) ; int num = x * x * x ; System . out . println ( num ) ; } } import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int K = sc . nextInt ( ) ; System . out . println ( solve ( s , K ) ) ; } public static String solve ( String s , int K ) { char [ ] chars = s . toCharArray ( ) ; int lastIndex = - 1 ; int length = chars . length ; for ( char i = 0 ; i < length ; i + + ) { char c = chars [ i ] ; int count = ( ' z ' - c ) + 1 ; if ( K > = count ) { chars [ i ] = ' a ' ; K - = count ; } else { lastIndex = i ; } if ( K < = 0 ) break ; } if ( K > 0 & & lastIndex > = 0 ) { if ( K > 26 ) K = K % 26 ; char c = ( char ) ( builder . charAt ( lastIndex ) + K ) ; chars [ i ] = c ; } return String . valueOf ( chars ) ; } } public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) : String input = br . readLine ( ) ; int x = Integer . parseInt ( input ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; System . out . println ( p * p * p ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long V = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long W = sc . nextLong ( ) ; long T = sc . nextLong ( ) ; long chati = ( V - W ) * T if ( ( B - A ) < chati ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) } } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { List < String > list = new ArrayList < String > ( ) ; while ( scan . hasNext ( ) ) { x1 = scan . nextDouble ( ) ; y1 = scan . nextDouble ( ) ; x2 = scan . nextDouble ( ) ; y2 = scan . nextDouble ( ) ; x3 = scan . nextDouble ( ) ; y3 = scan . nextDouble ( ) ; xp = scan . nextDouble ( ) ; yp = scan . nextDouble ( ) ; double S _ pab = Math . abs ( ( x1 - xp ) * ( y2 - yp ) - ( x2 - xp ) * ( y1 - yp ) ) ; double S _ pac = Math . abs ( ( x1 - xp ) * ( y3 - yp ) - ( x3 - xp ) * ( y1 - yp ) ) ; double S _ pbc = Math . abs ( ( x2 - xp ) * ( y3 - yp ) - ( x3 - xp ) * ( y2 - yp ) ) ; double S _ abc = Math . abs ( ( x3 - x1 ) * ( y2 - y1 ) - ( x2 - x1 ) * ( y3 - y1 ) ) ; if ( S _ abc = = S _ pab + S _ pac + S _ pbc ) { list . add ( " YES " ) ; } else { list . add ( " NO " ) ; } } for ( String s : list ) { System . out . printf ( " % s \ n " , s ) ; } } } public class Multi { public static void main ( String [ ] args ) { double x ; x = xclubic ( 2 ) ; System . out . println ( x ) ; } public static double xclubic ( double x ) { double y ; y = 3 ; return Math . pow ( x , y ) ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; double sum = 0 ; sum = Math . pow ( x , 3 ) ; System . out . println ( sum ) ; } import java . util . * ; import java . lang . * ; class atcoder145a { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int number = input . nextInt ( ) ; int output = number * number ; System . out . println ( output ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int x = sn . nextInt ( ) ; if ( x > 0 | | x < 100 ) { System . out . println ( x * x * x ) ; } } } class main { public static void ( String [ ] args ) { ver x = math . pow ( 2 , 3 ) ; System . out . println ( x ) ; } } package accoder ; import java . util . Scanner ; public class test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int input1 = scanner . nextInt ( ) ; int input2 = scanner . nextInt ( ) ; if ( input1 = = input2 ) { System . out . println ( " Draw " ) ; } else if ( input1 = = 1 & & input2 ! = 1 ) { System . out . println ( " Alice " ) ; } else if ( input2 = = 1 & & input1 ! = 1 ) { System . out . println ( " Bob " ) ; } else if ( input1 > input2 ) { System . out . println ( " Alice " ) ; } else if ( input1 < input2 ) { System . out . println ( " Alice " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; long b [ ] = new long [ n ] ; long suma = 0 ; long sumb = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; suma + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; sumb + = b [ i ] ; } if ( suma < sumb ) { System . out . println ( - 1 ) ; return ; } int count = 0 ; long husoku = 0 ; int kajo _ count = 0 ; List < Integer > kajo _ list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < b [ i ] ) { count + + ; husoku + = b [ i ] - a [ i ] ; } else if ( a [ i ] > b [ i ] ) { kajo _ count + + ; kajo _ list . add ( a [ i ] - b [ i ] ) ; } } if ( count = = 0 ) { System . out . println ( count ) ; return ; } Collections . sort ( kajo _ list , Collections . reverseOrder ( ) ) ; long kajo _ sum = 0 ; for ( int i = 0 ; i < kajo _ list . size ( ) ; i + + ) { kajo _ sum + = kajo _ list . get ( i ) ; count + + ; if ( husoku < = kajo _ sum ) { break ; } } System . out . println ( count ) ; } } } import java . util . Scanner ; public class second { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } ソースコード Copy Copy i port java util.S anne r ; pu b lic cla s Main publ c st t c void main ( S ring ] ar g s ) thr o w Exc e tion { Scanner s new Sc nn r Sys em.in ) ; final i nt A V , B , W T ; A = s c . n e t n ( ; V = sc.n e x t n ( ; B = sc.n e x t n ( ; W = sc.n e x t n ( ; T = sc.n e x t n ( ; s c.close ( ) ; in t diff = ath abs ( B ) ; if ( d i f = = ) { S yste .o t . p rintln ( " YE S " ) ; } el s e if ( M a h.ab ( V - W ) * T > = d f f & - W > & ) { y t m o t . p rintln ( " YE S " ) ; } el s e { S y s t e .out p rintln ( " NO " ) ; } } } import java . utl . Scanner ; public class Main { public static void main ( string [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x ^ 3 System . out . println ( answer ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { int x = new Scanner ( System . in ) . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; public class Main2 { int n ; int max = 1 < < 15 ; void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] cnt = new int [ max + 1 ] ; for ( int i = 1 ; i * i < = max ; i + + ) { cnt [ i * i ] + + ; for ( int j = i ; j * j + i * i < = max ; j + + ) { cnt [ i * i + j * j ] + + ; for ( int k = j ; k * k + j * j + i * i < = max ; k + + ) { cnt [ i * i + j * j + k * k ] + + ; for ( int l = k ; l * l + k * k + j * j + i * i < = max ; l + + ) { cnt [ i * i + j * j + k * k + l * l ] + + ; } } } } while ( true ) { n = sc . nextInt ( ) ; if ( n = = 0 ) break ; System . out . println ( cnt [ n ] ) ; } } public static void main ( String [ ] args ) { new Main2 ( ) . solve ( ) ; } } public class Hello { public static void Main ( ) { int A = int . Parse ( System . Console . ReadLine ( ) ) ; int B = int . Parse ( System . Console . ReadLine ( ) ) ; int C = int . Parse ( System . Console . ReadLine ( ) ) ; int X = int . Parse ( System . Console . ReadLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = A ; i + + ) { for ( int j = 0 ; j < = B ; j + + ) { for ( int k = 0 ; k < = C ; k + + ) { int ans = X - i * 500 - j * 100 - k * 50 ; if ( ans = = 0 ) count + + ; } } } System . Console . WriteLine ( count ) ; } } import java . util . * ; public class Main { public static void main ( Sting [ ] args ) { Scannner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { static int n ; static int m ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; n = Integer . parseInt ( st . nextToken ( ) ) ; m = Integer . parseInt ( st . nextToken ( ) ) ; boolean [ ] [ ] n _ map = new boolean [ n ] [ n ] ; boolean [ ] [ ] m _ map = new boolean [ m ] [ m ] ; String str ; for ( int i = 0 ; i < n ; i + + ) { str = br . readLine ( ) ; for ( int j = 0 ; j < n ; j + + ) { n _ map [ i ] [ j ] = ( str . charAt ( j ) = = ' # ' ) ; } } for ( int i = 0 ; i < m ; i + + ) { str = br . readLine ( ) ; for ( int j = 0 ; j < m ; j + + ) { m _ map [ i ] [ j ] = ( str . charAt ( j ) = = ' # ' ) ; } } for ( int i = 0 ; i < = n - m ; i + + ) { for ( int j = 0 ; j < = n - m ; j + + ) { if ( check ( n _ map , m _ map , i , j ) ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } } System . out . println ( " No " ) ; } static boolean check ( boolean [ ] [ ] a , boolean [ ] [ ] b , int start1 , int start2 ) { for ( int i = 0 ; i < m ; i + + ) { for ( int j = 0 ; j < m ; j + + ) { if ( a [ i + start1 ] [ j + start2 ] ! = b [ i ] [ j ] ) { return false ; } } } System . out . println ( start1 + " " + start2 ) ; return true ; } } public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final int num = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( num * num * num ) ; } } } import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int input = scan . nextInt ( ) ; int ans = input * input * input ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) int A2 = sc . nextInt ( ) int A3 = sc . nextInt ( ) ; int mic = Math . abs ( Math . max ( Math . max ( A1 , A2 ) , A3 ) - Math . min ( Math . min ( A1 , A2 ) , A3 ) ) ; System . out . println ( mic ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long a = sc . nextInt ( ) ; Long v = sc . nextInt ( ) ; Long b = sc . nextInt ( ) ; Long w = sc . nextInt ( ) ; Long t = sc . nextInt ( ) ; a = a + ( v * t ) ; b = b + ( w * t ) ; if ( a > = b ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class StillTBD { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String date = scanner . next ( ) ; int year = Integer . parseInt ( date . substring ( 0 , 4 ) ) ; int month = Integer . parseInt ( date . substring ( 5 , 7 ) ) ; int day = Integer . parseInt ( date . substring ( 8 , 10 ) ) ; if ( year < = 2019 & & month < = 04 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class abc145 _ a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ( int ) Math . pow ( sc . nextInt ( ) , 2 ) ) ; } } import java . util . Scanner ; class testIni1 { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int val = scan . nextInt ( ) ; while ( val ! = nul ) { val = val * val * val ; System . out . println ( val ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int y = sc . nextInt ( ) ; int answer = y * y * y ; System . out . println ( answer ) ; } package practice ; import java . util . * ; public class ABC042A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int first = scan . nextInt ( ) ; int second = scan . nextInt ( ) ; int therd = scan . nextInt ( ) ; int FIVE = 0 ; int SEVEN = 0 ; if ( ( first = = 5 | first = = 7 ) & ( second = = 5 | second = = 7 ) & ( therd = = 5 | therd = = 7 ) & ( first + second + therd = = 17 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( problem145a ( r ) ) ; } private static int problem145a ( int r ) { return r * r ; } import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class xorsum4 { static long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; long a [ ] = new long [ 60 ] ; long b [ ] = new long [ 60 ] ; for ( int i = 0 ; i < N ; i + + ) { long val = in . nextLong ( ) ; for ( int j = 0 ; j < 60 ; j + + ) { if ( val % 2 = = 0 ) { a [ j ] + + ; } else { b [ j ] + + ; } val / = 2 ; } } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long t = ( long ) Math . pow ( 2 , i ) % MOD ; t = ( t * a [ i ] ) % MOD ; t = ( t * b [ i ] ) % MOD ; ans = ( ans + t ) % MOD ; } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; double a = ( oub e x double kotae = M at h .pow ( a , 3 ) ; S stem.o t p i ntln ( x + " を 乗した値は " kotae " す " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { int i = ( int ) Math . pow ( Integer . parseInt ( scan . next ( ) ) , 3 ) ; System . out . print ( i ) ; } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int a = 0 , b = 0 ; if ( A = = 5 ) a + + ; else if ( A = = 7 ) b + + ; if ( B = = 5 ) a + + ; else if ( B = = 7 ) b + + ; if ( C = = 5 ) a + + ; else if ( C = = 7 ) b + + ; if ( a = = 2 & & b = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class ITP1 _ 1 _ B { int calc ( int x ) { int y = x * x * x ; return y ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int n ; n = cin . nextInt ( ) ; ArrayList < Integer > x = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { x . add ( cin . nextInt ( ) ) ; } for ( int i = 0 ; i < 101 ; i + + ) { int sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { sum + = ( x . get ( j ) - i ) * ( x . get ( j ) - i ) ; } if ( sum < xSquareMin ) { xSquareMin = sum ; } } System . out . println ( xSquareMin ) ; } } public class Main { public static void main ( String [ ] args ) { double base = 3d ; double exponent = 3d ; double num = Math . pow ( base , exponent ) ; System . out . printf ( num ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String value = br . readLine ( ) ; int inputValue = Integer . valueOf ( value ) ; System . out . println ( inputValue * inputValue * inputValue ) ; } catch ( IOException e ) { } } } import java . util . Scanner ; public class Kadai1 _ 2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < = x ) { if ( x < = 100 ) { System . out . println ( ( x * x ) * x ) ; } } } } import java . util . * ; import java . util . stream . * ; class Main { public static void main ( String [ ] args ) { var scanner = new Scanner ( System . in ) ; var x = scanner . nextLong ( ) ; var amax = ( long ) Math . pow ( x + 0.9 , 0.2 ) ; for ( long a = 1 ; a < = amax ; a + + ) { var b = fact ( x - a * a * a * a * a , 5 ) ; if ( b > = 0 ) { System . out . println ( a + " " + ( - b ) ) ; System . exit ( 0 ) ; } } var bmax = ( long ) Math . pow ( ( x / 5 ) + 0.9 , 0.25 ) ; for ( long b = 0 ; b < = bmax ; b + + ) { var a = fact ( x + b * b * b * b * b , 5 ) ; if ( a > 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } } static int fact ( long x , int p ) { assert x > = 0 ; var f = ( long ) Math . exp ( x + 0.9 , ( double ) p ) ; if ( f * f * f * f * f ! = x ) f = - 1L ; return ( int ) f ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ab = a * b ; int cd = c * d ; if ( ad = cd ) { System . out . println ( ab ) ; } else if ( ad > cd ) { System . out . println ( ab ) ; } else if ( cd > ad ) { System . out . println ( cd ) ; } } } class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferdReader ( new InputStreamReader ( System . in ) ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " + ( x * x * x ) + " ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = System . in . read ( ) ; int a = x * x * x ; System . out . println ( a ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int kekka ; kekka = x * x ; System . out . println ( kekka ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String value = br . readLine ( ) ; int inputValue = Integer . valueOf ( value ) ; System . out . println ( inputValue * inputValue * inputValue ) ; } catch ( IOException e ) { } } } import java . util . Scanner ; import math ; class Main { public static void main ( String [ ] arsg ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = { a , b , c , d , e } ; String ans = " Yay ! " ; for ( int i = 0 ; i < l ; i + + ) { for ( int x = 1 ; x < l - 1 ; x + + ) { if ( math . abs ( l [ i ] - l [ x ] ) > k ) { ans = " : ( " ; break out ; } } } out : System . out . println ( ans ) ; } } class Main { public int x ; public static void main ( String [ ] args ) { x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( " x * x * x " ) ; } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int i = Integer . parseInt ( str ) ; int j = i * i ; System . out . println ( " + j + " ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double x = readDouble ( in ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; public class colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String n = scan . next ( ) ; String [ ] data = n . split ( " , " ) ; System . out . println ( data [ 0 ] + " " + data [ 1 ] ) ; double a = Double . parseDouble ( data [ 0 ] ) ; double b = Double . parseDouble ( data [ 1 ] ) ; double h = Double . parseDouble ( data [ 2 ] ) ; double m = Double . parseDouble ( data [ 3 ] ) ; double tyou = h * 30 ; double tan = m * 6 ; double kaku ; if ( tyou > = 180 ) { tyou = tyou - 180 ; } if ( tan > = 180 ) { tan = tan - 180 ; } if ( tyou > = tan ) { kaku = tyou - tan ; } else { kaku = tan - tyou ; } double cosa = Math . cos ( Math . toRadians ( kaku ) ) ; double an = a * a + b * b - 2 * a * b * cosa ; double ans = Math . sqrt ( an ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; int challengeSum ; for ( int k = min ; k < max ; k + + ) { for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( k - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; boolean switch = false ; long amari = 0 long a = 0 , b = 0 , swap = 0 , r = 0 , x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; if ( i = = 0 ) amari = A [ i ] % 2 ; else { if ( A [ i ] % 2 ! = amari ) { switch = true ; break ; } } } long max = A [ 0 ] ; if ( switch = = false ) { for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } } if ( max > M * 2 | | switch = = true ) System . out . println ( 0 ) ; else { long ans = ( M - ( max / 2 ) ) / max + ( long ) 1 ; System . out . println ( ans ) ; } } } import java . util . * ; public class rect { int ar [ ] = new int [ 4 ] ; public void input ( ) { int i ; Scanner read = new Scanner ( System . in ) ; System . out . println ( " enter " ) ; for ( i = 0 ; i < 4 ; i + + ) { ar [ i ] = read . nextInt ( ) ; } } public int recto ( ) { int a = ( ar [ 0 ] * ar [ 1 ] ) ; int b = ( ar [ 2 ] * ar [ 3 ] ) ; if ( a > b ) return a ; else if ( a < b ) return b ; else return a ; } public static void main ( String [ ] args ) { rect obj = new rect ( ) ; obj . input ( ) ; obj . recto ( ) ; } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int distance [ ] = new int [ 10 ] ; distance [ 0 ] = b - a ; distance [ 1 ] = c - a ; distance [ 2 ] = d - a ; distance [ 3 ] = e - a ; distance [ 4 ] = c - b ; distance [ 5 ] = d - b ; distance [ 6 ] = e - b ; distance [ 7 ] = d - c ; distance [ 8 ] = e - c ; distance [ 9 ] = e - d ; int flag = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( k < distance [ i ] ) { flag = 0 ; break ; } } if ( flag = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = s . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main { String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } } public class B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; double pow = Math . pow ( num , 3 ) ; int answer = ( int ) pow ; System . out . println ( answer ) ; } } import numpy as np A = int ( input ( ) ) B = int ( input ( ) ) C = int ( input ( ) ) D = int ( input ( ) ) E = int ( input ( ) ) X = np . asarray ( [ A , B , C , D , E ] ) X _ div = X % 10 X _ sort = np . sort ( X _ div ) min = 0 for i in range ( 5 ) : if X _ sort [ i ] ! = 0 : min = X _ sort [ i ] break if min = = 0 : min = 10 X = 10 * ( ( X - 1 ) sum = 0 for i in range ( 5 ) : sum + = X [ i ] print ( sum - 10 + min ) import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( String . valueOf ( i + 1 ) , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } map . entrySet ( ) . stream ( ) . sorted ( java . util . Map . Entry . comparingByValue ( ) ) ; for ( String key : map . keySet ( ) ) { for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int X = Math . abs ( B - A ) ; int sp = V - W ; int Z = sp * T - X ; int z = sp * ( T - 1 ) - X ; if ( Z = = 0 | | z = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } public class StillTBD { public static void main ( String [ ] args ) { String s ; String k = " 2019 / 04 / 30 " ; Scanner input = new Scanner ( System . in ) ; s = input . nextLine ( ) ; if ( s = = null ? k = = null : s . equals ( k ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } class Util { public static int count ( int [ ] S , int N ) { if ( N = = 0 ) { return 1 ; } if ( N < 0 ) { return 0 ; } int res = 0 ; for ( int i = 0 ; i < S . length ; i + + ) { res + = count ( S , N - S [ i ] ) ; } return res ; } public static void main ( String [ ] args ) { int [ ] S = { 1 , 2 , 3 } ; int N = 4 ; System . out . println ( " Total number of ways to get desired change is " + count ( S , N ) ) ; } } import java . util . * ; import java . text . * ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { char [ ] cs = sc . nextLine ( ) . toCharArray ( ) ; if ( n = = 0 ) break ; int s = 0 ; for ( int i = 0 ; i < sc . length ; i + + ) { s + = cs [ i ] - ' 0' ; } System . out . println ( s ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Map < Integer , Integer > seen = new HashMap < > ( ) ; for ( int ix = 0 ; ix < 3 ; ix + + ) { int value = scanner . nextInt ( ) ; seen . put ( value , seen . getOrDefault ( value , 0 ) + 1 ) ; } bool result = seen . containsKey ( 5 ) & & seen . containsKey ( 7 ) & & seen . get ( 5 ) = = 2 & & seen . get ( 7 ) = = 1 ; System . out . println ( result ? " YES " : " NO " ) ; } } import java . util * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = ( a + b ) / 2 ; if ( ( ( float ) a + ( float ) b ) / 2 - c < 0.5 ) { System . out . println ( c ) ; } else { System . out . println ( c + 1 ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( x * x * x ) } } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; ] String str [ 2 ] = str . split ( " " ) ; int num1 = Integer . parseInt ( str [ 0 ] ) ; int num2 = integer . parseInt ( str [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( num2 ) ; else if ( num1 > = 6 ) { System . out . println ( num2 / 2 ) ; else { System . out . println ( 0 ) ; } } } } import java . io . * ; public class Power { public static void main ( String args [ ] ) { int x = 0 ; do { System . out . println ( " Form your number : " ) ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; } catch ( Exception e ) { x = 0 ; } } while ( x < 0 | | 100 < x ) ; System . out . println ( " The number powed by 3 is ? ? ? " ) ; System . out . println ( " ? ? ? " + Math . pow ( x , 3 ) + " ? ? ? " ) ; } } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; } String [ 2 ] str = str . split ( " " ) ; int num1 = Integer . parseInt ( str [ 0 ] ) ; int num2 = integer . parseInt ( str [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( num2 ) ; else if ( num1 > = 6 ) { System . out . println ( num2 / 2 ) ; else { System . out . println ( 0 ) ; } } } public class Main { public static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( ( int ) Math . pow ( input ( ) , 3 ) ) ; close ( ) ; } public static int input ( ) { return scanner . nextInt ( ) ; } public static void close ( ) { if ( scanner ! = null ) { scanner . close ( ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class A _ OneCardPoker { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a = = 1 ) { a = a + 13 ; } if ( b = = 1 ) { b = b + 13 ; } if ( a = = b ) { System . out . println ( " Draw " ) ; } else if ( a > b ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } # include < iostream > # include < algorithm > # include < string > # include < math . h > # define rep ( i , n ) for ( int i = 0 ; i < n ; i + + ) using namespace std ; int main ( ) { int a , b ; cin > > a > > b ; cout < < ( a % b = = 0 ? a / b : a / b + 1 ) < < endl ; return 0 ; } class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( num * num * num ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c ! = 17 ) { System . out . println ( " NO " ) ; } else { if ( ( a = = 5 | | a = = 7 ) & & ( b = = 5 | | b = = 7 ) ) { System . out . println ( " YES " ) ; } } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class HinaArare { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String output = " Tree " ; int num = sc . nextInt ( ) ; String [ ] color = new String [ num ] ; for ( int i = 0 ; i < num ; i + + ) { color [ i ] = sc . next ( ) ; } sc . close ( ) ; for ( int i = 0 ; i < num ; i + + ) { if ( color [ i ] . equals ( " Y " ) ) { output = " Four " ; break ; } } System . out . println ( output ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] permutations = new int [ n + 1 ] ; int min = n ; int [ ] mins = new int [ n + 1 ] ; for ( int i = 1 ; i < = n ; i + + ) { permutations [ i ] = sc . nextInt ( ) ; if ( i = = 1 ) { min = permutation [ 1 ] ; } min = Math . min ( min , permutations [ i ] ) ; mins [ i ] = min ; } int ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( permutations [ i ] = = mins [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; class Test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < 13 & & a > = 6 ) b / = 2 ; else if ( a < 6 ) b = 0 ; System . out . println ( b ) ; } } import java . util . Scanner ; public class ABC166D { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = Integer . parseInt ( sc . next ( ) ) ; for ( int i = - 118 ; i < = 199 ; i + + ) { for ( int j = - 119 ; j < = 118 ; j + + ) { if ( X = = Math . pow ( i , 5 ) - Math . pow ( j , 5 ) ) { System . out . println ( i + " " + j ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = scan . nextInt ( ) ; long frac [ ] = new long [ 100020 ] ; int a = 1000000007 ; if ( Math . abs ( x - y ) > 1 ) { System . out . println ( ' 0' ) ; return ; } frac [ 0 ] = 1 ; for ( int i = 1 ; i < = 100000 ; i + + ) frac [ i ] = frac [ i - 1 ] * i % a ; long ans = frac [ x ] * frac [ y ] % a ; if ( x = = y ) ans = ans * 2 % a ; System . out . println ( ans ) ; return ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = in . readLine ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . util . * ; public class BC91 _ A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b ) > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } int r ; float s1 ; float s2 ; s1 = 1 ^ 2 * 3.14 ; s2 = r ^ 2 * 3.14 ; println = ( s2 / s1 ) ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int a [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ N - 1 ] - a [ 0 ] ) ; } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int i = Integer . parseInt ( str ) ; int j = i * i ; System . out . println ( " " + j ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int kekka = x * x ; System . out . println ( kekka ) ; } } class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } public class Main { static int N , M ; static int [ ] [ ] arr ; static boolean [ ] visited ; static int count ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; arr = new int [ N + 1 ] [ 100 ] ; visited = new boolean [ N + 1 ] ; int [ ] orginal = new int [ M ] ; Map < Integer , String > result = new LinkedHashMap < Integer , String > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; orginal [ i ] = y ; arr [ x ] [ y ] = 1 ; } for ( int i = 1 ; i < = N ; i + + ) { visited [ i ] = true ; count = 1 ; for ( int j = 1 ; j < 100 ; j + + ) { if ( arr [ i ] [ j ] = = 1 ) { String xiaquid = String . format ( " % 06d " , Integer . valueOf ( i ) ) ; String cityorder = String . format ( " % 06d " , Integer . valueOf ( count ) ) ; String cityid = xiaquid + cityorder ; result . put ( j , cityid ) ; count + + ; } } } for ( int i = 0 ; i < M ; i + + ) { System . out . println ( result . get ( orginal [ i ] ) ) ; } } } import java . io . * ; import java . util . * ; public class ACBeg42 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int x = Integer . parseInt ( st . nextToken ( ) ) ; if ( x = = 5 ) fiveCount + + ; if ( x = = 7 ) sevenCount + + ; } if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; double a = ( double ) x ; double kotae = Math . pow ( a , 3 ) ; System . out . println ( kotae ) ; } } import java . util . * ; public class Xcubic { public static void main ( String [ ] args ) { Scanner Sc = new Scanner ( System . in ) ; int x = Sc . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } mport java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; sc . close ( ) ; int min = Math . min ( Math . min ( a1 , a2 ) , a3 ) ; int max = Math . max ( Math . max ( a1 , a2 ) , a3 ) ; System . out . println ( max - min ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = ( V - W ) * T ; int b = B - A ; if ( ( V - W ) * T > = B - A ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; a = sc . NextInt ( ) ; b = sc . NextInt ( ) ; c = sc . NextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int count = sc . nextInt ( ) ; char [ ] ca = s . toCharArray ( ) ; char [ ] ca _ n = new char [ ca . length ] ; for ( int i = 0 ; i < ca _ n . length ; i + + ) { ca _ n [ i ] = ( char ) ( ca [ i ] - 96 ) ; } if ( ca _ n . length = = 1 ) { ca _ n [ 0 ] = ( char ) ( ( ca _ n [ 0 ] + count ) % 26 ) ; if ( ca _ n [ 0 ] = = 0 ) { ca _ n [ 0 ] = 26 ; } } else { for ( int i = 0 ; i < ca _ n . length ; i + + ) { if ( ca _ n [ i ] = = 1 ) { continue ; } else if ( i = = ( ca _ n . length - 1 ) & & count > 0 ) { ca _ n [ i ] = ( char ) ( ( ca _ n [ i ] + count ) % 26 ) ; if ( ca _ n [ i ] = = 0 ) { ca _ n [ i ] = 26 ; } } else { if ( count > 0 & & 27 - ca _ n [ i ] < = count ) { count - = ( 27 - ca _ n [ i ] ) ; ca _ n [ i ] = 1 ; } } } } for ( int i = 0 ; i < ca _ n . length ; i + + ) { ca _ n [ i ] + = 96 ; } String s1 = new String ( ca _ n ) ; System . out . print ( s1 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; line = br . readLine ( ) ; int num = Integer . parseInt ( line ) ; int ans = num * 3 ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( string args [ ] ) { int coinVal ; int coinVal2 ; int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } } } import java . util . * ; class B { public static void main ( String [ ] args ) throws Exception { String T ; try ( Scanner scanner = new Scanner ( System . in ) ) { T = scanner . next ( ) ; } catch ( Exception e ) { throw e ; } class State { int index ; char currentChar ; State previousState ; int count ; } int score = 0 ; State result = new State ( ) { { index = - 1 ; currentChar = 0 ; previousState = null ; count = 0 ; } } ; final ArrayDeque < State > states = new ArrayDeque < > ( ) ; states . push ( result ) ; while ( ! states . isEmpty ( ) ) { final State state = states . pop ( ) ; if ( state . index + 1 > = T . length ( ) ) continue ; char [ ] charCandidates ; if ( T . charAt ( state . index + 1 ) = = ' ? ' ) { charCandidates = new char [ ] { ' P ' , ' D ' } ; } else { charCandidates = new char [ ] { T . charAt ( state . index + 1 ) } ; } for ( char c : charCandidates ) { State newState = new State ( ) { { index = state . index + 1 ; currentChar = c ; previousState = state ; count = state . count ; if ( c = = ' D ' ) { count + + ; } if ( index > = 1 & & state . currentChar = = ' P ' & & c = = ' D ' ) { count + + ; } } } ; if ( newState . count > = score & & newState . index = = T . length ( ) - 1 ) { result = newState ; score = newState . count ; } states . push ( newState ) ; } } State current = result ; List < Character > characters = new ArrayList < > ( ) ; while ( current . previousState ! = null ) { characters . add ( current . currentChar ) ; current = current . previousState ; } for ( int i = characters . size ( ) - 1 ; i > = 0 ; i -- ) { System . out . write ( characters . get ( i ) ) ; } System . out . println ( ) ; } } import java . util . * ; class Main { public static void main ( String s [ ] ) { Scanner sc = new Scanner ( System . in ) ; int arr [ ] = new int [ 3 ] ; int arr [ 0 ] = sc . nextInt ( ) ; int arr [ 1 ] = sc . nextInt ( ) ; int arr [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; System . out . println ( arr [ 0 ] + arr [ 1 ] ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( system . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; system . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( 9 ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) e . printStackTrace ( ) ; } } } } public class Main { public static void main ( String [ ] args ) { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final int num = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( num * num * num ) ; } } } main ( c , d ) for ( ; scanf ( " % d % d " , & c , & d ) + 1 ; ) printf ( " % d \ n " , c + d ) ; import java . util . * public class Main { public static void main ( String [ ] args ) { int a ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { int searchNumber = P [ i ] ; boolean hantei = true ; for ( j = 0 ; j < i ; j + + ) { if ( searchNumber > P [ j ] ) hantei = false ; break ; } if ( hantei = = true ) count + + ; } System . out . println ( count ) ; } } public class Xcubic { public static void main ( String [ ] args ) { int X = 2 ; System . out . println ( X * X * X ) ; int Y = 3 ; System . out . println ( Y * Y * Y ) ; } } public class Main { public static void main ( String [ ] args ) { int result = 0 ; System . out . println ( " Enter Number : " ) ; Scanner stdin = new Scanner ( System . in ) ; int number = stdin . nextInt ( ) ; if ( number > = 1 | | number < = 100 ) { result = number * number * number ; System . out . println ( result ) ; } else { System . out . println ( " Please enter 1 to 100 " ) ; } } } import java . io . * public class Main { public static void main ( String args [ ] ) { System . out . println ( " 数字を入力してください " ) ; BufferedReader rea d e r = new Buffered eader ( e In utStreamReader ( Sys em.in ) ) ; String l i ne = r e ad e r . eadLin ( ) ; n x = I n teger.pa r a s Int l n ) ; int a ns = x * x * x ; S ste .ou . r n l n a n ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int sum = 0 ; int count = 0 ; for ( int i = 0 ; i < = A ; i + + ) { sum = 500 * i ; if ( sum = = X ) { count + + ; } else if ( sum < X ) { for ( int j = 0 ; j < = B ; j + + ) { int sum2 = sum ; sum2 = sum2 + ( 100 * j ) ; if ( sum2 = = X ) { count + + ; } else if ( sum2 < X ) { for ( int h = 0 ; h < = C ; h + + ) { int sum3 = sum2 ; sum3 = sum3 + ( 50 * h ) ; if ( sum3 = = X ) { count + + ; } } } } } } System . out . println ( count ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int age = scan . nextInt ( ) ; int price = scan . nextInt ( ) ; int payment = 0 ; if ( price % 2 = = 0 ) { if ( age > = 13 ) { payment = price ; } else if ( age > = 12 | | age < = 6 ) { payment = price / 2 ; } else if ( age < = 5 ) { payment = 0 ; } System . out . println ( payment ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int index = new Integer ( scan . nextLine ( ) ) ; String [ ] scanLine = scan . nextLine ( ) . split ( " " ) ; int range = 0 ; for ( int i = 0 ; i < scanLine . lengh ( ) ; i + + ) { range + = ( index - new Integer ( scanLine [ i ] ) ) * ( index - new Integer ( scanLine [ i ] ) ) ; } System . out . println ( range ) ; } } import java . util . Scanner ; class ABC145 _ A { public static final double PI = 3.14159 ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int r = stdIn . nextInt ( ) ; final double one = 1 * 1 * PI ; final double s = r * r * PI ; System . out . println ( ( int ) ( s / one ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cardA = Integer . parseInt ( sc . next ( ) ) ; int CardB = Integer . parseInt ( sc . next ( ) ) ; String s ; if ( CardA > CardB ) { s = " Alice " ; } else if ( CardB > CardA ) { s = " Bob " ; } else { s = " Draw " ; } System . out . println ( s ) ; sc . close ( ) ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( Math . Pow ( x , 3 ) ) ; } } import java . util . * ; class Circle { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int result = ( int ) ( Math . pow ( r , 2 ) ) ; System . out . println ( result ) ; } } public class ITP1 _ 1 _ B { public static void main [ String [ ] args ] { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; ans = x * x * x ; 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 ( ) ; if ( N = = 1 ) { System . out . println ( 1 ) ; } else if ( N = = 2 ) { int T = sc . nextInt ( ) ; if ( T = = 1 ) { System . out . println ( 1 ) ; } else { System . out . println ( 2 ) ; } ; } else { int M [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { M [ i ] = sc . nextInt ( ) ; if ( ( M [ i ] = = 2 ) | | ( M [ i ] = = 1 ) ) { break ; } } for ( int r = 0 ; r < i ; r + + ) { if ( M [ r ] = = 2 ) { s = r ; } else { s = s ; } } int l = s ; for ( int q = 0 ; q < s ; q + + ) { if ( M [ q ] = = 2 ) { l = q ; } else { l = l ; } } int x = 0 ; int L = M [ 0 ] ; for ( int j = 0 ; j < l ; j + + ) { for ( int k = 1 ; k < = j ; k + + ) { L = Math . min ( L , M [ k ] ) ; } if ( L = = M [ j ] ) { x = x + 1 ; } else { x = x ; } ; } if ( v = = s ) { if ( s = = l ) { System . out . println ( x + 1 ) ; } else { System . out . println ( x + 2 ) ; } } else if ( s = = l ) { System . out . println ( x + 2 ) ; } else { System . out . println ( x + 3 ) ; } } } } import java . util . Scanner ; public class abc145 _ a { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; final int n = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( n * n ) ; sc . close ( ) ; } } public class maple { public static void main ( String [ ] args ) { int x = 6 ; if ( x > = 1 | | x < = 100 ) System . out . print ( x * x * x ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = Integer . parseInt ( sc . next ( ) ) ; int cityNum = Integer . parseInt ( sc . next ( ) ) ; Map < String , List < Integer > > map = new HashMap < String , List < Integer > > ( ) ; String [ ] [ ] array = new String [ cityNum ] [ 2 ] ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( String . valueOf ( i + 1 ) , new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { array [ i ] [ 0 ] = sc . next ( ) ; array [ i ] [ 1 ] = sc . next ( ) ; map . get ( array [ i ] [ 0 ] ) . add ( Integer . parseInt ( array [ i ] [ 1 ] ) ) ; } for ( String key : map . keySet ( ) ) { Collections . sort ( map . get ( key ) ) ; for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { for ( int j = 0 ; j < array . length ; j + + ) { if ( array [ j ] [ 0 ] . equals ( key ) & & Integer . parseInt ( array [ j ] [ 1 ] ) = = ( map . get ( key ) . get ( i ) ) ) { StringBuilder sb = new StringBuilder ( ) ; while ( key . length ( ) < 6 ) { sb . append ( " 0 " ) ; } sb . append ( key ) ; while ( ( map . get ( key ) . get ( i ) ) . size < 6 ) { sb . append ( " 0 " ) ; } array [ j ] [ 0 ] = sb . append ( map . get ( key ) . get ( i ) ) . toString ( ) ; } } } } for ( String [ ] ary2 : array ) { System . out . println ( ary2 [ 0 ] ) ; } } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date date1 = null ; Date date2 = null ; try { date1 = sdf . parse ( S ) ; date2 = sdf . parse ( " 2019 / 04 / 30 " ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } if ( date1 . before ( date2 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . printlin ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; solve ( N ) ; } public void solve ( int N ) { for ( int i = - 120 ; i < 120 ; i + + ) { for ( int j = - 120 ; j < 120 ; j + + ) { long ans = i * i * i * i * i - j * j * j * j * j ; if ( ans = = N ) { System . out . println ( i + " " + j ) ; return ; } } } return ; } } import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; class xorsum4 { static long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; long a [ ] = new long [ 60 ] ; long b [ ] = new long [ 60 ] ; for ( int i = 0 ; i < N ; i + + ) { long val = in . nextLong ( ) ; for ( int j = 0 ; j < 60 ; j + + ) { if ( val % 2 = = 0 ) { a [ j ] + + ; } else { b [ j ] + + ; } val / = 2 ; } } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long t = ( long ) Math . pow ( 2 , i ) % MOD ; t = ( t * a [ i ] ) % MOD ; t = ( t * b [ i ] ) % MOD ; ans = ( ans + t ) % MOD ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = sc . nextLong ( ) ; for ( int a = - 120 ; a < 120 ; a + + ) { for ( int b = - 120 ; b < 120 ; b + + ) { if ( gojyou ( a ) - gojyou ( b ) = = X ) { System . out . println ( a + " " + b ) ; return ; } } } System . out . println ( fa + " " + fb ) ; } static long gojyou ( int a ) { long a2 = ( long ) a ; return Math . pow ( a2 , 5l ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x ) ; } } public class main { public static void main ( int x ) { System . out . println ( x * x * x ) ; } } import java . util . * ; public class a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > 12 ) { a = 0 ; } if ( b > 12 ) { b = 0 ; } if ( a > b ) { System . out . println ( " Alice " ) ; } else { if ( b > a ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } System . out . println ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class Main { public static void swap ( long a [ ] , int b , int e , int t ) { for ( int i = 0 ; i < e - b ; i + + ) { long tmp = a [ b + i ] ; a [ b + i ] = a [ k + i ] ; a [ k + i ] = tmp ; } } public static void main ( Stirng [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; swap ( a , b , e , t ) ; } for ( int i = 0 ; i < n - 1 ; i + + ) System . out . print ( a [ i ] + " " ) ; System . out . println ( a [ n - 1 ] ) ; } } class Main { public static void main ( String [ ] args ) BufferedReader reader = new BufferdReader ( new InputStreamReader ( System . in ) ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " + ( x * x * x ) + " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int Min ; int Max ; for ( int i = 1 ; i < N ; i + + ) { if ( Min > a ) Min = a ; if ( Max < a ) Max = a ; System . out . println ( Max - Min ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA ; String [ ] imgB ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x * ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int base = sc . nextInt ( ) ; long cube = ( long ) base * base * base ; System . out . println ( cube ) ; sc . close ( ) ; } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String s = input . readLine ( ) ; int x = Interger . parseInt ( s ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } catch ( IOExceptin e ) { } } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; int i = x ^ 3 ; System . out . println ( i ) ; } } class Main { public static void main ( String args [ ] ) { Scanner str = new Scanner ( System . in ) ; int num = str . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . util . * ; public class AOJ1000 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; System . out . println ( a + b ) ; } } } import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . read ( ) ) ; int b = Integer . parseInt ( br . read ( ) ) ; int c = Integer . parseInt ( br . read ( ) ) ; int d = Integer . parseInt ( br . read ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int N = Integer . parseInt ( str ) ; str = scan . next ( ) ; int L = Integer . parseInt ( str ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { String input = scan . next ( ) ; list . add ( input ) ; } Collections . sort ( list ) ; String ans ; for ( int i = 0 ; i < 3 ; i + + ) { String input = list . get ( i ) ; ans = ans + input ; } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . InputMismatchException ; public class main { public static void main ( String args [ ] ) { int distance [ ] = new int [ 5 ] ; int limit = 0 ; try { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < distance . length ; i + + ) { distance [ i ] = scanner . nextInt ( ) ; } limit = scanner . nextInt ( ) ; scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( e ) ; } for ( int i = distance . length - 1 ; i > = 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) { if ( distance [ i ] - distance [ j ] > limit ) { System . out . println ( " : ( " ) ; System . exit ( 1 ) ; } } } System . out . println ( " Yay ! " ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; import java . math . * ; public class a { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double c = sc . nextInt ( ) ; double d = sc . nextInt ( ) ; double e = Math . toRadians ( 90 ) ; e = Math . cos ( e ) ; System . out . printf ( " % .19f " , Math . sqrt ( a * a + b * b - a * b * 2 * e ) ) ; } } } import java . io . * ; public class X { public static void main ( String [ ] args ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? . " ) ; tring tr r. r eadLine ( ) ; nt = nteger. p arseInt ( s tr ) ; ystem. o ut. p rintln ( x * x * x ) ; import java . util . Scanner ; public static Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = ( a + b ) / 2 ; d = ( a + b ) % 2 ; if ( d = = 0 ) { System . out . println ( c ) ; } else { System . out . println ( c + 0.5 ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " x * x * x " ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] = N [ 4 ] ; N [ 0 ] = sc nextInt ( ) ; N [ 1 ] = sc nextInt ( ) ; N [ 2 ] = sc nextInt ( ) ; N [ 3 ] = sc nextInt ( ) ; Arrays . sort ( N [ ] ) ; if ( N [ 0 ] = = 1 ) { if ( N [ 1 ] = = 4 ) { if ( N [ 2 ] = = 7 ) { if ( N [ 3 ] = = 9 ) { System . println ( " YES " ) ; } } } } else { System . println ( " NO " ) ; } } } import java . io * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; public class Reconciled { private final static int MOD = 1 _ 000 _ 000 _ 000 + 7 ; private final static BigDecimal B _ MOD = BigDecimal . valueOf ( MOD ) ; public static void main ( String ... args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] vals = reader . readLine ( ) . split ( " " ) ; final int N = Integer . parseInt ( vals [ 0 ] ) ; final int M = Integer . parseInt ( vals [ 1 ] ) ; if ( Math . abs ( N - M ) > 1 ) { System . out . print ( 0 ) ; return ; } BigDecimal result ; if ( N = = M ) { result = BigDecimal . valueOf ( 2 ) . multiply ( getPermutation ( N ) ) . multiply ( getPermutation ( N ) ) ; } else { result = getPermutation ( N ) . multiply ( getPermutation ( M ) ) ; } System . out . print ( result . remainder ( B _ MOD ) ) ; } private static BigDecimal getPermutation ( final int n ) { BigDecimal result = BigDecimal . ONE ; for ( int i = 1 ; i < = n ; i + + ) { result = result . multiply ( BigDecimal . valueOf ( i ) ) ; if ( result . compareTo ( B _ MOD ) = = 1 ) result = result . remainder ( B _ MOD ) ; } return result ; } } class Main { BufferReader br = new BufferReader ; int x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int x [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scanner . nextInt ( ) ; } System . out . println ( stamina ( x ) ) ; } private static int stamina ( int [ ] x ) { int count = Arrays . stream ( x ) . sum ( ) ; int p = count / x . length ; if ( count % x . length = = 0 ) { return Arrays . stream ( x ) . map ( i - > ( i - p ) * ( i - p ) ) . sum ( ) ; } else { return IntStream . of ( p , p + 1 ) . map ( t - > Arrays . stream ( x ) . map ( i - > ( i - t ) * ( i - t ) ) . sum ( ) ) . min ( ) . getAsInt ( ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( ( x * x * x ) ) ; } } hewjhqrke import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] menu = new int [ 5 ] ; for ( int i = 0 ; i < menu . length ; i + + ) { menu [ i ] = sc . nextInt ( ) ; } int max = 0 ; int flag = 0 ; for ( int i = 0 ; i < menu . length ; i + + ) { int tmp = Math . ceil ( ( double ) menu [ i ] / 10 ) * 10 ; if ( max < tmp - menu [ i ] ) { flag = i ; max = tmp - menu [ i ] ; } } for ( int i = 0 ; i < menu . length ; i + + ) { if ( i = = flag ) continue ; time + = Math . ceil ( ( double ) menu [ i ] / 10 ) * 10 ; } time + = menu [ flag ] ; System . out . println ( time ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { while ( scanner . hasNext ( ) ) { String [ ] s = scanner . nextLine ( ) . split ( " , " ) ; Student student = new Student ( s [ 0 ] , Double . parseDouble ( s [ 1 ] ) , Double . parseDouble ( s [ 2 ] ) ) ; if ( student . bmi . isDebu ( ) ) { System . out . println ( student . studentId ) ; } } } } } class Student { final String studentId ; final Bmi bmi ; Student ( String studentId , double ? ? ? ? ? ? kg , double ? ? ? ? ? ? m ) { this . studentId = studentId ; this . bmi = new BmiImpl ( ? ? ? ? ? ? kg , ? ? ? ? ? ? m ) ; } } interface Bmi { int debu = 25 ; boolean isDebu ( ) ; } class BmiImpl implements Bmi { private final double ? ? ? ? ? ? kg ; private final double ? ? ? ? ? ? m ; BmiImpl ( double ? ? ? ? ? ? kg , double ? ? ? ? ? ? m ) { this . ? ? ? ? ? ? kg = ? ? ? ? ? ? kg ; this . ? ? ? ? ? ? m = ? ? ? ? ? ? m ; } public double calc ( ) { return ? ? ? ? ? ? kg / Math . pow ( ? ? ? ? ? ? m , 2 ) ; } @ Override public boolean isDebu ( ) { return calc ( ) > = debu ; } } import java . util . Scanner ; public class Kadai1 _ 2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < x ) { if ( x < 100 ) { System . out . println ( ( x * x ) * x ) ; } } } } import java . util . * ; class ABC091A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , C = 0 ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; if ( A + B > = C ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . math . BigDecimal ; import java . math . MathContext ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; BigDecimal x [ ] , y [ ] ; x = new BigDecimal [ N ] ; y = new BigDecimal [ N ] ; for ( int i = 0 ; i < N ; i + + ) { int x1 , y1 ; x1 = sc . nextInt ( ) ; y1 = sc . nextInt ( ) ; x [ i ] = new BigDecimal ( x1 ) ; y [ i ] = new BigDecimal ( y1 ) ; } int c = 2 ; for ( int i = 2 ; i < = N ; i + + ) { c * = i ; } c = c / N ; int C = 1 ; for ( int i = 2 ; i < = N ; i + + ) { C * = i ; } BigDecimal sum = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { BigDecimal x1 = x [ i ] . add ( x [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; BigDecimal y1 = y [ i ] . add ( y [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; x1 = x1 . multiply ( x1 ) ; y1 = y1 . multiply ( y1 ) ; x1 = x1 . add ( y1 ) ; x1 = x1 . sqrt ( MathContext . DECIMAL64 ) ; sum = sum . add ( x1 ) ; } } sum = sum . multiply ( new BigDecimal ( c ) ) ; sum = sum . divide ( new BigDecimal ( C ) , 10 , BigDecimal . ROUND _ HALF _ UP ) ; System . out . println ( sum . toPlainString ( ) ) ; } } import java . lang . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = std . nextInt ( ) ; System . out . println ( math . pow ( n , 3 ) ) ; } } import java . io . * ; class Xcube { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readline ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) d = int ( input ( ) ) e = int ( input ( ) ) k = int ( input ( ) ) if ( e - a < = k ) : print ( " Yay ! " ) else : print ( " : ( " ) import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . UnsupportedEncodingException ; public class Sample { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; System . out . println ( " Enter a number between 1 and 100 " ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int cube = 0 ; if ( n > = 1 & & n < = 100 ) cube = n * n * n ; System . out . println ( cube ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int x , tot ; Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; tot = x * 3 ; System . out . Println ( tot ) ; System . out . Println ( ) ; } } import java . utl . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; int result = x - y ; System . out . println ( result ) ; } } public static void main ( String [ ] args ) { double x ; x = xclubic ( 2 ) ; System . out . println ( x ) ; } public static double xclubic ( double x ) { double y ; y = 3 ; return Math . pow ( x , y ) ; } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( a + b > = c ? " Yes " : " No " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Sample { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num1 = Integer . parseInt ( str ) ; double num2 = Math . pow ( num1 , 2 ) ; int num3 = ( int ) num2 ; System . out . println ( num3 ) ; } } function Main ( input ) { input = new Date ( input ) . getTime ( ) ; var check = new Date ( " 2019 / 04 / 30 " ) . getTime ( ) ; console . log ( ( input < = check ) ? " Heisei " : " TBD " ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; System . out . println ( pow ( n , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { ; try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = br . readLine ( ) ; int N = Integer . valueOf ( s ) ; if ( N < 1 | | N > 100 ) System . exit ( 0 ) ; int max = 0 ; int maxNum = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int num = calc ( i ) ; if ( maxNum < num ) { max = i ; maxNum = num ; } } System . out . println ( max ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } protected static int calc ( int N ) { int i = 0 ; while ( N % 2 = = 0 ) { N = N / 2 ; i + + ; } return i ; } import java . util . Scanner ; public class abc091a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b > = c ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Study2 { p blic s atic v id m in ( S t ring [ ] a gs ) { S anner s = n w S anner ( S y stem.i n ) ; i t r = s .n e xtInt ( ) ; i t a swer = r r ; S stem.o u t.p r intln ( a n swer ) ; S stem.o u t.p r intln ( ) ; } } import java . util . * ; import java . util . stream . * ; class Main { public static void main ( String [ ] args ) { var scanner = new Scanner ( System . in ) ; var x = scanner . nextInt ( ) ; var amax = 120 ; for ( int a = 1 ; a < = amax ; a + + ) { var b5 = a * a * a * a * a - x ; if ( b5 < 0 ) { var b = - fact5 ( - b5 ) ; if ( b < 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } else { var b = fact5 ( b5 ) ; if ( b > = 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } } static int fact5 ( int x ) { assert x > = 0 ; var r = ( int ) Math . pow ( x + 0.9 , 0.2 ) ; if ( x ! = r * r * r * r * r ) r = - 1 ; return r ; } } public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int number = stdin . nextInt ( ) ; if ( number > = 1 & & number < = 100 ) { int result = number * number * number ; System . out . println ( result ) ; } } } import java . util . Scanner ; public class Pangkat { public static void main ( String [ ] args ) { int a = 0 , b = 3 ; double c = 0 ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } import java . util . Scanner ; public class Pangkat { public static void main ( String [ ] args ) { int a = 0 , b = 3 , c ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } public class Main { public static void main ( String [ ] args ) { int y = x * x ; y = y * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { run ( ) ; } public static void run ( ) { int xc = readInput ( ) ; printCubic ( xc ) ; } public static int readInput ( ) { Scanner sc = new Scanner ( System . in ) ; return sc . nextInt ( ) ; } public static void printCubic ( int x ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { XCubic . run ( ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cntdif = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList < int > bigger = new ArrayList < int > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( int dif = A [ j ] - B [ j ] < 0 ) { difsum + = dif ; cnt + + ; } else if ( dif > 0 ) { bigger . add ( dif ) ; } } int big [ ] = bigger . toArray ( new int [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < big . length ; k + + ) { for ( int l = 0 ; l < big . length - k - 1 ; l + + ) { if ( big [ l ] > big [ l + 1 ] ) { temp = big [ l ] ; big [ l ] = big [ l + 1 ] ; big [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = big [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String [ ] data = new String [ 2 ] ; data [ 0 ] = " 2019 / 04 / 30 " ; data [ 1 ] = sc . nextLine ( ) ; Arrays . sore ( data ) ; if ( data [ 1 ] . equals ( " 2019 / 04 / 30 " ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = ( new Scanner ( System . in ) ) . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class main { public static void main ( Strings arg [ ] ) { int i = 3 ; System . out . println ( i * i * i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int index = 0 ; while ( index < s . length ( ) ) { System . out . println ( c ) ; if ( c = = ' d ' ) { if ( index + 5 > s . length ( ) ) { break ; } if ( index + 7 < s . length ( ) & & ( s . charAt ( index + 7 ) ! = ' a ' ) | | index + 7 = = s . length ( ) ) { if ( s . substring ( index , index + 7 ) . equals ( " dreamer " ) ) { index + = 7 ; } else { if ( s . substring ( index , index + 5 ) . equals ( " dream " ) ) { index + = 5 ; } else { break ; } } } else { if ( s . substring ( index , index + 5 ) . equals ( " dream " ) ) { index + = 5 ; } else { break ; } } } else if ( c = = ' e ' ) { if ( index + 5 > s . length ( ) ) { break ; } if ( index + 5 = = s . length ( ) | | s . charAt ( index + 5 ) ! = ' r ' ) { if ( s . substring ( index , index + 5 ) . equals ( " erase " ) ) { index + = 5 ; } else { break ; } } else { if ( s . substring ( index , index + 6 ) . equals ( " eraser " ) ) { index + = 6 ; } else { break ; } } } else { break ; } } System . out . println ( index = = s . length ( ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . NextInt ( ) ; int b = sc . NextInt ( ) ; int c = sc . NextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = Scanner ( System . in ) ; int x ; x = in . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class aa { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) , sum , min = Integer . MAX _ VALUE ; int A [ ] = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) A [ i ] = in . nextInt ( ) ; for ( int j = 0 ; j < 101 ; j + + ) { sum = 0 ; for ( int i = 0 ; i < a ; i + + ) { sum + = ( A [ i ] - j ) * ( A [ i ] - j ) ; } min = Math . min ( sum , min ) ; } System . out . println ( min ) ; } } class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int n = a . nextInt ( ) ; int ans = n * n * n System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder data = new StringBuilder ( ) ; while ( true ) { int sum = 0 ; String str = br . readLine ( ) ; int strsize = str . length ( ) ; if ( str . equals ( " 0 " ) ) break ; else if ( strsize > = 1 ) { int i = 0 ; while ( i < strsize ) { sum + = Integer . parseInt ( String . valueOf ( str . charAt ( i ) ) ) ; i + + ; } } data . append ( sum ) . append ( " \ n " ) ; } System . out . println ( data ) ; } import java . text . DateFormat ; import java . text . ParseException ; import java . util . Date ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; Date date1 = DateFormat . getDateInstance ( ) . parse ( a ) ; Date date2 = DateFormat . getDateInstance ( ) . parse ( " 2019 / 4 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff = < 0 ) { System . out . println ( " Heisei " ) ; } else if ( diff > 0 ) { System . out . println ( " TBD " ) ; } catch ( ParseException e ) { System . out . println ( e ) ; } } } class Main { public static void main ( x ) { System . out . println ( x ^ 3 ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; System . out . println ( pow ( n , 3 ) ) ; } } import java . util . Scanner ; public class Aim { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int x = 0 ; int y = 0 ; int z = 0 ; int countS = 0 ; int countK = 0 ; countS = ( s + 2 ) * ( s + 1 ) / 2 ; for ( x = k ; x < = s ; x + + ) { for ( y = k ; y < = s ; y + + ) { for ( z = k ; z < = s ; z + + ) { if ( x + y = = s - z ) { countK + + ; } } } } int show = countS ; if ( s = = 3 * k ) { show = 1 ; } System . out . println ( show ) ; } } import java . util . Scanner ; public class MyClass { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; double n = scanner . nextDouble ( ) ; int result = ( int ) Math . pow ( n , 3d ) ; System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA [ N ] ; String [ ] imgB [ M ] ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void swap ( long a [ ] , int b , int e , int t ) { for ( int i = 0 ; i < e - b ; i + + ) { long tmp = a [ b + i ] ; a [ b + i ] = a [ k + i ] ; a [ k + i ] = tmp ; } } public static void main ( Stirng [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; swap ( a , b , e , t ) ; } for ( int i = 0 ; i < n - 1 ; i + + ) System . out . print ( a [ i ] + " " ) ; System . out . println ( a [ n - 1 ] ) ; } } import java . util . Scanner ; public class StillTBD { public static void main ( String [ ] args ) { String s ; String k = " 2019 / 04 / 30 " ; Scanner input = new Scanner ( System . in ) ; s = input . nextLine ( ) ; if ( s = = null ? k = = null : s . equals ( k ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . * ; public class AGC004B { public static void main ( String [ ] args ) throws IOException { MyScanner sc = new MyScanner ( System . in ) ; int n ; long x ; n = sc . nextInt ( ) ; x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; long [ ] b = a . clone ( ) ; long ans = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long acc = 0 ; long xk = ( ( long ) x ) * k ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i - k + n ) % n ] ) ; acc + = b [ i ] ; } ans = Math . min ( ans , acc + xk ) ; } System . out . println ( ans ) ; } static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; int x = Integer . parseInt ( s ) ; x = x * x * x ; System . out . println ( x ) ; } } inport java . until . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; long t [ ] = new long [ n ] ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { t [ i ] = scanner . nextInt ( ) ; a [ i ] = scanner . nextInt ( ) ; } for ( int i = 1 ; i < n ; i + + ) { long p = Math . max ( brd _ t / t [ i ] , brd _ a / a [ i ] ) ; t [ i ] * = p ; a [ i ] * = p ; } System . out . println ( t [ n - 1 ] + a [ n - 1 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { long a = sc . nextLong ( ) ; int v = sc . nextInt ( ) ; long b = sc . nextLong ( ) ; int w = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; for ( int cnt = 0 ; cnt < t ; cnt + + ) { a + = v ; b + = w ; if ( a = = b ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } class Main { public void main ( string [ ] args ) { Scanner in = new Scanner ( System . in ) ; String x = in . next ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ; class at1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; for ( int i = 1 ; i < = 2 ; i + + ) { int diff = a [ i ] - a [ i - 1 ] ; sum = sum + diff ; } System . out . println ( sum ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextInt ( ) ; String b = sc . nextInt ( ) ; if ( a = = b ) { System . out . println ( " Draw " ) ; } else if ( a % 13 > b % 13 ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { XCubic . run ( ) ; } public class XCubic { static void run ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } } import java . util . Scanner ; public class taskA { public void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int A = r . nextInt ( ) ; int B = r . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } else if ( A > = 6 & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } catch IOException } } import java . util . * ; import javax . swing . * ; import java . text . * ; public class test { public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; s = s . replace ( " eraser " , " " ) ; s = s . replace ( " erase " , " " ) ; s = s . replace ( " dreamer " , " " ) ; s = s . replace ( " dream " , " " ) ; if ( s . length ( ) = = 0 ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } } import java . io . * public class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . * ; public class prob _ C { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double theta _ a = 30 * ( H + M / 60 ) ; double theta _ b = 360 * ( M / 60 ) ; double theta _ ab = Math . abs ( theta _ a - theta _ b ) ; double C = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( theta _ ab / 180 * Math . PI ) ) ; System . out . println ( C ) ; } } import java . util . Scanner ; public class Solution { private static Scanner input = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int balls = input . nextInt ( ) ; int people = input . nextInt ( ) ; if ( people = = 1 ) { System . out . println ( 0 ) ; } else { System . out . println ( balls - people ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( " x " ) ; } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = 3 ; System . out . println ( " " + Math . pow ( a , b ) + " " ) ; scan . close ( ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A = = B ) { System . out . println ( " Draw " ) ; } else if ( ( A = = 1 & & B ! = 1 ) | | ( A > B ) ) { System . out . println ( " Alice " ) ; } else if ( ( A ! = 1 & & B = = 1 ) | | ( A < B ) ) { System . out . println ( " Bob " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int rem = N - k ; System . out . println ( rem ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } } } int main ( int r ) { int value = r * r ; return value ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int a ; int b ; int x ; int cnt = 0 ; int Z ; for ( a = 0 ; a < = K ; x + + ) { if ( S - x < K ) Z = S - x ; for ( b = 0 ; b < = Z ; b + + ) { if ( S - a - b < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . next ( ) ; System . out . println ( k * k * k ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String [ ] line = sc . nextLine ( ) . split ( " " ) ; int x = Integer . parseInt ( line [ 0 ] ) ; } System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int result = 0 ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { result = x * x * x ; System . out . println ( result ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; system . out . println ( x * x * x ) ; } catch ( Exception e ) { } import java . util . * ; public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; str = str . replace ( " eraser " , " " ) ; str = str . replace ( " erase " , " " ) ; str = str . replace ( " dreamer " , " " ) ; str = str . replace ( " dream " , " " ) ; if ( str . equals ( " " ) ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( N % 2 = = 1 ) { System . out . println ( " No " ) ; return ; } if ( S . substring ( 0 , N / 2 ) . equals ( S . substring ( N / 2 , N ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int sum = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int x = s - ( x + y ) ; if ( ( x < = k ) & & ( x > = 0 ) ) { sum + + ; } } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( 3 ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int i = ( int ) Math . pow ( Integer . parseInt ( scan . next ( ) ) , 3 ) ; System . out . print ( i ) ; } } import java . io . * ; class Main { public void main ( String [ ] args ) throws IOException { int x ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; x = I teger.p a rseInt ( b uf ) ; S y s em.out . pri n tln ( x ) ; } } import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; class stillTBD { public static void main ( String args [ ] ) { try { Date boundaryDate = ConvertDateFromString ( " 2019 / 04 / 30 " ) ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; int result = ConvertDateFromString ( input ) . compareTo ( boundaryDate ) ; if ( ( result = = - 1 ) | | ( result = = 0 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } scanner . close ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static Date ConvertDateFromString ( String dateStr ) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date formatDate = sdf . parse ( dateStr ) ; System . out . println ( formatDate ) ; return formatDate ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) , W = sc . nextInt ( ) , h = sc . nextInt ( ) , w = sc . nextInt ( ) ; if ( H % h = = 0 & & W % w = = 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; for ( int i = 0 ; i < H ; + + i ) { for ( int j = 0 ; j < W ; + + j ) { System . out . print ( i % h = = h - 1 & & j % w = = w - 1 ? - 4000 * h * w + 3999 : 4000 ) ; System . out . print ( ' ' ) ; } System . out . println ( ) ; } } } } import java . util . Scanner ; public class void Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 1 ; for ( int i = 1 ; i < = N ; i * = 2 ) { result = i ; } System . out . println ( result ) ; } } public class Main { public static void main ( String [ ] args ) { int a = 0 ; try ( Scanner scanner = new Scanner ( System . in ) ) { a = scanner . nextInt ( ) ; } if ( a < 100 | | a > 0 ) { a = a * a * a ; System . out . println ( a ) ; } } } public class Main { public static void main ( String [ ] args ) { int a ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; System . out . println ( a * a * a ) ; } } package aoj ; import java . util . Scanner ; public class JOI2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x > 0 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( num * num ) ; } import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } Main kari = new Main ( ) ; if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = kari . setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; Iterator < Integer > it = setwise2 . iterator ( ) ; List < Integer > setList = new ArrayList < > ( ) ; while ( it . hasNext ( ) ) { setList . add ( it . next ( ) ) ; } for ( int i = 0 ; i < setList . size ( ) ; i + + ) { for ( int j = i ; j < setList . size ( ) ; j + + ) { setwise2 . add ( gcd ( setList . get ( i ) , setList . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwise2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise2 ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; int ans = aaa + bbb + ccc + ddd + eee - 10 + min ; System . out . println ( ans ) ; } } public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int flg = 0 ; for ( int j = 0 ; j < i ; j + + ) { if ( P [ i ] > P [ j ] ) { flg = 1 ; } } if ( flg = = 0 ) { count = count + 1 ; } } System . out . println ( count ) ; } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] * args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . format ( " % d " , n % k ) ; } } import java . util . * ; class Five _ Antennas { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Integer [ ] antennas = new Integer [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scan . nextInt ( ) ; } Arrays . sort ( antennas , Collections . reverseOrder ( ) ) ; int k = scan . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i ; j < 5 ; j + + ) { if ( antennas [ i ] - antennas [ j ] > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } public class Main { public static cul int ( int x ) { if ( 1 < = x & & x < = 100 ) { x = x * * 3 ; } } public static void main ( String [ ] args ) { cul ( x ) ; Sytem . out . println ( x ) ; } } import java . lang . * ; import java . io . * ; class ruhani { public static void main ( String [ ] args ) throws IOException { int A , B ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedRedaer br = new BufferedReader ( isr ) ; System . out . print ( " enter your age " ) ; A = Integer . parseInt ( br . readLine ( ) ) ; System . out . print ( " enter the cost b which is an even no " ) ; B = Integer . parseInt ( br . readLine ( ) ) ; if ( A < = 5 ) System . out . println ( " free of cost " ) ; if ( A > = 13 ) System . out . println ( " Your cost is " + B ) if ( A > = 6 & & A < = 12 ) System . out . println ( " Your cost is " + B / 2 ) } } import java . util . Scanner ; import java . util . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] K = new int [ ] ; int L = 100 ; int R = 0 ; int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { K [ i ] = sc . nextInt ( ) ; L = Math . min ( L , K [ i ] ) ; R = Math . max ( R , K [ i ] ) ; } for ( int i = L ; i < = R ; i + + ) { int tmp = 0 ; for ( int i = 0 ; i < N ; i + + ) { tmp + = ( K [ i ] - i ) * ( K [ i ] - i ) ; } ans = Math . min ( ans , tmp ) ; } System . out . print ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 | | A = = 5 & & B = 7 & & C = = 5 | | A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { Sytem . out . println ( " 入出力エラーです " ) ; } } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class ITP1 _ 1 _ B { public static void main ( String args [ ] ) { String line = " " ; try { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( ( line = bufferedReader . readLine ( ) ) ! = null ) { double volume = Math . pow ( ( double ) Integer . parseInt ( line ) , 3d ) ; System . out . println ( ( int ) volume ) ; } } catch ( IOException e ) { } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextLine ( ) ; int b = sc . nextLine ( ) ; int c = sc . nextLine ( ) ; int d = sc . nextLine ( ) ; int e = a * b ; int f = c * d ; if ( e > = f ) { System . out . println ( e ) ; } else { System . out . println ( f ) ; } } } import java . util . Scanner ; public class A { public static void Main ( String [ ] args ) { short coina ; short coinb ; short toyc ; Scanner sc = new Scanner ( System . in ) ; System . out . println ( " Coin A Coin B Toy 's price " ) ; coina = sc . nextShort ( ) ; coinb = sc . nextShort ( ) ; toyc = sc . nextShort ( ) ; if ( coina + coinb < toyc | | coina < 0 | | coinb < 0 ) { System . out . println ( " no " ) ; } else { System . out . println ( " yes " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { c ( ) ; } private void c ( ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] candies = new int [ n ] ; int res = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { candies [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n - k + 1 ; i + + ) { int left = Math . abs ( candies [ i ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int right = Math . abs ( candies [ i + k - 1 ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int tmp = Math . min ( left , right ) ; res = Math . min ( res , tmp ) ; } System . out . println ( res ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { c ( ) ; } private void c ( ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] candies = new int [ n ] ; int res = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { candies [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n - k + 1 ; i + + ) { int left = Math . abs ( candies [ i ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int right = Math . abs ( candies [ i + k - 1 ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int tmp = Math . min ( left , right ) ; res = Math . min ( res , tmp ) ; } System . out . println ( res ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } public class XCubic { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; Integer n = Integer . parseInt ( s ) ; System . out . println ( n * n * n ) ; } } import java . util . * ; public class A _ 052 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) , C = sc . nextInt ( ) , D = sc . nextInt ( ) ; int s , n ; s = A * B ; n = C * D ; if ( s > n ) { System . out . println ( s ) ; } else if ( n > s ) { System . out . println ( n ) ; } else { System . out . println ( A * B ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = S - x + y ; if ( z < = 0 & & z < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . io . * ; class ITP1 _ 1 _ B { public static void main ( String [ ] args ) throws IOException { DataInputStream d = new DataInputStream ( System . in ) ; String s = d . readLine ( ) ; int i = Integer . parseInt ( s ) ; System . out . println ( i * i * i ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 9 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = N [ i ] ; break ; } } System . out . println ( sum - 10 * count + min ) ; } } import java . util . * ; public class AtCoder04a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int AB , CD ; AB = A * B ; CD = C * D ; if ( AB > CD ) { System . out . print ( AB ) ; } else if ( AB < CD ) { System . out . print ( CD ) ; } else { System . out . print ( AB ) ; } } } public class Main { public static void main ( string args [ ] ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = in . readLine ( ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int acoin = sc . nextInt ( ) ; int bcoin = sc . nextInt ( ) ; int ccoin = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = acoin ; i + + ) { if ( i * 500 > N ) { break ; } if ( i * 500 = = N ) { count + + ; break ; } for ( int j = 0 ; j < = bcoin ; j + + ) { if ( i * 500 + j * 100 > N ) { break ; } if ( i * 500 + j * 100 = = N ) { count + + ; break ; } for ( int k = 0 ; k < = ccoin ; k + + ) { if ( i * 500 + j * 100 + k * 50 > N ) { break ; } if ( i * 500 + j * 100 + k * 50 = = N ) { count + + ; break ; } } } } System . outprintln ( count ) ; } } XCubic < ? php $ input = trim ( fgets ( STDIN ) ) ; $ ans = pow ( $ input , 3 ) ; echo $ ans ; ? > package aoj . exam ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main02 { public static void main ( String [ ] args ) { System . out . print ( " Input > > " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x ; try { x = Integer . parseInt ( reader . readLine ( ) ) ; if ( ! ( x > = 1 & & x < = 100 ) ) { throw new IllegalArgumentException ( " Please input between 1 and 100 ! " ) ; } System . out . println ( " Output > > " + ( x * x * x ) ) ; } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } public class Main { public static void main ( String args [ ] ) { int r = read ( ) ; System . out . println ( r * r ) ; } private static int read ( ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { return Integer . valueOf ( reader . readLine ( ) . trim ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; return - 1 ; } } } public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; return ; } import java . util . * ; class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = Integer . parseInt ( sc . next ( ) ) ; if ( n = = 5 ) five + + ; else if ( n = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class one { public static void main ( String [ ] args ) { int a , b , h , m ; double result ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] temp = reader . readLine ( ) . split ( " " ) ; a = Integer . parseInt ( temp [ 0 ] ) ; b = Integer . parseInt ( temp [ 1 ] ) ; h = Integer . parseInt ( temp [ 2 ] ) ; m = Integer . parseInt ( temp [ 3 ] ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } double angle = 0 ; angle = m / 60.0 * 2 * Math . PI - H / 12.0 * 2 * Math . PI ; if ( angle > = Math . PI ) { angle = 2 * Math . PI - angle ; } result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle ) ) ; System . out . println ( result ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( Integer . parseInt ( Math . pow ( x , 3 ) ) ) ; } } import java . util . * ; public class Study _ Scheduling { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int H1 = input . nextInt ( ) ; int M1 = input . nextInt ( ) ; int H2 = input . nextInt ( ) ; int M2 = input . nextInt ( ) ; int K = input . nextInt ( ) ; int remainder = 0 ; int minutes = 0 ; int hours = 0 ; if ( M2 < M1 ) { remainder = 1 ; minutes = ( M2 + 60 ) - M1 ; } else if ( M1 < M2 ) { minutes = M2 - M1 ; } hours = H2 - remainder - H1 ; int totalMinutes = ( hours * 60 ) + minutes ; System . out . println ( totalMinutes - K ) ; } } import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ; public class at1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; for ( int i = 1 ; i < = 2 ; i + + ) { int diff = a [ i ] - a [ i - 1 ] ; sum = sum + diff ; } System . out . println ( sum ) ; } } import java . util . Scanner ; public class ABC068 _ B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int i = 0 ; for ( i = 1 ; i < = n ; i = i * 2 ) { } i = i / 2 ; System . out . println ( i ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int array [ ] = new int [ 3 ] ; array [ 0 ] = a ; array [ 1 ] = b ; array [ 2 ] = c ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( array [ i ] = = 5 ) five + + ; else if ( array [ i ] = = 7 ) seven + + ; } if ( five = = 2 & & seven = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int array [ ] = new int [ 3 ] ; array [ 0 ] = a ; array [ 1 ] = b ; array [ 2 ] = c ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( array [ i ] = = 5 ) five + + ; else if ( array [ i ] = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) { int x = System . in ; void cubic ( int x ) { result = x ^ 3 ; System . out . println ( result ) ; } } } class Main { public static void main ( String args [ ] ) { int i = ( int ) Math . pow ( Integer . parseInt ( scan . next ( ) ) , 3 ) ; System . out . print ( i ) ; } } class Main { public static void main ( String [ ] args ) { x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; class abc89b { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; int n = cin . nextInt ( ) ; boolean flag [ ] = new boolean [ 1000 ] ; for ( int i = 0 ; i < 1000 ; i + + ) flag [ i ] = false ; for ( int i = 0 ; i < n ; i + + ) { String ch = cin . next ( ) ; flag [ ch . charAt ( 0 ) ] = true ; } int ans = 0 ; for ( int i = 0 ; i < 1000 ; i + + ) if ( flag [ i ] ) ans + + ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main190526 _ 2 { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; try { int age = scanner . nextInt ( ) ; int adultPrice = scanner . nextInt ( ) ; int finalPrice = - 1 ; if ( age < 5 ) finalPrice = 0 ; else if ( age < 12 ) finalPrice = adultPrice / 2 ; else finalPrice = adultPrice ; System . out . println ( finalPrice ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; } finally { scanner . close ( ) ; } } } import java . util . * ; import java . lang . * ; import java . io . * ; class pow { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; int kotae = ath p w x , 3 ) ; S y stem.out . pr i ntln ( x + " を 3 乗 し 値は " kotae " す " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int k ; List < Integer > spot = new ArrayList < > ( ) ; Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i + + ) { spot . add ( scanner . nextInt ( ) ) ; } k = scanner . nextInt ( ) ; List < Integer > tmpSpot = new ArrayList < > ( spot ) ; for ( int i = 0 ; i < 5 ; i + + ) { tmpSpot . remove ( i ) ; for ( int l : tmpSpot ) { if ( ( l - spot . get ( i ) ) > k ) { System . out . println ( " : ( " ) ; return ; } } } scanner . close ( ) ; System . out . println ( " Yay ! " ) ; } import java . util . * ; class main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N * N ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class x3 { public static void main ( String arg [ ] ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; double x = Integer . parseInt ( buf ) ; x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } import java . util . Scanner ; String tbd = " TBD " ; String heisei = " Heisei " ; Scanner inputDate = new Scanner ( System . in ) ; String [ ] splitDate = inputDate . split ( " / " , 0 ) ; int year = Integer . parseInt ( splitDate [ 0 ] ) ; int month = Integer . parseInt ( splitDate [ 1 ] ) ; int day = Integer . parseInt ( splitDate [ 2 ] ) ; if ( year < = 2018 ) return heisei ; else if ( year = = 2019 & & month < = 4 ) return heisei ; else return tbd ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextLine ( ) ; while ( true ) { if ( a . equals ( " 0 " ) ) break ; int sum = 0 ; for ( int = 1 ; i < a . lenght ( ) ; i + + ) { sum + = Character . getNumericValue ( a . charAt ( i ) ) } System . out . println ( sum ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) ; Scanner sc = new Scanner ( System . in ) ; int x = nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; ArrayList < String > array = new ArrayList < String > ( ) ; Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String s = scanner . nextString ( ) ; if ( String . valueOf ( s ) . length ( ) = = 0 ) { break ; } array . add ( s ) ; } int sz = array . size ( ) ; int n = 0 ; boolean i = false ; for ( n = 0 ; n < sz ; n + + ) { if ( " Y " = = array . get ( n ) ) i = true ; } if ( i ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; x = args [ 0 ] ; System . out . println ( " 入力した値の3乗は " + x * x * x + " です " ) ; } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( int ) Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class intro2 { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } public class TwoCoins ( ) { public static void main ( string args [ ] ) { private int coinVal ; private int coinVal2 ; private int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; } String [ ] str2 ; str2 = new String [ 2 ] ; str2 = str . split ( " " ) ; int num1 = Integer . parseInt ( str2 [ 0 ] ) ; int num2 = integer . parseInt ( str2 [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( num2 ) ; else if ( num1 > = 6 ) { System . out . println ( num2 / 2 ) ; else { System . out . println ( 0 ) ; } } } import java . io . * ; public class Power { public static void main ( String args [ ] ) { int x = 0 ; do { System . out . println ( " 0 ? ? ? 100 ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : " ) ; I n p tStreamReader isr = n w Inp tStreamReader ( Sys t em.in ) ; B u f eredReader br n w Buf eredReader ( isr ) ; t r y St r ng buf = b . ea d Line ( ) ; x = I t ger.par s eInt ( buf ) ; } c a c h ( Exc e ption e ) { x = 0 } h l e ( x < 0 | | 1 0 0 < x ) ; S y s em.out . pri n tln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y s t m.out. p rin t ln ( " ? ? ? " + Ma t h pow ( x , 3 ) + " ? ? ? ? ? § ? ? ? " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Squared { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; System . out . println ( " 値を入力してください ( このプログラムは値を3乗するものです ) 。 " ) ; int x = Integer.parseInt ( br.readLine ( ) ) ; System.out. p r i tln x x x ) ; } } import java . io . * ; import java . util . * ; public class OneCardPoker extends Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; if ( A = = B ) { System . out . println ( " Draw " ) ; } else if ( A = = 1 ) { System . out . println ( " Alice " ) ; } else if ( B = = 1 ) { System . out . println ( " Bob " ) ; } else if ( A > B ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } mport java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int n1 = stdin . nextInt ( ) ; int n2 = stdin . nextInt ( ) ; int [ ] [ ] input = new int [ n1 + 1 ] [ n2 + 1 ] ; for ( int i = 0 ; i < n1 ; i + + ) { for ( int j = 0 ; j < n2 ; j + + ) { input [ n1 ] [ n2 ] = stdin . nextInt ( ) ; } } stdin . close ( ) ; int dis = 0 ; double tmp = 0 ; int output = 0 ; for ( int i = 0 ; i < n1 ; i + + ) { for ( int j = 0 ; j < n2 ; j + + ) { for ( int k = 1 ; k < n1 ; k + + ) { tmp = tmp + Math . pow ( input [ i ] [ j ] - input [ i + k ] [ j ] , 2 ) ; } } dis = ( int ) Math . pow ( Math . sqrt ( tmp ) , 2 ) ; if ( dis = = tmp ) { output + + ; } } System . out . println ( output ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . printIn ( ans ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; } catch ( Exception e ) { } System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int v = Integer . parseInt ( line ) ; int v2 = v ; v2 * = v * v ; System . out . println ( v2 ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class B { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int y ; y = x * x * x ; System . out . println ( y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int mindex = 0 ; int sum = 0 ; int [ ] alist = { a , b , c , d , e } ; int slist [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { if ( alist [ mindex ] % 10 = = 0 | | alist [ mindex ] % 10 > alist [ i ] % 10 & & alist [ i ] % 10 ! = 0 ) { mindex = i ; } } for ( int i = 0 ; i < 5 ; i + + ) { if ( i = mindex | | alist [ i ] % 10 = = 0 ) { sum + = alist [ i ] ; } else { sum + = alist [ i ] / 10 * 10 + 10 ; } } System . out . println ( sum ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public static void Main ( String [ ] args ) { short coina ; short coinb ; short toyc ; Scanner sc = new Scanner ( System . in ) ; System . out . println ( " Coin A Coin B Toy 's price " ) ; coina = sc . nextShort ( ) ; coinb = sc . nextShort ( ) ; toyc = sc . nextShort ( ) ; if ( coina + coinb < toyc | | coina < 0 | | coinb < 0 ) { System . out . println ( " no " ) ; } else { System . out . println ( " yes " ) ; } } import java . utli . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n < = 2 ) { System . out . println ( 2 ) ; } else if ( 2 < n & & n < = 4 ) { System . out . println ( 4 ) ; } else if ( 2 < n & & n < = 8 ) { System . out . println ( 8 ) ; } else if ( 2 < n & & n < = 16 ) { System . out . println ( 16 ) ; } else if ( 2 < n & & n < = 32 ) { System . out . println ( 32 ) ; } else { System . out . println ( 64 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int ans = 0 ; boolean flag = true ; for ( int i = 0 ; i < n ; i + + ) { int tmp = p [ i ] ; for ( int j = 0 ; j < i ; j + + ) { if ( tmp > p [ j ] ) { flag = false ; break ; } } if ( flag ) ans + + ; } System . out . println ( ans ) ; } } package ABC ; import java . util . Scanner ; public class ABC055A { public static void main ( ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; System . out . println ( ( N * 800 ) - ( N / 15 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String ans ; for ( int i = 0 ; i < 2 ; i + + ) { if ( ( ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] ) = = ( c [ 1 ] [ i ] - c [ 1 ] [ i + 1 ] ) ) & & ( ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] ) = = ( c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] ) ) ) { ans = " Yes " ; } else { ans = " No " ; } } System . out . println ( ans ) ; } } import java . io . * ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { int x , x _ 3 ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; x _ 3 = x * x * x ; System . out . println ( " x ^ 3 = " + x _ 3 ) ; } } package AtCoderBegineerContest087 ; import java . util . Scanner ; public class Main087A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = 6000 ; int maxA = 30 ; int maxB = 40 ; int maxC = 50 ; int count = 0 ; for ( int numA = 0 ; numA < = maxA ; numA + + ) { for ( int numB = 0 ; numB < = maxB ; numB + + ) { int numC = ( x - 500 * numA - 100 * numB ) / 50 ; if ( maxC > = numC & & numC > = 0 ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class A103 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] li = new int [ 3 ] ; li [ 0 ] = sc . nextInt ( ) ; li [ 1 ] = sc . nextInt ( ) ; li [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( li ) ; int i = ( li [ 2 ] - li [ 1 ] ) + ( li [ 1 ] - li [ 0 ] ) ; System . out . println ( i ) ; } } import lib . Input ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . paseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . * ; public class Xcube { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readline ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . util . Scanner ; import java . lang . math ; class Main { public static void main ( String [ ] arsg ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = { a , b , c , d , e } ; String ans = " Yay ! " ; for ( int i = 0 ; i < l ; i + + ) { for ( int x = 1 ; x < l - 1 ; x + + ) { if ( math . abs ( l [ i ] - l [ x ] ) > k ) { ans = " : ( " ; break out ; } } } out : System . out . println ( ans ) ; } } import java . util . * ; public class example { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; } else { long m = 12 / N + 1 ; int n = 1 ; int mlcm = 1 ; for ( int i = 0 ; i < m ; i + + ) n * = 10 ; for ( int i = 1 ; i < n + 1 ; i + + ) { if ( P % ( Math . pow ( i , N ) ) = = 0 ) { mlcm = i ; } } System . out . println ( mlcm ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; List < Integer > sums = new ArrayList ( ) ; for ( ; ; ) { String num = scan . nextLine ( ) ; if ( num . equals ( " 0 " ) ) { break ; } int sum = 0 ; for ( int i = 0 ; i < num . length ( ) ; i + + ) { char n = num . charAt ( i ) ; sum + = Character . getNumericValue ( n ) ; } sums . add ( sum ) ; } for ( int m : sums ) { System . out . println ( m ) ; } } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( a = = b ) { if ( a = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } else if ( a = = c ) { if ( a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } else if ( b = = c ) { if ( b = = 5 & & a = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } class Main { public static void main ( String [ ] args ) { int r = ( int ) new Scanner ( System . in ) . nextLine ( ) ; int r2 = r * r ; System . out . println ( r2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; System . out . println ( floor ( average ( x , y ) ) ) ; } private float average ( int x , int y ) { return ( x + y ) / 2 ; } private int floor ( float z ) { return Math . floor ( z ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int sum = 0 ; sum = x * x * x ; System . out . println ( sum ) ; } } public class Main ( ) { public integer cube ( int x ) { return x * x * x ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int p = scanner . next ( ) ; System . out . println ( cube ( p ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int ans = a + b + c + d + e ; int A = 10 - a % 10 ; if ( A = = 10 ) { A = = 0 ; } int B = 10 - b % 10 ; if ( B = = 10 ) { B = = 0 ; } int C = 10 - c % 10 ; if ( C = = 10 ) { C = = 0 ; } int D = 10 - d % 10 ; if ( D = = 10 ) { D = = 0 ; } int E = 10 - e % 10 ; if ( E = = 10 ) { E = = 0 ; } ans + = A + B + C + D + E ; ans - = Math . max ( A , Math . max ( b , Math . max ( c , Math . max ( d , e ) ) ) ) ; System . out . println ( ans ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( x * x * x ) if ( x > = 2 & & x < = 100 ) { System . out . println ( y ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . util . Scanner ; public class ITP11B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; int i = Integer . parseInt ( input ) ; System . out . println ( i * i * i ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int n [ ] = new int [ 4 ] ; String m ; int p = 0 ; for ( int i = 0 ; i < N ; i + + ) { m = sc . next ( ) ; if ( m = = " P " ) n [ 0 ] + + ; if ( m = = " G " ) n [ 1 ] + + ; if ( m = = " W " ) n [ 2 ] + + ; if ( m = = " Y " ) n [ 3 ] + + ; } for ( int k = 0 ; k < 4 ; k + + ) if ( n [ k ] > 0 ) p + + ; if ( p = = 3 ) { System . out . println ( " three " ) ; } else if ( p = = 4 ) { System . out . println ( " four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = 1 ) { a = 14 ; } if ( b = = 1 ) { b = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( A = = B ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . util . Scanner ; public class RB91A { int a , b ; int cost ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; cost = sc . nextInt ( ) ; if ( a + b < = cost ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static void main ( String [ ] args ) { new RB91A ( ) . solve ( ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Sub { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long v = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long w = sc . nextLong ( ) ; long t = sc . nextLong ( ) ; for ( int i = 0 ; i < t ; i + + ) { a = a + v ; b = b + w ; if ( a = = b ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( x [ j ] x [ i ] - x [ i ] x [ i ] ) * ( x [ j ] x [ i ] - x [ i ] x [ i ] ) ; } if ( Math . sqrt ( sum ) = = int ( Math . sqrt ( sum ) ) ) { counter + + ; } } } } } import java . util . * ; class Main { public static void main ( Strimg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , C = sc . nextInt ( ) ; if ( A + B > = C ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class BBBBBBBBBB { public static void main ( String [ ] args ) { long x , bal1 , bal2 , bal3 , ans , kk ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 0 ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { bal1 = a [ i ] ; bal2 = 0 ; bal3 = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = ( ( i - k ) + n ) % n ; if ( pi = = 0 ) pi = n ; if ( bal1 > a [ pi ] + ( ( long ) k ) * x ) { bal1 = a [ pi ] + ( k ) * x ; bal2 = k ; bal3 = a [ pi ] ; } } if ( bal2 > kk ) kk = bal2 ; ans + = bal3 ; } System . out . println ( ans + ( kk ) * x ) ; } } import java . util . Scanner ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } package atCoder01 ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double avarage = Math . ceil ( ( a + b ) / 2 ) ; System . out . println ( avarage ) ; } import java . io * ; class Main { publi static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputSteamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . pareInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class BinaryConversion { public static long [ ] decimalToBinary ( long num ) { long [ ] a = new long [ 60 ] ; int i = a . length - 1 ; while ( num ! = 0 ) { a [ i ] = num % 2 ; num / = 2 ; i -- ; } return a ; } public static long binaryToDecimal ( long [ ] a ) { long num = 0 ; for ( int i = 0 ; i < a . length ; i + + ) { num + = ( a [ i ] * Math . pow ( 2 , a . length - 1 - i ) ) ; } return num ; } } public class XOR { public static long [ ] xor ( long num1 , long num2 ) { long [ ] a = BinaryConversion . decimalToBinary ( num1 ) ; long [ ] b = BinaryConversion . decimalToBinary ( num2 ) ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = ( a [ i ] + b [ i ] ) % 2 ; } return a ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] num = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { num [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < num . length - 1 ; i + + ) { for ( int j = i + 1 ; j < num . length ; j + + ) { long [ ] temp = XOR . xor ( num [ i ] , num [ j ] ) ; sum + = BinaryConversion . binaryToDecimal ( temp ) ; } } sum % = ( Math . pow ( 10 , 9 ) + 7 ) ; System . out . println ( sum ) ; } } public class XCubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int inputIum = scan . nextInt ( ) ; System . out . println ( calCubic ( inputIum ) ) ; } private static long calCubic ( int inputIum ) { return inputIum * inputIum * inputIum ; } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( scan . hasNext ( ) ) { double [ ] x = new double [ 3 ] ; double [ ] y = new double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = scan . nextDouble ( ) ; y [ i ] = scan . nextdouble ( ) ; } double xp = scan . nextDouble ( ) ; double yp = scan . nextDouble ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = x [ i ] - xp ; y [ i ] = y [ i ] - yp ; } double [ ] gaiseki = new double [ 3 ] ; gaiseki [ 0 ] = x [ 0 ] * y [ 1 ] - y [ 0 ] * x [ 1 ] ; gaiseki [ 1 ] = x [ 1 ] * y [ 2 ] - y [ 2 ] * x [ 1 ] ; gaiseki [ 2 ] = x [ 2 ] * y [ 0 ] - y [ 2 ] * x [ 0 ] ; int plus = 0 ; int minus = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( gaiseki [ i ] > 0 ) plus + + ; if ( gaiseki [ i ] < 0 ) minus + + ; } String ans = " NO " ; if ( plus = = 3 | | minus = = 3 ) ans = " YES " ; System . out . printf ( " % s \ n " , ans ) ; } } } import java . util . Scanner ; public class TwoRectangles { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) , b = sc . nextLong ( ) ; long c = sc . nextLong ( ) , d = sc . nextLong ( ) ; System . out . println ( Math . max ( a * b , c * d ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextint ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } public class main { public static void main ( String [ ] args ) { int x ; int kekka ; x = 2 ; kekka = x * x ; System . out . println ( kekka ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int input _ number = scanner . nextInt ( ) ; System . out . println ( input _ number * input _ number * input _ number ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; System . out . println ( k * k * k ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long n = scan . nextLong ( ) , total = 1 ; long ar [ ] = new long [ n ] ; if ( n = = 1 ) { System . out . println ( total ) ; } else { for ( int i = 1 ; i < n ; i + + ) { if ( ar [ i - 1 ] > ar [ i ] ) { total + = 1 ; } } System . out . println ( total ) ; } } } Public class main { Public static void main { int x ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int i = s . nextInt ( ) ; System . out . println ( i * i * i ) ; } } package syokora _ p ; import java . util . Scanner ; public class MMM { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ABC087 _ B { public static void main ( String [ ] args ) { int a , b , c , x ; int output = 0 ; int i , j , k ; Scanner scan = new Scanner ( System . in ) ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; c = scan . nextInt ( ) ; x = scan . nextInt ( ) ; for ( i = 0 ; i < = a ; i + + ) { for ( j = 0 ; j < = b ; j + + ) { for ( k = 0 ; k < = c ; k + + ) { if ( 500 * i + 100 * j + k * 50 = = x ) { output + + ; } } } } System . out . println ( output ) ; } } public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; String b = scan . next ( ) ; String c = scan . next ( ) ; int ab [ ] = new int [ 3 ] ; ab [ 0 ] = Integer . valueOf ( a ) . intValue ( ) ; ab [ 1 ] = Integer . valueOf ( b ) . intValue ( ) ; ab [ 2 ] = Integer . valueOf ( c ) . intValue ( ) ; Arrays . sort ( ab ) ; if ( ab [ 0 ] = = 5 & & ab [ 1 ] = = 5 & & ab [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) } } public class aoj _ 1B { public static void main ( String [ ] args ) { double a = 2d ; double b = 3d ; double ans = Math . pow ( a , b ) ; System . out . println ( " ans " ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( ( a = = 5 ) & & ( b = = 5 ) & & ( c = = 7 ) ) { System . out . println ( " yes " ) ; } else if ( ( a = = 5 ) & & ( b = = 7 ) & & ( c = = 5 ) ) { System . out . println ( " yes " ) ; } else if ( ( a = = 7 ) & & ( b = = 5 ) & & ( c = = 5 ) ) { System . out . println ( " yes " ) ; } else { System . out . println ( " No " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; int ans = Math . pow ( x , 3 ) ; System . out . println ( ans ) ; } } import java . lang . Math ; class Test { public static void main ( String [ ] args ) ? ? ? throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Squared { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ABC123b { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double c = sc . nextInt ( ) ; double d = sc . nextInt ( ) ; double e = sc . nextInt ( ) ; double min = 0 ; double a1 = a / 10 ; a1 = Math . ceil ( a1 ) ; double b1 = b / 10 ; b1 = Math . ceil ( b1 ) ; double c1 = c / 10 ; c1 = Math . ceil ( c1 ) ; double d1 = d / 10 ; d1 = Math . ceil ( d1 ) ; double e1 = e / 10 ; e1 = Math . ceil ( e1 ) ; double sum = a1 + b1 + c1 + d1 + e1 ; min = a % 10 ; if ( min > b % 10 & & b % 10 ! = 0 ) { min = b % 10 ; } if ( min > c % 10 & & c % 10 ! = 0 ) { min = c % 10 ; } if ( min > d % 10 & & d % 10 ! = 0 ) { min = d % 10 ; } if ( min > e % 10 & & e % 10 ! = 0 ) { min = e % 10 ; } sum = ( sum * 10 ) - 10 + min ; System . out . println ( ( int ) sum ) ; } } public void 1 _ 1 _ B ( ) { int x = input ( ) ; print ( x * x * ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { int a = Integer . parseInt ( args [ 0 ] ) System . out . println ( a * a * a ) ; } } import java . util . Map ; import java . util . TreeMap ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < Integer , int [ ] > sortup = new TreeMap < > ( ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int [ ] ans = new int [ M ] ; for ( int i = 0 ; i < M ; i + + ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] c = new int [ 2 ] ; c [ 0 ] = a ; c [ 1 ] = i ; sortup . put ( b , c ) ; } for ( int key : sortup . keySet ( ) ) { System . out . println ( key ) ; int [ ] c = sortup . get ( key ) ; ans [ c [ 1 ] ] = String . format ( " % 06d % 06d " , c [ 0 ] , + + P [ c [ 0 ] - 1 ] ) ; } for ( int i = 0 ; i < M ; i + + ) { System . out . println ( ans [ i ] ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ab = a * b ; int cd = c * d ; if ( ab > cd ) { System . out . println ( ab ) ; } else if ( ab = = cd ) { System . out . println ( ab ) ; } else if ( ab < cd ) { System . out . println ( cd ) ; } } } public class main { public static void main ( String [ ] args ) { int x ; x = 2 ; for ( int count = 0 ; count < 2 ; count + + ) { x = x * 2 ; } System . out . println ( x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = input . readLine ( ) ; System . out . println ( x ) } } import java . lang . Math ; class Test { public static void main ( String [ ] args ) throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; HashMap < Integer , int [ ] > map = new HashMap < > ( ) ; ArrayList < Pair > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { int [ ] array = new int [ Integer . MAX _ VALUE ] ; map . put ( i + 1 , array ) ; } for ( int i = 0 ; i < m ; i + + ) { int p = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; list . add ( new Pair ( p , y ) ) ; int [ ] a = map . get ( p ) ; a [ y ] + + ; map . put ( p , a ) ; } for ( int i = 0 ; i < n ; i + + ) { int num = 1 ; int [ ] a = map . get ( i + 1 ) ; for ( int j = 0 ; j < a . length ; j + + ) { if ( a [ j ] = = 1 ) { a [ j ] = num ; num + + ; } } } for ( Pair pair : list ) { int p = pair . p ; int y = pair . y ; int order = map . get ( p ) [ y ] ; System . out . println ( String . format ( " % 06d " , p ) + String . format ( " % 06d " , order ) ) ; } } static class Pair { int p ; int y ; Pair ( int p , int y ) { this . p = p ; this . y = y ; } } } public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder builder = new StringBuilder ( ) ; String line ; int count = 0 ; while ( ( line = reader . readLine ( ) ) ! = null ) { Pattern pattern = Pattern . compile ( " ( [ 0-9 ] + ) " ) ; Matcher matcher = pattern . matcher ( line ) ; while ( matcher . find ( ) ) { count + = Integer . parseInt ( matcher . group ( ) ) ; } } System . out . println ( count ) ; } } inport java . until . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x \ n ; System . out . println ( answer ) ; } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( sc . nextInt ( ) = = 7 ) { sevenCounter + + ; } else { fiveCounter + + ; } } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } class Main { public static void main ( String [ ] args ) { int x = 2 x = x ^ 3 System . out . print ( x ) } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextFloat ( ) ; long b = sc . nextInt ( ) ; long c = sc . nextFloat ( ) ; long d = sc . nextInt ( ) ; long n = sc . nextInt ( ) ; for ( long i = 0 ; i < n ; i + + ) { a + = b ; c + = d ; } if ( c > = a ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } package start ; import java . util . Scanner ; public class Input { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + a * a * a + ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String strInput r . readLine ( ) ; int intInputData strInput . parseInt ( ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner = std new Scanner ( System . in ) ; int n = std . nextInt ( ) ; System . out . println ( math . pow ( n , 3 ) ) ; } } import java . util . Scanner ; class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int inputNum = Integer . parseInt ( str ) ; int intNum = inputNum * inputNum * inputNum ; System . out . println ( intNum ) ; } import java . util . Scanner ; public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int fiv = 0 ; int sev = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; switch ( num ) { case 5 : fiv + + ; break ; case 7 : sev + + ; break ; } } if ( fiv = = 2 & & sev = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " no " ) ; } } } import java . util . ArrayList ; import java . util . Scanner ; public class AA { static Scanner sc = new Scanner ( System . in ) ; static ArrayList < Integer > IntList = new ArrayList < Integer > ( ) ; static ArrayList < String > StrList = new ArrayList < String > ( ) ; public static void main ( String [ ] args ) { int ans1 = sc . nextInt ( ) ; int ans2 = sc . nextInt ( ) ; int ans3 = sc . nextInt ( ) ; int ans4 = sc . nextInt ( ) ; int ans5 = sc . nextInt ( ) ; int cont = 0 ; int a = ans3 - ans1 ; int ans = a * 60 ; int sum = ans - ans2 - ans4 - ans5 ; System . out . println ( sum ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws IOException { BufferedReader br = new BfferedReader ( new InputStreamReader ( System . in ) ) ; String line = " " ; int count = 0 ; while ( ( line = br . readLine ( ) ) ! = null ) { int a = 0 ; boolean f = false ; for ( int i = 0 ; i < line . length ( ) ; i + + ) { f = false ; if ( line . charAt ( i ) > = ' 0' & & line . charAt ( i ) < = ' 9' ) { a = a * 10 + ( int ) ( line . charAt ( i ) - ' 0' ) ; f = true ; } if ( ! f ) { count + = a ; a = 0 ; } } } System . out . println ( count ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input _ text = scanner . nextLine ( ) ; int r = Integer . parseInt ( input _ text ) ; System . out . println ( r * r ) ; scanner . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class ITP1 _ 1 _ B { public static void main ( String args [ ] ) { String line = " " ; try { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( ( line = bufferedReader . readLine ( ) ) ! = null ) { double volume = Math . pow ( ( double ) Integer . parseInt ( line ) , 3d ) ; System . out . println ( ( int ) volume ) ; } } catch ( IOException e ) { } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cntdif = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList < int > bigger = new ArrayList < int > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( A [ j ] - B [ j ] < 0 ) { difsum + = A [ j ] - B [ j ] ; cnt + + ; } else if ( A [ j ] - B [ j ] > 0 ) { bigger . add ( A [ j ] - B [ j ] ) ; } } int big [ ] = bigger . toArray ( new int [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < big . length ; k + + ) { for ( int l = 0 ; l < big . length - k - 1 ; l + + ) { if ( big [ l ] > big [ l + 1 ] ) { temp = big [ l ] ; big [ l ] = big [ l + 1 ] ; big [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = big [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; double ans = ( double ) pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ( int ) ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . printf ( answer ) ; System . out . printf ( \ n ) ; } } class Circle { public static void main ( String [ ] args ) { int r = 5 ; int ratio = r * r ; System . out . println ( ratio ) ; } } int main ( ) { Scanner sc = new Scanner ( System . in ) ; int a ; int b ; while ( true ) { if ( ! sc . hasNext ( ) ) break ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; System . out . println ( a + b ) ; } return 0 ; } # include < cstdio > # include < iostream > # include < cstring > using namespace std ; int main ( ) { string s ; while ( 1 ) { cin > > s ; if ( s = = " 0 " ) break ; int sum = 0 ; for ( char c : s ) sum + = c - ' 0' ; cout < < sum < < endl ; } return 0 ; } public class Main { public static void main ( String [ ] args ) { int x ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ) ; } } import java . util . Scanner ; public class Main { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; b = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { b * = a ; } ; System . out . println ( b ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long sum = 0 ; long minus = 0 ; int C _ minus = 0 ; for ( int i = 0 ; i < N ; i + + ) { long Ai = sc . nextLong ( ) ; A [ i ] = Ai ; C [ i ] = Ai ; } for ( int i = 0 ; i < N ; i + + ) { long Bi = sc . nextLong ( ) ; B [ i ] = Bi ; C [ i ] = C [ i ] - Bi ; sum + = C [ i ] ; if ( C [ i ] < 0 ) { C _ minus + + ; minus + = C [ i ] ; } } if ( C _ minus = 0 ) { System . out . println ( 0 ) ; } else if ( sum < 0 ) { System . out . println ( - 1 ) ; } else { int answer = 0 ; Arrays . sort ( C ) ; for ( int i = C . length - 1 ; i > = 0 ; i -- ) { minus + = C [ i ] ; if ( minus > 0 ) { answer = C . length - 1 - i + 1 ; break ; } } answer + = C _ minus ; System . out . println ( answer ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = Integer . parseInt ( in . nextLine ( ) ) ; int mealPrice = 800 ; int discount = 200 ; int discountPoint = 15 ; int x = n * mealPrice ; int y = ( n / discountPoint ) * discount ; System . out . println ( x - y ) ; } import java . util . Scanner ; public class atcoder1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans ; if ( a < 6 ) ans = 0 ; else if ( a > = 6 & & a < = 12 ) ans = b / 2 ; else ans = b ; 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 ( ) ; boolean P = false , W = false , G = false , Y = false ; String S = sc . next ( ) ; ; for ( int i = 1 ; i < n ; i + + ) { if ( S . equals ( " P " ) ) P = true ; else if ( S . equals ( " W " ) ) W = true ; else if ( S . equals ( " G " ) ) G = true ; else if ( S . equals ( " Y " ) ) Y = true ; } if ( W & & G & & Y ) { if ( P ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; } } } public class Main { public static void main ( string [ ] args ) { int x ; x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = N1 [ i ] ; break ; } } if ( count = = 5 ) count = = 4 ; System . out . println ( sum - 10 * count + min ) ; } class Main { public static void main ( String args [ ] ) { int x = 3 ; if ( x > = 1 & & x < = 100 ) { int y = x * x * x ; } System . out . println ( y ) ; } } import java . util . * ; class Study _ Scheduling { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int H1 = input . nextInt ( ) ; int M1 = input . nextInt ( ) ; int H2 = input . nextInt ( ) ; int M2 = input . nextInt ( ) ; int K = input . nextInt ( ) ; int remainder = 0 ; int minutes = 0 ; int hours = 0 ; if ( M2 < M1 ) { remainder = 1 ; minutes = ( M2 + 60 ) - M1 ; } else if ( M1 < M2 ) { minutes = M2 - M1 ; } hours = H2 - remainder - H1 ; int totalMinutes = ( hours * 60 ) + minutes ; System . out . println ( totalMinutes - K ) ; } } class Main { public static void main ( String args [ ] ) { int x ; System . out . read ( x ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder data = new StringBuilder ( ) ; while ( true ) { int sum = 0 ; String str = br . readLine ( ) ; int strsize = str . length ( ) ; if ( str . equals ( " 0 " ) ) break ; else if ( strsize > = 1 ) { int i = 0 ; while ( i < strsize ) { sum + = Integer . parseInt ( String . valueOf ( str . charAt ( i ) ) ) ; i + + ; } } data . append ( sum ) . append ( " \ n " ) ; } System . out . println ( data ) ; } public class Main { public static void main ( String [ ] args ) { Optional < String > input = Optional . of ( args [ 0 ] ) ; long x = Integer . parseInt ( input . orElse ( " 0 " ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { String line = null ; int num = 0 ; Scanner sc = null ; try { sc = new Scanner ( System . in ) ; do { line = sc . nextLine ( ) ; char [ ] work = line . toCharArray ( ) ; for ( int i = 0 ; i < work . length ; i + + ) { num + = Character . getNumericValue ( work [ i ] ) ; } if ( num ! = 0 ) { System . out . println ( num ) ; } num = 0 ; } while ( ! line . equals ( " 0 " ) ) ; } finally { sc . close ( ) ; } } class Main { public static void main ( String [ ] a ) { int x = 0 , a = 3 ; Scanner input = new Scanner ( System . in ) : x = input . nextInt ( ) ; int c = ( int ) Math . pow ( x , b ) ; System . out . println ( c ) ; } } class Main { public static void main ( String [ ] args ) { int intInputData = System . in . read ( ) ; int intResult = intInputData ^ 3 ; System . out . println ( intResult . toString ( ) ) ; } } public class Main { public static void main ( String [ ] args ) { int x = x ^ 3 ; System . out . println ( x ) ; } } class Main { public static void main ( String [ ] args ) { int x = System . in ( ) int y = x * x * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Mofu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int mofu [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { mofu [ i ] = scan . nextInt ( ) ; } int maxmofu = mofu [ 0 ] ; int minmofu = mofu [ 0 ] ; for ( int i = 1 ; i < 3 ; i + + ) { if ( maxmofu < mofu [ i ] ) { maxmofu = mofu [ i ] ; } if ( minmofu > mofu [ i ] ) { minmofu = mofu [ i ] ; } } System . out . println ( " 合計コストは " + ( maxmofu i nmofu ) です 。 " ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int wkInt = sc . nextInt ( ) ; System . out . println ( wkInt * wkInt * wkInt ) ; } } class main { public static void main ( Strings arg [ ] ) { int i ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; i = x * x * x ; System . out . println ( i ) ; } import java . util . Scanner ; public class main { static int N , M ; static int [ ] arr ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; arr = new int [ N ] ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; arr [ P - 1 ] + + ; } for ( int i = 0 ; i < arr . length ; i + + ) { for ( int j = 0 ; j < arr [ i ] ; j + + ) { String id1 = String . format ( " % 06d " , i + 1 ) ; String id2 = String . format ( " % 06d " , j + 1 ) ; System . out . println ( id1 + id2 ) ; } } } } package main . task168 ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . Scanner ; public class B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int H = in . nextInt ( ) ; int M = in . nextInt ( ) ; double red = Math . PI * 2 * ( H / 12.0 + ( M / 60 ) / 12.0 - ( M / 60 ) ) ; double rsq = ( A * A + B * B ) - ( 2 * A * B ) * Math . cos ( red ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } import java . util . Scanner ; pubulic class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = A ; i + + ) { for ( int j = 0 ; j < = B ; j + + ) { for ( int k = 0 ; k < = C ; k + + ) { if ( 500 * i + 100 * j + 50 * k = = X ) { ans + + ; } } } } System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . printIn ( ans ) ; } } class public { public static void main ( Stirng args [ ] ) throws IOException { int a = 2 ; System . out . printlin ( math . pow ( a , 3 ) ) ; } } package app ; import java . util . * ; public class App { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { System . out . println ( i + " 文字目を入力してください " ) ; a [ i ] = sc.nextInt ( ) ; } n t f v = 0 ; int s e v n = 0 for i t = ; i < a l n g h ; i + + ) f a [ ] = = 5 ) { f i e + + ; e l s e i ( a i ] = 7 ) { s v n + + ; } } i f ( iv = = 2 & & se v n = 1 ) { Sy te . ut print n ( Y E S ) ; } e l se { System . o ut. p r i t n ( " N " ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = ndew Scanner ( System . in ) ; int x = Integer . parseInt ( in . next ( ) ) ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { int wkInt ; wkInt = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( wkInt * wkInt * wkInt ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int inputNum = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( inputNum * inputNum * inputNum ) ; } } class Main { public static void main ( String [ ] args ) { int x = new ( ) ; System . out . println ( x ^ 3 ) ; } } # include < iostream > # include < string > using namespace std ; string s ; int main ( ) { cout < < s < < endl ; while ( s ! = " 0 " ) { cin > > s ; int ans = 0 ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { ans + = s [ i ] - ' 0' ; } cout < < ans < < endl ; } } import java . util . Scanner class Main { public static void Main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int x = Integer . parseInt ( sc . nextLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; class Rp1ABC091A { public static void main ( String args [ ] ) { int A ; int B ; int C ; Scanner sc = new Scanner ( System . in ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; if ( A + B > = C ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; + + k ) { long val + = ( arr [ j ] [ k ] - arr [ i ] [ k ] ) * ( arr [ j ] [ k ] - arr [ i ] [ k ] ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) * ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) ) ; } if ( Math . sqrt ( sum ) = = ( int ) ( Math . sqrt ( sum ) ) ) { counter + + ; } } } System . out . print ( counter ) ; } } public class Test01 { public static void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = new sc . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; i < n ; j + + ) { sum + = Math . sqrt ( 1.0 * ( x [ j ] - x [ i ] ) * ( x [ j ] - x [ i ] ) + ( y [ j ] - y [ i ] ) * ( y [ j ] - y [ i ] ) ) ; } } System . out . println ( sum * 2 / n ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; Syste . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { String strNum = null ; int x = 0 ; try { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; ufferedReader nsLine ew ufferedReader ( n ew nputStreamReader ( S ystem. i n ) ) ; trNum nsLine. r eadLine ( ) ; nteger. p arseInt ( s trNum ) ; f x = 1 & = 00 ) ystem. o ut. p rintln ( x ) ; e lse { ystem. o ut. p rintln ( " ? ? \ ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } c t ch ( I E xception e ) { y tem.ou t .pr i ntln ( e ) ; } c t ch ( N m berFormatException e2 { y tem.ou t .pr i ntln ( e2 ) ; } import java . util . Scanner ; public class EjerC { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] nums = sc . nextLine ( ) . split ( " " ) ; int cont = 1 ; int bump = Integer . parseInt ( nums [ 0 ] ) ; for ( int i = 1 ; i < nums . length ; i + + ) { if ( Integer . parseInt ( nums [ i ] ) < bump ) { bump = Integer . parseInt ( nums [ i ] ) ; cont + + ; } } System . out . println ( cont ) ; } } class Main { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int x = kb . nextInt ( ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = x * x * x System . out . println ( 1 ? ? ? x ? ? ? 100 ) ; } } # include < iostream > using namespace std ; int main ( ) { int a , b , x , y ; cin > > a > > b ; x = a * b ; y = 2 * ( a + b ) ; cout < < x < < endl ; cout < < y < < endl ; return 0 ; } public class index { public static void main ( Stirng [ ] args ) { INT A , B , C ; while ( 1 ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; A = new String ( in . readLine ( ) ) ; if ( A = = 5 & & A = = 7 ) { B = new String ( in . readLine ( ) ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } C = new String ( in . readLine ( ) ) ; if ( A + B + C = = 17 ) { System . outprintln ( " Yes ! " ) ; } else { break ; } } } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( Math . pow ( ( double ) x , 3d ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; if ( ( a - 5 ) * ( b - 5 ) * ( c - 7 ) = = 0 | | ( a - 5 ) * ( b - 7 ) * ( c - 5 ) = = 0 | | ( a - 7 ) * ( b - 5 ) * ( c - 5 ) = = 0 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int z = 0 ; for ( int i = 0 ; A = = X ; i + + ) { z = z + i ; } for ( int j = 0 ; B = = X ; j + + ) { z = z + j ; } for ( int k = 0 ; C = = X ; k + + ) { z = z + k ; } System . out . print ( z ) ; } } public class ITP1 _ 1B { public static void main ( String [ ] args ) { for ( double i = 1 ; i < = 100 ; i + + ) { Math . pow ( i , 3 ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; for ( int i = 1 ; i < = 100 ; i + + ) { i = x ; System . out . println ( i * i * i ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( ) int i = x ^ 3 ; System . out . println ( i ) ; } } import java . util . Scanner ; class team _ formation1 _ b { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( ( n + m ) > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) } } import java . util . * ; class A { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; if ( n [ 0 ] ! = 1 & & n [ 1 ] ! = 4 & & n [ 2 ] ! = 7 & & n [ 3 ] ! = 9 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . priintln ( r * r ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int stnum ; double weight , height , BMI ; String data , datap [ ] ; while ( scan . hasNext ( ) ) { data = scan . next ( ) ; datap = data . split ( " , " , 3 ) ; stnum = Integer . valueOf ( datap [ 0 ] ) ; weight = Double . valueOf ( datap [ 1 ] ) ; height = Double . valueOf ( datap [ 2 ] ) ; BMI = ( weight ) / ( height * height ) ; if ( BMI > = 25.0 ) System . out . println ( stnum ) ; } } } import java . io . * ; class Main { public static void main ( ) { int a , b , c ; String buf ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; a = Integer . parseInt ( buf ) ; buf = br . readLine ( ) ; b = Integer . parseInt ( buf ) ; buf = br . readLine ( ) ; c = Integer . parseInt ( buf ) ; String s1 = a + b + c ; if ( s = = 557 | | s = = 575 | | s = = 755 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int [ ] [ ] matrix = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int a [ 0 ] = 0 ; int b [ 0 ] = matrix [ 0 ] [ 0 ] - a1 ; int b [ 1 ] = matrix [ 0 ] [ 1 ] - a1 ; int b [ 2 ] = matrix [ 0 ] [ 2 ] - a1 ; int a [ 1 ] = matrix [ 1 ] [ 0 ] - b1 ; int a [ 2 ] = matrix [ 2 ] [ 0 ] - b1 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( matrix [ i ] [ j ] ! = a [ i ] + b [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { int X ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; X = sc . nextInt ( ) ; System . out . println ( X * X * X ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextInt ( ) ; String b = sc . nextInt ( ) ; String c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main3 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = s . nextInt ( ) ; } int c = 0 ; for ( int i = 0 ; i < n ; i + + ) { boolean f = true ; for ( int j = 0 ; j < = i ; j + + ) { if ( a [ i ] > a [ j ] ) { f = false ; break ; } } if ( f ) c + + ; } System . out . println ( c ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( args [ 0 ] ^ 3 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner snanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( A * B * C = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( Strings [ ] args ) { int x ; x = 2 ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; long sum _ N = 1 ; long sum _ M = 1 ; long ans = 0 ; int n _ m = Math . abs ( N - M ) ; if ( n _ m < 2 ) { for ( long i = N ; i < = 0 ; i -- ) { sum _ N * = i ; } for ( long j = M ; j < = 0 ; j -- ) { sum _ M * = j ; } if ( n _ m = = 0 ) { ans = sum _ N * sum _ M * 2 ; } else { ans = sum _ N * sum _ M ; } } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . next ( ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . IO . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( " 入出力エラーです " ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x * ) ; } } import java . util . Arrays ; import java . util . * ; public class main { private static Scanner sc = new Scanner ( System . in ) ; static double xp , yp ; public static void main ( String [ ] args ) { while ( sc . hasNextDouble ( ) ) { double xm [ ] = new double [ 3 ] ; double ym [ ] = new double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { xm [ i ] = sc . nextDouble ( ) ; ym [ i ] = sc . nextDouble ( ) ; } xp = sc . nextDouble ( ) ; yp = sc . nextDouble ( ) ; Arrays . sort ( xm ) ; Arrays . sort ( ym ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( xm [ i ] = = xp & & ym [ i ] = = yp ) break ; } if ( xm [ 0 ] < xp & & xm [ 2 ] > xp & & ym [ 0 ] < yp & & ym [ 2 ] > yp ) { System . out . println ( " Yes " ) ; } else { mm ( ) ; } } } private static void mm ( ) { System . out . println ( " No " ) ; } } public class Main { public static void main ( String args [ ] ) { int x > = 1 & & x < = 100 ; int y = x * x * x ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { public static void main ( String args [ ] ) { int a = 3 ; int x = 7 ; int num = Math . pow ( a , x ) ; System . out . println ( Math . pow ( a , x ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b < = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; int x , cube ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] argas ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int count = 0 ; if ( a [ 0 ] = = 1 ) count + + ; if ( a [ 1 ] = = 1 ) count + + ; if ( a [ 2 ] = = 1 ) count + + ; System . out . println ( count ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String strInput = r . readLine ( ) ; int intInputData = Integer . parseInt ( strInput ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } public class Main { public static void main ( String [ ] args ) { int = 3 ; int = x ; System . out . println ( 3 * x ) ; } } import java . util . * ; public class Main { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; HashMap < Integer , Arraylist < Integer > > h = new HashMap < Integer , Arraylist < Integer > > ( ) ; Hashmap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( ! h . containkey ( P ) ) { h . put ( P , new ArrayList < Integer > ( ) ) ; } h . get ( P ) . add ( Y ) ; hm . put ( Y , i ) ; } for ( int key : h . keyset ( ) ) { Collection . sort ( h . keyset ( ) ) ; } String [ ] ans = new String [ M ] ; for ( int key : h . keyset ( ) ) { string first = key + " " ; for ( int i = 0 ; i < 6 - ( key + " " ) . length ; i + + ) { first = " 0 " + first ; } for ( int i = 0 ; i < h . get ( key ) . size ; i + + ) { int ind = hm . get ( h . get ( key ) . get ( i ) ) ; String second = ( i + 1 ) + " " ; for ( int j = 0 ; j < 6 - ( ( i - 1 ) + " " ) . size ; j + + ) { second = " 0 " + second ; } ans [ ind ] = first + second ; } } for ( an : ans ) { System . out . println ( an ) ; } } } } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BuffreredReader br = new BufferedReader ( is ) ; int i = br . readLine ( ) ; int j = i * i ; j = j * j System . out . println ( " + j + " ) ; } } import java . util . * ; import java . text . * ; public class ABC119A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; if ( S . compareTo ( " 2019 / 04 / 30 " ) > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } try { Date date1 = DateFormat . getDateInstance ( ) . parse ( S ) ; } catch ( ParseException e ) { } } } public class Calc { public static void main ( String [ ] args ) throws IOException { int ans = 0 ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String str = null ; str = br . readLine ( ) ; int r = Integer . parseInt ( str ) ; ans = r * r ; 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 ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList < Integer > bigger = new ArrayList < Integer > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( A [ j ] - B [ j ] < 0 ) { difsum + = A [ j ] - B [ j ] ; cnt + + ; } else if ( A [ j ] - B [ j ] > 0 ) { bigger . add ( A [ j ] - B [ j ] ) ; } } int big [ ] = bigger . toArray ( new Integer [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < big . length ; k + + ) { for ( int l = 0 ; l < big . length - k - 1 ; l + + ) { if ( big [ l ] > big [ l + 1 ] ) { temp = big [ l ] ; big [ l ] = big [ l + 1 ] ; big [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = big [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { for ( int l = 0 ; l < = k ; l + + ) { if ( i + j + l = = s ) ans + + ; } } } System . out . println ( ans ) ; } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } System . out . println ( sold ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) counter + + ; } } } System . out . println ( counter ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; s = buf . readLine ( ) ; int i = Integer . parseInt ( s ) ; i = i ^ 3 ; System . out . println ( i + \ r \ n ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; double x = ( a + b ) / 2 ; System . out . print ( int ( Math . seil ( x ) ) ) ; } } import java . util . Scanner ; public class Main { static int T [ ] ; static int A [ ] ; static Long TA [ ] ; static Long TT [ ] ; static int N ; static int ans = 0 ; public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; T = new int [ N ] ; TT = new Long [ N ] ; TA = new Long [ N ] ; A = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { T [ i ] = sc . nextInt ( ) ; A [ i ] = sc . nextInt ( ) ; } TT [ 0 ] = T [ 0 ] ; TA [ 0 ] = A [ 0 ] ; ans + = T [ 0 ] + A [ 0 ] ; for ( int i = 0 ; i < N - 1 ; i + + ) { update ( i ) ; } System . out . println ( ans ) ; } static void update ( int m ) { int k = Math . max ( ( TT [ m ] + T [ m + 1 ] - 1 ) / T [ m + 1 ] , ( TA [ m ] + A [ m + 1 ] - 1 ) / A [ m + 1 ] ) ; ans + = T [ m + 1 ] * k - TT [ m ] - TA [ m ] + A [ m + 1 ] * k ; TT [ m + 1 ] = T [ m + 1 ] * k ; TA [ m + 1 ] = A [ m + 1 ] * k ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int tmp = sc . nextInt ( ) ; if ( tmp < min ) { min = Math ( min , tmp ) ; cnt + + ; } } System . out . print ( cnt ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 3 ; x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } public class main { public static void ( String [ ] args ) { int x = math . pow ( 2 , 3 ) ; System . out . println ( " x " ) ; } } public class Main { public static cul int ( int x ) { x = x * * 3 ; return x ; } public static void main ( String [ ] args ) { y = cul ( x ) ; Sytem . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x < = 100 ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int y = 0 ; long min ; long a [ ] = new long [ n + 1 ] ; long b [ ] = new long [ n + 1 ] ; long c [ ] = new long [ n + 1 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; c [ i ] = a [ i ] - b [ i ] ; if ( i = = 1 ) { min = b [ i ] ; } if ( c [ i ] ! = 0 ) { y = 1 ; } if ( c [ i ] > = 0 ) { if ( b [ i ] < = min ) min = b [ i ] ; } } long ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { ans + = b [ i ] ; } if ( y = = 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( ans - min ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int ia = 0 ; ia < a , ia + + ) { for ( int ib = 0 ; ib < b , ib + + ) { for ( int ic = 0 ; ic < c , ic + + ) { if ( x = = a * 50 + b * 100 + c * 500 ) { count + + ; } } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class InputSample { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int n = 0 ; if ( 2 ^ n < = N ) { n = n + 1 ; } else { System . out . println ( 2 ^ n ) ; } } } import java . lang . Math . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int x = scan . nextInt ( ) ; int out = Math . pow ( x , 3 ) ; System . out . println ( out ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( x [ 4 ] - x [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else if ( x [ 4 ] - x [ 0 ] < = k ) { Systme . out . println ( " Yay ! " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 & & x < = 100 ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int A1 = scanner . nextInt ( ) ; int A2 = scanner . nextInt ( ) ; int A3 = scanner . nextInt ( ) ; int max = A1 ; int min = A1 ; if ( A2 > max ) { max = A2 ; } if ( A2 < min ) { min = A2 ; } if ( A3 > max ) { max = A3 ; } if ( A3 < min ) { min = A3 ; } System . out . println ( max - min ) ; scanner . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ab [ ] = new int [ 2 ] ; ab [ 0 ] = sc . nextInt ( ) ; ab [ 1 ] = sc . nextInt ( ) ; for ( int i = 0 ; i < ab . length ; i + + ) { if ( ab [ i ] = = 1 ) { ab [ i ] = ab [ i ] + 13 ; } } if ( ab [ 0 ] > ab [ 1 ] ) { System . out . println ( " Alice " ) ; } else if ( b [ 0 ] < ab [ 1 ] ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Drow " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; ? ? class Main { ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? try { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String line = br . readLine ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( getCubed ( line ) ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } catch ( Exception e ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? e . printStackTrace ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? private static long getCubed ( String line ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? long x = Long . parseLong ( line ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return ( long ) Math . pow ( x , 3 ) ; ? ? ? ? ? ? ? ? ? ? } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } import java . util . ArrayList ; import java . util . Scanner ; class Scratch { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < Integer > valList = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { valList . add ( scanner . nextInt ( ) ) ; } int k = scanner . nextInt ( ) ; Integer val = valList . get ( 0 ) ; for ( int i = 1 ; i < valList . size ( ) ; i + + ) { if ( Math . abs ( val - valList . get ( i ) ) > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yay ! " ) ; } } import java . io . * ; import java . util . NoSuchElementException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; char ar [ ] = str . toCharArray ( ) ; int L = ar . length ; int left = sc . nextInt ( ) ; for ( int i = 0 ; i < L - 1 ; i + + ) { int aaa = va ( ( int ) ar [ i ] ) ; if ( aaa ! = 26 & & aaa < left ) { isa = true ; ar [ i ] = ' a ' ; left - = aaa ; } } while ( left > 0 ) { if ( left > = 26 ) { left % = 26 ; } else { ar [ L - 1 ] + = left ; left = 0 ; if ( ar [ L - 1 ] > 122 ) ar [ L - 1 ] + = 97 - 123 ; } } System . out . println ( String . valueOf ( ar ) ) ; } static int va ( int aa ) { return - aa + 97 + 26 ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; system . out . println ( x * 3 ) } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x < = 100 ; System . out . println ( x * x * x ) ; } } public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; System . out . println ( " Please enter an integer x " ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( " Cube of a x in aline : " + ( x * x * x ) ) ; } } public class Main { public static void Main ( String [ ] args ) { byte x = Integer . parseInt ( args [ 0 ] ) ; x = x * x * x ; System . out . pritln ( x ) ; } } import java . util . Scanner ; public class Haiku { public static void main ( String [ ] args ) { int five = 0 ; int seven = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { int num = Integer . parseInt ( sc . next ( ) ) ; switch ( num ) { case 5 : five + + ; break ; case 7 : seven + + ; break ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( solution ( x ) ) ; } public static solution ( int x ) { return x * x * x ; } } class test { public static void main ( String args [ ] ) { int fiveCount = 0 ; int sevenCount = 0 ; for ( String arg : args [ ] ) { if ( Integer . parseInt ( arg ) = = ' 5' ) { fiveCount + + } if ( Integer . parseInt ( arg ) = = ' 7' ) { fiveCount + + } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " OK " ) } else { System . out . print ( " NO " ) } } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double x ; x = readDouble ( in ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . printlin ( x ) ; } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { List < Integer > list = new ArrayList < Integer > ( ) ; int sum = 0 ; for ( ; ; ) { int x = scan . nextInt ( ) ; if ( x = = 0 ) { break ; } String number = String . valueOf ( x ) ; for ( int i = 0 ; i < number . length ( ) ; i + + ) { char ch = number . charAt ( i ) ; Srting c = String . valueOf ( ch ) ; int n = Integer . parseInt ( c ) ; sum + = n ; } list . add ( sum ) ; } for ( int n : list ) { System . out . println ( n ) ; } } } class Main { public static void main ( String [ ] args ) System . out . println ( x * x * x ) } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; 1 < = x < = 100 ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( x < = 100 & & x > = 1 ) { ; System . out . println ( x * x * x ) ; } } } class Xcubic { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; if ( 1 < = x < = 100 ) { int ans = x * x * x ; System . out . println ( ans ) ; } } } public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; System . out . println ( " Please enter an integer x " ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { int result = x * x * x ; System . out . println ( " Cube of a x in aline : " + result ) ; } else { System . out . println ( " Please enter an integer x between 1 and 100 " ) ; } } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int res = 0 ; for ( h = 0 ; h < a ; h + + ) { for ( i = 0 ; i < b ; i + + ) { int y = ( x - 500 * h - 100 * i ) / 50 ; if ( y = > 0 & & y < = c ) { res + + ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main5 { int X ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; System . out . print ( X * X * X ) ; } public static void main ( String [ ] args ) { Main5 obj = new Main5 ( ) ; obj . solve ( ) ; } } # coding : UTF - 8 x = input ( ) y = x * 3 print int ( y ) ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class maint { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int x = a . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; } int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; if ( a + b > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main20190603 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; scan . close ( ) ; String [ ] data = str . split ( " " ) ; int charge = 0 ; int age = 0 ; int price = 0 ; age = Integer . parseInt ( data [ 0 ] ) ; price = Integer . parseInt ( data [ 1 ] ) ; if ( 6 < = age & & age < = 12 ) { charge = price / 2 ; } else if ( age > 12 ) { charge = price ; } System . out . println ( charge ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; long a = 0 ; long b = 0 ; long swap = 0 ; long r = 0 ; long x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long max = A [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } if ( max > M * 2 ) System . out . println ( 0 ) ; else { int ans = M / max + 1 ; System . out . println ( ans ) ; } } } class Main { public static void main ( String [ ] args ) { int a = x ; int sum = 0 ; sum = a * a * a ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; num = num * 2 ; System . out . plintln ( unm ) ; } } class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; int a = x * x * x ; System . out . println ( a ) ; } } public class { public static void main ( String [ ] args ) { System . out . println ( y = x * * 3 ) print int ( y ) } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { StringTokenizer token = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( Integer . parseInt ( token . nextElement ( ) . toString ( ) ) = = 7 ) { sevenCounter + + ; } else { fiveCounter + + ; } } } catch ( IOException ex ) { } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * * 3 ) ; } } import java . util . * ; import java . awt . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] p = new int [ m ] ; int [ ] y = new int [ m ] ; int [ ] [ ] cop = new int [ 2 ] [ m ] ; for ( int i = 0 ; i < m ; i + + ) { p [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; cop [ 0 ] [ i ] = p [ i ] ; cop [ 1 ] [ i ] = y [ i ] ; } Arrays . sort ( cop , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] o1 , int [ ] o2 ) { return Integer . compare ( o1 [ 1 ] , o2 [ 1 ] ) ; } } ) ; int [ ] count = new int [ n ] ; int [ ] num = new int [ 1000000001 ] ; for ( int i = 0 ; i < m ; i + + ) { num [ cop [ 1 ] [ i ] - 1 ] = + + count [ cop [ 0 ] [ i ] - 1 ] ; } for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < 5 - p [ i ] / 10 ; j + + ) { System . out . print ( " 0 " ) ; } System . out . print ( p [ i ] ) ; for ( int j = 0 ; j < 5 - ( num [ y [ i ] - 1 ] 1 ) / 10 ; j + + ) { System . out . print ( " 0 " ) ; } System . out . print ( num [ y [ i ] - 1 ] ) ; System . out . println ( " " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int 500 yen = sc . nextInt ( ) ; int 100 yen = sc . nextInt ( ) ; int 50 yen = sc . nextInt ( ) ; int value = sc . nextInt ( ) ; int max500 = value / 500 ; int max100 ; int result = 0 ; int nokori500 ; int nokori100 ; for ( int i = 0 ; i < max500 ; i + + ) { nokori500 = value - 500 * i ; max100 = ( value - i * 500 ) / 100 ; for ( int j = 0 ; j < max100 ; j + + ) { nokori100 = nokori500 - 100 * j ; if ( nokori100 % 50 = = 0 ) { result + + ; } } } System . out . println ( result ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ; int x = Integer . parseInt ( reader . readLine ( ) ) ; x = Math . pow ( x , 3 ) ; System . out . print ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kbScanner = new Scanner ( System . in ) ; int num = kbScanner . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { if ( args [ 0 ] < = 5 ) System . out . println ( " 0 " ) ; else if ( args [ 0 ] < = 12 ) System . out . println ( args [ 1 ] / 2 ) ; else System . out . println ( args [ 1 ] ) ; } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; system . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class ABC068B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 1 ; i < = N ; i + + ) { if ( Math . pow ( 2 , i ) < = N & & N < Math . pow ( 2 , i + 1 ) ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } } } } import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . Scanner ; import java . util . AbstractMap . SimpleEntry ; import java . util . HashSet ; import java . util . Iterator ; class Main { static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { long num = sc . nextLong ( ) ; A [ i ] = num ; } int MK = 62 ; int [ ] dp = new int [ MK ] ; for ( int k = 0 ; k < MK ; k + + ) { long mask = 1l < < k ; for ( int i = 0 ; i < N ; i + + ) { if ( ( A [ i ] & mask ) = = 0l ) { dp [ k ] + + ; } } } long ans = 0 ; for ( int k = 0 ; k < MK ; k + + ) { long tmp = 1l < < k ; tmp % = MOD ; tmp * = ( dp [ k ] * ( N - dp [ k ] ) ) % MOD ; tmp % = MOD ; ans + = tmp ; ans % = MOD ; } System . out . println ( ans % MOD ) ; } } package charactor ; import java . util . Scanner ; public class Sum _ of _ Numbers { public static void main ( String [ ] args ) { int sum = 0 ; StringBuilder out = new StringBuilder ( ) ; Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String words = sc . next ( ) ; if ( words . equals ( " 0 " ) ) break ; char ch [ ] = words . toCharArray ( ) ; sum = 0 ; for ( int i = 0 ; i < ch . length ; i + + ) { String str = String . valueOf ( ch [ i ] ) ; int num = Integer . parseInt ( str ) ; sum + = num ; } out = new StringBuilder ( out + ( sum + " \ n " ) ) ; } System . out . print ( out ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; byte max = 0 ; byte min = 123 ; byte input ; for ( int i = 0 ; i < 5 ; i + + ) { input = sc . nextByte ( ) ; max = Math . max ( max , input ) ; min = Math . min ( min , input ) ; } byte k = sc . nextByte ( ) ; if ( k > = max - min ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { System . out . println ( " Please input number . ( 1 < = x < = 100 ) " ) ; int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( " answer is " + x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int x = scn . nextInt ( ) ; int xr = Math . pow ( x , ( 1 / 5 ) ) ; int a = 0 , b = 0 ; boolean flg = true ; while ( flg ) { for ( b = 0 ; b > = xr ; b -- ) { if ( Math . pow ( a , 5 ) - Math . pow ( b , 5 ) = = x ) { flg = false ; break ; } } if ( flg ) { a + + ; } else break ; } System . out . println ( a + " " + b ) ; } } import java . util . Scanner ; public class Main { public static void Main ( Stirng [ ] args ) { int n = 0 ; while ( n = = 0 ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 | | A = = 7 ) { Scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 | | B = = 7 ) { if ( A + B ! = 12 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } Scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . out . println ( " Yes ! " ) ; } else { break ; } } } } } } Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * a ) ; import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void run ( ) { while ( sc . hasNext ( ) ) { Point [ ] p = new Point [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { p [ i ] = new Point ( sc . nextDouble ( ) , sc . nextDouble ( ) ) ; } if ( ! isInner ( p [ 0 ] , p [ 1 ] , p [ 2 ] , p [ 3 ] ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } } boolean isInner ( Point a , Point b , Point c , Point p ) { if ( p . sub ( a ) . mult ( b . sub ( a ) ) > 0.0 ) return false ; if ( p . sub ( b ) . mult ( c . sub ( b ) ) > 0.0 ) return false ; if ( p . sub ( c ) . mult ( a . sub ( c ) ) > 0.0 ) return false ; return true ; } public static void main ( String [ ] args ) { new Main . run ( ) ; } class Point { double x , y ; Point ( double x , double y ) { this . x = x ; this . y = y ; } Point sub ( Point p ) { return new Point ( x - p . x , y - p . y ) ; } double mult ( Point p ) { return x * p . y - y * p . x ; } } } public class Hankei { public static void main ( String [ ] args ) { double r = 2 ; double a , b , c ; a = r * r * Math . PI ; b = Math . PI ; c = a / b ; System . out . print ( ( int ) c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Array . sort ( a ) ; System . out . println ( a [ n - 1 ] - a [ 0 ] ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max _ x = Integer . MIN _ VALUE ; int max _ y = Integer . MIN _ VALUE ; int min _ x = Integer . MAX _ VALUE ; int min _ y = Integer . MAX _ VALUE ; int x = 0 ; int y = 0 ; int itizi = 0 ; for ( int i = 0 ; i < N ; i + + ) { x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; if ( x > y ) { itizi = y ; y = x ; x = itizi ; } max _ x = Math . max ( x , max _ x ) ; min _ x = Math . min ( x , min _ x ) ; max _ y = Math . max ( y , max _ y ) ; min _ y = Math . min ( y , min _ y ) ; } long a = ( long ) Math . abs ( max _ x - min _ x ) * ( long ) Math . abs ( max _ y - min _ y ) ; long b = ( long ) Math . abs ( max _ x - min _ y ) * ( long ) Math . abs ( max _ y - min _ x ) ; if ( a > b ) System . out . println ( b ) ; else System . out . println ( a ) ; } } public class Main { public static void main ( String args [ ] ) { int x = 2 ; System . out . println ( x * * 3 ) ; } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } import java . utill . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int A1 = Math . abs ( A ) ; int V = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int B1 = Math . abs ( B ) ; int W = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int sp = V - W ; double a = Math . signum ( A ) ; double b = Math . signum ( B ) ; if ( a = = b ) { int k = B1 - A1 ; int def = Math . abs ( k ) ; } else { int def = B1 + A1 ; } if ( A = = B ) { System . out . println ( " YES " ) ; } else if ( V > W ) { if ( sp * T > = def ) { System . out . println ( " YES " ) ; } } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; system . out . println ( answer ) ; } } import java . util . * ; import java . sio . * ; public class CardPoker { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = b ) System . out . println ( " Draw " ) ; else if ( a = = 1 ) System . out . println ( " Alice " ) ; else if ( b = = 1 ) System . out . println ( " Bob " ) ; else if ( a > b ) System . out . println ( " Alice " ) ; else System . out . println ( " Bob " ) ; } } import java . util . * ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; InputStreamReader reader = new InputStreamReader ( System . in ) ; int n = sc . nextInt ( ) ; int s ; boolean p = false ; boolean w = false ; boolean g = false ; boolean y = false ; for ( int i = 0 ; i < n ; i + + ) { try { s = reader . read ( ) ; if ( ( char ) s = = ' P ' ) p = true ; else if ( ( char ) s = = ' W ' ) w = true ; else if ( ( char ) s = = ' G ' ) g = true ; else if ( ( char ) s = = ' Y ' ) y = true ; else t = false ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } if ( p = = w = = g = = true ) { if ( y = = false ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } } import java . lang . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int x = stdid . nextInt ( ) ; x = x * x * x ; System . out . println ( String . valueOf ( x ) + " \ r \ n " ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; } catch ( IOException e ) { System . out . println ( e ) ; } System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String po = sc . nextLine ( ) ; String p [ ] = po . substring ( " / " , 0 ) ; System . out . println ( ( Integer . parseInt ( p [ 1 ] ) < 5 ) ? " Heisei " : " TBD " ) ; } } import java . util . Scanner ; public class Coins { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int fiveHundred = Integer . parseInt ( scanner . nextLine ( ) ) ; int hundred = Integer . parseInt ( scanner . nextLine ( ) ) ; int fifty = Integer . parseInt ( scanner . nextLine ( ) ) ; int money = Integer . parseInt ( scanner . nextLine ( ) ) ; if ( money % 100 = = 50 ) { if ( fifty = = 0 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } fifty - = 1 ; money - = 50 ; } int total = 0 ; for ( int i = Math . min ( fiveHundred , Math . floorDiv ( money , 500 ) ) ; i > = 0 ; i -- ) { total + = countUp ( money - ( 500 * i ) , hundred , fifty ) ; } System . out . println ( total ) ; } public static int countUp ( int sum , int hundred , int fifty ) { int c = 0 ; for ( int i = Math . min ( hundred , sum / 100 ) ; i > = 0 ; i -- ) { if ( ( sum - ( i * 100 ) ) < = ( fifty * 50 ) ) { c + + ; } } return c ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } Main kari = new Main ( ) ; if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = kari . setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; Iterator it = setwise2 . iterator ( ) ; List < Integer > setList = new ArrayList < > ( ) ; while ( it . hasNext ( ) ) { setList . add ( it . next ( ) ) ; } for ( int i = 0 ; i < setList . size ( ) ; i + + ) { for ( int j = i ; j < setList . size ( ) ; j + + ) { setwise2 . add ( gcd ( setList . get ( i ) , setList . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwise2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise2 ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; Public class Main { public Static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; System . out . println ( answer ) ; } } import java . util . * ; public class JavaApplication69 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; if ( ( 5 < = A ) & & ( 7 < = B ) & & ( 5 < = C & & C < = 10 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Cube { public static void main ( String [ ] args ) { int x ; Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int pow = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { pow * = x ; } System . out . println ( pow ) ; } } import java . util . Scanner ; public class MMM { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class A _ 054 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) ; if ( A = = 1 ) { A = 14 ; } if ( B = = 1 ) { B = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( B > A ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } } class Main { public static void main ( String args [ ] ) { int x = 0 ; DataInputStream d = new DataInputStream ( System . in ) x = d ; x = d * d * d ; System . out . println ( x ) ; } } import java . util . Scanner ; class java { public static void main ( String [ ] args ) { Scanner hankei = new Scanner ( System . in ) ; int r = hankei . nextInt ( ) ; System . out . println ( r * r ) ; } } public class v { public static void main ( String [ ] args ) { int x ; x = 2 ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ThreeCube { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int a = kb . nextInt ( ) ; System . out . printf ( " % d \ n " , a * a * a ) ; } } public class Main { public static void main ( String args [ ] ) { int i , o ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( br . readline ( ) ) ; o = i * i * i ; System . out . println ( o ) ; } } import java . io . * ; public class Exercise { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . io * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , ans ; x = Integer . ParseInt ( br . readLine ) ; ans = x * x * x ; System . out . println ( ans ) ; } } 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 ( ) ; if ( ( a + b ) % 2 = = 1 ) System . out . println ( ( a + b ) / 2 + 1 ) ; else System . out . println ( ( atb ) / 2 ) ; } } import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( x * x * x ) System . out . println ( y ) ; } } import java . util . * ; import java . util . function . * ; public class Main { public static void main ( String [ ] args ) { long mod = 10 * 9 + 7 ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long c = 0 ; for ( int j = 0 ; j < N ; j + + ) { if ( ( ( A [ j ] > > > i ) & 1 ) = = 1 ) { c + + ; } } long a = ( c * ( N - c ) ) % m ; for ( int j = 0 ; j < i ; j + + ) { a = ( a < < 1 ) % m ; } ans + = a ; ans % = m ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class irohaDigit { public static void main ( String [ ] args ) { int N ; int D ; Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; D = sc . nextInt ( ) ; int d [ ] = new int [ 10 ] ; for ( int i = 0 ; i < D ; i + + ) { d [ sc . nextInt ( ) ] = 1 ; } int sum = 0 ; int start9 = 0 ; int maxD = String . valueOf ( N ) . length ( ) ; for ( int i = maxD - 1 ; i > = 0 ; i -- ) { int x = N / ( int ) ( Math . pow ( 10 , i ) ) ; N = N % ( int ) Math . pow ( 10 , i ) ; if ( d [ x ] = = 1 ) { { for ( int j = x ; j < 10 ; j + + ) { if ( d [ j ] ! = 1 ) { x = j ; break ; } else if ( j = = 9 ) { j = - 1 ; start9 = 1 ; } } } } if ( i = = ( maxD - 1 ) & & start9 = = 1 ) sum = sum + 10 * ( int ) Math . pow ( 10 , i ) ; else sum = sum + x * ( int ) Math . pow ( 10 , i ) ; if ( N = = 0 ) break ; } System . out . print ( sum ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) : String input = br . readLine ( ) ; int x = Integer . parseInt ( input ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] array = new int [ 8 ] [ 2 ] ; for ( int i = 0 ; i < N ; + + i ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; array [ i ] [ 1 ] = sc . nextInt ( ) ; } double total = 0.0d ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = 0 ; j < N ; j + + ) { if ( i = = j ) continue ; total + = Math . sqrt ( nijo ( array [ i ] [ 0 ] - array [ j ] [ 0 ] ) + nijo ( array [ i ] [ 1 ] - array [ j ] [ 1 ] ) ) ; } } System . out . println ( 2.0d * total / N ) ; } private int nijo ( int x ) { return x * x ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 , max = 1 , p ; i < n ; i + + ) { p = sc . nextInt ( ) ; if ( p = > max ) { count + + ; max = p ; } } System . out . println ( count ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList l = new ArrayList ( ) ; while ( sc . hasNext ( ) ) { String [ ] s = sc . next ( ) . split ( " , " ) ; double w = Double . parseDouble ( s [ 1 ] ) ; double h = Double . parseDouble ( s [ 2 ] ) ; if ( w / ( h * h ) > = 25 ) l . add ( Integer . parseInt ( s [ 0 ] ) ) ; } if ( l . isEmpty ( ) ) System . out . println ( " 該当なし " ) ; else f o ( Int ger i : l ) Sys e m . o ut.pri n tln ( i ) ; } } import java . util . * ; public class C { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; List < Info > list = new ArrayList < > ( m ) ; for ( int i = 0 ; i < m ; + + i ) { int p = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; list . add ( new Info ( p , y , i ) ) ; } Collections . sort ( list , ( I0 , I1 ) - > ( I0 . p ! = I1 . p ) ? I0 . p - I1 . p : I0 . y - I1 . y ) ; int x = 1 ; for ( int i = 0 ; i < m ; + + i ) { if ( i > 0 & & list . get ( i - 1 ) . p = = list . get ( i ) . p ) { + + x ; } else { x = 1 ; } list . get ( i ) . x = x ; } Collections . sort ( list , ( I0 , I1 ) - > I0 . o - I1 . o ) ; for ( int i = 0 ; i < m ; + + i ) { showZero ( 6 - String . valueOf ( list . get ( i ) . p ) . length ( ) ) ; System . out . print ( list . get ( i ) . p ) ; showZero ( 6 - String . valueOf ( list . get ( i ) . x ) . length ( ) ) ; System . out . println ( list . get ( i ) . x ) ; } } static void showZero ( int num ) { for ( int i = 0 ; i < num ; + + i ) { System . out . print ( 0 ) ; } } } class Info { int p ; int y ; int o ; int x ; public Info ( int p , int y , int o ) { this . p = p ; this . y = y ; this . o = o ; } } import java . math . BigDecimal ; import java . math . MathContext ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; BigDecimal x [ ] , y [ ] ; x = new BigDecimal [ N ] ; y = new BigDecimal [ N ] ; for ( int i = 0 ; i < N ; i + + ) { int x1 , y1 ; x1 = sc . nextInt ( ) ; y1 = sc . nextInt ( ) ; x [ i ] = new BigDecimal ( x1 ) ; y [ i ] = new BigDecimal ( y1 ) ; } int c = 2 ; for ( int i = 2 ; i < = N ; i + + ) { c * = i ; } c = c / N ; int C = 1 ; for ( int i = 2 ; i < = N ; i + + ) { C * = i ; } BigDecimal sum = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { BigDecimal x1 = x [ i ] . add ( x [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; BigDecimal y1 = y [ i ] . add ( y [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; x1 = x1 . multiply ( x1 ) ; y1 = y1 . multiply ( y1 ) ; x1 = x1 . add ( y1 ) ; x1 = x1 . sqrt ( MathContext . DECIMAL64 ) ; sum = sum . add ( x1 ) ; } } sum = sum . multiply ( new BigDecimal ( c ) ) ; sum = sum . divide ( new BigDecimal ( C ) , 10 , BigDecimal . ROUND _ HALF _ UP ) ; System . out . println ( sum . toPlainString ( ) ) ; } } public class XCubic { public static void main ( String [ ] args ) { int x = 2 ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( Math . pow ( x , 3 ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Atc { public static void main ( String [ ] args ) { Integer x = 5 ; Integer y = 7 ; boolean b = false ; Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > inputs = new ArrayList < > ( ) { { add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; } } ; if ( inputs . remove ( x ) & & inputs . size ( ) = = 2 ) { if ( inputs . remove ( x ) & & inputs . size ( ) = = 1 ) { if ( inputs . remove ( y ) & & inputs . size ( ) = = 0 ) { b = true ; } } } if ( b ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static int cul ( int x ) { return Math . pow ( x , 3 ) ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } import java . util . * ; class Main { static int a , b ; static boolean s ; public static void main ( String [ ] $ ) { Scanner c = new Scanner ( System . in ) ; int k = c . nextInt ( ) , x = c . nextInt ( ) , y = c . nextInt ( ) ; x * = a = x < 0 ? - 1 : 1 ; y * = b = y < 0 ? - 1 : 1 ; if ( s = x < y ) x ^ = y ^ ( y = x ) ; int n = ( x + y + k - 1 ) / k ; if ( k % 2 = = 0 & & ( x + y ) % 2 = = 1 ) { System . out . println ( - 1 ) ; return ; } else if ( x + y < k ) if ( ( x + y ) % ( n = 2 ) = = 1 ) { System . out . println ( 3 ) ; p ( x , x - k ) ; p ( x + ( k + x - y ) / 2 , x - k + ( k - x + y ) / 2 ) ; p ( x , y ) ; return ; } else if ( ( k - ( x + y ) % k ) % k % 2 = = 1 ) n + + ; System . out . println ( n ) ; int m = ( k * n - x - y ) / 2 , i = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( m > k * i ) { p ( 0 , - k * i ) ; } else if ( x + m > k * i ) { p ( k * i - m , - m ) ; } else { p ( x , k * i - 2 * m - x ) ; } } } static void p ( int x , int y ) { System . out . println ( a * ( s ? y : x ) + " " + b * ( s ? x : y ) ) ; } } double a , b , c , d ; system . out . println ( `` enter value a `` ) ; a = sc . nextDouble ( ) ; system . out . println ( `` enter value b `` ) ; b = sc . nextDouble ( ) ; system . out . println ( `` enter value c `` ) ; c = sc . nextDouble ( ) ; system . out . println ( `` enter value d `` ) ; d = sc . nextDouble ( ) ; if ( ( 1 > a ) | | ( a > 10000 ) | | ( 1 > b ) | | ( b > 10000 ) | | ( 1 > c ) | | ( c > 10000 ) | | ( 1 > d ) | | ( d > 10000 ) ) { system . out . println ( `` error `` ) } if ( ( a * b - c * d ) > = 0 ) { system . out . println ( a * b ) } ; else { system . out . println ( c * d ) } ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . UnsupportedEncodingException ; public class Sample { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in , " UTF-8 " ) ) ; int n = br . read ( ) ; if ( n > = 1 & & n < = 100 ) System . out . println ( n * n * n ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; if ( a = = 1 ) a + = 13 ; if ( b = = 1 ) b + = 13 ; if ( a > b ) System . out . println ( " Allice " ) ; else if ( b > a ) System . out . println ( " Bob " ) ; else System . out . println ( " Draw " ) ; input . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) ! = null ) { int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } stdReader . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . io . * ; import java . util . * ; import java . lang . * ; public class area { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } mport java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String input = br . readLine ( ) ; if ( input . equals ( " 0 " ) ) { break ; } int total = 0 ; char [ ] charAry = input . toCharArray ( ) ; for ( int i = 0 ; i < charAry . length ; i + + ) { total + = Character . getNumericValue ( charAry [ i ] ) ; } System . out . println ( total ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int v = Integer . parseInt ( line ) ; int v2 = v ; v2 * = v * v ; System . out . println ( v2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sc . nextInt ( ) , x = 0 , y = 0 ; for ( int i = 1 ; i < n ; i + + ) { x + = 800 ; if ( i % 15 = = 0 ) { y + = 200 ; } } System . out . println ( x - y ) ; } } public class Main { public static void main ( String [ ] args ) { double x ; x = x * x * x ; System . out . printf ( " % .0f " , x ) ; } } import java . util . * ; import java . io . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( k < Math . abs ( a - b ) ) flag = true ; if ( k < Math . abs ( a - c ) ) flag = true ; if ( k < Math . abs ( a - d ) ) flag = true ; if ( k < Math . abs ( a - e ) ) flag = true ; if ( k < Math . abs ( b - c ) ) flag = true ; if ( k < Math . abs ( b - d ) ) flag = true ; if ( k < Math . abs ( b - e ) ) flag = true ; if ( k < Math . abs ( c - d ) ) flag = true ; if ( k < Math . abs ( c - e ) ) flag = true ; if ( k < Math . abs ( d - e ) ) flag = true ; if ( flag = = false ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class D { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int BigH2 = H2 - H1 ; int BigH2M2 = BigH2 * 60 + M2 ; int clearTime = BigH2M2 - M1 ; int answer = clearTime - K ; System . out . println ( answer ) ; } } class MAIN { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readline ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( sanjo ( x ) ) ; } public int sanjo ( int x ) { int y = x * x * x ; return y ; } } public class Main { System . out . println ( x * x * x ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int average = Math . ceil ( ( a + b ) / 2 ) ; System . out . println ( average ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a ; int b ; a = Integer . parseInt ( br . readLine ( ) ) ; sannjyou sa = new sannjyou ( ) ; b = sa . sann ( a ) ; System . out . println ( b ) ; } public class sannjyou { private int a ; public int sann ( int b ) { a = b ; int k ; k = a * a * a ; return k ; } } } import java . io . * class Main { public static void main ( String args [ ] ) { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = buf . readLine ( ) ; int x = Integer . parseInt ( a ) ; x = x * x * x ; System . out . println ( x ) ; } } puts gets . to _ i * * 3 import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { while ( scanner . hasNext ( ) ) { String [ ] s = scanner . nextLine ( ) . split ( " , " ) ; Student student = new Student ( s [ 0 ] , Double . parseDouble ( s [ 1 ] ) , Double . parseDouble ( s [ 2 ] ) ) ; if ( student . bmi . is ? ? ? ? ? ? ( ) ) { System . out . println ( student . ? ? ? ? ± ? ? ? ? ? ? ? ) ; lass tudent inal tring ? ? ? ± ? ? ? ? ? ? ? ; f nal B i b i ; S udent ( S t ring ? ? ? ± ? ? ? ? ? ? ? , d o ble ? ? ? ? ? k g , d o ble ? ? ? ? ? m ) { h s . ? ? ? ? ± ? ? ? ? ? ? ? = ? ? ± ? ? ? ? ? ? ? ; t h i s bmi = ne miI pl ( ? ? ? ? ? ? k g , ? ? ? ? ? m ) ; } } n e face Bmi in ? ? ? ? ? ? ? ? ¢ ? ? ? ? = 2 5 ; b ol e n is ? ? ? ? ? ( ) ; } c l a s BmiIm l imple ents Bmi { pri a e final doubl ? ? ? ? ? k g ; p r iv a e final doubl ? ? ? ? ? m ; B m i I m l ( doubl e ? ? ? ? ? k g , d o ub l ? ? ? ? ? m ) { t h i . ? ? ? ? ? k g = ? ? ? ? k g ; t h is . ? ? ? ? ? m = ? ? ? ? m ; } p u b i doubl calc ( { r e t r ? ? ? ? ? k g / M at . ow ( ? ? ? ? ? ? m , 2 ) ; } @ O v r i de publi boole n is ? ? ? ? ? ( ) { r e t r calc ( > = ? ? ? ? ? ? ? ? ¢ ? ? ? ? ; } } class Coin { static final int INF = 100000 ; public static int coinChangeMod ( int d [ ] , int n , int k ) { int [ ] M = new int [ n + 1 ] ; M [ 0 ] = 0 ; int [ ] S = new int [ n + 1 ] ; S [ 0 ] = 0 ; for ( int j = 1 ; j < = n ; j + + ) { int minimum = INF ; int coin = 0 ; for ( int i = 1 ; i < = k ; i + + ) { if ( j > = d [ i ] ) { if ( ( 1 + M [ j - d [ i ] ] ) < minimum ) { minimum = 1 + M [ j - d [ i ] ] ; coin = i ; } } } M [ j ] = minimum ; S [ j ] = coin ; } int l = n ; while ( l > 0 ) { System . out . println ( d [ S [ l ] ] ) ; l = l - d [ S [ l ] ] ; } return M [ n ] ; } public static void main ( String [ ] args ) { int d [ ] = { 0 , 1 , 2 , 3 } ; coinChangeMod ( d , 5 , 3 ) ; } } pmport java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } } public class Main { ? ? ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int ans = x * x * x ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( ans ) ; ? ? ? ? ? ? ? ? } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int countFive = 0 ; int countSeven = 0 ; if ( a = = 5 ) { countFive + + ; } else { countSeven + + ; } if ( b = = 5 ) { countFive + + ; } else { countSeven + + ; } if ( c = = 5 ) { countFive + + ; } else { countSeven + + ; } if ( countFive = 5 ) { System . out . println ( " YES " ) } else { System . out . println ( " NO " ) } } } import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Haiko { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { int k = scan . nextInt ( ) ; map . put ( k , map . getOrDefault ( k , 0 ) + 1 ) ; } if ( map . get ( 5 ) = = 2 & & map . get ( 7 ) = = 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; String date = scan . next ( ) ; System . out . println ( date . compareTo ( " 2019 / 04 / 30 " ) < = 0 ? " Heisei " : " TBD " ) ; } } import java . util . Scanner ; public class App { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nextInt = sc . nextInt ( ) ; System . out . println ( nextInt * nextInt * nextInt ) ; } } import lib . Input ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Input . getInt ( " x " ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x < = 100 ; int cubic = x * x * x ; System . out . println ( cubic ) ; } } public class TwoCoins { public static void main ( string args [ ] ) { int coinVal ; int coinVal2 ; int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; system . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( n > = answer ) { answer * = 2 ; } System . out . println ( answer / 2 ) ; } } pimport java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Map < Integer , int [ ] > map = new TreeMap < Integer , int [ ] > ( ) ; for ( int i = 0 ; i < m ; i + + ) { int [ ] array = new int [ 2 ] ; array [ 0 ] = i ; array [ 1 ] = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; map . put ( b , array ) ; } int [ ] ary = new int [ n ] ; String [ ] s = new String [ m ] ; for ( int [ ] num : map . values ( ) ) { ary [ num [ 1 ] - 1 ] + + ; s [ num [ 0 ] ] = String . format ( " % 06d % 06d " , num [ 1 ] , ary [ num [ 1 ] - 1 ] ) ; } StringBuilder sb = new StringBuilder ( ) ; for ( String ss : s ) { sb . append ( ss + " \ n " ) ; } System . out . println ( sb ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = < 5 ) { System . out . println ( 0 ) ; return ; } else if ( a > = 13 ) { System . out . println ( b ) ; } else { System . out . println ( b / 2 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; scan . nextLine ( ) ; List < Integer > values = Arrays . sort ( Arrays . of ( scan . nextLine ( ) . split ( " " ) ) . map { i - > new Integer ( i ) ; } ; ) ; Map < Integer , Integer > searchResult = new HashMap ( ) < > ; int i = 0 ; for ( i ; i < values . get ( values . size - 1 ) ; i + + ) { searchResult . put ( calc ( list , i ) , i ) ; } searchResult Object [ ] mapkey = mMap . keySet ( ) . toArray ( ) ; Arrays . sort ( mapkey ) ; for ( Integer nKey : mMap . keySet ( ) ) { System . out . println ( mMap . get ( nKey ) ) ; break ; } } public static int calc ( List < Integer > list , Integer point ) { Integer result = 0 ; int i = 0 ; for ( i ; i < list . size ; i + + ) { result + = ( ( list . get ( i ) - point ) * ( list . get ( i ) - point ) ) ; } return result ; } } import java . util . Scanner ; import java . util . Random ; import java . math . * ; public class tokyokaijo2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int j = 0 , h = 0 ; int x = 0 , y = 0 , z = 0 , c = 0 ; j = Math . abs ( w ) ; h = Math . abs ( v ) ; if ( j - h > 0 ) { System . out . println ( " NO " ) ; } else { x = v * t + a ; y = a - v * t ; z = w * t + b ; c = b - w * t ; if ( b > a & & x > = z ) { System . out . println ( " YES " ) ; } else if ( b < a & & y < = c ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class datetest { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; Date heiseiDate = sdf . parse ( " 2019 / 04 / 30 " ) ; if ( formatDate . before ( heiseiDate ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { ArrayList < String > array = new ArrayList < String > ( ) ; Scanner scanner = new Scanner ( System . in ) ; int a = sccaner . nextInt ( ) ; while ( true ) { String s = scanner . nextString ( ) ; if ( String . valueOf ( s ) . length ( ) = = 0 ) { break ; } array . add ( s ) ; } int n = 0 ; boolean i = false ; for ( n = 0 ; n < a ; n + + ) { if ( " Y " = = array . get ( n ) ) i = true ; } if ( i ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = N1 [ i ] ; break ; } } if ( count = = 5 ) count = 4 ; System . out . println ( sum - 10 * count + min ) ; } import java . io . * ; import java . util . * ; import java . lang . * ; public class area { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n , l ; n = in . nextInt ( ) ; l = in . nextInt ( ) ; String [ ] S = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) S [ i ] = in . next ( ) ; S . sort ( ) ; for ( int i = 0 ; i < n ; i + + ) System . out . print ( S [ i ] ) ; System . out . println ( ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; return 0 ; } } public static void main ( String [ ] args ) { if ( ! args [ 0 ] . isEmpty ) { int num = args [ 0 ] ; } int retNum = num * num * num ; System . out . println ( retNum ) ; } import java . io . * ; import java . util . * ; import java . lang . * ; public class file { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } class Main { public static void main ( String args [ ] ) { double x ; System . out . println ( Math . pow ( x , 2 ) ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int i = br . readLine ( ) ; i = i * i ; System . out . println ( i ) ; } } import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; if ( A < = B ) { if ( A * V * T < = B * V * T ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { int B = - ( B * T ) ; int A = - ( A * T ) ; if ( A * V * T > = B * V * T ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } 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 ( ) ; if ( a > b ) { System . out . println ( " Alice " ) ; } else if ( a = = b ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } import java . util . * ; class test { public static void main ( String args [ ] ) { } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cntdif = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList bigger < int > = new ArrayList < int > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( int dif = A [ j ] - B [ j ] < 0 ) { difsum + = dif ; cnt + + ; } else if ( dif > 0 ) { bigger . add ( dif ) ; } } int big [ ] = bigger . toArray ( new int [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < bigger . length ; k + + ) { for ( int l = 0 ; l < bigger . length - k - 1 ; l + + ) { if ( bigger [ l ] > bigger [ l + 1 ] ) { temp = bigger [ l ] ; bigger [ l ] = bigger [ l + 1 ] ; bigger [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = bigger [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } class Main { int x ; System . out . println ( x ^ 3 ) ; } package src . AtCoder . abc145 ; import java . util . Scanner ; public class abc145 _ a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( Math . pow ( sc . nextInt ( ) , 2 ) ) ; } } import java . io . * ; public class cubic { public static void main ( String [ ] args ) throws IOException { String s ; int a ; int b ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; s = buf . readLine ( ) ; a = Integer . parseInt ( s ) ; b = a * a * a ; System . out . println ( b ) ; } } import java . util . Scanner ; public class Main054A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = b ) { System . out . println ( " draw " ) ; } else if ( a = = 1 ) { System . out . println ( " Alice " ) ; } else if ( b = = 1 ) { System . out . println ( " Bob " ) ; } else if ( a > b ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } sc . close ( ) ; } } package aoj3 ; public class ? ? ? Main { public static void main ( String args [ ] ) { System . out . println ( " Hello World " ) ; int = x System . out . printl ( 1 ? ? ? x ? ? ? 100 ) } } import java . util . Scanner ; public class ABC068B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = N ; i > = 1 ; i -- ) { if ( i % 2 = = 0 ) { System . out . println ( i ) ; break ; } } } } # include < bits / stdc + + . h > using namespace std ; int main ( ) { int a , b ; cin > > a > > b ; if ( a = = 13 ) cout < < b < < endl ; else if ( a < = 5 ) cout < < 0 < < endl ; else cout < < b / 2 ; return 0 ; } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } Main kari = new Main ( ) ; if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = kari . setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; Iterator < Integer > it = setwise2 . iterator < > ( ) ; List < Integer > setList = new ArrayList < > ( ) ; while ( it . hasNext ( ) ) { setList . add ( it . next ( ) ) ; } for ( int i = 0 ; i < setList . size ( ) ; i + + ) { for ( int j = i ; j < setList . size ( ) ; j + + ) { setwise2 . add ( gcd ( setList . get ( i ) , setList . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwise2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise2 ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) thorws java . lang . Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = input . readLine ( ) ; int output = Integer . parseInt ( x ) ; output = output ^ 3 ; System . out . println ( output ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( anser ) ; } } public class Main { public static void main { int x ; System . out . println ( x * x * x ) ; } } import java . io public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; class At { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double z = ( n + m ) / 2.00 ; int z1 = ( int ) z ; int z2 = n + m ; if ( z2 % 2 ! = 0 ) { if ( z1 % 2 = = 1 ) { z1 + = 1 ; } } System . out . println ( z1 ) ; } } import java . util . Scanner ; public class Main { public static int [ ] powerCard = new int [ ] { 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 1 } ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; String [ ] card = s . split ( " " ) ; int i = Integer . parseInt ( card [ 0 ] ) ; int j = Integer . parseInt ( card [ 1 ] ) ; if ( ( i < 14 & & j < 14 ) & & ( i > 0 & & j > 0 ) { for ( int k = 0 ; k < powerCard . length ; k + + ) { if ( powerCard [ k ] = = i ) { i = k ; } if ( powerCard [ k ] = = j ) { j = k ; } } if ( i > j ) { System . out . println ( " Alice " ) ; } else if ( i < j ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } else { System . out . println ( " Draw " ) ; } } } import java . util * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N + 1 ] ; B [ 0 ] = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; B [ i + 1 ] = B [ i ] + A [ i ] ; } double C = B [ N ] / N ; int D = ( int ) C ; int x = D ; int y = 0 ; if ( C > D + 0.5 ) { x = x + 1 ; } for ( int j = 0 ; j < N ; j + + ) { y = y + ( A [ j ] - x ) * ( A [ j ] - x ) ; } System . out . println ( y ) ; } } import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ans = 0 ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputnum ; int ans ; while ( true ) { inputnum = sc . nextInt ( ) ; if ( inputnum = = 0 ) break ; while ( inputnum ! = 0 ) { ans + = inputnum % 10 ; inputnum - = inputnum % 10 ; if ( inputnum = = 0 ) break ; inputnum = inputnum / 10 ; } System . out . println ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] check = new int [ 3 ] ; check [ 0 ] = int A = scan . nextInt ( ) ; check [ 1 ] = int B = scan . nextInt ( ) ; check [ 2 ] = int C = scan . nextInt ( ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < check . length ; i + + ) { if ( check [ i ] = = 5 ) { count _ 5 + + ; } else if ( check [ i ] = = 7 ) { count _ 7 + + ; } check [ i ] } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) * ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) ) ; } if ( Math . sqrt ( sum ) = = int ( Math . sqrt ( sum ) ) ) { counter + + ; } } } System . out . print ( counter ) ; } } import java . util . Scanner ; public class Test1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int a = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; ; i + + ) { int b = a % 10 ; a = ( a - b ) / 10 ; sum = sum + b ; if ( a = = 0 ) break ; } if ( sum = = 0 ) break ; System . out . printf ( " % d \ n " , sum ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int num ; String buf ; try { BufferdReader br = new BufferdeReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; num = Integer . parseInt ( buf ) ; System . out . println ( num * num * num ) ; } catch ( Exception e ) { } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( problem145a ( r ) ) ; } private static int problem145a ( int r ) { return r * r ; } import java . io . * ; public class AOJ2 { public static void main ( String [ ] args ) { String line ; int x ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } catch ( NumberFormatException e ) { System . out . println ( e ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . lang . * ; import java . io . * ; class MAIN { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readline ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( sanjo ( x ) ) ; } public static int sanjo ( int x ) { int y = x * x * x ; return y ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; int ans = aaa + bbb + ccc + ddd + eee + min - 10 ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; if ( A = = B ) { System . out . println ( " DRAW " ) ; } else if ( A = = 1 & & B > = 2 & & B < = 13 ) { System . out . println ( " Alice " ) ; } else if ( B = = 1 & & A > = 2 & & B < = 13 ) { System . out . println ( " Bob " ) ; } else if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( A < B ) { System . out . println ( " Bob " ) ; } } } import java . util . * ; public class HinaArare { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Character > list = new ArrayList < Character > ( ) ; while ( n -- > 0 ) list . add ( sc . next ( ) . charAt ( 0 ) ) ; List < Character > list2 = new ArrayList < Character > ( new HashSet < > ( list ) ) ; if ( list2 . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else if ( list2 . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } } } import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; a = a * a * a ; System . out . println ( a ) ; } } import java . io . * ; public class B { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { System . out . println ( " 値を入力してください : " ) ; String line = reade r . r adLine ) ; i t n = I n teger.pa r s e nt ( i e ; Syste m .out.pri n tln ( n * * n ) ; } cat c h ( IOEx c e p t i o n ) Syst m .out.printl ( e ) } } } import java . util . * ; public class test { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int [ ] array = new int [ 6 ] ; for ( int i = 0 ; i < array . length ; i + + ) { array [ i ] = reader . nextInt ( ) ; } if ( array [ 4 ] - array [ 0 ] < = array [ 5 ] ) System . out . println ( " Yay ! " ) ; else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; if ( a < 0 ) { b = a * - 1 ; } if ( ( V - W ) * T > = b | | a = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class OneCardPoker { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int alice = sc . nextInt ( ) , bob = sc . nextInt ( ) ; if ( alice = = 1 & & bob ! = 1 ) System . out . println ( " Alice " ) ; else if ( bob = = 1 & & alice ! = 1 ) System . out . println ( " Bob " ) ; else if ( alice < bob ) System . out . println ( " Bob " ) ; else if ( alice > bob ) System . out . println ( " Alice " ) ; else System . out . println ( " Draw " ) ; } } public class main { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < = x & & x < = 100 ) { ; System . out . println ( x * x * x ) ; } } } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; if ( n _ customer > 1 ) { while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } } System . out . println ( sold ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int re = ( h * h ) + ( r * r ) ; double res = Math . sqrt ( re ) ; System . out . println ( res ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . util . * public class main { public static void main ( Staring [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] dist = new int [ 5 ] ; for ( int i = 5 ; i < 5 ; i + + ) { dist [ i ] = sc . nextInt ( ) ; } int limit = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] < k ) { System . out . println ( " Yay ! " ) ; return 0 ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; import java . io . * ; import java . awt . geom . * ; public class TaskC { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; long MOD = 1 _ 000 _ 000 _ 007 ; String [ ] s = br . readLine ( ) . split ( " " ) ; long n = Long . parseLong ( s [ 0 ] ) ; long m = Long . parseLong ( s [ 1 ] ) ; if ( m > n + 1 | | m < n - 1 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } long fact1 = 1 ; long fact2 = 1 ; for ( int i = 0 ; i < m ; i + + ) { fact1 * = ( i + 1 ) ; fact1 % = MOD ; } for ( int i = 0 ; i < n ; i + + ) { fact2 * = ( i + 1 ) ; fact2 % = MOD ; } long ans = ( fact1 * fact2 ) % MOD ; if ( m = = n ) ans * = 2 ; ans % = MOD ; System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int input = args [ 0 ] ; int output = input * input * input ; System . out . println ( output ) ; } } import java . util . Scanner ; public class P { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int hdeg = 30 * h ; int mdeg = 6 * m ; int deg = Math . abs ( hdeg - mdeg ) ; double cosdeg = Math . cos ( deg * Math . PI / 180 ) ; double asrq = a * a ; double bsqr = b * b ; double c = Math . sqrt ( asqr + bsqr - 2 * a * b * cosdeg ) ; System . out . println ( c ) ; } } System . out . println ( Math . pow ( ( double ) x , 3d ) ) ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , M = sc . nextInt ( ) , i , j , k , l ; String [ ] a = new String [ N ] , b = new String [ M ] ; boolean f = true ; for ( i = 0 ; i < N ; i + + ) { a [ i ] = sc . next ( ) ; } for ( i = 0 ; i < M ; i + + ) { b [ i ] = sc . next ( ) ; } for ( i = 0 ; i < N - M + 1 ; i + + ) { for ( j = 0 ; j < N - M + 1 ; j + + ) { for ( k = 0 ; k < M ; k + + ) { for ( l = 0 ; l < M ; l + + ) { if ( a [ i + k ] . charAt ( j + l ) ! = b [ k ] . charAt ( l ) ) { f = false ; break ; } } } if ( f = = true ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; ; } f = true ; } } System . out . println ( " No " ) ; } import java . util . Scanner ; public class AtcoderBCA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; int hoge ; for ( int i = 0 ; i < a . length ; i + + ) { for ( int j = 0 ; j < i ; j + + ) { if ( a [ i ] < a [ j ] ) { hoge = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = hoge ; } } } hoge = a [ 1 ] - a [ 2 ] ; int task = hoge + a [ 2 ] ; System . out . println ( task ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; line = in . readLine ( ) System . out . print ( Integer . parseInt ( line ) ^ 3 ) ; in . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( - 1 ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; int x , cube ; x = Integer . parseInt ( r . readLine ) ; cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { { public static void main ( String [ ] args ) { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = buf . readLine ( ) ; int x = Integer . parseInt ( a ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . lang . Math ; class Test { public static void main ( String [ ] args ) ? ? ? throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) int b = sc . nextInt ( ) ; String c [ ] = new String [ a ] ; for ( int i = 0 ; i < b ; i + + ) { c [ i ] = sc . next ( ) ; } Arrays . sort ( c ) ; for ( int i = 0 ; i < b ; i + + ) { System . out . print ( c [ i ] ) ; } } } import java . util . * ; public class xCubic { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; System . out . println ( Math . round ( Math . pow ( x , 3 ) ) ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " x * x * x " ) ; } } import java . util . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String inp [ ] = br . redaLine ( ) ; int a = Integer . parseInt ( inp [ 0 ] ) ; int b = Integer . parseInt ( inp [ 1 ] ) ; if ( a < = 12 & & a > = 6 ) b / = 2 else if ( a < = 5 ) b = 0 ; System . out . print ( b ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int getValue = sc . nextInt ( ) ; int res = getValue * getValue * getValue ; System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt = 0 ; String str = " " ; int N1 = Integer . parseInt ( sc . next ( ) ) ; int N2 = Integer . parseInt ( sc . next ( ) ) ; int W1 = Integer . parseInt ( sc . next ( ) ) ; int W2 = Integer . parseInt ( sc . next ( ) ) ; System . out . print ( Math . max ( N1N2 , W1 * W2 ) ) ; System . out . println ( ) ; } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int answer = ( int ) Math . pow ( x , 3 ) ; System . out . println ( answer ) ; } } package Contest1506 ; import java . util . Scanner ; public class A1506 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; scn . close ( ) ; System . out . println ( ( k = = 1 ) ? " 0 " : n - k ) ; } } import java . io . * ; public class X Cubic { public static void main ( String [ ] args ) throws IOException { int x , x _ 3 ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; x _ 3 = x * x * x ; System . out . println ( x _ 3 ) ; } } public class Main { public static cul int ( int x ) { y = x * x * x ; return y ; public static void main ( String [ ] args ) { int y = int ( x ) ; Sytem . out . println ( y ) ; } } # include " stdio.h " int main ( x ) { printf ( " % d \ n " , x * x * x ) ; } import java . util . * ; public class Main { public static Long gcd ( Long x , Long y ) { if ( x < y ) return gcd ( y , x ) ; if ( y = = 0 ) return x ; return gcd ( y , x % y ) ; } public static Long lcm ( Long x , Long y ) { return x * y / gcd ( x , y ) ; } public static Long fac ( Long x ) { if ( x = = 0 ) return x + 1 ; return x * fac ( x - 1 ) ; } public static Long per ( Long x , Long y ) { return fac ( x ) / fac ( x - y ) ; } public static Long com ( Long x , Long y ) { return per ( x , y ) / fac ( y ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; Long b = sc . nextLong ( ) ; Long c = sc . nextLong ( ) ; Long [ ] in = new int [ a ] ; double d = 0 ; Long e = a - a ; Long f = e ; Long g = e ; f + + ; for ( int i = 0 ; i < a ; i + + ) { in [ i ] = sc . nextLong ( ) ; } Arrays . sort ( in ) ; for ( int i = 0 ; i < b ; i + + ) { d + = in [ a - i - 1 ] ; } d / = b ; for ( int i = 0 ; i < a ; i + + ) { if ( i > = a - c & & in [ i ] = = in [ a - b ] ) { f + + ; if ( i > = a - b ) { g + + ; } } } for ( Long i = g ; i < = f ; i + + ) { e + = com ( f , i ) ; } System . out . println ( d ) ; System . out . println ( e ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; system . out . println ( x * x * x ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; Public class Main { Static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; System . out . println ( answer ) ; } } import java . lang . * ; import java . util . * ; ? ? ? ? class Main { ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? Scanner stdId = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? ? ? int n = stdId . nextInt ( ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int sum = 0 ; sum = x * x * x ; System . out . println ( sum ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( Systm . in ) ; int r , sum ; r = sc . nextInt ( ) ; System . out . print ( r ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . next ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; ? ? class Main { ? ? ? ? public static void main ( String [ ] args ) throws java . io . IOException { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ? ? ? ? ? ? ? ? ? ? String hoge = input . readLine ( ) ; ? ? ? ? ? ? ? ? int i = Integer . parseInt ( hoge ) ; ? ? ? ? ? ? ? ? ? ? System . out . println ( i * i * i ) ; ? ? ? ? } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA = new String [ ] ; String [ ] imgB = new String [ ] ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = " " ; imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = " " ; imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . * ; import java . io . * ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; short x = scan . nextShort ( ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int x = stdin . nextInt ( ) ; if ( x > = 1 | | x < = 100 ) { System . out . println ( x * x * x ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; int b ; if ( a < 0 ) { b = a * - 1 ; } if ( ( V - W ) * T > = b | | a = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( a + e < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } public class Main { public static void main ( String [ ] args ) { Int x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } 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 ( ) ; if ( a > = 13 ) { System . out . println ( B ) ; } else if ( a < = 12 & & a > = 6 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 1 ; for ( int i = 0 ; i < N ; i + + ) { max = Math . pow ( 2 , i ) ; if ( max > N ) { break ; } } max = max / 2 ; System . out . println ( max ) ; } } public class ITP1 _ 2 _ A { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . next ( ) ; List < String > list = new ArrayList < > ( ) ; replace ( list , new StringBuilder ( text ) , " " , 0 ) ; int maxScoore = 0 ; int maxIndex = 0 ; int index = 0 ; for ( String str : list ) { int score = 0 ; for ( int i = 0 ; i < str . length ; i + + ) { if ( str . charAt ( i ) = = ' ? ' ) { continue ; } if ( str . charAt ( i ) = = ' D ' ) { score + + ; } else { if ( str . charAt ( i + 1 ) = = ' D ' ) { score + + ; } } } if ( score > maxScore ) { maxScore = score ; maxIndex = index ; } index + + ; } return list . get ( maxIndex ) } private void replace ( List < String > list , String text , String tmp , int index ) { for ( int i = index ; i < text . length ) { tmp + = text . charAt ( i ) ; if ( text . charAt ( i ) = = ' ? ' ) { replace ( list , new StringBuilder ( text ) , tmp + ' P ' , i + 1 ) ; replace ( list , new StringBuilder ( text ) , tmp + ' D ' , i + 1 ) ; } } list . add ( tmp + ' \ n ' ) ; } } public class Main { public static cul int ( int x ) { x = x * * 3 ; return x ; } public static void main ( String [ ] args ) { cul ( x ) ; Sytem . out . println ( x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( reader . readLine ( ) ) ; x = Math . pow ( x , 3 ) ; System . out . print ( x ) ; } } import java . util . Scanner ; public class Abc127A { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int age = in . nextInt ( ) ; int cost = in . nextInt ( ) ; in . close ( ) ; int ans = age > 12 ? cost : age < 6 ? 0 : cost / 2 ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x = 6 * * 3 ; System . out . prinln ( x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word ; try { word = reader . readLine ( ) ; int num = Integer . parseInt ( word ) ; int ans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { reader . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } } Compile Error Logs : You are not authorized to see the message . ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Judge : 4 / 4 JAVA CPU : 00.03 sec Memory : 24408 KB Length : 723 B 2016 - 02 - 22 23 : 58 2016 - 02 - 22 23 : 58 ? ? ? ? ? ? ? ? ? ? ? ± ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ase erdict PU ime emory n ut ase ame ase 1 : ccepted 0.03 ec 4408 B est _ case _ 1 ase 2 : ccepted 0.03 ec 3900 B est _ case _ 2 ase 3 : ccepted 0.03 ec 4124 B est _ case _ 3 ase 4 : ccepted 0.03 ec 4132 B est _ case _ 4 rev ext ccepted 0.03 ec 4408 B udge nput 1 n1. t xt ) udge utput 1 ut1. t xt ) omments ? \ ? ? ? ? ? ? ? ? § ? ? ? ? ? ? C tegories F ee T gs import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; System . out . println ( i * i * i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = sc . nextInt ( ) ; int A = 0 ; int B = 0 ; boolean tf = false ; for ( int i = - 100 ; i < 100 ; i + + ) { for ( int j = - 100 ; j < 100 ; j + + ) { if ( i * i * i * i * i - j * j * j * j * j = = X ) { A = i ; B = j ; tf = true break ; } } if ( tf ) break ; } System . out . println ( A + " " + B ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int n = sc . nextInt ( ) ; if ( n = = 0 ) break ; int a = sc . nextInt ( ) ; double h = sc . nextDouble ( ) / 100 ; double w = sc . nextDouble ( ) ; double b = Math . abs ( 22 - w / ( h * h ) ) ; for ( int i = 1 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; h = sc . nextDouble ( ) / 100 ; w = sc . nextDouble ( ) ; double a = Math . abs ( 22 - w / ( h * h ) ) ; if ( a < b ) { b = a ; a = x ; } else if ( a = = b & & x < a ) a = x ; } System . out . println ( a ) ; } } } import lib . Input ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { int f ( int x ) { int c = 0 ; while ( x % 2 = = 0 ) { x / = 2 ; + + c ; } return c ; } public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int max = 0 , res = 1 ; for ( int i = 1 ; i < = n ; + + i ) { if ( f ( i ) > max ) { res = i ; max = Math . max ( max , f ( i ) ) ; } } out . println ( res ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; import java . util . Scanner ; public class AskCubeOfX { public int Input ( ) { int x = 0 ; Scanner in = new Scanner ( System . in ) ; x = in . nextInt ( ) ; return x ; } public int askCube ( int x ) { return x * x * x ; } public void Print ( int cube ) { System . out . println ( cube ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 0 , cube = 0 ; AskCubeOfX test = new AskCubeOfX ( ) ; x = test . Input ( ) ; cube = test . askCube ( x ) ; test . Print ( cube ) ; } } import java . util . Scanner ; public class Test { static int n , min = Integer . MAX _ VALUE ; static int [ ] nums ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; nums = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } if ( n = = 2 ) { min = nums [ 0 ] = = nums [ 1 ] ? 1 : 0 ; System . out . println ( min ) ; return ; } t ( 0 , 0 ) ; System . out . println ( min ) ; } public static void t ( int i , int pv ) { if ( i > = n ) return ; if ( i = = 0 ) { int cv = 0 ; for ( int x = 2 ; x < n ; x + + ) if ( x % 2 = = 0 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; t ( i + 1 , cv ) ; } else { int cv = 0 ; for ( int x = 0 ; x < n ; x + + ) { if ( ( pv + cv ) > min ) break ; if ( i ! = x & & i % 2 = = x % 2 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; } if ( nums [ i - 1 ] = = nums [ i ] & & pv = = 0 & & cv = = 0 ) cv = n / 2 ; min = Math . min ( min , pv + cv ) ; t ( i + 1 , pv + cv ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String T = sc . next ( ) ; int N = T . length ( ) ; String t [ ] = T . split ( " " , 0 ) ; String anss = " 0 " ; for ( int i = 0 ; i < N ; i + + ) { if ( t [ i ] . equals ( " ? " ) ) { t [ i ] = = " D " ; } anss = anss + t [ i ] ; } String ans = anss . split ( 1 , N + 1 ) ; System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) { int x ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String but = br . readLine ( ) ; x = Integer . parseInt ( but ) ; if ( x > = 0 & & x < = 100 ) { x = x * x * x ; } } } import java . util . * ; import java . text . * ; public Class Main { public static void main ( String args [ ] ) { SimpleDateFormat f = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date heisei = f . parse ( " 2019 / 04 / 30 " ) ; Date d = f . parse ( args [ 0 ] ) ; if ( d . after ( heisei ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int n = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( i * 500 + j * 100 + k * 50 ) = = x ) { n + + ; } } } } System . out . println ( n ) ; } } } import java . util . Scanner ; import . java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; int i = x ^ 3 ; System . out . println ( i ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class BC042 _ IrohaAndHaiku { public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) arr [ i ] = in . nextInt ( ) ; Arrays . sort ( arr ) ; if ( isHaiku ( arr ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static boolean isHaiku ( int [ ] arr ) { int [ ] haiku = { 5 , 5 , 7 } ; for ( int i = 0 ; i < 3 ; i + + ) if ( arr [ i ] ! = haiku [ i ] ) return false ; return true ; } static class InputReader { public BufferedReader br ; public StringTokenizer st ; public InputReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = null ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } public class Main { public static void main ( String [ ] args ) { int a = a ; int e = e ; int k = e - a ; if ( k < = 15 ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int kekka ; kekka = x * x * x ; System . out . println ( kekka ) ; } } import java . io . * public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . lang . * ; import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner stdId = new Scanner ( system . in ) ; int n = stdId . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } } import java . util . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int count [ ] = { 0 , 0 } ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 3 ; i + + ) { if ( num [ i ] = = 5 ) count [ 0 ] + + ; else if ( num [ i ] = = 7 ) count [ 1 ] + + ; } if ( count [ 0 ] = = 2 & & count [ 1 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 9 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = Ni [ i ] ; break ; } } System . out . println ( sum - 10 * count + min ) ; } } public class Main { public static void main ( String [ ] args ) { int a = new java . util . Scanner ( System . in ) . nextLine ( ) ; int b = new java . util . Scanner ( System . in ) . nextLine ( ) ; int c = new java . util . Scanner ( System . in ) . nextLine ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { Sytem . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { Sytem . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { Sytem . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . scanner ; public class Main ( ) { public staic void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; public class Itp1 _ 1b { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Itp1 _ 1b obj = new Itp1 _ 1b ( ) ; obj . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scaner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; int mp = x * * 3 ; System . out . println ( mp ) ; } } # include < bits / stdc + + . h > using namespace std ; int main ( void ) { ios : : sync _ with _ stdio ( 0 ) ; cin . tie ( 0 ) ; cout . tie ( 0 ) ; int n ; cin > > n ; int MAX = INT _ MIN ; int MIN = INT _ MAX ; int temp ; for ( int i = 0 ; i < n ; + + i ) { cin > > temp ; MAX = max ( MAX , temp ) ; MIN = min ( MIN , temp ) ; } cout < < MAX - MIN < < endl ; return 0 ; } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long m = sc . nextLong ( ) ; long leastCommon = 1 ; for ( int i = 0 ; i < n ; i + + ) { long num = sc . nextLong ( ) ; leastCommon = calcLeastCommon ( leastCommon , num ) ; if ( leastCommon > m * 2 ) { print ( 0 ) ; return ; } } print ( ( m + leastCommon / 2 ) / leastCommon ) ; sc . close ( ) ; } public static long calcLeastCommon ( long x , long y ) { return x * y / calcGreatestCommon ( x , y ) ; } public static long calcGreatestCommon ( long x , long y ) { long temp ; while ( x % y ! = 0 ) { temp = y ; y = x % y ; x = temp ; } return y ; } public static void print ( Object obj ) { System . out . println ( obj ) ; } } public class Main { public static cul int ( int x ) { x = x * * 3 ; return x ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( ) int i = x ^ 3 ; System . out . println ( i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long n = sc . nextLong ( ) ; List < Long > a = new ArrayList < Long > ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { a . add ( i , sc . nextLong ( ) ) ; } if ( a . get ( 0 ) = = a . get ( 1 ) ) { a . get ( 1 ) = a . get ( 0 ) + 1 ; count + + ; } if ( 4 < = n ) { for ( int i = 2 ; i < n ; i + = 2 ) { if ( a . get ( 0 ) ! = a . get ( i ) ) { count + + ; } } for ( int i = 3 ; i < n ; i + = 2 ) { if ( a . get ( 1 ) ! = a . get ( i ) ) { count + + ; } } } System . out . println ( count ) ; } } public class XCubic { public static void main ( String [ ] args ) { int x ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int num = scanner . nextInt ( ) ; int x = Math . pow ( num , 3 ) ; System . out . println ( " num " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanne ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = new String ( in . readLine ( ) ) ; String [ ] input = line . split ( " " , 0 ) ; int age = Integer . parseInt ( input [ 0 ] . trim ( ) ) ; int price = Integer . parseInt ( input [ 1 ] . trim ( ) ) ; if ( age < = 5 ) { System . out . print ( " 100 " ) ; } else if ( age < = 12 ) { System . out . print ( price / 2 ) ; } else { System . out . print ( price ) ; } } catch ( IOException e ) { System . out . print ( e ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { int n ; int [ ] v1 , v2 ; { Scanner s = new Scanner ( System . in ) ; n = s . nextInt ( ) ; v1 = new int [ n ] ; v2 = new int [ n ] ; for ( int i = 0 ; i < n / 2 ; i + + ) { v1 [ s . nextInt ( ) ] + + ; v2 [ s . nextInt ( ) ] + + ; } } System . out . println ( n - v1 [ max ( v1 ) ] - v2 [ max ( v2 ) ] ) ; } static int max ( int [ ] v ) { int ans = 0 ; for ( int i = 1 ; i < v . length ; i + + ) { if ( v [ i ] > v [ ans ] ) { ans = i ; } } return ans ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = Integer . parseInt ( sc . next ( ) ) ; int cityNum = Integer . parseInt ( sc . next ( ) ) ; Map < String , List < Integer > > map = new HashMap < String , List < Integer > > ( ) ; String [ ] [ ] array = new String [ cityNum ] [ 2 ] ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( String . valueOf ( i + 1 ) , new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { array [ i ] [ 0 ] = sc . next ( ) ; array [ i ] [ 1 ] = sc . next ( ) ; map . get ( array [ i ] [ 0 ] ) . add ( Integer . parseInt ( array [ i ] [ 1 ] ) ) ; } for ( String key : map . keySet ( ) ) { Collections . sort ( map . get ( key ) ) ; for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { for ( int j = 0 ; j < array . length ; j + + ) { if ( array [ j ] [ 0 ] . equals ( key ) & & Integer . parseInt ( array [ j ] [ 1 ] ) = = ( map . get ( key ) . get ( i ) ) ) { StringBuilder sb = new StringBuilder ( ) ; while ( key . length ( ) < 6 ) { sb . append ( " 0 " ) ; } sb . append ( key ) ; while ( map . get ( key ) . get ( i ) . length < 6 ) { sb . append ( " 0 " ) ; } array [ j ] [ 0 ] = sb . append ( map . get ( key ) . get ( i ) ) . toString ( ) ; } } } } for ( String [ ] ary2 : array ) { System . out . println ( ary2 [ 0 ] ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A + B + C ) ! = 17 ) { System . out . println ( " No " ) ; } else if ( A ! = 7 & & B ! = 7 & & C ! = 7 ) { System . out . println ( " No " ) ; } else if ( A ! = 5 & & B ! = 5 & & C ! = 5 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } ; } ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int n = scan . nextInt ( ) ; if ( n = = 0 ) break ; int ans = 0 , x = 0 , near = 0 , j = 0 ; for ( int i = 0 ; i < n ; i + + ) { int num = scan . nextInt ( ) ; int w ; double h ; h = scan . nextDouble ( ) / 100 ; w = scan . nextInt ( ) ; int bmi = ( int ) ( ( double ) w / ( h * h ) ) ; if ( i = = 0 ) ans = num ; if ( bmi > = 22 ) x = bmi - 22 ; else x = 22 - bmi ; near = Double . MAX _ VALUE ; if ( near > x ) { near = x ; ans = num ; } } System . out . println ( ans ) ; } } } class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; System . out . println ( m . cube ( m . readInt ( System . in ) ) ) ; } private Main ( ) { } int readInt ( InputStream is ) { java . io . DataInputStream dis = new java . io . DataInputStream ( is ) ; return dis . readInt ( ) ; } int cube ( int n ) { return n * n * n ; } } import java . io * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , ans ; x = Integer . ParseInt ( br . readLine ) ; ans = x * x * x ; System . out . println ( ans ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * a ) ; } import java . util . * ; public class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { for ( int z = 0 ; z < = k ; z + + ) { if ( x + y + z = = s ) { count + + ; } } } } System . out . println ( count ) ; } } import java . util . * ; public class Test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < 13 & & a > = 6 ) b / = 2 ; else if ( a < 6 ) b = 0 ; System . out . println ( b ) ; } } package atCoder ; import java . util . Scanner ; public class ABC082 _ Round _ Up _ The _ Mean { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double x = ( a + b ) / 2 ; double ans = Math . ceil ( x ) ; System . out . println ( ( int ) ans ) ; } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { StringTokenizer token = new StringTokenizer ( " 5 5 7 " ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( Integer . parseInt ( token . nextElement ( ) . toString ( ) ) = = 7 ) sevenCounter + + ; else fiveCounter + + ; } } catch ( Exception ex ) { } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { class static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int n = Integer . parseInt ( line ) ; System . out . println ( n + " / n " ) ; } catch ( Ioexception e ) { System . out . println ( e ) ; } } } import java . util . * ; import java . util . stream . * ; class Main { public static void main ( String [ ] args ) { var scanner = new Scanner ( System . in ) ; var x = scanner . nextInt ( ) ; var amax = ( int ) pow ( x + 0.9 , 0.2 ) ; for ( int a = 1 ; a < = amax ; a + + ) { var b = fact5 ( x - a * a * a * a * a ) ; if ( b > = 0 ) { System . out . println ( a + " " + ( - b ) ) ; System . exit ( 0 ) ; } } var bmax = ( int ) pow ( x / 5 + 0.9 , 0.25 ) ; for ( int b = 1 ; b < = bmax ; b + + ) { var a = fact5 ( x + b * b * b * b * b ) ; if ( a > = 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } static int fact5 ( int x ) { assert x > 0 ; var r = ( int ) pow ( x + 0.9 , 0.2 ) ; if ( x > r * r * r * r * r ) r = - 1 ; return r ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { Sytem . out . println ( " 入出力エラーです " ) ; } } } import java . util . * ; public static void main ( String [ ] atgs ) { Scanner scan = new Scanner ( System . in ) ; int ans = 0 ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; scan . close ( ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . next ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader rd = new BufferedReader ( new InputStreamReader ( system . in ) ) ; int read = IntegerParseInt ( rd . ReadLine ( ) ) ; system . out . println ( ( int ) Math . pow ( read , 3 ) ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BuferedReader ( new InputStreamReader ( Systen . in ) ) ; try { String temp = reader . readLine ( ) ; int x = Integer . parseInt ( temp ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " Input only 1data " ) ; } return ; } } # include < stdio . h > int main ( void ) { int num , a ; while ( 1 ) { scanf ( " % d " , & num ) ; if ( num = = 0 ) break ; else { int sum = 0 ; while ( num > 0 ) { a = num % 10 ; sum = sum + a ; num = num / 10 ; } printf ( " % d \ n " , sum ) ; } } return 0 ; } import java . io * public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Math . pow ( b , 3 ) ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = null ; sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; boolean flag = false ; for ( int i = 1 ; i < = T ; i + + ) { if ( A + ( V * i ) = = B + ( W * i ) | | if ( A + ( V * i ) = = B ) { flag = true ; break ; } } if ( flag ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } n = gets . to _ i puts n * n import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] t = new int [ N ] ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { t [ i ] = sc . nextInt ( ) ; a [ i ] = sc . nextInt ( ) ; } long [ ] dp = new long [ N ] ; dp [ 0 ] = t [ 0 ] + a [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { long tnum = ( dp [ i - 1 ] / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ) * t [ i - 1 ] ) ; long anum = ( dp [ i - 1 ] / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ) * a [ i - 1 ] ) ; long rate = Math . max ( ( long ) Math . ceil ( ( double ) tnum / ( double ) t [ i ] ) , ( long ) Math . ceil ( ( double ) anum / ( double ) a [ i ] ) ) ; dp [ i ] = rate * ( long ) ( t [ i ] + a [ i ] ) ; } System . out . println ( dp [ N - 1 ] ) ; } } import java . io . * ; import java . util . * ; import java . lang . * ; public class NAIN { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } import java . util . * ; import java . text . * ; public class Main { public static void main ( String args [ ] ) { SimpleDateFormat f = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date heisei = f . parse ( " 2019 / 04 / 30 " ) ; Date d = f . parse ( args [ 0 ] ) ; if ( d . after ( heisei ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * x * x ) + ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class AtCoder2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputNum = sc . nextInt ( ) ; sc . nextLine ( ) ; String input = sc . nextLine ( ) ; int centerValue = inputNum / 2 ; String [ ] arrayStr = input . split ( " " ) ; int [ ] arrayInt = new int [ arrayStr . length ] ; int [ ] arrayIntCopy = new int [ arrayStr . length ] ; for ( int i = 0 ; i < arrayStr . length ; i + + ) { arrayInt [ i ] = Integer . parseInt ( arrayStr [ i ] ) ; arrayIntCopy [ i ] = Integer . parseInt ( arrayStr [ i ] ) ; } for ( int i = 0 ; i < arrayStr . length ; i + + ) { arrayInt [ i ] = 0 ; Arrays . sort ( arrayInt ) ; System . out . println ( arrayInt [ centerValue ] ) ; System . arraycopy ( arrayIntCopy , 0 , arrayInt , 0 , arrayInt . length ) ; } sc . close ( ) ; } } import java . lang . * ; import java . util . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( in ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } } import java . util . * ; class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { if ( str . equals ( " 0 " ) ) break ; int t = 0 ; for ( int i = 0 ; i < str . length ( ) ; i + + ) { t + = Character . getNumericValue ( str . charAt ( i ) ) ; } System . out . println ( t ) ; } } } Scanner sn = new Scanner ( System . in ) ; int A = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; int sum = A + B + C ; if ( sum = = 17 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } # include < iostream > using namespace std ; int main ( ) { int a , b , x , y ; cin > > a > > b ; x = a * b ; y = 2 * ( a + b ) ; cout < < x < < y < < endl ; return 0 ; } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( scan . next ( ) ) ; } Arrays . sort ( a ) ; System . out . println ( a [ n - 1 ] - a [ 0 ] ) ; } } lass Main { public static void main ( String args [ ] ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int y = x * x * x ; System . out . prinln ( " y " ) ; } } import java . text . * ; import java . util . * ; public class MainJ { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; try { DateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date date1 = sdf . parse ( a ) ; Date date2 = sdf . parse ( " 2019 / 04 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } } class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readln ( ) . trim ( ) ) ; System . out . println ( " " + x * x * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } catch IOException { } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . printf ( " % d % n " , Math . floor ( ( a + b ) / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( C < a + b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class x _ cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( ( int ) ( x * x * x ) ) ; } } public class Main { public static void main ( String [ ] args ) } { int year = args [ 0 ] . substring ( 0 , 3 ) ; int month = args [ 0 ] . substring ( 5 , 6 ) ; int day = args [ 0 ] . substring ( 8 , 9 ) ; Date inputDay = new Date ( year , month , day , 12 , 0 , 0 ) ; Date s = new Date ( 2019 , 4 , 30 , 12 , 0 , 0 ) ; if ( s . before ( inputDay ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . Scanner ; public class A001 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int e = s . nextInt ( ) ; int k = s . nextInt ( ) ; int [ ] f = { a , b , c , d , e , k } ; for ( int i = 0 ; i < f . length ; i + + ) { int n1 = 0 ; int n2 = 0 ; int ans = 0 ; for ( int j = 0 ; j < f . length ; j + + ) { if ( i = = j ) { continue ; } n1 = f [ i ] ; n2 = f [ j ] ; if ( n1 > n2 ) { ans = n1 - n2 ; } else { ans = n2 - n1 ; } ; if ( ans > k ) { System . out . println ( " : ( " ) ; return ; } } ; } ; System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numlist [ ] = new int [ 5 ] ; int k ; int result = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ( numlist [ i + 1 ] - numlist [ i ] ) > k ) { result = 1 ; break ; } } if ( result = = 0 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numlist [ ] = new int [ 5 ] ; int k ; int result = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ( numlist [ i + 1 ] - numlist [ i ] ) = = 2 ) { result = 1 ; break ; } } if ( result = = 0 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } package internship ; import java . util . Scanner ; public class { public static void main ( String [ ] args ) { int x = 0 , temp , tot ; boolean swi = false ; Scanner sc = new Scanner ( System . in ) ; while ( swi = = true ) { temp = sc . nextInt ( ) ; if ( 1 < = temp | | 100 < = temp ) x = temp ; swi = true ; } tot = x * x * x ; System . out . println ( tot ) ; System . out . println ( ) ; } } import java . util . Scanner ; public class tamrini { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a ; a = new int [ 3 ] ; boolean dool = false ; for ( int i = 0 ; i < 3 ; i + + ) { int x = scanner . nextInt ( ) ; if ( x ! = 5 & & x ! = 7 ) { System . out . println ( " NO " ) ; dool = true ; break ; } a [ i ] = x ; } if ( dool = = false ) { boolean chool = false ; for ( int i = 0 ; i < 2 ; i + + ) { if ( a [ i ] > a [ i + 1 ] ) { System . out . println ( " NO " ) ; chool = true ; break ; } } if ( chool = = false ) System . out . println ( " YES " ) ; } scanner . close ( ) ; } } # include < iostream > # include < vector > # include < cmath > # include < algorithm > using namespace std ; const double EPS = 1e-8 ; int main ( ) { int H , W ; string f [ 600 ] ; while ( cin > > H > > W ) { for ( int i = H - 1 ; i > = 0 ; i -- ) cin > > f [ i ] ; vector < pair < double , int > > vd ; for ( int i = 1 ; i < = H ; i + + ) { for ( int j = 0 ; j < = W ; j + + ) { int cnt = 0 ; for ( int k = 0 ; k < 4 ; k + + ) { int ni = i - k % 2 , nj = j - k / 2 ; if ( 0 < = ni & & ni < H & & 0 < = nj & & nj < W & & f [ ni ] [ nj ] = = ' # ' ) cnt + + ; } if ( cnt % 2 = = 1 ) { if ( 0 < = i - 1 & & i - 1 < H & & 0 < = j & & j < W & & f [ i - 1 ] [ j ] = = ( cnt = = 1 ? ' # ' : ' .' ) ) vd . push _ back ( make _ pair ( ( double ) j / i , 1 ) ) ; if ( 0 < = i & & i < H & & 0 < = j - 1 & & j - 1 < W & & f [ i ] [ j - 1 ] = = ( cnt = = 1 ? ' # ' : ' .' ) ) vd . push _ back ( make _ pair ( ( double ) j / i , - 1 ) ) ; } } } sort ( vd . begin ( ) , vd . end ( ) ) ; int res = 1 , cur = 1 ; for ( int i = 0 ; i < vd . size ( ) ; ) { int idx = i ; while ( idx < vd . size ( ) & & abs ( vd [ i ] . first - vd [ idx ] . first ) < EPS ) cur + = vd [ idx + + ] . second ; i = idx ; res = max ( cur , res ) ; } cout < < res < < endl ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; double [ ] x = new double [ a ] ; double [ ] y = new String [ a ] ; for ( int i = 0 ; i < a ; i + + ) { x [ i ] = sc . nextDouble ( ) ; y [ i ] = sc . nextDouble ( ) ; } double b = 0 ; for ( int i = 0 ; i < a - 1 ; i + + ) { for ( int j = i + 1 ; j < a ; j + + ) { b + = Math . sqrt ( ( x [ i ] - x [ j ] ) * ( x [ i ] - x [ j ] ) + ( y [ i ] - y [ j ] ) * ( y [ i ] - y [ j ] ) ) ; } } b * = 2 / a ; System . out . println ( b ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ 5 ] fromAnt ; int [ 5 ] toAnt ; for ( int i = 0 ; i < 5 ; i + + ) { fromAnt [ i ] = sc . nextInt ( ) ; toAnt [ i ] = fromAnt [ i ] ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( toAnt [ j ] - fromAnt [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; return ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; if ( formatDate . before ( 20 19 / 0 4 / 3 0 ) ) { S y s em.out . pri n tln ( " He i s ei " ) ; } e l e { Sy s em.out . pri n tln ( " TB D " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; boolean hantei = false ; long amari = 0 ; long a = 0 , b = 0 , swap = 0 , r = 0 , x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; if ( i = = 0 ) amari = A [ i ] % 2 ; else { if ( A [ i ] % 2 ! = amari ) { hantei = true ; break ; } } } long max = A [ 0 ] ; if ( hantei = = false ) { for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } } if ( max > M * 2 | | hantei = = true ) System . out . println ( 0 ) ; else { long ans = ( M - ( max / 2 ) ) / max + ( long ) 1 ; System . out . println ( ans ) ; } } } public class Main { public class void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; int sum = x * x * x ; System . out . println ( sum ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line1 = br . readLine ( ) ; line1 = line1 . trim ( ) ; int N = Integer . parseInt ( line1 ) ; long PosA = 0 ; long PosB = 0 ; long a = 0 ; long b = 0 ; long mag = 0 ; for ( int i = 0 ; i < N ; i + + ) { String lines = br . readLine ( ) ; lines = lines . trim ( ) ; String [ ] temp = lines . stlip ( " " ) ; a = Integer . parseInt ( temp [ 0 ] ) ; b = Integer . parseInt ( temp [ 1 ] ) ; if ( PosA < = a & & PosB < = b ) { PosA = a ; PosB = b ; } else { mag = ( long ) Math . ceil ( Math . max ( ( double ) PosA / a , ( double ) PosB / b ) ) ; PosA = a * mag ; PosB = b * mag ; } } } } import java . util . * ; import java . io . * ; public class main { public static void main ( String [ ] args ) throws Exception { new main ( ) . print ( ) ; return ; } void print ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; } } import java . io . Scanner ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) ( Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X [ ] = new int [ N ] ; int sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { X [ i ] = sc . nextInt ( ) ; sum = sum + X [ i ] ; } double M = ( double ) Math . round ( sum / N ) ; int ans1 = 0 ; for ( int i = 0 ; i < X . length ; i + + ) { ans1 = X [ i ] ; ans + = ( int ) Math . pow ( ans1 - M , 2 ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int x = a * b ; int y = c * d ; if ( x < y ) System . out . println ( y ) ; else if ( x > y ) System . out . println ( x ) ; else System . out . println ( x ) ; } } import static java . lang . System . out ; import java . util . Scanner ; class Main { public void main ( String ... args ) { String x = new Scanner ( System . in ) . nextLine ( ) ; int input = Integer . parseInt ( x ) ; out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ABC _ 042 { public static void main ( String [ ] args ) { int number1 = 0 ; int number2 = 0 ; int number3 = 0 ; String anser = " NO " ; Scanner scan = new Scanner ( System . in ) ; number1 = scan . nextInt ( ) ; number2 = scan . nextInt ( ) ; number3 = scan . nextInt ( ) ; if ( checkFiveOrSeven ( number1 ) ) { if ( checkFiveOrSeven ( number2 ) ) { if ( checkFiveOrSeven ( number3 ) ) { if ( number1 + number2 + number3 = = 17 ) { anser = " YES " ; } } } } System . out . println ( anser ) ; } private static boolean checkFiveOrSeven ( int number ) { if ( number = = 5 | | number = = 7 ) { return true ; } return false ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int n = Integer . parseInt ( str ) ; int ans = 1 ; int min = 0 ; str = scan . nextLine ( ) ; String [ ] substr = str . split ( " " , 0 ) ; int [ ] array = new int [ 200000 ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = Integer . parseInt ( substr [ i ] ) ; } if ( array [ 1 ] < = array [ 0 ] ) { min = array [ 1 ] ; ans + + ; } else { min = array [ 0 ] ; } for ( int i = 2 ; i < n ; i + + ) { if ( min > array [ i ] ) { min = array [ i ] ; ans + + ; } } System . out . println ( ans ) ; scan . close ( ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; String str = br . readline ( ) ; int N = Integer . parseInt ( str ) ; int Ans = N ^ 3 ; System . out . println ( Ans ) ; } } import java . util . * ; public class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ; int i , tmp , pre ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String [ ] a = new String [ n ] ; String [ ] b = new String [ m ] ; for ( i = 0 ; i < n ; i + + ) { a [ i ] = sc . next ( ) ; } for ( i = 0 ; i < m ; i + + ) { b [ i ] = sc . next ( ) ; } for ( i = 0 ; i < n - m + 1 ; i + + ) { for ( int j = 0 ; j < n - m + 1 ; j + + ) { if ( j = = 0 ) tmp = 0 ; else tmp = pre ; tmp = a [ i ] . indexOf ( b [ i ] , tmp ) ; if ( tmp = = - 1 ) break ; pre = tmp ; if ( Main . check ( tmp , i , a , b ) ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } public static boolean check ( int col , int row , String [ ] a , String [ ] b ) { for ( int i = 1 ; i < m ; i + + ) { if ( a [ row + i ] . indexOf ( b [ i ] , col ) ! = col ) return false ; } return true ; } } 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 ( ) ; System . out . println ( a * b + " " + ( a * 2 + b * 2 ) ) ; } import java . util . Scanner ; public class xcubic { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . io . * ; public class Keisan4 { public static void main ( String [ ] args ) { System . out . println ( " Input number " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int N = Integer . parseInt ( line ) ; if ( N < = 1 | | 100 < = N ) { System . out . println ( " Number is not collect " ) ; } else { System . out . println ( N * N * N ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " Number is not collect " ) ; } } } class Main { public static void main ( String args [ ] ) { int x = Integer . parseInt ( arg [ 0 ] ) System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Test1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String box = sc . next ( ) ; int sum = 0 ; for ( int i = 0 ; i < box . length ( ) ; i + + ) { sum + = box . charAt ( i ) - ' 0' ; } System . out . printf ( " % d \ n " , sum ) ; } } } package zen ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class SumOfThree { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; int max = Integer . parseInt ( s [ 0 ] ) ; int ans = Integer . parseInt ( s [ 1 ] ) ; int result = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int k = ans - ( i + j ) ; if ( 0 < = k & & k < = ans ) result + + ; } } System . out . println ( result ) ; } } package ABC145 ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int a = r * r ; System . out . println ( a ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { int age = 0 ; int change = 0 ; int result = 0 ; Scanner sc = new Scanner ( System . in ) ; age = sc . nextInt ( ) ; change = sc . nextInt ( ) ; if ( age < = 5 ) { result = 0 ; } else if ( 6 < = age & & age < = 12 ) { result = change / 2 ; } else { result = change ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int k = scn . nextInt ( ) ; int s = scn . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { if ( s > = x + y & & s - ( x + y ) < = k ) { count = count + 1 } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; System . out . println ( Math . max ( a * b , c * d ) ) ; } } package test . java ; import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = 3 ; System . out . println ( " " + Math . pow ( a , b ) + " " ) ; } } import java . util . Scanner ; class BinaryConversion { public static long [ ] decimalToBinary ( long num ) { long [ ] a = new long [ 60 ] ; int i = a . length - 1 ; while ( num ! = 0 ) { a [ i ] = num % 2 ; num / = 2 ; i -- ; } return a ; } public static long binaryToDecimal ( long [ ] a ) { long num = 0 ; for ( int i = 0 ; i < a . length ; i + + ) { num + = ( a [ i ] * Math . pow ( 2 , a . length - 1 - i ) ) ; } return num ; } } public class XOR { public static long [ ] xor ( long num1 , long num2 ) { long [ ] a = BinaryConversion . decimalToBinary ( num1 ) ; long [ ] b = BinaryConversion . decimalToBinary ( num2 ) ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = ( a [ i ] + b [ i ] ) % 2 ; } return a ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] num = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { num [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < num . length - 1 ; i + + ) { for ( int j = i + 1 ; j < num . length ; j + + ) { long [ ] temp = XOR . xor ( num [ i ] , num [ j ] ) ; sum + = BinaryConversion . binaryToDecimal ( temp ) ; } } sum % = ( Math . pow ( 10 , 9 ) + 7 ) ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Abc127A01 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > 12 ) { System . out . println ( b ) ; } else if ( a > 5 ) { System . out . println ( b / 2 ) ; } else { System . out . println ( 0 ) ; } } } public void Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } for ( int a = 0 ; a < N ; a + + ) { for ( int b = 0 ; b < = i ; b + + ) { if ( P [ a ] > P [ b ] ) { break ; } } count + = 1 ; } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn . new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int y = ( n / 15 ) * 200 ; int x = n * 800 ; System . out . println ( x - y ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ) ; ans = x * x * x ; System . out . printline ( ans ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { MyScanner scanner = new MyScanner ( ) ; int A = scanner . nextIn ( ) ; int B = scanner . nextIn ( ) ; int C = scanner . nextIn ( ) ; int X = scanner . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = A ; i + + ) { int ans1 = + 500 * i ; for ( int j = 0 ; j < = B ; j + + ) { int ans2 = + 100 * j ; for ( int k = 0 ; k < = C ; k + + ) { int ans3 = + 50 * k ; if ( ans1 + ans2 + ans3 = = X ) { ans + + ; } } System . out . print ( ans ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c - sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( e - a < = k ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; import java . util . InputMismatchException ; class main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int r = scanner . nextInt ( ) ; scanner . close ( ) ; System . out . println ( r * r ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int b = 0 ; int xcubic ; int a = 0 ; while ( b = 0 ) { while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 00 ) i = - 1 ; } x c bi a a a ; Sys e . u . p r n ln ( xcu i ) ; } } } import java . util . Scanner ; import java . util . Date ; import java . text . ParseException ; import java . text . SimpleDateFormat ; public class StillTBD { public static void main ( String [ ] args ) { try { Scanner scanner = new Scanner ( System . in ) ; String input _ str = scanner . next ( ) ; scanner . close ( ) ; SimpleDateFormat sdFormat = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date input _ date = sdFormat . parse ( input _ str ) ; Date standard _ date = sdFormat . parse ( " 2019 / 04 / 30 " ) ; if ( input _ date . compareTo ( standard _ date ) > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } StillTBD ( ) { } } class public { public static void main ( Stirng args [ ] ) { int a = 2 ; System . out . printlin ( math . pow ( a , 3 ) ) ; } } class Main { public static void main { String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } } private static int solution ( int n , int [ ] seq ) { HashMap < Integer , Integer > bucket = new HashMap < > ( ) ; int overflow = 0 ; for ( int i = 0 ; i < seq . length ; i + + ) { if ( bucket . containsKey ( seq [ i ] ) ) { int val = bucket . get ( seq [ i ] ) ; bucket . put ( seq [ i ] , val + 1 ) ; } else bucket . put ( seq [ i ] , 1 ) ; } int counter = 0 ; for ( Map . Entry map : bucket . entrySet ( ) ) { int val = ( int ) map . getValue ( ) ; if ( val > 2 ) overflow + + ; if ( val = = 1 ) { counter + + ; if ( counter = = 2 ) { overflow + + ; counter = 0 ; } } } return overflow ; } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { int a , b ; Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = a * a * a ; System . out . println ( b ) ; } } public class main { public static void main { int x ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } } } class Main { public static void main ( String [ ] args ) { int x = 2 ; double sum = 0 ; sum = Math . pow ( x , 3 ) ; System . out . println ( sum ) ; } import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int c = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n > 5 ) { num [ 2 ] = n ; } else { num [ c + + ] = n ; } } if ( num [ 0 ] = = 5 & & num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( ) ; System . out . println ( str * str * str ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; boolean second = false long a = 0 , b = 0 , swap = 0 , r = 0 , x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long max = A [ 0 ] ; if ( max = = 2 ) second = true ; for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; if ( b = = 2 ) second = true ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } if ( max > M * 2 | | ( second = = true & & max / 2 % = = 0 ) ) System . out . println ( 0 ) ; else { long ans = ( M - ( max / 2 ) ) / max + ( long ) 1 ; System . out . println ( ans ) ; } } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int x = n * m ; int y = 2 * ( n + m ) ; System . out . print ( x ) ; System . out . print ( " " ) ; System . out . print ( y ) } } import java . util . Scanner ; import java . util . Arrays ; public class AtCoder1 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 100 ] ; int i = 0 , sum = 0 ; float sum1 = 0 ; for ( i = 0 ; i < 3 ; i + + ) { a [ i ] = s . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 0 ] - a [ 2 ] ) ; } } import java . util . * ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A + B + C ) ! = 17 ) { System . out . println ( " No " ) ; } else if ( A ! = 7 & & B ! = 7 & & C ! = 7 ) { System . out . println ( " No " ) ; } else if ( A ! = 5 & & B ! = 5 & & C ! = 5 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } import java . util . * ; public class at51B { public static void main ( String [ ] atgs ) { Scanner scan = new Scanner ( System . in ) ; int ans = 0 ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; scan . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; if ( 1 < = x & & x > = 100 ) { x = x * x * x ; System . out . println ( x ) ; } } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = ( int ) Math . pow ( b , 3 ) ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x = < 100 ; System . out . println ( " x * x * x " ) ; } } import java . util . Scanner ; public class a _ circle { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int r = scan . nextInt ( ) ; System . out . println ( r * r ) ; } } x = int ( input ( ) ) println ( x * x * x ) import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; float rad = Math . abs ( H * 30 + M * 0.5 - M * 6 ) ; if ( rad > = 180 ) { rad = 360 - rad ; } double C = 0 ; C = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( rad ) ) ; System . out . println ( Math . pow ( C , 0.5 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long v = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long w = sc . nextLong ( ) ; long t = sc . nextLong ( ) ; if ( w > = v ) { System . out . print ( " NO " ) ; System . exit ( 0 ) ; } double dis = Math . abs ( a - b ) ; double num = v - w ; num * = t ; if ( num > = dis ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; boolean gg = true ; Integer [ ] array = new Integer [ n ] ; int a = 1 ; int b = 0 ; for ( int i = 0 ; i < n ; i + + ) { array [ n ] = s . nextInt ( ) ; if ( i ! = 0 ) { if ( array [ n ] < array [ a ] ) { a + + ; } else { b = array [ n ] ; } } } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class A { public static int min ( int [ ] a ) { int min = a [ 0 ] ; for ( int i = 0 ; i < a . length ; i + + ) { if ( a [ i ] < min & & a [ i ] ! = - 1 ) { min = a [ i ] ; a [ i ] = - 1 ; System . out . println ( a [ i ] ) ; } } return min ; } public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , y , z ; String s = reader . readLine ( ) ; String [ ] inp = s . split ( " " ) ; x = Integer . parseInt ( inp [ 0 ] ) ; y = Integer . parseInt ( inp [ 1 ] ) ; z = Integer . parseInt ( inp [ 2 ] ) ; int [ ] arr = new int [ 3 ] ; arr [ 0 ] = x ; arr [ 1 ] = y ; arr [ 2 ] = z ; int cost = 0 ; int a = Math . min ( x , Math . min ( y , z ) ) ; if ( a = = x ) { int b = Math . max ( y , z ) ; cost = cost + Math . abs ( b - a ) ; cost = cost + ( Math . max ( y , z ) - b ) ; } else if ( a = = y ) { int b = Math . max ( x , z ) ; cost = cost + Math . abs ( b - a ) ; cost = cost + ( Math . max ( x , z ) - b ) ; } else if ( a = = z ) { int b = Math . max ( x , y ) ; cost = cost + Math . abs ( b - a ) ; cost = cost + ( Math . max ( x , y ) - b ) ; } System . out . println ( cost ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( System . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) ; e . printStackTrace ( ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; final int A , V , B , W , T ; A = sc . nextInt ( ) ; V = sc . nextInt ( ) ; B = sc . nextInt ( ) ; W = sc . nextInt ( ) ; T = sc . nextInt ( ) ; sc . close ( ) ; int diff = Math . abs ( A - B ) ; if ( Math . abs ( V - W ) * T > = diff & & V - M > 0 & & B - A > 0 ) { System . out . println ( " YES " ) ; } if ( Math . abs ( V - W ) * T > = diff & & M - V > 0 & & A - B > 0 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; public class B { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int n = Integer . parseInt ( line ) ; if ( 1 < = n & & n < = 100 ) { System . out . println ( n * n * n ) ; } else { System . out . println ( " 値の範囲が正しくありません " ) ; } } catch ( IOException e ) y tem.o t .println ( e ) } } class main1 { public void Main ( ) { String S ; int i = Integer . parseInt ( S ) ; if ( i < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . next ( ) ; if ( text . charAt ( text . length - 1 ) = = ' ? ' ) { text = text . substring ( 0 , text . length - 1 ) + " D " ; } while ( text . indexOf ( " ? " ) > - 1 ) { text = text . replaceAll ( " P \ \ ? " , " PD " ) ; text = text . replaceAll ( " \ \ ? D " , " PD " ) ; } System . out . println ( text ) ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int flg = 0 ; for ( int j = 0 ; j < i ; j + + ) { if ( P [ i ] > P [ j ] ) { flg = 1 ; } } if ( flg = = 0 ) { count = count + 1 ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; char [ ] [ ] A = new char [ n ] [ n ] ; char [ ] [ ] B = new char [ m ] [ m ] ; for ( int i = 0 ; i < n ; i + + ) { String n = scn . next ( ) ; for ( int j = 0 ; j < n ; j + + ) { A [ i ] [ j ] = n . charAt ( j ) ; } } for ( int i = 0 ; i < m ; i + + ) { String m = scn . next ( ) ; for ( int j = 0 ; j < m ; j + + ) { B [ i ] [ j ] = m . charAt ( j ) ; } } String ans = " No " ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( i + m > n | | j + m > n ) { break ; } for ( int k = 0 ; k < m ; k + + ) { for ( int l = 0 ; l < m ; l + + ) { if ( A [ i + k ] [ j + l ] = = B [ k ] [ l ] ) { ans = " Yes " ; break ; } } } } } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ^ 3 ; System . out . println ( x ) ; } } import java . util . * public class Main { public static void main ( String [ ] args ) { int result ; Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int PI = 3.14 ; result = r * r * PI / 1 * 1 * PI ; System . out . println ( " result " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; if ( a = = 1 ) { if ( b ! = 1 ) { System . out . println ( " Alice " ) ; } } if ( b = = 1 ) { if ( a ! = 1 ) { System . out . println ( " Bob " ) ; } } if ( ( a > b ) & & ( a ! = 1 ) & & ( b ! = 1 ) ) System . out . println ( " Alice " ) ; if ( ( a < b ) & & ( a ! = 1 ) & & ( b ! = 1 ) ) System . out . println ( " Bob " ) ; if ( a = = b ) System . out . println ( " Draw " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; String [ ] s = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] = = ' Y ' ) { ans + = 1 ; } } if ( ans = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; HashMap < Integer , Arraylist < Integer > > h = new HashMap < Integer , Arraylist < Integer > > ( ) ; Hashmap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( ! h . containkey ( P ) ) { h . put ( P , new ArrayList < Integer > ( ) ) ; } h . get ( P ) . add ( Y ) ; hm . put ( Y , i ) ; } for ( int key : h . keyset ( ) ) { Collection . sort ( h . keyset ( ) ) ; } String [ ] ans = new String [ M ] ; for ( int key : h . keyset ( ) ) { string first = key + " " ; for ( int i = 0 ; i < 6 - ( key + " " ) . length ; i + + ) { first = " 0 " + first ; } for ( int i = 0 ; i < h . get ( key ) . size ; i + + ) { int ind = hm . get ( h . get ( key ) . get ( i ) ) ; String second = ( i + 1 ) + " " ; for ( int j = 0 ; j < 6 - ( ( i - 1 ) + " " ) . size ; j + + ) { second = " 0 " + second ; } ans [ ind ] = first + second ; } } for ( String an : ans ) { System . out . println ( an ) ; } } } import java . util . Scanner ; ? ? public class Main { ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? Scanner sc = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? int x = sc . nextInt ( ) ; int answer = x * x * x ; ? ? ? ? ? ? ? ? System . out . println ( answer ) ; ? ? ? ? } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ( ) ; } min = a [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } } system . out . println ( count ) ; } } import java . io . * ; class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( Reader in ) ; System . out . print ( i * i * i ) ; } } 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 Solution { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastReader in , PrintWriter out ) { out . println ( ( int ) Math . pow ( in . nextInt ( ) , 2 ) ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } package ABC . ABC051 ; import java . util . Scanner ; public class B { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int answer = 0 ; if ( S > K * 3 ) { System . out . println ( 0 ) ; return ; } for ( int i = K ; i > = 0 ; i -- ) { int tmp1 = S - i ; if ( tmp1 > K + K ) { break ; } for ( int j = K ; j > = 0 ; j -- ) { int tmp2 = tmp1 - j ; if ( tmp2 < 0 ) { continue ; } else if ( tmp2 > K ) { break ; } answer + + ; } } System . out . println ( answer ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } public class XCubic { public static void main ( String [ ] args ) { int y = new java . util . Scanner ( System . in ) . nextInt ( ) ; int x = 1 ; x = y * y * y ; System . out . print ( x ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner tc = new Scanner ( System . in ) ; int N , K ; N = tc . nextInt ( ) ; K = tc . nextInt ( ) ; if ( K > = 1 & & K < = 100 & & N > = 1 & & N < = 100 ) { if ( N > K ) { int D = N - K ; System . out . println ( D ) ; } if ( K > N ) { int D = K - N ; System . out . println ( D ) ; } } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] unko = new int [ 3 ] ; int sum = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { unko [ i ] = cs . nextInt ( ) ; sum * = unko [ i ] ; } if ( sum = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int N4 = sc . nextInt ( ) ; ArrayList < int > a = new ArrayList < int > ( ) ; a . add ( 1 ) ; a . add ( 7 ) ; a . add ( 9 ) ; a . add ( 4 ) ; if ( a . indexOf ( N1 ) ! = - 1 ) { a . remove ( a . indexOf ( N1 ) ) ; if ( a . indexOf ( N2 ) ! = - 1 ) { a . remove ( a . indexOf ( N2 ) ) ; if ( a . indexOf ( N3 ) ! = - 1 ) { a . remove ( a . indexOf ( N3 ) ) ; if ( a . indexOf ( N4 ) ! = - 1 ) { System . out . println ( " YES " ) ; } } } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class TwoRectangles { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int s1 = a * b ; int s2 = c * d ; if ( s1 > = s2 ) { System . out . println ( s1 ) ; } else { System . out . println ( s2 ) ; } } } import java . io . * ; public class B { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( 1 < = x & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " 値の範囲が正しくありません " ) ; } } catch ( IOException e ) y tem.o t .println ( e ) } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; class stillTBD { public static void main ( String args [ ] ) { try { Date boundaryDate = ConvertDateFromString ( " 2019 / 04 / 30 " ) ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; int result = ConvertDateFromString ( input ) . compareTo ( boundaryDate ) ; if ( ( result = = - 1 ) | | ( result = = 0 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } scanner . close ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static Date ConvertDateFromString ( String dateStr ) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date formatDate = sdf . parse ( dateStr ) ; System . out . println ( formatDate ) ; return formatDate ; } } # include < iostream > using namespace std ; int main ( ) { int a , b , x , y ; cin > > a > > b ; x = a * b ; y = 2 * ( a + b ) ; cout < < x < < " " < < y < < endl ; return 0 ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 1 ; i < = N ; i + + ) { for ( int j = 1 ; j < = i ; j + + ) { if ( P [ i - 1 ] < = P [ j - 1 ] ) { break ; } } if ( j = = i ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = New Scaner ( System . in ) ; int x ; x = scan . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { public static void main ( string args [ ] ) { Scanner scan = new Scanner ( Ststem . in ) ; int x = scan . next ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } 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 array [ ] [ ] = new int [ m ] [ 4 ] ; for ( int i = 0 ; i < m ; i + + ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; array [ i ] [ 1 ] = sc . nextInt ( ) ; array [ i ] [ 2 ] = i ; } Comp comp = new Comp ( ) ; Arrays . sort ( array , ( a , b ) - > Integer . compare ( a [ 0 ] , b [ 0 ] ) ) ; int index = 0 ; for ( int i = 1 ; i < = m ; i + + ) { if ( i = = m ) { checkYear ( array , index , i ) ; } else if ( array [ i - 1 ] [ 0 ] ! = array [ i ] [ 0 ] ) { checkYear ( array , index , i ) ; index = i ; } } Arrays . sort ( array , ( a , b ) - > Integer . compare ( a [ 2 ] , b [ 2 ] ) ) ; for ( int i = 0 ; i < m ; i + + ) { System . out . printf ( " % 012d \ n " , array [ i ] [ 0 ] * 1000000 + array [ i ] [ 3 ] ) ; } } private static void checkYear ( int array [ ] [ ] , int index , int i ) { for ( int j = index ; j < i ; j + + ) { int min = 1000000001 ; int minIndex = 0 ; for ( int k = index ; k < i ; k + + ) { if ( array [ k ] [ 3 ] ! = 0 ) { continue ; } if ( array [ k ] [ 1 ] < min ) { min = array [ k ] [ 1 ] ; minIndex = k ; } } array [ minIndex ] [ 3 ] = j - index + 1 ; } } } import java . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int x = a . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String args [ ] ) { Integer s = new Integer ( ) ; int data s . Integer . parseInt ( args [ 0 ] ) ; System . out . println ( data * data * data ) ; } } import java . util . Scanner ; public class IrohaandHaiku { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 | | b = = 5 | | c = = 5 ) { if ( a = = 7 | | b = = 7 | | c = = 7 ) { if ( a + b + c = = 17 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } public class Xcubic { public static void main ( String [ ] args ) { int X = 2 ; System . out . println ( X * X * X ) ; } } import java . math . BigDecimal ; import java . math . MathContext ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; BigDecimal x [ ] , y [ ] ; x = new BigDecimal [ N ] ; y = new BigDecimal [ N ] ; for ( int i = 0 ; i < N ; i + + ) { int x1 , y1 ; x1 = sc . nextInt ( ) ; y1 = sc . nextInt ( ) ; x [ i ] = new BigDecimal ( x1 ) ; y [ i ] = new BigDecimal ( y1 ) ; } int c = 2 ; for ( int i = 2 ; i < = N ; i + + ) { c * = i ; } c = c / N ; int C = 1 ; for ( int i = 2 ; i < = N ; i + + ) { C * = i ; } BigDecimal sum = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { BigDecimal x1 = x [ i ] . add ( x [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; BigDecimal y1 = y [ i ] . add ( y [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; x1 = x1 . multiply ( x1 ) ; y1 = y1 . multiply ( y1 ) ; x1 = x1 . add ( y1 ) ; x1 = x1 . sqrt ( MathContext . DECIMAL32 ) ; sum = sum . add ( x1 ) ; } } sum = sum . multiply ( new BigDecimal ( c ) ) ; sum = sum . divide ( new BigDecimal ( C ) , 10 , BigDecimal . ROUND _ HALF _ UP ) ; System . out . println ( sum . toPlainString ( ) ) ; } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { System . out . println ( " Please input number . ( 1 < = x < = 100 ) " ) ; int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( " answer is " + x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; char [ ] [ ] aa = new char [ n ] [ n ] ; char [ ] [ ] bb = new char [ m ] [ m ] ; for ( int i = 0 ; i < n ; i + + ) { String a = scn . next ( ) ; for ( int j = 0 ; j < n ; j + + ) { A [ i ] [ j ] = a . charAt ( j ) ; } } for ( int i = 0 ; i < m ; i + + ) { String b = scn . next ( ) ; for ( int j = 0 ; j < m ; j + + ) { bb [ i ] [ j ] = b . charAt ( j ) ; } } String ans = " No " ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( i + m > n | | j + m > n ) { break ; } for ( int k = 0 ; k < m ; k + + ) { for ( int l = 0 ; l < m ; l + + ) { if ( aa [ i + k ] [ j + l ] = = bb [ k ] [ l ] ) { ans = " Yes " ; break ; } } } } } System . out . println ( ans ) ; } } public void static main ( String [ ] args ) { int [ ] x = { 2 , 3 } ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . printIn ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . print ( x * x * x ) ; } } import java . io . * ; class oneCardPoker { public static void main ( String args [ ] ) throws IOException { int number [ ] ; number = new int [ 2 ] ; BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String strNum [ ] = str . split ( " " ) ; for ( int i = 0 ; i < 2 ; i + + ) { number [ i ] = Integer . parseInt ( strNum [ i ] ) ; } if ( number [ 0 ] > number [ 1 ] ) { System . out . println ( " Alice " ) ; } else if ( number [ 0 ] < number [ 1 ] ) { System . out . println ( " BOb " ) ; } else if ( number [ 0 ] = = number [ 1 ] ) { System . out . println ( " Draw " ) ; } return ; } } import java . util . * ; public class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Mian { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { if ( ( a = = 7 ) & & ( b = = 5 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 5 ) & & ( b = = 7 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 5 ) & & ( b = = 5 ) & & ( c = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = Integer . parseInt ( sc . next ( ) ) ; if ( n = = 5 ) five + + ; else if ( n = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int answer = x ^ 3 ; System . out . println ( answer ) ; } } import java . io . * ; public class Exercise { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { int [ ] A = new int [ 3 ] ; Scanner scan = new Scanner ( System . in ) ; A [ 0 ] = Integer . parseInt ( scan . next ( ) ) ; A [ 1 ] = Integer . parseInt ( scan . next ( ) ) ; A [ 2 ] = Integer . parseInt ( scan . next ( ) ) ; int tmpmin = 101 ; int nummin = 0 ; int tmpmax = 0 ; int nummax = 0 ; int num = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( tmpmin > = A [ i ] ) { tmpmin = A [ i ] ; nummin = i ; } if ( tmpmax < A [ i ] ) { tmpmax = A [ i ] ; nummax = i ; } if ( i ! = nummin & & i ! = nummax ) { num = i ; } } int cost = 0 ; cost + = A [ num ] - A [ nummin ] ; cost + = A [ nummax ] - A [ num ] ; System . out . println ( cost ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; int intInputData = parseInt ( r . readLine ( ) ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class AssignA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; N [ 0 ] = sc . nextInt ( ) ; N [ 1 ] = sc . nextInt ( ) ; N [ 2 ] = sc . nextInt ( ) ; N [ 3 ] = sc . nextInt ( ) ; boolean ans = solve ( N ) ; System . out . println ( ans ? " YES " : " NO " ) ; } private static boolean solve ( int [ ] N ) { Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 & & N [ 1 ] = = 4 & & N [ 2 ] = = 7 & & N [ 3 ] = = 9 ) { return true ; } return false ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = in . readLine ( ) ) ! = null ) { if ( line . equals ( " " ) ) line = " ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ; System . out . print ( Integer . parseInt ( line ) ^ 3 ) ; } stdReader . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( - 1 ) ; } } } import java . io . * ; class Main { public static void main ( String arg [ ] ) { int num ; String buf ; try { BufferedREader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; num = Integer . parseInt ( bur ) ; System . out . print ( num * num * num ) ; System . out . print ( " \ n " ) ; } catch ( Exception e ) { } } } public class Xcubic { public static void main ( String [ ] args ) { int X = 2 ; System . out . println ( X * X * X ) ; int Y = 3 ; System . out . println ( Y * Y * Y ) ; } } import java . io * class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( ( int ) Match . pow ( x , 3 ) ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = a . substring ( 5 , 7 ) ; int n = Interger . parseInt ( a ) ; if ( n > 4 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } import java . util . * ; public class AOJ _ 02 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { System . out . println ( sc . nextInt ( ) + sc . nextInt ( ) ) ; } } } import java . util . * ; class Main { public static void main ( string [ ] args ) { Scanner sc = New Scanner ( System . In ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * x * x ) + ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] argas ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( a . charAt ( i ) = = " 1 " ) count + + ; } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Vector ; public class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String num = br . readLine ( ) ; if ( num = = null ) { break ; } int a = num . split ( " " ) [ 0 ] , b = num . split ( " " ) [ 1 ] ; System . out . println ( a + b ) ; } } } class Main { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } mport java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int [ ] pList = new int [ m ] ; int [ ] yList = new int [ m ] ; Map < Integer , Integer > yearTree = new TreeMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < m ; i + + ) { pList [ i ] = scanner . nextInt ( ) ; yList [ i ] = scanner . nextInt ( ) ; yearTree . put ( yList [ i ] , pList [ i ] ) ; } int [ ] pCounter = new int [ n ] ; for ( int yi : yearTree . keySet ( ) ) { yearTree . put ( yi , + + pCounter [ yearTree . get ( yi ) - 1 ] ) ; } for ( int i = 0 ; i < m ; i + + ) { System . out . println ( String . format ( " % 06d % 06d " , pList [ i ] , yList [ i ] ) ) ; } } } public class XCube { public static void main ( String [ ] args ) { int x = 2 ; int y = x * x * x ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BuffreredReader br = new BufferedReader ( is ) ; int i = br . readLine ( ) ; int j = i * i ; System . out . println ( " + j + " ) ; } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String nb = br . readLine ( 3 ) ; int x = I teger.p a rseInt ( n b ) ; S y s em.out . pri n tln ( Mat h .pow ( x , 3 ) ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int X = x ; for ( int i = 0 ; i < 2 ; i + + ) { X * = x ; } System . out . println ( X ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String s = br . readLine ( ) ; String [ ] str = br . readLine ( ) . split ( ' / ' ) ; int y = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; if ( y > 2019 | | ( y < = 2019 & & ( m > 5 ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } import java . util . * ; public class Main81B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; A < a ; a + + ) { for ( int b = 0 ; B < b ; b + + ) { int c = ( X - a * 500 - b * 100 ) / 50 ; if ( c < = C & & c > = 0 ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } class Main { public static void main ( String [ ] args ) { int x = 3 ; int sum = 0 ; sum = x * x * ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 = | | a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . * ; import java . lang . * ; ? ? class Main { ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Scanner s = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int x = s . nextInt ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( x * x * x ) ; ? ? ? ? ? ? ? ? } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] b = new int [ a ] ; int sum = 0 ; for ( int i = 0 ; i < a ; i + + ) { b [ i ] = sc . nextInt ( ) ; sum + = b [ i ] ; } int pos = 0 ; if ( sum % a > = a ( float ) / 2 ) pos = ( sum / a ) + 1 ; else pos = sum / a ; sum = 0 ; for ( int i = 0 ; i < a ; i + + ) { sum + = ( b [ i ] - pos ) * ( b [ i ] - pos ) ; } System . out . println ( sum ) ; } public static long factorial ( long n ) { if ( n = = 0 ) { return new Long ( 1 ) ; } System . out . println ( n * factorial ( n - 1 ) ) ; return n * factorial ( n - 1 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; n = n * n * n System . out . println ( n ) ; } } import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A = = 1 ) { A = 14 ; } if ( B = = 1 ) { B = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; return ; } if ( B > A ) { System . out . println ( " Bob " ) ; return ; } if ( A = = B ) { System . out . println ( " Draw " ) ; } } } import java . util . * ; class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] fromAnt ; int [ ] toAnt ; for ( int i = 0 ; i < 5 ; i + + ) { fromAnt [ i ] = sc . nextInt ( ) ; toAnt [ i ] = fromAnt [ i ] ; } for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( toAnt [ j ] - fromAnt [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; return ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; char [ ] s = new char [ N ] ; for ( int i = 0 ; i < N ; i + + ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( s [ i ] = = ' Y ' ) { ans + = 1 ; } } if ( ans = = 0 ) { System . out . println ( " Three " ) ; } if ( ans > 0 ) { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws IOException { int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scan . nextInt ( ) ; } int ans = Integer . MAX _ VALUE ; for ( int i = 1 ; i < = 100 ; i + + ) { int temp = 0 ; for ( int j = 0 ; j < n ; j + + ) { temp + = ( int ) Math . pow ( ( x [ j ] - i ) , 2 ) ; } if ( temp < ans ) ans = temp ; } System . out . println ( ans ) ; } } n1 = int ( input ( ) ) r1 = n1 * n1 print ( r1 ) import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] = N [ 4 ] N [ 0 ] = sc nextInt ( ) ; N [ 1 ] = sc nextInt ( ) ; N [ 2 ] = sc nextInt ( ) ; N [ 3 ] = sc nextInt ( ) ; Arrays . sort ( N [ ] ) ; if ( N [ 0 ] = = 1 ) { if ( N [ 1 ] = = 4 ) { if ( N [ 2 ] = = 7 ) { if ( N [ 3 ] = = 9 ) { System . println ( " YES " ) ; } } } } else { System . println ( " NO " ) ; } } } import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ans = 0 ; System . out . println ( ans ) ; } } import java . util . * ; class Mani ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nums [ ] ; for ( int i = 0 ; i < nums . length ; i + + ) nums [ i ] = sc . nextInt ( ) ; if ( nums [ 1 ] = < nums [ 3 ] ) { System . out . print ( " NO " ) ; } else { for ( int i = 0 ; i < nums [ 4 ] + 1 ; i + + ) { if ( nums [ 0 ] > = nums [ 2 ] ) { System . out . print ( " YES " ) ; break ; } else if ( nums [ 4 ] = = i ) { System . out . print ( " NO " ) ; } nums [ 0 ] + = nums [ 1 ] ; nums [ 2 ] + = nums [ 3 ] ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; long sum _ N = 1 ; long sum _ M = 1 ; long ans = 0 ; int n _ m = Math . abs ( N - M ) ; if ( n _ m < 2 ) { for ( long i = N ; i < = 0 ; i -- ) { sum _ N * = i ; } for ( long j = M ; j < = 0 ; j -- ) { sum _ M * = j ; } if ( n _ m = 0 ) { ans = sum _ N * sum _ M * 2 ; } else { ans = sum _ N * sum _ M ; } } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x : = 3 ; System . out . println ( x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * x * x ) + ) ; } } import java . util . Scanner ; import java . util . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] K = new int [ N ] ; int L = 100 ; int R = 0 ; int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { K [ i ] = sc . nextInt ( ) ; L = Math . min ( L , K [ i ] ) ; R = Math . max ( R , K [ i ] ) ; } for ( int i = L ; i < = R ; i + + ) { int tmp = 0 ; for ( int i = 0 ; i < N ; i + + ) { tmp + = ( K [ i ] - i ) * ( K [ i ] - i ) ; } ans = Math . min ( ans , tmp ) ; } System . out . print ( ans ) ; } } public static int calculateCube ( int x ) { int result = 0 ; if ( x > = 1 | | x < = 100 ) { result = x * x * x ; } return result ; } public static void main ( String [ ] args ) { int cubic = calculateCube ( 2 ) ; System . out . println ( cubic ) ; } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 7 | | B = = 7 | | C = = 7 ) { if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( B = = 7 ) { if ( C = = 5 & & A = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( C = = 7 ) { if ( A = = 5 & & B = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } else { System . out . println ( " no " ) ; } } } import java . io ; class Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamreader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( a * a * a ) ; } } import java . util . * ; public class Aaa { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; double pow = 1 ; double ans = 0 ; for ( i = 1 ; i < = N ; i + + ) { pow = pow * i ; ans = ( double ) pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ( int ) ans ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = new int ( in . readLine ( ) ) ; Ststem . out . println ( x * x * x ) ; } } import java . io . * class Main { public static void main ( String [ ] args ) throws IOException { Buffered reader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int a = parseInt ( str ) ; System . out . print ( a * a * a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class sample { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = a * a * a ; print ( b ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util * . ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a & & b = = 5 ) { if ( c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) } if ( a & & c = = 5 ) { if ( b = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) } if ( b & & c = = 5 ) { if ( a = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) } } } public class Pangkat { public static void main ( String [ ] args ) { int a = 0 , c = 0 ; int b = 3 ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } public class main { public static void main ( string [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } package abc042 ; import java . util . Scanner ; public class Iroha _ and _ Haiku { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int A = stdIn . nextInt ( ) ; int B = stdIn . nextInt ( ) ; int C = stdIn . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) System . out . println ( " Yes " ) ; else if ( A = = 5 & & B = = 7 & & C = = 5 ) System . out . println ( " Yes " ) ; else if ( A = = 7 & & B = = 5 & & C = = 5 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ' \ n ' + scanner . next ( ) + ' \ n ' ) ; if ( sb . charAt ( sb . length ( ) - 2 ) = = ' ? ' ) { sb . setChatAt ( sb . length ( ) - 2 , ' D ' ) ; } while ( sb . indexOf ( " ? " ) > - 1 ) { for ( int i = 1 ; i < sb . length ( ) - 1 ; i + + ) { if ( sb . charAt ( i ) = = ' ? ' ) { if ( sb . charAt ( i - 1 ) = = ' P ' ) { sb . setCharAt ( i , ' D ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' D ' ) { sb . setCharAt ( i , ' P ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' P ' ) { sb . setCharAt ( i , ' D ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' ? ' ) { continue ; } } } } System . out . println ( sb . substring ( 1 , sb . length ( ) - 1 ) ) ; } } # coding : UTF _ 8 x = input ( ) y = x * * 3 print int ( y ) ; import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int input = scan . nextInt ( ) ; int ans = input * input * input ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; string str = br . readline ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int i , o ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( br . readLine ( ) ) ; o = i * i * i ; System . out . println ( o ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; sc . close ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } package score100 ; import java . util . Scanner ; public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = b & & b = = 5 & & c = = 7 | | b = = c & & c = = 5 & & a = = 7 | | c = = a & & a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int x = Integer . parseInt ( line ) ; int a = x * x * x ; System . out . println ( a ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } import java . util . * ; import java . math . * ; class contest { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; long n ; n = cin . nextInt ( ) ; n = ( int ) Math . pow ( n , 2 ) ; System . out . println ( n ) ; } } ; import java . util . * ; public class Program { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = 1 ; for ( int i = 0 ; i < 3 ; i + + ) y * = x ; System . out . println ( y ) ; } public static void main ( String [ ] args ) { Program p = new Program ( ) ; p . run ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( System . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( 9 ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) e . printStackTrace ( ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ; min = a [ 0 ] ; } for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } system . out . println ( min ) ; } } } class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextLine ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; for ( int i = 1 ; i < N ; i + + ) { int Min ; int Max ; if ( Min > a ) Min = a ; if ( Max < a ) Max = a ; } System . out . println ( Max - Min ) ; } class Main { public static void main ( String args [ ] ) { int x ; System . in . read ( x ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { String s ; int i , g ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { s = sc . next ( ) if ( s . equals ( " 0 " ) ) break ; g = 0 ; for ( i = 0 ; i < s . length ( ) ; i + + ) g + = s . charAt ( i ) - 48 ; System . out . println ( g ) ; } } } class Main { public static void main ( String [ ] args ) { int x = 3 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; long sum _ N = 0 ; long sum _ M = 0 ; if ( ABS ( N - M ) < 2 ) { for ( i = N ; i = 0 ; i -- ) { sum _ N * = i ; } for ( j = M ; j = 0 ; j -- ) { sum _ M * = j ; } } System . out . println ( sum _ N * sum _ M ) ; } } package abc055 ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( 800 * n - 200 * ( n / 15 ) ) ; } } public class Main { public static void main ( String [ ] args ) { String test = args [ 0 ] ; int temp = ( int ) args [ 0 ] ; int answer = temp * temp * temp ; System . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int y = Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } import heapq n , m = [ int ( v ) for v in input ( ) . split ( ' ' ) ] costs = [ ] links = [ ] for i in range ( n ) : costs . append ( [ 0 ] * i ) links . append ( set ( ) ) for i in range ( m ) : l , r , c = [ int ( v ) for v in input ( ) . split ( ' ' ) ] l - = 1 r - = 1 for j in range ( l , r ) : for k in range ( j + 1 , r + 1 ) : c0 = costs [ k ] [ j ] if c0 = = 0 or c0 > c : costs [ k ] [ j ] = c links [ k ] . add ( j ) h = [ ] heapq . heappush ( h , ( 0 , n - 1 ) ) closed = n while len ( h ) > 0 : c0 , n0 = heapq . heappop ( h ) if closed < = n0 : continue closed = n0 if n0 = = 0 : print ( c0 ) exit ( ) for n1 in links [ n0 ] : c1 = costs [ n0 ] [ n1 ] heapq . heappush ( h , ( c0 + c1 , n1 ) ) print ( " -1 " ) import java . util . * ; import java . lang . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ar = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { ar [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ar ) ; int k = sc . nextInt ( ) ; if ( k > e - a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } sc . close ( ) ; } } import java . util . * ; class Solution { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int l = scan . nextInt ( ) ; String [ ] ss = new String [ n ] ; int i = 0 ; while ( i < n ) { ss [ i ] = scan . next ( ) ; i + + ; } Arrays . sort ( ss ) ; String res = " " ; for ( String s : ss ) { res + = s ; } System . out . println ( res ) ; } } import java . util . * ; import java . text . SimpleDateFormat ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; SimpleDateFormat format = new SimpleDateFormat ( " yyyy / MM / dd " ) ; try { Date date = format . parse ( sc . next ( ) ) ; Date last = format . parse ( " 2019 / 04 / 30 " ) ; System . out . println ( date . after ( last ) ? " TBD " : " Heisei " ) ; } catch ( Exception e ) { } } # include < iostream > # include < string > # include < math . h > # include < algorithm > # define rep ( i , n ) for ( int i = 0 ; i < n ; i + + ) using namespace std ; int main ( ) { int a ; cin > > a ; cout < < a * 800 - a / 15 * 200 < < endl ; return 0 ; } import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int radius = sc . nextInt ( ) ; System . out . println ( 3.1415 * radius * radius ) ; } } class Main { public static void main ( String [ ] args ) { int i = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( i * i * i ) ; Return 0 ; } } class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } package javaapplication1 ; import java . util . Scanner ; public class jou { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; a = a * a * a ; System . out . println ( a ) ; } } import java . util . Scanner ; public class Ferris _ Wheel { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num1 = scan . nextInt ( ) ; int num2 = scan . nextInt ( ) ; if ( num1 < = 12 ) { num2 / = 2 ; } if ( num1 < = 5 ) { num2 = 0 ; } System . out . println ( num2 ) ; scan . close ( ) ; } } ipackage AtCoder2020May3Beginner ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( int i = 1 ; i * i < = n ; i + + ) { if ( n % i = = 0 ) { al . add ( i ) ; al . add ( n / i ) ; } } Collections . sort ( al ) ; for ( int val : al ) { for ( int i = 0 ; i < = val ; i + + ) { if ( check ( i , i - val , n ) ) { System . out . println ( i + " " + ( i - val ) ) ; return ; } } } System . out . println ( " a " ) ; } public static boolean check ( long a , long b , int x ) { long val1 = a * a * a * a * a ; long val2 = b * b * b * b * b ; if ( val1 - val2 = = ( long ) x ) { return true ; } else { return false ; } } } import java . util . Scanner ; class main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int y ; y = scan . nextInt ( x ) ; y = y * y * y ; System . out . println ( y ) ; } } import java . io . * ; class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( Reader in ) ; System . out . print ( i * i * i ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class APointInATriangle { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; Boolean isNull = str = = null ; while ( ! isNull ) { String [ ] datas = str . split ( " " , 8 ) ; double x1 = Double . parseDouble ( datas [ 0 ] ) ; double y1 = Double . parseDouble ( datas [ 1 ] ) ; double x2 = Double . parseDouble ( datas [ 2 ] ) ; double y2 = Double . parseDouble ( datas [ 3 ] ) ; double x3 = Double . parseDouble ( datas [ 4 ] ) ; double y3 = Double . parseDouble ( datas [ 5 ] ) ; double xp = Double . parseDouble ( datas [ 6 ] ) ; double yp = Double . parseDouble ( datas [ 7 ] ) ; double x = xp - x1 ; double y = yp - y1 ; double p = x2 - x1 ; double q = y2 - y1 ; double r = x3 - x1 ; double u = y3 - y1 ; double [ ] coefficient = Simultaneous ( p , r , x , q , u , y ) ; double s = coefficient [ 0 ] ; double t = coefficient [ 1 ] ; if ( s < 0 | | t < 0 ) { System . out . println ( " NO " ) ; } else if ( s + t > 0 & & s + t < 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } str = br . readLine ( ) ; isNull = str = = null ; } } private static double [ ] Simultaneous ( double a , double b , double c , double d , double e , double f ) { double x = ( double ) ( e * c - b * f ) / ( a * e - b * d ) ; double y = ( double ) ( a * f - c * d ) / ( a * e - b * d ) ; double [ ] answer = { x , y } ; return answer ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ; int x = reader . readLine ( ) ; System . out . print ( Math . pow ( x , 3 ) ) ; } } package com . company ; import java . io . * ; import java . util . * ; public class lowelements { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 0 ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i - 1 ] > arr [ i ] | | arr [ i - 1 ] = = 1 ) { sum + + ; } } if ( arr [ n - 1 ] = = 1 ) { sum + + ; } out . println ( sum ) ; out . close ( ) ; } 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 . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( i + 1 , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } map . entrySet ( ) . stream ( ) . sorted ( Map . Entry . comparingByValue ( ) ) ; foreach ( String key : map . keySet ( ) ) { for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int cnt = 0 ; if ( K > 1 ) { cnt = N - K ; } System . out . println ( cnt ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new ImputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int x = Integer . parseInt ( s ) ; int a = x * x * x ; System . out . println ( a ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; class TestClass { public static void main ( String args [ ] ) throws Exception { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int a [ ] = new int [ n ] ; System . out . println ( findXor ( a , n ) ) ; } static int findXor ( int arr [ ] , int n ) { int xoR = 0 ; for ( int i = 0 ; i < n ; i + + ) { xoR = xoR ^ arr [ i ] ; } return xoR * 2 ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * * 3 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . println ( ans ) ; } } import java . io . * ; class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( Reader in ) ; System . out . print ( i * i * i ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; Date heiseiDate = new SimpleDateFormat ( " yyyy / MM / dd " ) . format ( 2019 / 04 / 30 ) ; if ( formatDate . before ( heiseiDate ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + a * a * a + ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] KISU = new int [ 100001 ] ; int [ ] GUSU = new int [ 100001 ] ; for ( int i = 0 ; i < = 100000 ; i + + ) { KISU [ i ] = 0 ; GUSU [ i ] = 0 ; } for ( int i = 0 ; i < N ; i + + ) { if ( i % 2 = = 0 ) { KISU [ sc . nextInt ( ) ] + + ; } else if ( i % 2 = = 1 ) { GUSU [ sc . nextInt ( ) ] + + ; } } int K _ MAX = 0 ; int G _ MAX = 0 ; int K _ NUM = 0 ; int G _ NUM = 0 ; int K _ 2nd = 0 ; int G _ 2nd = 0 ; int K _ 2nu = 0 ; int G _ 2nu = 0 ; for ( int i = 0 ; i < = 100000 ; i + + ) { if ( K _ MAX < KISU [ i ] ) { K _ MAX = KISU [ i ] ; K _ NUM = i ; } if ( G _ MAX < GUSU [ i ] ) { G _ MAX = GUSU [ i ] ; G _ NUM = i ; } } Arrays . sort ( KISU ) ; Arrays . sort ( GUSU ) ; K _ 2nd = KISU [ 99998 ] ; G _ 2nd = GUSU [ 99998 ] ; if ( K _ NUM ! = G _ NUM ) { System . out . println ( N - K _ MAX - G _ MAX ) ; } else if ( K _ NUM = = G _ NUM ) { int [ ] [ ] mat = new int [ 2 ] [ 2 ] ; mat [ 0 ] [ 0 ] = K _ MAX ; mat [ 0 ] [ 1 ] = K _ 2nd ; mat [ 1 ] [ 0 ] = G _ MAX ; mat [ 1 ] [ 1 ] = G _ 2nd ; System . out . println ( Math . min ( N - mat [ 0 ] [ 0 ] - mat [ 1 ] [ 1 ] , N - mat [ 0 ] [ 1 ] - mat [ 1 ] [ 0 ] ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long k = sc . nextLong ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < s . length ( ) ; i + + ) { if ( ( 26 - ( s . charAt ( i ) - ' a ' ) ) < = k ) { k - = 26 - ( s . charAt ( i ) - ' a ' ) ; sb . append ( ' a ' ) ; } else { sb . append ( s . charAt ( i ) ) ; } } if ( k > 0 ) { char t = sb . charAt ( s . length ( ) - 1 ) ; sb . delete ( s . length ( ) - 1 , s . length ( ) ) ; sb . append ( ( char ) ( ( t + k ) % 26 ) ) ) ; } System . out . println ( sb ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( a = = b ) { if ( a = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } elif ( a = = c ) { if ( a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } elif ( b = = c ) { if ( b = = 5 & & a = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } public class Main { public static void main ( Stating [ ] args ) { int x = 2 ; x = x * x * x ; System . out . println ( " x = " + x ) ; } } import java . util . * ; class rect { int ar [ ] = new int [ 4 ] ; public void input ( ) { int i ; Scanner read = new Scanner ( System . in ) ; System . out . println ( " enter " ) ; for ( i = 0 ; i < 4 ; i + + ) { ar [ i ] = read . nextInt ( ) ; } } public int recto ( ) { int a = ( ar [ 0 ] * ar [ 1 ] ) ; int b = ( ar [ 2 ] * ar [ 3 ] ) ; if ( a > b ) return a ; else if ( a < b ) return b ; else return a ; } public static void main ( String [ ] args ) { rect obj = new rect ( ) ; obj . input ( ) ; obj . recto ( ) ; } } inport . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader rd = New BufferedReader ( new InputStreamReader ( system . in ) ) ; int read = IntegerParseInt ( rd . ReadLine ( ) ) ; system . out . println ( ( int ) Math . pow ( read , 3 ) ) ; } } public class wafu { public static void main ( String [ ] args ) { int A ; int B ; int C ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " Yes " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . util . Scanner ; public class P { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ab = Math . abs ( a - b ) ; int ac = Math . abs ( a - c ) ; int ad = Math . abs ( a - d ) ; int ae = Math . abs ( a - e ) ; int bc = Math . abs ( b - c ) ; int bd = Math . abs ( b - d ) ; int be = Math . abs ( b - e ) ; int cd = Math . abs ( c - d ) ; int ce = Math . abs ( c - e ) ; int de = Math . abs ( d - e ) ; int count = 0 ; if ( ab < k ) { count + + ; } if ( ac < k ) { count + + ; } if ( ad < k ) { count + + ; } if ( ae < k ) { count + + ; } if ( bc < k ) { count + + ; } if ( bd < k ) { count + + ; } if ( be < k ) { count + + ; } if ( cd < k ) { count + + ; } if ( ce < k ) { count + + ; } if ( de < k ) { count + + ; } if ( count > 0 ) { System . out . println ( " Yay ! " ) ; } else { Systme . out . println ( " : ( " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Input { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextlnt ( ) ; int b = scan . nextlnt ( ) ; int n = scan . nextlnt ( ) ; if ( a * n < = b * s ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; class kuma { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * x ) ; } } class Cubic { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int fcount = 0 ; int scount = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int a = stdIn . nextInt ( ) ; if ( a = = 5 ) fcount + + ; else if ( a = = 7 ) scount + + ; } if ( fcount = = 2 & & scount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] KISU = new int [ 100001 ] ; int [ ] GUSU = new int [ 100001 ] ; for ( int i = 0 ; i < = 100000 ; i + + ) { KISU [ i ] = 0 ; GUSU [ i ] = 0 ; } for ( int i = 0 ; i < N ; i + + ) { if ( i % 2 = = 0 ) { KISU [ sc . nextInt ( ) ] + + ; } else if ( i % 2 = = 1 ) { GUSU [ sc . nextInt ( ) ] + + ; } } int K _ MAX = 0 ; int G _ MAX = 0 ; int K _ NUM = 0 ; int G _ NUM = 0 ; int K _ 2nd = 0 ; int G _ 2nd = 0 ; int K _ 2nu = 0 ; int G _ 2nu = 0 ; for ( int i = 0 ; i < = 100000 ; i + + ) { if ( K _ MAX < KISU [ i ] ) { K _ MAX = KISU [ i ] ; K _ NUM = i ; } if ( G _ MAX < GUSU [ i ] ) { G _ MAX = GUSU [ i ] ; G _ NUM = i ; } } Arrays . sort ( KISU ) ; Arrays . sort ( GUSU ) ; K _ 2nd = KISU [ 99999 ] ; G _ 2nd = GUSU [ 99999 ] ; if ( K _ NUM ! = G _ NUM ) { System . out . println ( N - K _ MAX - G _ MAX ) ; } else if ( K _ NUM = = G _ NUM ) { int [ ] [ ] mat = new int [ 2 ] [ 2 ] ; mat [ 0 ] [ 0 ] = K _ MAX ; mat [ 0 ] [ 1 ] = K _ 2nd ; mat [ 1 ] [ 0 ] = G _ MAX ; mat [ 1 ] [ 1 ] = G _ 2nd ; System . out . println ( Math . min ( N - mat [ 0 ] [ 0 ] - mat [ 1 ] [ 1 ] , N - mat [ 0 ] [ 1 ] - mat [ 1 ] [ 0 ] ) ) ; } } } public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; x = x * x * x ; System . out . println ( x ) ; } } import javafx . util . Pair ; 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 ( ) ; Map < Integer , List < Long > > dic = new HashMap < > ( ) ; List < Pair < Integer , Long > > toi = new ArrayList < > ( ) ; for ( int i = 0 ; i < m ; i + + ) { int x = sc . nextInt ( ) ; long y = sc . nextLong ( ) ; toi . add ( new Pair < > ( x , y ) ) ; List < Long > list = dic . getOrDefault ( x , new ArrayList < > ( ) ) ; list . add ( y ) ; dic . put ( x , list ) ; } Map < Integer , Long [ ] > sortDic = new HashMap < > ( ) ; dic . entrySet ( ) . stream ( ) . forEach ( e - > { Long [ ] tmp = e . getValue ( ) . toArray ( new Long [ e . getValue ( ) . size ( ) ] ) ; Arrays . sort ( tmp ) ; sortDic . put ( e . getKey ( ) , tmp ) ; } ) ; for ( int i = 0 ; i < toi . size ( ) ; i + + ) { Pair mon = toi . get ( i ) ; String x = mon . getKey ( ) . toString ( ) ; String paddingleft = x . format ( " % 6s " , x ) . replace ( " " , " 0 " ) ; String index = String . valueOf ( Arrays . binarySearch ( sortDic . get ( mon . getKey ( ) ) , mon . getValue ( ) ) + 1 ) ; String paddingRight = index . format ( " % 6s " , index ) . replace ( " " , " 0 " ) ; System . out . println ( paddingleft + paddingRight ) ; } } } public class Main { private static int N ; private static int M ; private static int area [ ] ; private static int city [ ] ; private static ArrayList < Integer > p [ ] ; private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; area = new int [ M ] ; city = new int [ M ] ; p = new ArrayList [ M ] ; for ( int i = 0 ; i < M ; i + + ) { area [ i ] = sc . nextInt ( ) ; city [ i ] = sc . nextInt ( ) ; if ( p [ area [ i ] ] = = null ) p [ area [ i ] ] = new ArrayList < Integer > ( ) ; p [ area [ i ] ] . add ( city [ i ] ) ; } for ( int j = 1 ; j < = N ; j + + ) { Collections . sort ( p [ j ] ) ; } for ( int k = 0 ; k < M ; k + + ) { int pos = p [ area [ k ] ] . indexOf ( city [ k ] ) + 1 ; String str = String . format ( " % 06d % 06d " , area [ k ] , pos ) ; System . out . println ( str ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count5 = 0 ; int count7 = 0 ; Scanner sc = new Scanner ( System . in ) ; Stirng [ ] line = sc . nextLine ( ) . split ( " " ) ; for ( String n : line ) { if ( n . equals ( " 5 " ) ) { count5 + + ; } if ( n . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " OK " ) ; } else { System . out . println ( " NG " ) ; } } } public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int sum = 1 ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; for ( int k = min ; k < max ; k + + ) { int challengeSum ; for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( k - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( challengeSum ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double radM = ( double ) ( M * 6.0 ) ; double radH = ( double ) ( ( H * 60 + M ) * 0.5 ) ; double rad = Math . abs ( radM - radH ) ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( rad / 180 * Math . PI ) ) ; System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] atgs ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int num = Integer . parseInt ( line ) ; System . out . println ( num * num ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BUfferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } class main1 { public void Main ( ) { String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int xcubic ; int a = 0 ; while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 0 0 ) i = - 1 ; } xc u b c * a a ; Sys e . u . p r n ln ( " " + c b i c + " " ; } } import java . util . * fun main ( args : Array < String > ) { val sc = Scanner ( System . ` in ` ) val a : Int = sc . nextInt ( ) val b : Int = sc . nextInt ( ) val c : Int = sc . nextInt ( ) val d : Int = sc . nextInt ( ) if ( a * b > = c * d ) { print ( a * b ) } else if ( a * b < c * d ) { print ( c * d ) } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; System . out . println ( Math . pow ( a , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = Integer . parseInt ( scan . next ( ) ) ; scan . close ( ) ; int y = ( int ) Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } import java . util . * ; class xCubic { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = Integer . parselnt ( so . next ( ) ) ; int result = n * n * n ; System . out . println ( result ) ; } } } import java . until . Scanner ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } public class Min { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; int a = sca . nextInt ( ) ; int b = sca . nextInt ( ) ; int c = sca . nextInt ( ) ; int x = sca . nextInt ( ) ; int y = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( 500 * i ) + ( 100 * j ) + ( 50 * k ) = = x ) { y + + ; } } } } System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int z = 0 ; for ( int i ; A = = X ; i + + ) { z = z + i ; } for ( int j ; B = = X ; j + + ) { z = z + j ; } for ( int k ; C = = X ; k + + ) { z = z + k ; } System . out . print ( z ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int s1 = Math . abs ( a - b ) + Math . abs ( b - c ) ; int s2 = Math . abs ( a - c ) + Math . abs ( b - c ) ; int s3 = Math . abs ( a - b ) + Math . abs ( a - c ) ; System . out . println ( Math . min ( s1 , Math . min ( s2 , s3 ) ) ) ; } } class Main { int x ; public static void main ( String [ ] args ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; int y ; 1 = < x = < 100 ; y = x * x * x ; System . out . println ( " x " ) ; System . out . println ( " y " ) ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; final int [ ] [ ] original = new int [ M ] [ 3 ] ; final int [ ] [ ] year = new int [ 1000001 ] [ 2 ] ; final int [ ] inputOrder = new int [ M ] ; final int [ ] area = new int [ N + 1 ] ; for ( int i = 0 ; i < M ; i + + ) { original [ i ] [ 0 ] = i ; original [ i ] [ 1 ] = sc . nextInt ( ) ; original [ i ] [ 2 ] = sc . nextInt ( ) ; year [ original [ i ] [ 2 ] ] [ 0 ] = original [ i ] [ 1 ] ; inputOrder [ i ] = original [ i ] [ 2 ] ; } for ( int i = 1 ; i < year . length ; i + + ) { area [ year [ i ] [ 0 ] ] + + ; year [ i ] [ 1 ] = area [ year [ i ] [ 0 ] ] ; } String tempArea ; String tempYearOrder ; for ( int i = 0 ; i < M ; i + + ) { tempArea = String . valueOf ( year [ inputOrder [ i ] ] [ 0 ] ) ; tempYearOrder = String . valueOf ( year [ inputOrder [ i ] ] [ 1 ] ) ; while ( tempArea . length ( ) < 6 ) { tempArea = " 0 " + tempArea ; } while ( tempYearOrder . length ( ) < 6 ) { tempYearOrder = " 0 " + tempYearOrder ; } System . out . println ( tempArea + tempYearOrder ) ; } } } import java . util . Scanner ; public class Main { 3. public static void main ( String [ ] args ) { 4 . Scanner sc = new Scanner ( System . in ) ; 5. int n = sc . nextInt ( ) ; 6. int x = 800 * n ; 7. int y = 200 * ( n / 25 ) ; 8 . System . out . println ( x - y ) ; 9 . } 10 . } # include < bits / stdc + + . h > using namespace std ; typedef long long LL ; const int maxn = 2e3 + 5 ; LL a [ maxn ] ; LL b [ maxn ] [ maxn ] ; int main ( ) { int n ; LL x , sum = 1L L < < 60L L ; cin > > n > > x ; for ( int i = 1 ; i < = n ; i + + ) cin > > a [ i ] ; for ( int i = 1 ; i < = n ; i + + ) { b [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < = n - 1 ; k + + ) { int pos = i - k ; if ( pos < = 0 ) pos = n - abs ( pos ) ; b [ i ] [ k ] = min ( b [ i ] [ k - 1 ] , a [ pos ] ) ; } } for ( int k = 0 ; k < = n - 1 ; k + + ) { LL ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { ans + = b [ i ] [ k ] ; } sum = min ( sum , ans + x * k ) ; } cout < < sum < < endl ; } public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k = = 1 ) System . out . println ( " 0 " ) ; else System . out . println ( n - k ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a ; int b ; a = Integer . parseInt ( br . readLine ( ) ) ; sannjyou sa = new sannjyou ( ) ; b = sa . sann ( a ) ; System . out . println ( b ) ; } } public class sannjyou { private int a ; public int sann ( int b ) { a = b ; int k ; k = a * a * a ; return k ; } } package helloworld ; import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int n = r . nextInt ( ) ; System . out . println ( n * n ) ; } } public class study { public static void main ( String [ ] args ) { int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int a = 60 * ( H2 - H1 ) , b = M2 - M1 + a ; int l = b - K ; System . out . println ( l ) ; } } public class Xcube { public static void main ( String [ ] args ) { int x = 0 ; try { x = Integer . parseInt ( args [ 0 ] ) ; } catch ( NumberFormatException e ) { System . out . println ( args [ 0 ] + " ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y tem.ex i t ( 1 ) ; } y tem.ou t .pr i ntln ( x * ) } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int mindex = 0 ; int sum = 0 ; int [ ] alist = { a , b , c , d , e } ; int [ ] slist = 5 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( alist [ mindex ] % 10 = = 0 | | alist [ mindex ] % 10 > alist [ i ] % 10 & & alist [ i ] % 10 ! = 0 ) { mindex = i ; } } for ( int i = 0 ; i < 5 ; i + + ) { if ( i = mindex | | alist [ i ] % 10 = = 0 ) { sum + = alist [ i ] ; } else { sum + = alist [ i ] / 10 * 10 + 10 ; } } System . out . println ( sum ) ; } } package javaapplication1 ; import java . util . Scanner ; public class sum { public static void main ( String args [ ] ) { int m , n , sum = 0 ; Scanner s = new Scanner ( System . in ) ; while ( true ) { m = s . nextInt ( ) ; if ( m = = 0 ) break ; sum = 0 ; while ( m ! = 0 ) { n = m % 10 ; sum + = n ; m = m / 10 ; } System . out . println ( sum ) ; } } } } public class Main ( ) { public static void main ( String [ ] args ) throws Exception { int y = 2 ; int x = y * y * y ; System . out . println ( x ) ; } } inport java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String x = " NO " ; if ( a = = 5 ) { if ( ( b = = 5 ) % % ( c = = 7 ) ) { x = " YES " ; } else if ( ( b = = 7 ) % % ( c = = 5 ) ) { x = " YES " ; } } else if ( a = = 7 ) { if ( ( b = = 5 ) & & ( c = = 5 ) ) { x = " YES " ; } } System . out . println ( x ) ; } } public class Main { public static int cul ( int x ) { y = Math . pow ( x , 3 ) ; return y ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = " " ; for ( ; ; ) { System . out . print ( " > " ) ; input = in . readLine ( ) ; try { Integer . parseInt ( input ) ; } catch ( NumberFormatException e ) { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; nt nteger. p arseInt ( i nput ) ; f ( ( x ) | x 00 ) ) { ystem. o ut. p rintln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } e s e { x ; S y tem.ou t .pr i ntln ( x ) ; b r ak ; } public class TwoCoins ( ) { public static void main ( string args [ ] ) { private int coinVal ; private int coinVal2 ; private int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String nb = br . readLine ( ) ; int x = I teger.p a rseInt ( n b ) ; S y s em.out . pri n tln ( Mat h .pow ( x , 3 ) ) ; } } import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = std . nextInt ( ) ; System . out . println ( math . pow ( n , 3 ) ) ; } } class Main { public static void main ( String args [ ] ) { double d = Integer . parseInt ( args [ 0 ] ) ; int i = Math . pow ( d , 3 ) ; System . out . println ( i ) ; } } import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; System . out . println ( Math . max ( A * B , C * D ) ) ; } } public class XCubic { public static void GetCubed ( int num ) { int n = ( int ) Math . pow ( num , 3 ) ; System . out . println ( n ) ; } public static void main ( String [ ] args ) { GetCubed ( Integer . parseInt ( args [ 0 ] ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . Scanner ; public class Iroha { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } String yon = " NO " ; if ( a [ 0 ] = = 5 ) { if ( a [ 1 ] = = 5 ) { if ( a [ 2 ] = = 7 ) { yon = " YES " ; } } else if ( a [ 1 ] = = 7 ) { if ( a [ 2 ] = = 5 ) { yon = " NO " ; } } } else if ( a [ 0 ] = = 7 ) { if ( a [ 1 ] = = 5 ) { if ( a [ 2 ] = = 5 ) { yon = " YES " ; } } } System . out . println ( yon ) ; } } package app ; import java . util . * ; public class App { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { System . out . println ( i + " 文字目を入力してください " ) ; a [ i ] = sc.nextInt ( ) ; } n t f v = 0 ; int s e v n = 0 for i t = ; i < a l n g h ; i + + ) f a [ ] = = 5 ) { f i e + + ; e l s e i ( a i ] = 7 ) { s v n + + ; } } i f ( iv = = 2 & & se v n = 1 ) { Sy te . ut print n ( Y E S ) ; } e l se { System . o ut. p r i t n ( " N " ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; List < String > sl = new ArrayList < String > ( Arrays . asList ( s . split ( " / " ) ) ) ; if ( Integer . parseInt ( sl . get ( 0 ) ) < 2019 ) { System . out . println ( " Heisei " ) ; } else if ( Integer . parseInt ( sl . get ( 1 ) ) < 4 ) { System . out . println ( " Heisei " e ; } else { System . out . println ( " TBD " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = a ; + + i ) { for ( int j = 0 ; j < = b ; + + j ) { if ( ( x - 500 * i - 100 * j ) / 50 > = 0 & & ( x - 500 * i - 100 * j ) / 50 < = c ) { + + count ; } } } System . out . println ( count ) ; import java . util . * ; public class B _ Coins { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a < = A ; a + + ) { for ( int b = 0 ; b < = B ; b + + ) { int c = ( X - a * 500 - b * 100 ) / 50 ; if ( c > = 0 & & c < = C ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; import java . text . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int big = Math . pow ( r , 2 ) ; System . out . println ( big ) ; } } # include < stdio . h > int main ( int argc , const char * argv [ ] ) { int a , b ; while ( scanf ( " % d % d \ n " , & a , & b ) ! = EOF ) { printf ( " % d \ n " , a + b ) ; } return 0 ; } import java . io . * ; import java . util . * ; public class lowelements { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 0 ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i - 1 ] > arr [ i ] | | arr [ i - 1 ] = = 1 ) { sum + + ; } } if ( arr [ n - 1 ] = = 1 ) { sum + + ; } out . println ( sum ) ; out . close ( ) ; } 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 ; } } } package Vol000 ; import java . util . Scanner ; public class AOJ0 _ 64 { public static void main ( String arg [ ] ) { Scanner in = new Scanner ( System . in ) ; int count = 0 ; String tmp = " 0 " ; while ( in . hasNext ( ) ) { char ch [ ] = in . nextLine ( ) . toCharArray ( ) ; for ( int i = 0 ; i < ch . length ; i + + ) { while ( i < ch . length & & ( Character . isDigit ( ch [ i ] ) ) ) { tmp + = ch [ i ] ; i + + ; } count + = Integer . valueOf ( tmp ) ; tmp = " 0 " ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int index = new Integer ( scan . nextLine ( ) ) ; String [ ] scanLine = scan . nextLine ( ) . split ( " " ) ; int range = 0 ; for ( int i = 0 ; i < scanLine . lengh ; i + + ) { range + = ( index - new Integer ( scanLine [ i ] ) ) * ( index - new Integer ( scanLine [ i ] ) ) ; } System . out . println ( range ) ; } } package atcoder . beginner ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( " age value > " ) ; String [ ] input = scanner . nextLine ( ) . split ( " " ) ; int age = Integer . valueOf ( input [ 0 ] ) ; int value = Integer . valueOf ( input [ 1 ] ) ; int cost = value ; if ( age < = 5 ) { cost = 0 ; } else if ( age > = 6 & & age < = 12 ) { cost = value / 2 ; } System . out . println ( cost ) ; } } import java . util . Scanner ; public class CubeCalculation { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int number = stdin . nextInt ( ) ; if ( number > = 1 & & number < = 100 ) { int result = number * number * number ; System . out . println ( " Cube result : " + result ) ; } else { System . out . println ( " Only can calculate between 1 and 100 " ) ; } } } mport java . util . ArrayList ; import java . util . Scanner ; import java . util . Collections ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int number = scan . nextInt ( ) ; int length = scan . nextInt ( ) ; ArrayList list = new ArrayList ( number ) ; for ( int i = 0 ; i < number ; i + + ) { list . set ( i , scan . nextLine ( ) ) ; } Collections . sort ( list ) ; for ( int i = 0 ; i < number ; i + + ) { System . out . print ( list . get ( i ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . until . Scanner ; public class Index { public static void main ( Stirng [ ] args ) { int n = 0 ; while ( n = = 0 ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 & & A = = 7 ) { Scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } Scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . out . println ( " Yes ! " ) ; } else { break ; } } } } } } public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { long x , kk , ans ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; long [ ] [ ] dp = new long [ n + 500 ] [ n + 500 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 9000000000000000000L ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { dp [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = ( ( i - k ) + n ) % n ; if ( pi < = 0 ) pi = n + pi ; if ( dp [ i ] [ k - 1 ] > = a [ pi ] ) dp [ i ] [ k ] = a [ pi ] ; else dp [ i ] [ k ] = dp [ i ] [ k - 1 ] ; } } long sum = 0 ; for ( int k = 0 ; k < n ; k + + ) { sum = 0 ; for ( int i = 1 ; i < = n ; i + + ) { sum + = dp [ i ] [ k ] ; } if ( sum < ans ) ans = sum + k * x ; } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public void main ( string [ ] args ) { Scanner in = new Scanner ( System . in ) ; String x = in . next ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { int count _ 5 = 0 , count _ 7 = 0 ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { int num = scan . nextInt ( ) ; if ( num = = 5 ) count _ 5 + + ; if ( num = = 7 ) count _ 7 + + ; } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } 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 ans = ( a + b ) / 2 System . out . println ( ( a + b ) % 2 = = 0 ? ans : ans + 1 ) ; } } class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferdReader ( new InputStreamReader ( System . in ) ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " + ( x * x * x ) + " ) ; } } import java . util . Scanner ; public class Main02 { public static void main ( String [ ] args ) { String input = new Scanner ( System . in ) . nextLine ( ) ; int x ; try { x = Integer . parseInt ( input ) ; if ( ! ( x > = 1 & & x < = 100 ) ) { throw new IllegalArgumentException ( ) ; } System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a = sc . nextInt ( ) ; if ( a = = 5 ) { five + + ; } if ( a = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . io . * ; class Main { public static main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( 500 * a + 100 * b + 50 * c = = x ) count + + ; } } } Sysetm . out . println ( count ) ; } } 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 ans = ( a + b ) / 2 System . out . println ( ( a + b ) % 2 = = 0 ? ans : ans + 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { z = S - x - y ; if ( z < = K & & z > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * 3 ) + ) ; } } import java . io . * ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int num = Integer . parseInt ( line ) ; int Y ; Y = 3 ; System . out . println ( Math . pow ( num , Y ) ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " The input number was not correct . " ) ; } } } import java . util . * ; class Codechef { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int arr [ ] [ ] = new int [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; j + + ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } int count = 0 ; double dist = 0 ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { dist + = ( double ) ( Math . pow ( arr [ i ] [ k ] - arr [ j ] [ k ] , 2 ) ) ; } dist = ( double ) Math . sqrt ( dist ) ; double ans = Math . ceil ( dist ) ; if ( ans = = dist ) count + + ; dist = 0 ; } } System . out . println ( count ) ; sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String str ; String str1 ; String str2 ; String str3 ; String str4 ; String str5 ; int a , b , c , d , e , k ; System . out . println ( " aの値を入力してください " ) ; str = scanner.next ( ) ; Sys e .out.pr i ntln ( " b 値を入力して く ださい " ) ; str1 = scanner.next ( ) ; System.out.printl n ( " の値を入 し ください " ) ; str2 = canner . nex t ( ) ; Sys t e m.out.println ( " dの値を入力してください " ) ; str 3 = scan e .next ( ) ; Sys t e m out.pr i ntl n ( " eの値を入 力 し てください " ) ; str4 = scanner.next ( ) ; Sy s t e .out p intln ( " k の値を入 力 し て ださい " ) ; str 5 = scan n e r.next ( ) ; a = Integer.parseInt ( str ) ; = I t ger.par s eInt ( s t 1 ) ; c = In t eger.pa r s eInt ( str2 ) ; d = Integer.parseInt ( s t r 3 ; e nteger. p arse I n t s r ) ; k = I nteger.p a rse I n ( t 5 ) ; if ( e-a < = k ) { S y s e . ut.prin t ln ( " Yay ! " ) ; } e l e { System. o ut.print l n ( " : ( " ; } } } import java . util . Scanner ; public class Prob3 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] original = new int [ 2 ] ; int [ ] multiples = new int [ 2 ] ; int [ ] manipulate = new int [ 2 ] ; int t = sc . nextInt ( ) ; original [ 0 ] = sc . nextInt ( ) ; original [ 1 ] = sc . nextInt ( ) ; int numvotes = original [ 0 ] + original [ 1 ] ; for ( int i = 0 ; i < t - 1 ; i + + ) { manipulate [ 0 ] = sc . nextInt ( ) ; manipulate [ 1 ] = sc . nextInt ( ) ; if ( manipulate [ 0 ] > original [ 0 ] & & manipulate [ 1 ] > original [ 1 ] ) { numvotes + = ( manipulate [ 1 ] - original [ 1 ] ) + ( manipulate [ 0 ] - original [ 0 ] ) ; original [ 0 ] = manipulate [ 0 ] ; original [ 1 ] = manipulate [ 1 ] ; continue ; } if ( manipulate [ 0 ] = = original [ 0 ] & & manipulate [ 1 ] = = original [ 1 ] ) continue ; multiples [ 0 ] = manipulate [ 0 ] ; multiples [ 1 ] = manipulate [ 1 ] ; int n = 1 ; while ( multiples [ 0 ] < original [ 0 ] | | multiples [ 1 ] < original [ 1 ] ) { multiples = multiply ( manipulate , n ) ; n + + ; } numvotes + = ( multiples [ 1 ] - original [ 1 ] ) + ( multiples [ 0 ] - original [ 0 ] ) ; original [ 0 ] = multiples [ 0 ] ; original [ 1 ] = multiples [ 1 ] ; } System . out . println ( numvotes ) ; } public static int [ ] multiply ( int [ ] input , int n ) { int [ ] output = { input [ 0 ] , input [ 1 ] } ; for ( int i = 0 ; i < input . length ; i + + ) { output [ i ] * = n ; } return output ; } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . next ( ) ; String [ ] PARTS = { " dream " , " dreamer " , " erase " , " eraser " } ; boolean flag = true ; boolean able = true ; while ( flag ) { flag = false ; for ( int i = 0 ; i < PARTS . length ; i + + ) { if ( input . endsWith ( PARTS [ i ] ) ) { input = input . substring ( input . length ( ) - 6 ) ; flag = true ; } } if ( input . length ( ) = = 0 ) able = true ; else able = false ; } if ( able ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] S = new int [ N ] ; boolean flg = false ; for ( int i = 0 ; i < N ; i + + ) { flg | = s . next ( ) . equals ( " Y " ) ; } System . out . println ( flg ? " Four " : " Three " ) ; } } import java . util . * ; public class B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > list _ a = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i + + ) { int din = sc . nextInt ( ) ; list _ a . add ( din ) ; } Collections . sort ( list _ a ) ; int ans = 0 ; for ( int i = 1 ; i < n ; i + + ) { ans + = list _ a . get ( i ) - list _ a . get ( i - 1 ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String args [ ] ) { int a = 2 int x = 3 System . out . println ( a * x ) ; } } class Main { public int x ; public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) ! = null ) { int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } stdReader . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . util . * ; public class main { public static main ( String args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; if ( a > = 13 ) { System . out . println ( b + " \ n " ) ; } else if ( a < 13 & & a > = 6 ) { System . out . println ( ( b / 2 ) + " \ n " ) ; } else { System . out . println ( " 0 \ n " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . next ( ) ; List < String > list = new ArrayList < > ( ) ; replace ( list , new StringBuilder ( text ) , " " , 0 ) ; int maxScoore = 0 ; int maxIndex = 0 ; int index = 0 ; for ( String str : list ) { int score = 0 ; for ( int i = 0 ; i < str . length ; i + + ) { if ( str . charAt ( i ) = = ' ? ' ) { continue ; } if ( str . charAt ( i ) = = ' D ' ) { score + + ; } else { if ( str . charAt ( i + 1 ) = = ' D ' ) { score + + ; } } } if ( score > maxScore ) { maxScore = score ; maxIndex = index ; } index + + ; } return list . get ( maxIndex ) ; } private void replace ( List < String > list , String text , String tmp , int index ) { for ( int i = index ; i < text . length ; i + + ) { tmp + = text . charAt ( i ) ; if ( text . charAt ( i ) = = ' ? ' ) { replace ( list , new StringBuilder ( text ) , tmp + ' P ' , i + 1 ) ; replace ( list , new StringBuilder ( text ) , tmp + ' D ' , i + 1 ) ; } } list . add ( tmp + ' \ n ' ) ; } } using System ; public class Cubic { public static void Main ( string ) { Console . WriteLine ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean b = false ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { b = true ; break ; } } if ( b ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } int calc ( int r ) { int ans ; return ans = r * r ; } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { public void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } public class XCubic { public static void main ( String [ ] args ) { int x = 0 ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class PrintChessboard { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } public static void main ( String [ ] args ) { int [ ] seq = { 1 , 1 , 1 , 1 } ; int res _ 2 = solution _ 2 ( seq . length , seq ) ; System . out . println ( res _ 2 ) ; } private static int solution _ 2 ( int length , int [ ] seq ) { int overflow = 0 ; int p1 = seq [ 0 ] ; int p2 = seq [ 1 ] ; for ( int i = 2 ; i < seq . length ; i + + ) { if ( p1 = = p2 ) { overflow + + ; } else if ( i % 2 = = 0 ) { if ( seq [ i ] ! = p1 ) overflow + + ; p1 = seq [ i ] ; } else if ( i % 2 ! = 0 ) { if ( seq [ i ] ! = p2 ) overflow + + ; } } return overflow ; } package test ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class main { public static void main ( String args [ ] ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( a * a * a ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Test1 { public static void main ( String [ ] args ) { InputStreamReader str = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( str ) ; try { String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; if ( 0 < = x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error " ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i = 0 , count = 0 , d ; String a , c ; int b [ ] ; b = new int [ 100000 ] ; Scanner n = new Scanner ( System . in ) ; while ( true ) { a = n . nextLine ( ) ; if ( a = = ' 0' ) { break ; } for ( i = 0 ; i < a . length ; i + + ) { c = a . charAt ( i ) ; d = Integer . parseInt ( c ) ; sum = sum + d ; } b [ i ] = sum ; count + + ; i + + ; } while ( count > i ) { System . out . printf ( " % d " , b [ i ] ) ; i + + ; System . out . printf ( " \ n " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x ^ 3 ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class atcoder0221 _ C { public class Main { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; List < Integer > X = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i + + ) { X . add ( scan . nextInt ( ) ) ; } int i = 0 ; int sum = 0 ; for ( int tmp : X ) { sum = sum + tmp ; i + + ; } int av = sum / i ; int av2 = av ; if ( sum % i > 0 ) { av2 = av + + ; } int result = 0 ; int result2 = 0 ; if ( i > 1 ) { for ( int tmp2 : X ) { result = result + ( tmp2 - av ) * ( tmp2 - av ) ; } for ( int tmp3 : X ) { result2 = result2 + ( tmp3 - av2 ) * ( tmp3 - av2 ) ; } if ( result > result2 ) { result = result2 ; } if ( result = = 0 ) { result = av ; } } else { result = av ; } System . out . println ( result ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = b ) { System . out . println ( " Draw " ) ; } else if ( ( a > b & & b ! = 1 ) | | a = = 1 ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String x = sc . next ( ) ; if ( x . equals ( " 0 " ) ) break ; boolean can = true ; int sum = 0 ; for ( int i = 0 ; i < x . length ( ) ; i + + ) { sum + = Integer . parseInt ( x [ i ] ) ; } System . out . printtln ( sum ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String T = sc . next ( ) ; sc . close ( ) ; String [ ] a = T . split ( " " ) ; for ( int i = 0 ; i < T . length ( ) ; i + + ) { if ( a [ i ] . equals ( " ? " ) ) { a [ i ] = " D " ; } } for ( int i = 0 ; i < T . length ( ) ; i + + ) System . out . print ( a [ i ] ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; long T [ ] = new int [ N ] ; long A [ ] = new int [ N ] ; long xt = 1 ; long xa = 1 ; for ( int i = 0 ; i < N ; i + + ) { T [ i ] = Integer . parseInt ( sc . next ( ) ) ; A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < N ; i + + ) { long kake = ( long ) Math . max ( Math . ceil ( ( xt - 1 + T [ i ] ) / T [ i ] ) , Math . ceil ( ( xa - 1 + A [ i ] ) / A [ i ] ) ) ; xt = T [ i ] * kake ; xa = A [ i ] * kake ; } System . out . println ( xt + xa ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int x = Math . abs ( a1 - a2 ) ; int y = Math . abs ( a2 - a3 ) ; int z = Math . abs ( a3 - a1 ) ; int max = Math . max ( x , y ) ; int max = Math . max ( z , max ) ; System . out . println ( x + y + z - max ) ; sc . close ( ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Striung str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io . ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( Math . pow ( x , 3 ) ; } } String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) } else { System . out . println ( " TBD " ) } class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( System . in ) ; System . out . print ( str * str * str ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String bs = b . readLine ( ) ; int x = Integer . parseInt ( bs ) ; for ( int i = 1 ; i < 3 ; i + + ) { x * x = x ; } System . out . println ( x ) ; } } import java . util . Scanner ; class a { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; Scanner scan1 = new Scanner ( System . in ) ; int B = scan1 . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } else if ( 6 < = A & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; double ans = Math . pow ( Integer . parseInt ( line ) , 3 ) ; String crlf = System . getProperty ( " line.separator " ) ; System . out . println ( ans " + " crlf ) ; } catch ( Exception e ) { e.printStackTrace ( ) ; } } } class Xcubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = br . readLine ( ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int a = new java . util . Scanner ( System . in ) . nextLine ( ) ; int b = new java . util . Scanner ( System . in ) . nextLine ( ) ; int c = new java . util . Scanner ( System . in ) . nextLine ( ) ; switch ( a , b , c ) { case a = 7 & & b = = 5 & & c = = 5 : System . out . println ( " YES " ) ; break ; case a = = 5 & & b = = 7 & & c = = 5 : Ssytem . out . println ( " YES " ) break ; case a = = 5 & & b = = 5 & & c = = 7 : Ssytem . out . println ( " YES " ) break ; default : Ssytem . out . print ( " NO " ) ; } } } public class study _ 1 { public static void main ( String [ ] args ) { int A = 30 ; int B = 100 ; if ( A < 6 ) { System . out . println ( " 0円 " ) ; } e se i ( < 1 ) { S stem.o u t.p r intln ( B / 2 + " 円 " ) ; } e s { Sy s em.out . pri n tln ( B + " 円 " ) ; } } } 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 ( ) ; ArrayList [ ] year = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i + + ) { year [ i ] = new ArrayList < Integer > ( ) ; } int [ ] p = new int [ m ] ; int [ ] y = new int [ m ] ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < m ; i + + ) { p [ i ] = sc . nextInt ( ) - 1 ; y [ i ] = sc . nextInt ( ) ; year [ p [ i ] ] . add ( y [ i ] ) ; } for ( int i = 0 ; i < n ; i + + ) { Collections . sort ( year [ i ] ) ; for ( int j = 0 ; j < year [ i ] . size ( ) ; j + + ) { map . put ( year [ i ] . get ( j ) , j + 1 ) ; } } for ( int i = 0 ; i < m ; i + + ) { p [ i ] + + ; String s1 = String . valueOf ( p [ i ] ) ; String ans1 = p [ i ] ; for ( int j = 0 ; j < 6 - s1 . length ( ) ; j + + ) { ans1 = " 0 " + ans1 ; } int t2 = map . get ( year [ i ] ) ; String s2 = String . valueOf ( t2 ) ; String ans2 = s2 ; for ( int j = 0 ; j < 6 - s2 . length ( ) ; j + + ) { ans2 = " 0 " + ans2 ; } System . out . println ( ans1 + ans2 ) ; } } } public class contest { public static void main ( String args [ ] ) { double pi ; pi = 3.14 ; int r = 0 ; int a = ( int ) ( 3.14 * r * r ) ; int a2 = ( int ) 3.14 ; int howMuch = a / a2 ; System . out . print ( howMuch ) ; } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BuffreredReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int i = Integer . parseInt ( str ) ; int j = i * i ; System . out . println ( " + j + " ) ; } } # include < iostream > using namespace std ; int main ( ) { int r ; cin > > r ; int x = r * r ; cout < < x < < endl ; } class Main { public static void main ( String args [ ] ) { System . out . println ( x * x * x ) ; } } inport java . util . scanner public class main ( ) { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } public class Main { public static cul int ( int x ) { y = x * x * x ; return y ; } public static void main ( String [ ] args ) { int y = int ( x ) ; Sytem . out . println ( y ) ; } } package app ; import java . util . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int BigH2 = H2 - H1 ; int BigH2M2 = BigH2 * 60 + M2 ; int clearTime = BigH2M2 - M1 ; int answer = clearTime - K ; System . out . println ( answer ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ; ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int h = ( double ) H * 30 ; int m = ( double ) M * 6 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Math . abs ( h - m ) ) ) ) ; System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; int ans = pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Max = 0 ; int sum1 = 0 ; int sum2 = 0 ; int [ ] X = sc . nextInt [ N ] ; for ( int i = 0 ; i < N ; i + + ) { X [ i ] = sc . nextInt ( ) ; if ( Max < x [ i ] ) { Max = x [ i ] ; } } sc . close ( ) ; sum1 = pow ( 1 , N , X ) ; for ( int j = 2 ; j < = Max ; j + + ) { sum2 = pow ( 2 , N , X ) ; if ( sum1 = > sum2 ) { sum1 = sum2 ; } } System . out . println ( sum1 ) ; } private static int pow ( int n1 , int N , int array [ ] ) { int sum = 0 ; for ( int k = 0 ; k < N ; k + + ) { sum + = Math . pow ( array [ k ] - n1 , 2 ) ; } return sum ; } } import java . util . Scanner ; public class x { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; System . out . println ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ) ; String string = sc . next ( ) ; string = string . replace ( " ? " , " D " ) ; System . out . println ( string ) ; } } q import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ? ? ? ( new FileReader ( " foo.in " ) ) ; ? ? ? String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class ABC042A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N , count5 , count7 ; count5 = count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { N = sc . nextInt ( ) ; if ( N = = 5 ) { + + count5 ; } else if ( N = = 7 ) { + + count7 ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . io . * ; public class Cubic { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k ; if ( a > 13 ) { k = b ; } else if ( a < = 6 ) { k = b / 2 ; } else if ( a > 6 ) { k = 0 ; } System . out . println ( k ) ; } } import java . text . * ; import java . util . * ; public class MainJ { public static void main ( String [ ] args ) { Locale . setDefault ( Locale . JAPAN ) ; Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; try { Date date1 = DateFormat . getDateInstance ( ) . parse ( a ) ; Date date2 = DateFormat . getDateInstance ( ) . parse ( " 2019 / 04 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } } package com . ACM ; import java . util . Scanner ; public class Haiku { public void syllables ( int A , int B , int C ) { if ( ( A < 0 | | A > 10 ) | | ( B < 0 | | B > 10 ) | | ( C < 0 | | C > 10 ) ) { System . exit ( 0 ) ; } else { switch ( A ) { case 5 : if ( ( B = = 5 & & C = = 7 ) | | ( B = = 7 & & C = = 5 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } break ; case 7 : if ( B = = 5 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } break ; default : System . out . println ( " No " ) ; break ; } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( " 输入 " ) ; i n t A = s . n ex t Int ( ) ; i n t B = s . n ex t Int ( ) ; i n t C = s . n ex t Int ( ) ; n e w Hai u ( ) .s y l l ables ( A , B , C ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { ? ? public static void main ( String [ ] args ) { ? ? ? ? InputStreamReader isr = new InputStreamReader ( System . in ) ; ? ? ? ? BufferedReader br = new BufferedReader ( isr ) ; ? ? ? ? String buf = br . readLine ( ) ; ? ? ? ? int x = Integer . parseInt ( buf ) ; ? ? ? ? int mp = Math . pow ( x , 3 ) ; ? ? ? ? System . out . println ( mp ) ; ? ? } } mport java . util . Scanner ; public class Main { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } import java . lang . * ; import java . util . * ; import java . io . * ; class Main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( in ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } } package Contest1506 ; import java . util . Scanner ; class A1506 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; scn . close ( ) ; System . out . println ( ( k = = 1 ) ? " 0 " : n - k ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner scn = new Scanner ( System . in ) ; double a = scn . nextInt ( ) ; double b = scn . nextInt ( ) ; double h = scn . nextInt ( ) ; double m = scn . nextInt ( ) ; double ans = 0 ; double r = Math . abs ( ( ( ( ( h * 60 ) + m ) / 2 ) - ( m * 6 ) ) ) ; if ( r = = 0 ) { System . out . println ( Math . abs ( a - b ) ) ; } else if ( r = = 180 ) { System . out . println ( a + b ) ; } else { ans = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( Math . toRadians ( r ) ) ) ) ; System . out . println ( ans ) ; } scn . close ( ) ; } } import java . util . Scanner ; public class A _ ABC042 _ A { public static void main ( String [ ] args ) { final String FIVE = " 5 " ; final String SEVEN = " 7 " ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; scanner . close ( ) ; String [ ] arrStr = ( input . split ( " " , 0 ) ) ; int fivCnt = 0 ; int sevCnt = 0 ; for ( String num : arrStr ) { if ( num . equals ( FIVE ) ) { fivCnt + + ; } else if ( num . equals ( SEVEN ) ) { sevCnt + + ; } } String res ; if ( fivCnt = = 2 & & sevCnt = = 1 ) { res = " YES " ; } else { res = " NO " ; } System . out . println ( res ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { int ans = 0 ; Scanner s = new Scanner ( System . in ) ; System . out . println ( " Enter a number " ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { ans = x * x * x ; System . out . println ( " Answer of cubic " + ans ) ; } else { System . out . println ( " Number is invalid " ) ; } } } import java . io . * class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } } import java . lang . * ; import java . io . * ; class MAIN { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( sanjo ( x ) ) ; } public static int sanjo ( int x ) { int y = x * x * x ; return y ; } } import java . util . Scanner ; public classMain { public static void main ( String [ ] args ) { Scanner sc = newScanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x System . out . println ( answer ) ; } } import java . util . Scanner ; class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int inputNum = Integer . parseInt ( str ) ; int intNum = inputNum * inputNum * inputNum ; System . out . println ( intNum ) ; } import java . util . * ; public class mondai7 { public static void main ( String [ ] args ) { int n , l , r , d , p = 0 , t = 0 , x = 0 , kiroku = 0 , max = 0 , max2 = 0 , hensu = 0 ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; int [ ] ten = new int [ n ] ; int [ ] byou = new int [ n ] ; r = scan . nextInt ( ) ; int [ ] ban = new int [ r ] ; l = scan . nextInt ( ) ; for ( int i = 0 ; i < r ; i + + ) { d = scan . nextInt ( ) ; t = scan . nextInt ( ) ; x = scan . nextInt ( ) ; if ( i = = 0 ) { kiroku = t ; byou [ 0 ] = t ; } ten [ d - 1 ] = ten [ d - 1 ] + x ; for ( int j = 1 ; j < n ; j + + ) { if ( ten [ max ] < ten [ j ] ) { max = j ; } } ban [ p ] = max ; if ( i > 0 ) { byou [ ban [ p - 1 ] ] = byou [ ban [ p - 1 ] ] + t - kiroku ; } kiroku = t ; hensu = max ; max = 0 ; p = p + 1 ; } byou [ hensu ] = byou [ hensu ] + ( l - t ) ; for ( int k = 1 ; k < n ; k + + ) { if ( byou [ max2 ] < byou [ k ] ) { max2 = k ; } } System . out . println ( max2 + 1 ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) if ( x < 0 | | x > 100 ) { return - 1 ; } return x * x * x ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } } import java . util . Scanner ; public class Beginning { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in , " UTF-8 " ) ; int n [ ] = { 1 , 9 , 7 , 4 } ; String [ ] inp = new String [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { inp [ i ] = sc . next ( ) ; } int cont = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = 0 ; j < 4 ; j + + ) { if ( n [ i ] = = Integer . parseInt ( inp [ j ] ) ) cont + + ; } } if ( cont = = 4 ) { System . out . print ( " YES " ) ; } else if ( cont ! = 4 ) { System . out . print ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int v = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int w = scn . nextInt ( ) ; int t = scn . nextInt ( ) ; double tt ; String ans = " YES " ; if ( b > a ) tt = ( double ) ( b - a ) / ( v - w ) ; if ( a > b ) tt = ( double ) ( a - b ) / ( v - w ) ; if ( t < tt ) ans = " NO " ; if ( w > v ) ans = " NO " ; System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] args = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { args [ i ] = Integer . parseInte ( br . readLine ( ) ) ; } int c1 = 0 ; int c2 = 0 ; int c10 = 0 ; int counter = 0 ; if ( args [ 0 ] + args [ 1 ] * 2 + args [ 2 ] * 10 > = args [ 3 ] ) { for ( ; c10 < = args [ 2 ] ; c10 + + ) { if ( c10 * 10 > args [ 3 ] ) { break ; } else if ( c1 + c2 * 2 + c10 * 10 < args [ 3 ] ) { } else { for ( ; c2 < = args [ 1 ] ; c2 + + ) { if ( c10 * 10 + c2 * 2 > args [ 3 ] ) { break ; } else if ( c10 * 10 + c2 * 2 < args [ 3 ] ) { } else { counter + + ; } } } } } System . out . println ( counter ) ; } } public class Main11 { public static void main ( String [ ] args ) { int x = 3 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } package internship ; import java . util . Scanner ; public class test1 { public static void main ( String [ ] args ) { int x = 0 , temp , tot ; boolean swi = false ; Scanner sc = new Scanner ( System . in ) ; while ( swi = = true ) { temp = sc . nextInt ( ) ; if ( 1 < = temp | | 100 < = temp ) x = temp ; swi = true ; } tot = x * x * x ; System . out . println ( tot ) ; System . out . println ( ) ; } } public class Main { public static void main ( String [ ] args ) { int a ; try ( Scanner scanner = new Scanner ( System . in ) ) { a = scanner . nextInt ( ) ; } a = a * a * a ; System . out . println ( a ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int inputNum = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( inputNum * inputNum * inputNum ) ; } import java . util . * ; public class main { private static Scanner sc = new Scanner ( System . in ) ; static int x1 , x2 , x3 , y1 , y2 , y3 , xp , yp ; public static void main ( String [ ] args ) { while ( sc . hasNextInt ( ) ) { int xm [ ] = new int [ 3 ] ; int ym [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { xm [ i ] = sc . nextInt ( ) ; ym [ i ] = sc . nextInt ( ) ; } xp = sc . nextInt ( ) ; yp = sc . nextInt ( ) ; Arrays . sort ( xm ) ; Arrays . sort ( ym ) ; if ( xm [ 0 ] < xp ) { if ( xm [ 3 ] > xp ) { if ( ym [ 0 ] < yp ) { if ( ym [ 3 ] < yp ) { System . out . println ( " Yes " ) ; } else { mm ( ) ; } } else { mm ( ) ; } } else { mm ( ) ; } } else { mm ( ) ; } } } private static void mm ( ) { System . out . println ( " No " ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . println ( Math . pow ( Integer . parseInt ( new Scanner ( System . in ) . next ( ) ) , 3 ) ) ; } } import scala . io . { StdIn = > in } object Main extends App { val Array ( a , b ) = in . readLine . split ( " " ) . map ( _ . toInt ) val ans = a match { case x if x < = 5 = > 0 case x if x < = 12 = > b / 2 case _ = > b } println ( ans ) } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; i = i * i * i ; System . out . println ( i ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int a = Integer . parseInt ( line ) ; a = a * a * a ; System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kbd = new Scanner ( System . in ) ; int a = kbd . nextInt ( ) ; int b = kbd . nextInt ( ) ; int h = kbd . nextInt ( ) ; int m = kbd . nextInt ( ) ; double A = h * 30 + m * 0.5 ; double B = m * 6 ; double C = 0 ; if ( A - B > = 0 ) { C = A - B ; } else { C = B - A ; } if ( C > 180 ) { C = 360 - C ; } C = Math . toRadians ( C ) ; double x = b * Math . sin ( C ) * b * Math . sin ( C ) ; double y = ( b * Math . cos ( C ) - a ) * ( b * Math . cos ( C ) - a ) ; System . out . println ( Math . sqrt ( x + y ) ) ; } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 1 ; for ( int i = 0 ; i < N ; i + + ) { max = 2 * * i ; if ( max > N ) { break ; } } max = max / 2 ; System . out . println ( max ) ; } } public class Main { public static void main ( String [ ] args ) { int x = number ; x > = 1 & & x < = 100 ; System . out . println ( x * x * x ) ; } } import java . io . * ; import java . util . * ; public class Main { public int cube ( int x ) { public static int answer = x * x * x ; return answer ; } public static void main ( String args [ ] ) throws Exception { int submit = cube ( 3 ) ; System . out . println ( submit ) ; } } public class Test { public static void main ( String args ) { int x = args . toInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; import java . util . Map . Entry ; public class Main { static int N , M ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; Map < Integer , Integer > ml = new LinkedHashMap < Integer , Integer > ( ) ; Map < Integer , String > result = new LinkedHashMap < Integer , String > ( ) ; Map < Integer , Integer > m = new TreeMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int pi = sc . nextInt ( ) ; int yi = sc . nextInt ( ) ; ml . put ( yi , pi ) ; m . put ( yi , pi ) ; } int count ; String xiaquid , cityorder , cityid ; for ( int i = 1 ; i < = N ; i + + ) { count = 0 ; for ( Map . Entry < Integer , Integer > entry : m . entrySet ( ) ) { int v = entry . getValue ( ) ; if ( i = = v ) { count + + ; xiaquid = String . format ( " % 06d " , Integer . valueOf ( v ) ) ; cityorder = String . format ( " % 06d " , Integer . valueOf ( count ) ) ; cityid = xiaquid + cityorder ; result . put ( entry . getKey ( ) , cityid ) ; } } } for ( Map . Entry < Integer , Integer > entry : ml . entrySet ( ) ) { for ( Map . Entry < Integer , String > entry2 : result . entrySet ( ) ) { if ( entry . getKey ( ) = = entry2 . getKey ( ) ) System . out . println ( entry2 . getValue ( ) ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( IOException e ) { } int i = Math . pow ( x , 3 ) ; System . out . println ( i ) ; } } import java . io . * ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String line = br . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x = = 0 ) { break ; } int sum ; while ( x > 0 ) { int y = x ; y = y / 10 ; y = y * 10 ; sum + = ( x - y ) ; x = ( y / 10 ) ; } System . out . println ( sum ) ; } } } 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 ( ) ; if ( 0 < = A & & A < = 5 ) { int B = 0 ; System . out . println ( A B ) ; } else if ( 6 < = A & & A < = 12 ) { int B = B / 2 ; System . out . println ( A B ) ; } else if ( 13 < = A & & A < = 100 ) { System . out . println ( A B ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Xcubic { public static void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; try { int x = scan . nextInt ( ) ; if ( ( x > = 100 ) | | ( x < = 0 ) ) System . exit ( 0 ) ; x = x * x * x ; System . out . println ( " " + x + " " ) ; } catch ( InputMismatchException e ) { System . out . println ( " ? ? ¨ ? ? ? ? ? ? " ) ; public class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int x = stdid . nextInt ( ) ; x = x * x * x ; System . out . println ( String . valueOf ( x ) + " \ r \ n " ) ; } } public class Main { public static void main ( String [ ] args ) { int x = new java . util . Scannner ( System . in ) . nextInt ( ) ; int i = x * x * x ; System / out . println ( i ) ; } } import java . util . Scanner public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; Sytem . out . println ( x - y ) ; } } import java . util . Scanner ; public class work { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int xcubic ; int a = 0 ; while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 0 0 ) i = - 1 ; } xc u b c * a a ; Sys e . u . p r n ln ( xcu i ) ; } } public class Main { public static void main ( String [ ] args ) { int year = args [ 0 ] . substring ( 0 , 3 ) ; int month = args [ 0 ] . substring ( 5 , 6 ) ; int day = args [ 0 ] . substring ( 8 , 9 ) ; Date inputDay = new Date ( year , month , day , 12 , 0 , 0 ) ; Date s = new Date ( 2019 , 4 , 30 , 12 , 0 , 0 ) ; if ( s . before ( inputDay ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . * ; public class Main { long MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } long [ ] c = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { c [ i ] = a [ i ] - b [ i ] ; } long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { sum + = c [ i ] ; } if ( sum < 0 ) { System . out . println ( " -1 " ) ; return ; } Arrays . sort ( c ) ; int r = n - 1 ; boolean ru = false ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( c [ i ] > = 0 ) break ; ans + + ; while ( r > = 0 ) { if ( ! ru ) { ru = true ; ans + + ; } if ( c [ i ] + c [ r ] > = 0 ) { int tmp = c [ i ] + c [ r ] ; c [ i ] = 0 ; c [ r ] = tmp ; break ; } else { c [ i ] = c [ i ] + c [ r ] ; ru = false ; r -- ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class ABC087B _ Coins { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = a ; i + + ) { int rest1 = x ; rest1 = rest1 - 500 * i ; if ( rest1 < 0 | | rest1 > 100 * b + 50 * c ) { continue ; } for ( int j = 0 ; j < = b ; j + + ) { int rest2 = rest1 ; rest2 = rest2 - 100 * j ; if ( rest2 < 0 | | rest2 > 50 * c ) { continue ; } if ( rest2 % 50 = = 0 & & rest2 / 50 < = c ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Iterator ; import java . util . Collections ; import java . util . Comparator ; import java . util . Random ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = 0.5 ; x + = ( a + b / 2 ) ; System . out . print ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 3 ; int x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = nre Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = ( a + b ) / 2 ; if ( ( a + b ) % 2 = = 0 ) { System . out . println ( ( a + b ) / 2 ) ; } else { System . out . println ( ( a + b + 1 ) / 2 ) ; } } } import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; if ( A < B ) { if ( A + ( V * T ) < B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else if ( A + ( V * T ) > = B + ( W * T ) ) { System . out . println ( " No " ) ; } } else if ( B < A ) { if ( B - ( W * T ) > = A - ( V * T ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } else if ( A = = B ) { if ( A + ( V * T ) < = B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } } import java . util . Scanner ; class Haiku { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; System . out . println ( " 整数値a : " ) ; int a = s dIn n e xtInt ( ) ; Syst e m . ut.pri n tln ( " 整数値b : " ) ; int b = stdIn. n e x Int ) ; Syst e m.out.p r i n ln ( " 整数 値 c : " ) ; int c = s tdIn.nextInt ( ) ; f ( a = 7 ) { if ( b = = 5 & & c = = 5 { S y st e m . ut . p ri n tl n ( " Y e s ) ; } e l se { System. o u t.p r i n l ( " No " ; } } e lse if ( a = = 5 ) { i f ( b = & c = = 7 { S y st e m . ut . p ri n tl n ( " Y e s ) ; } e l se i f ( b = = 7 & & c = = 5 ) { y tem. ut . p ri n tl n ( " Y e s ) ; } e l se { System. o u t.p r i n l ( " No " ; } } e lse { System . o ut . p r n l ( " Ye s ) ; } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans ; if ( k > 1 ) { ans = n - k ; } else { ans = 0 ; } System . out . println ( ans ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; s = reader . readLine ( ) ; String [ ] inp = s . split ( " " ) ; int a , b , c ; a = Integer . parseInt ( inp [ 0 ] ) ; b = Integer . parseInt ( inp [ 1 ] ) ; c = Integer . parseInt ( inp [ 2 ] ) ; if ( a + b > = c ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; class test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( [ ] String args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; floor ( average ( x , y ) ) ; } private average ( int x , int y ) { return ( x + y ) / 2 ; } private int floor ( float z ) { return Math . floor ( z ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; if ( A = = 1 ) { A = 14 ; } else if ( B = = 1 ) { B = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( B > A ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int list [ ] = new int [ 3 ] ; for ( int i = 0 ; i < N ; i + + ) { list [ i ] = sc . nextInt ( ) ; } Arrays . sort ( list ) ; System . out . println ( ( list [ 1 ] - list [ 0 ] ) + ( list [ 2 ] - list [ 1 ] ) ) ; } } class Main { public static void main ( String [ ] args ) { int i = 2 if ( i > = 1 & & i < 101 ) { System . out . println ( " Input = " + i ) ; System . out . println ( " Output = " + i * i * i ) ; } else { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } } } import java . util . Scanner ; public class ATC { static int n , min = Integer . MAX _ VALUE ; static int [ ] nums ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; nums = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } if ( n = = 2 ) { min = nums [ 0 ] = = nums [ 1 ] ? 1 : 0 ; System . out . println ( min ) ; return ; } t ( 0 , 0 ) ; System . out . println ( min ) ; } public static void t ( int i , int pv ) { if ( i > = n ) return ; if ( i = = 0 ) { int cv = 0 ; for ( int x = 2 ; x < n ; x + + ) if ( x % 2 = = 0 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; t ( i + 1 , cv ) ; } else { int cv = 0 ; for ( int x = 0 ; x < n ; x + + ) { if ( ( pv + cv ) > min ) break ; if ( i ! = x & & i % 2 = = x % 2 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; } if ( nums [ i - 1 ] = = nums [ i ] & & pv = = 0 & & cv = = 0 ) cv = n / 2 ; min = Math . min ( min , pv + cv ) ; t ( i + 1 , pv + cv ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class P01 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( ) ; System . out . print ( str * str * str ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } public static void main ( String [ ] args ) { int count5 = 0 ; int count7 = 0 ; for ( String arg : args ) { if ( arg . equals ( " 5 " ) ) { count5 + + ; } else if ( arg . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int arrayMin = Integer . Max _ Value ; for ( int i = 0 ; i < n ; i + + ) { arrayMin = Math . min ( p [ i ] , arrayMin ) ; if ( arrayMin = = p [ i ] ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } elif ( A > = 6 & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferedReader br = new BufferedReader ( new StreamReader ( System . in ) ) ; try { buf = br . readline ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( " 入出力エラーです " ) ; } } } import java . util . Scanner ; import java . util . Random ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = nextInt ( ) ; int num = a / 15 ; System . out . println ( 800 * a - num ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String a = scanner . nextLine ( ) ; if ( a . equals ( " 0 " ) ) break ; int sum = 0 ; for ( String b : a . split ( " " ) ) { sum + = Integer . parseInt ( b ) ; } System . out . println ( sum ) ; } } } public class Main { public static void main ( String [ ] args ) { int = x x = x * x * x system . out , println ( < x < 100 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; int n = sc . nextInt ( ) ; long [ ] [ ] rui = new long [ 60 ] [ 2 ] ; for ( int i = 0 ; i < n ; i + + ) { long a = sc . nextLong ( ) ; for ( int j = 0 ; j < 60 ; j + + ) { long t = a / ( long ) Math . pow ( 2 , j ) ; rui [ j ] [ ( int ) ( t % 2 ) ] + + ; } } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long t = ( long ) Math . pow ( 2 , i ) % MOD ; long t = ( t * rui [ i ] [ 0 ] ) % MOD ; t = ( t * rui [ i ] [ 1 ] ) % MOD ; ans = ( ans + t ) % MOD ; } System . out . println ( ans ) ; } } public class Index { public static void main ( Stirng [ ] args ) { INT A , B , C ; while ( 1 ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; A = new String ( in . readLine ( ) ) ; if ( A = = 5 & & A = = 7 ) { B = new String ( in . readLine ( ) ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } C = new String ( in . readLine ( ) ) ; if ( A + B + C = = 17 ) { System . outprintln ( " Yes ! " ) ; } else { break ; } } } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main2 ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int r [ ] = new int [ n ] ; for ( int i = 0 ; i < r . length ; i + + ) { r [ i ] = sc . nextInt ( ) ; } double c [ ] = new double [ n ] ; for ( int i = 0 ; i < c . length ; i + + ) { c [ i ] = r [ i ] ; for ( int j = 0 ; j < i ; j + + ) { double t = Math . sqrt ( 4 * r [ i ] * r [ j ] ) ; c [ i ] = Math . max ( c [ j ] + t , c [ i ] ) ; } } double max = 0 ; for ( int i = 0 ; i < n ; i + + ) { max = Math . max ( max , c [ i ] + r [ i ] ) ; } System . out . println ( max ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tempList [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { tempList [ i ] = sc . nextInt ( ) ; } Arrays . sort ( tempList ) ; int [ ] anserList = { 5 , 5 , 7 } ; if ( Arrays . equals ( tempList , anserList ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String line = in . nextLine ( ) ; in . close ( ) ; String [ ] ary = line . split ( " " ) ; boolean w7 = false ; boolean [ ] w5 = { false , false } ; for ( String w : ary ) { int intW = Integer . parseInt ( w . trim ( ) ) ; if ( intW ! = 5 & & intW ! = 7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 5 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 = = false ) { w7 = true ; } else if ( intW = = 5 ) { if ( w5 [ 0 ] = = false ) { w5 [ 0 ] = true ; } else if ( w5 [ 1 ] = = false ) { w5 [ 1 ] = true ; } } } if ( w7 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( Math . ceil ( double ( a + b ) / 2.0 ) ) ; } } import java . util . * ; public class ABC113C { public static void main ( String [ ] args ) { new ABC113C ( ) . execute ( ) ; } private void execute ( ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; int [ ] prefs = new int [ M ] ; int [ ] years = new int [ M ] ; Map < Integer , Integer > yearPref = new HashMap < > ( ) ; Map < Integer , Integer > order = new HashMap < > ( ) ; Map < Integer , String > cityNumbers = new HashMap < > ( ) ; for ( int i = 0 ; i < M ; i + + ) { prefs [ i ] = sc . nextInt ( ) ; years [ i ] = sc . nextInt ( ) ; yearPref . put ( years [ i ] , prefs [ i ] ) ; } int [ ] ys = years . clone ( ) ; Arrays . sort ( ys ) ; for ( int i = 0 ; i < ys . length ; i + + ) { int y = ys [ i ] ; int p = yearPref . get ( y ) ; if ( ! order . containsKey ( p ) ) { order . put ( p , 0 ) ; } int ord = order . get ( p ) + 1 ; order . put ( p , ord ) ; String cityNum = String . format ( " % 06d " , p ) + String . format ( " % 06d " , ord ) ; cityNumbers . put ( y , cityNum ) ; } for ( int i = 0 ; i < M ; i + + ) { System . out . println ( cityNumbers . get ( years [ i ] ) ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] b = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) b [ N ] = sc . nextInt ( ) ; int ans = 0 ; boolean plus = 0 ; for ( int i = 0 ; i < N ; i + + ) { plus = true ; for ( int j = 0 ; j < i ; j + + ) { if ( b [ j ] < b [ i ] ) { plus = false ; break ; } } if ( plus ) ans + + ; } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = n ; n = x * x * x ; System . out . println ( n ) ; } } a public class Main { public static void main ( String [ ] args ) { int x ; int num = x * 3 ; System . out . println ( num ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { int x , a ; System . out . println ( " Input x : " ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; a = x * x * x ; System . out . println ( " x ^ 3 = " + a ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " The input number was not correct . " ) ; } } } public class ITP1 _ 1B { public static void main ( String [ ] args ) { int arg = Integer . valueOf ( args [ 0 ] ) ; int answer = arg * arg * arg ; System . out . print ( answer ) ; } } import java . util * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String po = sc . nextLine ( ) ; po = po . replace ( " / " , " . " ) ; String p [ ] = po . substring ( " . " , 0 ) ; System . out . println ( ( Integer . parseInt ( p [ 1 ] ) < 5 ) ? " Heisei " : " TBD " ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x * ) ; } } public class Main { public static void main ( String [ ] args ) { ? ? ? int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( " x * x * x " ) ; } } import java . io . * ; import java . util . * ; public class Main { @ SuppressWarnings ( " unchecked " ) static boolean [ ] used ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int V = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; List < Edge > [ ] edges = new List [ V ] ; for ( int i = 0 ; i < V ; i + + ) { edges [ i ] = new ArrayList < Edge > ( ) ; } used = new boolean [ V ] ; } static class Edge { int to , cap , rev ; Edge ( int to , int cap , int rev ) { this . to = to ; this . cap = cap ; this . rev = rev ; } } } import sys stdin = sys . stdin ni = lambda : int ( ns ( ) ) na = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) ns = lambda : stdin . readline ( ) . rstrip ( ) # ignore trailing spaces n = ni ( ) a = na ( ) mn = 9999999999 ct = 0 for i in range ( n ) : if mn > a [ i ] : ct + = 1 mn = a [ i ] print ( ct ) import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Manager { public Manager ( ) { } static int input ; public static void main ( String args [ ] ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; input = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } public class XCubic { public static void main ( String [ ] args ) { int inputValue = Integer . valueOf ( System . console ( ) . readLine ( ) ) ; System . out . println ( inputValue * inputValue * inputValue ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Integer lenChara = Integer . valueOf ( scan . nextLine ( ) ) ; String targetChara = scan . nextLine ( ) ; if ( lenChara % 2 = = 0 ) { int divide = lenChara / 2 ; String start = targetChara . substring ( 0 , divide ) ; String end = targetChara . substring ( divide , targetChara . length ( ) ) ; if ( start . equals ( end ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } class Main { public static void main ( String [ ] args ) { int x = args [ 0 ] ; x = x * x * x ; System . out . plintln ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ( ) ; min = a [ 0 ] ; } for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } system . out . println ( count ) ; } } } import java . util . Scanner ; public class Main9 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { String data1 = scanner . nextLine ( ) ; String data2 = scanner . nextLine ( ) ; String data3 = scanner . nextLine ( ) ; String [ ] data1Array = data1 . split ( " " ) ; String [ ] data2Array = data2 . split ( " " ) ; long startPosA = Long . parseLong ( data1Array [ 0 ] ) ; long moveDisA = Long . parseLong ( data1Array [ 1 ] ) ; long startPosB = Long . parseLong ( data2Array [ 0 ] ) ; long moveDisB = Long . parseLong ( data2Array [ 1 ] ) ; long time = Long . parseLong ( data3 ) ; boolean isCatch = false ; for ( int i = 1 ; i < = time ; i + + ) { startPosA + = moveDisA ; startPosB + = moveDisB ; if ( startPosA > = startPosB ) { isCatch = true ; break ; } } System . out . println ( isCatch ? " YES " : " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( string [ ] args ) { Scanner in = new Scanner ( System . in ) ; String x = in . next ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . util . scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? 3 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? " ) ; ystem. o ut. p rint ( " ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? > " ) ; nt tdIn. n extInt ( ) ; ystem. o ut. p rint ( " ? ? \ ? ? ? ? ? ? ? ? ? " ? ? ? 3 ? ? ? ? ? ? " ? ? § ? ? ? " ) ; } } import java . util . Scanner ; public class NOMURA2020BSandbox { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String T = sc . next ( ) ; System . out . println ( T . replaceAll ( " / ? " , " D " ) ) ; } } import java . io . IOException ; class Main { public static void main ( String [ ] args ) { try { int x = System . in . read ( ) ; int a = x * x * x ; } catch ( IOException e ) { } System . out . println ( a ) ; } } 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 ( ) ; System . out . println ( ( a + b ) + " " + s ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; List < Position > positions = new ArrayList < Position > ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; positions . add ( new Position ( x , y ) ) ; } int c = 0 ; double distances = 0.0 ; for ( int i = 0 ; i < positions . size ( ) ; i + + ) { for ( int y = 0 ; y < positions . size ( ) ; y + + ) { if ( i = = y ) { continue ; } c + + ; distances + = calcDistance ( positions . get ( i ) , positions . get ( y ) ) ; } } System . out . println ( ( distances / c ) ) ; } static double calcDistance ( Position a , Position b ) { return Math . sqrt ( Math . pow ( a . x - b . x ) + Math . pow ( a . y - b . y ) ) ; } public class Position { public int x ; public int y ; public Position ( int x , int y ) { this . x = x ; this . y = y ; } } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a ; a = new int [ 3 ] ; boolean dool = false ; for ( int i = 0 ; i < 3 ; i + + ) { int x = scanner . nextInt ( ) ; if ( x ! = 5 & & x ! = 7 ) { System . out . println ( " NO " ) ; dool = true ; break ; } a [ i ] = x ; } if ( dool = = false ) { boolean chool = false ; for ( int i = 0 ; i < 2 ; i + + ) { if ( a [ i ] > a [ i + 1 ] ) { System . out . println ( " NO " ) ; chool = true ; break ; } } if ( chool = = false ) System . out . println ( " YES " ) ; } scanner . close ( ) ; } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } # include < iostream > int main ( ) { int x ; std : : cin > > x ; std : : cout < < x * x * x < < std : : endl ; return 0 ; } public class ABC042 { public static void main ( String [ ] args ) { int seven = 0 ; int five = 0 ; String [ ] num = new String [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = new java . util . Scanner ( System . in ) . nextLine ( ) ; } for ( int i = 0 ; i < 3 ; i + + ) { if ( num [ i ] . length ( ) = = 5 ) { five + + ; } if ( num [ i ] . length ( ) = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int num _ 1 = Integer . parseInt ( str ) ; String str = scan . next ( ) ; int num _ 2 = Integer . parseInt ( str ) ; String str = scan . next ( ) ; int num _ 3 = Integer . parseInt ( str ) ; if ( num _ 1 = " 7 " ) { if ( num _ 2 = " 5 " & & num _ 3 = " 5 " ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( num _ 2 = " 7 " ) { if ( num _ 1 = " 5 " & & num _ 3 = " 5 " ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( num _ 3 = " 7 " ) { if ( num _ 2 = " 5 " & & num _ 1 = " 5 " ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } class Main { public static void main ( String [ ] args ) { int input = args [ 0 ] ; System . out . println ( input * input * input ) ; } } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; if ( n _ customer > 1 ) { while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } } else { sold + + ; } System . out . println ( sold ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int N = Integer . parseInt ( str ) ; str = scan . next ( ) ; int L = Integer . parseInt ( str ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { String input = scan . next ( ) ; list . add ( input ) ; } Collections . sort ( list ) ; for ( int i = 0 ; i < 3 ; i + + ) { String input = list . get ( i ) ; String ans = ans + input ; } System . out . println ( ans ) ; } } n = gets . to _ i puts n * n import java . util . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int BigH2 = H2 - H1 ; int BigH2M2 = BigH2 * 60 + M2 ; int clearTime = BigH2M2 - M1 ; int answer = clearTime - K ; System . out . println ( answer ) ; } } public class main { public static void Input ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextINt ( ) ; int B = sc . nextINt ( ) ; int C = sc . nextINt ( ) ; int X = sc . nextINt ( ) ; int y = 0 ; int count = 0 ; for ( int i = 0 ; i < A ; i + + ) { for ( int j = 0 ; j < B ; j + + ) { y = ( X - 500 * i - 100 * j ) / 50 ; if ( y > = 0 & & y < = C ) { count = count + 1 ; } } } System . out . println ( count ) ; } } class Main { public static void main ( Strings [ ] args ) { int x ; x = 0 ; System . out . println ( x ^ 3 ) ; } } # include < stdio . h > # define uint unsigned int int in ( ) { int x = 0 , c ; for ( ; ( uint ) ( ( c = getchar ( ) ) - ' 0' ) > = 10 ; ) { if ( c = = ' -' ) return - in ( ) ; if ( ! ~ c ) throw ~ 0 ; } do { x = ( x < < 3 ) + ( x < < 1 ) + ( c - ' 0' ) ; } while ( ( uint ) ( ( c = getchar ( ) ) - ' 0' ) < 10 ) ; return x ; } int main ( ) { int n , S ; while ( n = in ( ) , S = in ( ) , ( n | | S ) ) { int w [ 102 ] = { } , a [ 102 ] = { } ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int b ; w [ b = in ( ) ] + + ; a [ b ] + + ; } for ( int i = 99 ; i > = 0 ; i -- ) w [ i ] + = w [ i + 1 ] ; for ( int i = 0 ; i < = 100 ; i + + ) if ( 2 * i > S ) ans + = a [ i ] * ( a [ i ] - 1 ) / 2 ; for ( int i = 1 ; i < = 100 ; i + + ) ans + = a [ i ] * w [ i > S - i ? i + 1 : S - i + 1 ] ; printf ( " % d % c " , ans , 10 ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = 0 ; try { x = Integer . parseInt ( in . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } System . out . println ( ( int ) Math . pow ( ( double ) x , 3d ) ) ; } } import java . util . Scanner ; public class demo { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double a , b , h , m ; a = in . nextDouble ( ) ; b = in . nextDouble ( ) ; h = in . nextDouble ( ) ; m = in . nextDouble ( ) ; in . close ( ) ; double h _ angle = 0.5 * ( h * 60 + m ) ; double m _ angle = 6 * m ; double angle = Math . abs ( h _ angle - m _ angle ) ; angle = Math . min ( angle , 360 - angle ) ; double res = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle * Math . PI / 180 ) ) ; System . out . printf ( " % .20f \ n " , res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nextTime = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { nextTime = sc . nextInt ( ) ; if ( i ! = 4 ) nextTime = Math . ceil ( nextTime ) ; } System . out . println ( nextTime ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = Math . abs ( Math . max ( Math . max ( a , b ) , c ) - Math . min ( Math . min ( a , b ) , c ) ) ; System . out . println ( ans ) } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parse ( args [ 0 ] ) ; int y = Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } impmport java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; double xr = 360 * ( x * 60 + y ) / 720 ; double yr = 360 * y / 60 double e = Math . max ( xr - yr , yr - xr ) ; double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( c , 2 ) - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } public class AtCorder091 { public static void main ( String [ ] args ) { int a = 0 ; int b = 0 ; int c = 0 ; a = Integer . parseInt ( args [ 0 ] ) ; b = Integer . parseInt ( args [ 1 ] ) ; c = Integer . parseInt ( args [ 2 ] ) ; if ( ( ( a > = 1 ) & & ( a < = 500 ) ) & & ( ( b > = 1 ) & & ( b < = 500 ) ) & & ( ( c > = 1 ) & & ( b < = 1000 ) ) ) { if ( c < = a + b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int x = scanner . nextint ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( " enter x : " ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x ^ 3 ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double [ ] x = new double [ N ] ; double [ ] y = new double [ N ] ; double [ ] ans = new double [ 40320 ] ; double [ ] aa = new double [ ] { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 } ; double [ ] bb = new double [ ] { 0 , 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 } ; for ( int i = 0 ; i < N ; i + + ) { x [ i ] = sc . nextDouble ( ) ; y [ i ] = sc . nextDouble ( ) ; } int count = 0 ; for ( int i = 0 ; i < = N - 2 ; i + + ) { for ( int k = i + 1 ; k < = N - 1 ; k + + ) { ans [ count ] = Math . sqrt ( ( x [ i ] - x [ k ] ) * ( x [ i ] - x [ k ] ) + ( y [ i ] - y [ k ] ) * ( y [ i ] - y [ k ] ) ) ; count + + ; } } double total = 0 ; for ( int i = 0 ; i < 40320 ; i + + ) { total + = ans [ i ] ; } System . out . println ( ( total * aa [ N - 1 ] / bb [ N ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } int m = 1000000007 ; long answer = 0 ; for ( int i = 0 ; i < 61 ; i + + ) { long d = ( 1L < < i ) ; long count = 0 ; for ( int j = 0 ; j < a . length ; j + + ) { if ( ( d & a [ j ] ) > 0 ) { count + + ; } } count = count * ( n - count ) ; answer = ( answer + ( ( d * count ) % m ) % m ; } System . out . println ( answer % m ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ) ; ABeginning solver = new ABeginning ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABeginning { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = 4 ; int [ ] arr = in . nextArray ( n ) ; Arrays . sort ( arr ) ; out . println ( Arrays . equals ( arr , new int [ ] { 1 , 4 , 7 , 9 } ) ? " YES " : " NO " ) ; } } static class InputReader implements AutoCloseable { 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 ( ) ) ; } public int [ ] nextArray ( int n ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = nextInt ( ) ; } return arr ; } public void close ( ) { } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int L = scan . nextInt ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i < N ; i + + ) { String [ ] str = new String [ N ] ; str [ i ] = reader . readLine ( ) ; } Arrays . sort ( str ) ; for ( String out : str ) { System . out . print ( out ) ; } reader . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; if ( formatDate < = 2019 / 04 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int L = scan . nextInt ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { str [ i ] = scan . next ( ) ; } Arrays . sort ( str ) ; for ( String out : str ) { System . out . print ( out ) ; } scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( ( x [ j ] x [ i ] - x [ i ] x [ i ] ) * ( x [ j ] x [ i ] - x [ i ] x [ i ] ) ) ; } if ( Math . sqrt ( sum ) = = int ( Math . sqrt ( sum ) ) ) { counter + + ; } } } System . out . print ( counter ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] data = new int [ 3 ] ; for ( int i = 0 ; i < data . length ; i + + ) { data [ i ] = sc . nextInt ( ) ; } Arrays . sort ( data ) ; return ( data [ 1 ] - data [ 0 ] ) > ( data [ 2 ] - data [ 1 ] ) ? ( data [ 2 ] - data [ 1 ] ) : ( data [ 1 ] - data [ 0 ] ) ; } } class Main { public static void main ( String args [ ] ) { int n = 0 ; System . in ( n ) ; System . out . println ( n * n * n ) ; } } import java . io . * public class Xcube { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readline ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = input . readLine ( ) ; int output = Integer . parseInt ( x ) ; output = output * output * output System . out . println ( output ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = reader . readLine ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main { String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ABC = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { ABC [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ABC ) ; boolean flg = false ; if ( ABC [ 0 ] = = 5 ) { if ( ABC [ 1 ] = = 5 ) { if ( ABC [ 2 ] = = 7 ) { flg = true ; } } } if ( flg ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( solution ( x ) ) ; } public static int solution ( int x ) { return x * x * x ; } } mport java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int N = gi ( ) ; int m = 2 ; for ( int i = 1 ; i < = N ; i + + ) { int c = 0 ; int a = i ; while ( true ) { if ( a % 2 ! = 0 ) { break ; } a / = 2 ; c + + ; } if ( c > m ) { m = c ; } } System . out . print ( m ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } class Main { public static void main ( string [ ] args ) { int x ; } } / * package whatever import java . io . * ; import java . util . * ; class GFG { private static final long MOD = ( long ) ( 1e9 + 7 ) ; public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = input . nextLong ( ) ; long xor = 0l , sum = 0l ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { xor = ( a [ i ] ^ a [ j ] ) % MOD ; sum + = ( xor % MOD ) ; } } System . out . println ( sum % MOD ) ; } } class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int n = stdId . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer \ n ) ; } } import java . util . * ; public class A { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { int x 2 ; x = x * x * x ; System . out . println ( x ) ; } } package atcorder ; public class HelloWorld { public static void main ( String args [ ] ) { int [ ] arg = new int [ 3 ] ; int y ; for ( int x = 0 ; x < 3 ; x + + ) { arg [ x ] = Integer . parseInt ( args [ x ] ) ; } if ( arg [ 0 ] < arg [ 1 ] ) { y = arg [ 0 ] ; arg [ 0 ] = arg [ 1 ] ; arg [ 1 ] = y ; System . out . println ( " テスト1 " ) ; } i f ( r [ 1 ] < a r g 2 ) { y = a g 1 ; a r g [ 1 = a r g 2 ; a r g [ 2 = y ; f ( r [ 0 ] < a r g 1 ) { y = a g 0 ; a r g [ 0 = a r g 1 ; a r g [ 1 = y ; o r i t x = 0 ; < 3 ; x + ) { S ys t e .out.p r int l n ( arg [ x ] ) ; } S y s e .out.p r int l n ( ( arg [ 0 ] - a r g 1 ) + ( a r [ ] - a r g 2 ) ) ; } } public class Main { public statilc void main ( ) { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; System . out . println ( i * i * i ) ; } } import java . util . Scanner ; public class Main { public Static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; System . out . println ( answer ) ; } } class Main { ? ? ? public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; System . out . println ( Math . pow ( a , 3 ) ) ; ? ? ? } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; double pi = 3.14159265359 ; double a = r * r * pi ; System . out . println ( ( int ) Math . floor ( a / pi ) ) ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int n = 8 ; int j = 2 ; int k = 0 ; while ( ( ( n / j ) / 2 ) % 2 = = 0 ) { if ( n % j = = 0 ) { j = j * 2 ; k = k + 1 ; } else { break ; } } System . out . println ( j * 2 ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { int num = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( num * num * num ) ; } } import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; System . out . println ( pow ( n , 3 ) ) ; } } import java . util . * ; static class Colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double arg1 = 30 * H + 0.5 * M ; double arg2 = 6 * M ; double x1 = A * Math . cos ( Math . toRadians ( arg1 ) ) ; double y1 = A * Math . sin ( Math . toRadians ( arg1 ) ) ; double x2 = B * Math . cos ( Math . toRadians ( arg2 ) ) ; double y2 = B * Math . sin ( Math . toRadians ( arg2 ) ) ; System . out . println ( Math . hypot ( x2 - x1 , y2 - y1 ) ) ; } } import Java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ; int x = Java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; } } import java . util . Scanner ; class GoodDistance { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int count = 0 ; double [ ] [ ] a = new double [ N ] [ D ] ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = 0 ; j < D ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < N - 1 ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { double sum = 0 ; for ( int k = 0 ; k < D ; k + + ) { sum + = Math . pow ( a [ i ] [ k ] - a [ j ] [ k ] , 2 ) ; } sum = Math . sqrt ( sum ) ; if ( sum % 1 = = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class solution { public static void main ( String [ ] args ) { int n , b ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( n > = 13 ) { System . out . println ( b ) ; } else if ( n > 5 & & n < 13 ) { System . out . println ( b / 2 ) ; } else { System . out . println ( " 0 " ) ; } } } import java . util . Scanner ; public class Main { public static void swap ( long a [ ] , int b , int e , int t ) { for ( int i = 0 ; i < e - b ; i + + ) { long tmp = a [ b + i ] ; a [ b + i ] = a [ t + i ] ; a [ t + i ] = tmp ; } } public static void main ( Stirng [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; swap ( a , b , e , t ) ; } for ( int i = 0 ; i < n - 1 ; i + + ) System . out . print ( a [ i ] + " " ) ; System . out . println ( a [ n - 1 ] ) ; } } import java . util . * ; public class Colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double arg1 = 30 * H + 0.5 * M ; double arg2 = 6 * M ; double x1 = A * Math . cos ( Math . toRadians ( arg1 ) ) ; double y1 = A * Math . sin ( Math . toRadians ( arg1 ) ) ; double x2 = B * Math . cos ( Math . toRadians ( arg2 ) ) ; double y2 = B * Math . sin ( Math . toRadians ( arg2 ) ) ; System . out . println ( Math . hypot ( x2 - x1 , y2 - y1 ) ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 1 ; x * * 3 System . out . println ( x ) ; } } public class ABC054 _ A { public static void main ( String [ ] args ) { int A = 8 , B = 6 ; if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( A = = B ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; System out . println ( x - y ) ; } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] ai = new int [ n ] ; int [ ] bi = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { ai [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { bi [ i ] = sc . nextInt ( ) ; } int minusNums = 0 ; int minusNumsLength = 0 ; int [ ] plusNums = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { if ( ai [ i ] - bi [ i ] < 0 ) { minusNums + = ai [ i ] - bi [ i ] ; minusNumsLength + + ; } else { plusNums [ i ] = ai [ i ] - bi [ i ] ; } } if ( minusNums = = 0 ) { System . out . println ( " 0 " ) ; return ; } Arrays . sort ( plusNums ) ; for ( int i = 0 ; i < plusNums . length ; i + + ) { minusNums + = plusNums [ plusNums . length - i - 1 ] ; if ( minusNums > = 0 ) { System . out . println ( minusNumsLength + i + 1 ) ; return ; } } System . out . println ( " -1 " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int year = Integer . parseInt ( S . substring ( 0 , 4 ) ) ; int month = Integer . parseInt ( S . substring ( 5 , 7 ) ) ; int day = Integer . parseInt ( S . substring ( 8 , 10 ) ) ; if ( year < 2019 ) { System . out . println ( " Heisei " ) ; return ; } if ( month < = 4 & & year = = 2019 ) { System . out . println ( " Heisei " ) ; return ; } System . out . println ( " TBD " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = New Scanner ( System . in ) ; int n = scan . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; public class Sanjyou { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int it = 3 ; int total = 0 ; scanner . close ( ) ; System . out . println ( helper ( n , it , total ) ) ; } public int helper ( int n , int it , int total ) { if ( it = = 0 ) { return total ; } else { return helper ( n , it - 1 , total * n ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] [ ] array = new int [ n ] [ 3 ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; array [ i ] [ 1 ] = sc . nextInt ( ) ; array [ i ] [ 2 ] = array [ i ] [ 1 ] - array [ i ] [ 0 ] ; } long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( array [ i ] [ 0 ] < array [ i ] [ 1 ] ) ans + = array [ i ] [ 1 ] ; } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int SideA = keyboard . nextInt ( ) ; int SideB = keyboard . nextInt ( ) ; int SideC = keyboard . nextInt ( ) ; int [ ] arr = new int [ ] { SideA , SideB , SideC } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } keyboard . close ( ) ; } class Main { public static void main ( String [ ] args ) { int x , ans ; ans = x ^ 3 ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ams = 0 ; System . out . println ( ans ) ; } } public class Main { private static String judgeDists ( int [ ] dists , int k ) { if ( k < 0 | | k > 123 ) return " : ( " ; for ( int tmp : dists ) { if ( tmp < 0 | | tmp > 123 ) return " : ( " ; } for ( int i = 0 ; i < dists . length ; i + + ) { for ( int j = i + 1 ; j < dists . length ; j + + ) { if ( dists [ j ] - dists [ i ] > k ) return " : ( " ; } } return " Yay ! " ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] dists = new int [ 5 ] ; dists [ 0 ] = sc . nextInt ( ) ; dists [ 1 ] = sc . nextInt ( ) ; dists [ 2 ] = sc . nextInt ( ) ; dists [ 3 ] = sc . nextInt ( ) ; dists [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( judgeDists ( dists , k ) ) ; } } import java . util . Scanner ; public class Sanjyou { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class StillTBD . java { public static void main ( String [ ] args ) { String s ; String k = " 2019 / 04 / 30 " ; Scanner input = new Scanner ( System . in ) ; s = input . nextLine ( ) ; if ( s = = null ? k = = null : s . equals ( k ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C < = ( A + B ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public class main { public static void main { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h1 = sc . nextInt ( ) ; int m1 = sc . nextInt ( ) ; int h2 = sc . nextInt ( ) ; int m2 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int h = h2 - h1 ; int m = ( h * 60 + m2 ) - m1 ; int ret = m - k ; System . out . printf ( String . valueOf ( ret ) ) ; } } import java . io . * ; import java . util . * ; public class LowElements { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 0 ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i - 1 ] > arr [ i ] | | arr [ i - 1 ] = = 1 ) { sum + + ; } } if ( arr [ n - 1 ] = = 1 ) { sum + + ; } out . println ( sum ) ; out . close ( ) ; } 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 . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] antenas = { a , b , c , d , e } ; boolean connect = true ; check : for ( int i = 0 ; i < antenas . length - 2 ; i + + ) { for ( int j = i ; j < antenas . length - 1 ; j + + ) { if ( antenas [ j ] - antenas [ i ] > k ) { connect = false ; break check ; } } } String output = connect ? " Yay ! " : " : ) " ; System . out . println ( output ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class AtcoderABC87B { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( input . readLine ( ) ) ; int b = Integer . parseInt ( input . readLine ( ) ) ; int c = Integer . parseInt ( input . readLine ( ) ) ; int target = Integer . parseInt ( input . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( i * 500 ) + ( j * 100 ) + ( k * 50 ) = = target ) count + + ; } } } System . out . println ( count ) ; } } public class Main { public static void main ( String [ ] args ) { int 1 < = x < = 100 ; N = x * x * x ; System . out . println ( N ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; int x * = 3 ; System . out . println ( x ) ; } } import java . lang . Math ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } public class main { static int N , M ; static int [ ] arr ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; arr = new int [ N ] ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; arr [ P - 1 ] + + ; } for ( int i = 0 ; i < arr . length ; i + + ) { for ( int j = 0 ; j < arr [ i ] ; j + + ) { String id1 = String . format ( " % 06d " , i + 1 ) ; String id2 = String . format ( " % 06d " , j + 1 ) ; System . out . println ( id1 + id2 ) ; } } } } class Main { public static void main ( String [ ] args ) { int x ; double sum = 0 ; sum = Math . pow ( x , 3 ) ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Test _ c { public static void Main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int P [ ] = new int [ N ] ; int sum = 1 ; boolean flag = true ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = scan . nextInt ( ) ; } int pre _ min = P [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { loop : for ( int j = 1 ; j < i + 1 ; j + + ) { flag = true ; if ( P [ i ] > pre _ min ) { flag = false ; continue loop ; } } if ( flag = = true ) { sum + = 1 ; pre _ min = P [ i ] ; } } System . out . print ( sum ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class AOJ { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < 13 ) { b = b / 2 ; } else if ( a < 5 ) { b = 0 ; } System . out . println ( b ) ; } } import java . util . scanner ; public class main ( ) { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; public class Xcube { public static void main ( String [ ] args ) { int x = 0 ; try { x = Integer . parseInt ( args [ 0 ] ) ; } catch ( NumberFormatException e ) { System . out . println ( args [ 0 ] + " ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y tem.ex i t ( 1 ) ; } y tem.ou t .pr i ntln ( x * ) } package helloworld ; import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int n = r . nextInt ( ) ; System . out . println ( n * n ) ; } } public static void main ( [ ] String args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; floor ( average ( x , y ) ) ; } private average ( int x , int y ) { return ( x + y ) / 2 ; } private int floor ( float z ) { return Math . floor ( z ) ; } public class Main { public static void main ( String [ ] args ) { int result = 0 ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { result = x * x * x ; System . out . println ( result ) ; } } } import java . util . Scanner ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int res = 0 ; if ( a < = 5 ) { res = 0 ; } else if ( a < = 12 ) { res = b / 2 ; } else { res = b ; } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . nextLine ( ) ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( a + b ) ; } } } class Test1 { public static void main ( String [ ] args ) { InputStreamReader str = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( str ) ; try { String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; while ( true ) { if ( str . equals ( " 0 " ) ) break ; int t = 0 ; for ( int i = 0 ; i < str . length ( ) ; i + + ) { t + = Character . getNumericValue ( str . charAt ( i ) ) ; } System . out . println ( t ) ; } } } class Main { public static void main ( String [ ] args ) { int x = 3 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ) ; ans = x * x * x ; System . out . println ( ans ) ; } } public class main { public static void main ( String args [ ] ) { double a = 9d ; double b = 4d ; double ans = Math . pow ( a , b ) ; System . out . println ( " ans " ) ; class math { public static void main ( String args [ ] ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class XCubic { public static void run ( ) { int xc = readInput ( ) ; printCubic ( xc ) ; } public int readInput ( ) { Scanner sc = new Scanner ( System . in ) ; return sc . nextInt ( ) ; } public void printCubic ( int x ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { XCubic . run ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ; sc . nextInt ; sc . nextInt ; sc . nextInt ; int e = sc . nextInt ; int k = sc . nextInt ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { DataInputStream r = new DataInputStream ( System . in ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = ( long ) Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = input . readLine ( ) ) ! = null ) { String str _ ary [ ] = str . split ( " , " ) ; Double a [ ] = new Double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = Double . parseDouble ( str _ ary [ i ] ) ; } if ( a [ 1 ] / Math . pow ( a [ 2 ] , 2 ) > = 25 ) System . out . println ( ( int ) a [ 0 ] ) ; } } } import java . io . * ; public class Power { public static void main ( String args [ ] ) { int x = 0 ; do { System . out . println ( " 0 ? ? ? 100 ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : " ) ; I n p tStreamReader isr = n w Inp tStreamReader ( Sys t em.in ) ; B u f eredReader br n w Buf eredReader ( isr ) ; t r y St r ng buf = b . ea d Line ( ) ; x = I t ger.par s eInt ( buf ) ; } c a c h ( Exc e ption e ) { x = 0 } h l e ( x < 0 | | 1 0 0 < x ) ; S y s em.out . pri n tln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y s t m.out. p rin t ln ( " ? ? ? " + Ma t h pow ( x , 3 ) + " ? ? ? ? ? § ? ? ? " ) ; } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; system . out . println ( answer ) ; } } public class Main { public static int cul ( int x ) { y = x * x * x ; return y ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } 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 ( ) ; if ( a > b ) { System . out . println ( " Alice " ) ; } else if ( a = = b ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } import java . io . * ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = Integer . parseInt ( in . next ( ) ) ; System . out . println ( x ^ 3 ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; int A = Integer . parseInt ( lines [ 0 ] ) ; int B = Integer . parseInt ( lines [ 1 ] ) ; if ( B > 12 ) { System . out . println ( A ) ; } else if ( B > 5 ) { System . out . println ( A / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . io . * public class Main { public static void main ( String args [ ] ) { System . out . println ( " 数字を入力してください " ) ; BufferedReader rea d e r = new Buffered eader ( e In utStreamReader ( Sys em.in ) ) ; String l i ne = r e ad e r . eadLin ( ) ; n x = I n teger.pa r a s Int l n ) ; x = x * x * x ; S yste m . u . r n l n x ) } } import java . util . * ; class Circle { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int result = ( int ) ( Math . pow ( r , 2 ) ) ; s . close ( ) ; System . out . println ( result ) ; } } import java . util . Scanner ; public class C { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer a = scanner . nextInt ( ) ; Integer b = scanner . nextInt ( ) ; Integer h = scanner . nextInt ( ) ; Integer m = scanner . nextInt ( ) ; double result ; double angle = ( h * 360 / 12 + m * 30 / 60 ) - m * 360 / 60 ; result = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . printf ( " % .20f " , result ) ; } } import java . util . Scanner ; public class abc145 _ a { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; final int n = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( n * n ) ; } } import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class CF { private static final long M = 998 _ 244 _ 353 ; public static void main ( String [ ] args ) throws Exception { try ( BufferedInputStream in = new BufferedInputStream ( System . in ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ) { Scanner sc = new Scanner ( in ) ; int [ ] times = new int [ 5 ] ; int [ ] actual = new int [ 5 ] ; int maxDiff = Integer . MIN _ VALUE ; int diffPos = - 1 ; for ( int i = 0 ; i < 5 ; i + + ) { int x = sc . nextInt ( ) ; actual [ i ] = x ; int sum = 0 ; sum + = x / 10 * 10 ; if ( x % 10 > 0 ) sum + = 10 ; times [ i ] = sum ; int diff = sum - x ; if ( diff > maxDiff ) { maxDiff = diff ; diffPos = i ; } } int total = 0 ; for ( int i = 0 ; i < times . length ; i + + ) if ( i ! = diffPos ) total + = times [ i ] ; out . println ( total + actual [ diffPos ] ) ; } } } import java . util . * ; class A { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; if ( n [ 0 ] ! = 1 | | n [ 1 ] ! = 4 | | n [ 2 ] ! = 7 | | n [ 3 ] ! = 9 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } package AtCoder ; import java . util . Arrays ; import java . util . Scanner ; public class abc121 _ a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int k = sc . nextInt ( ) ; if ( arr [ 4 ] - arr [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } public class X { public static void main ( String [ ] args ) { Scanner scanNum = new Scanner ( System . in ) ; int x = scanNum . nextInt ( ) ; System . out . println ( x * x * x ) ; } } package aoj3 ; public class ? ? ? Main { public static void main ( String args [ ] ) { System . out . println ( " Hello World " ) ; int = x x = 3 * 3 * 3 System . out . printl ( 1 ? ? ? x ? ? ? 100 ) } } import java . util . * ; public class colon { public static void main ( String agrs [ ] ) { Scanner in = new Scanner ( System . in ) ; double a = in . nextDouble ( ) ; double b = in . nextDouble ( ) ; double h = in . nextDouble ( ) ; double m = in . nextDouble ( ) ; h * = 30 ; m * = 6 ; h + = m / 12 ; if ( m = = 0 ) { m = 360.0 ; } if ( h = = 0 ) { h = 360.0 ; } double angle = Math . min ( Math . abs ( h - m ) , Math . abs ( m - h ) ) ; angle / = 180 ; angle * = Math . PI ; double hyp = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( angle ) ) ; hyp = Math . sqrt ( hyp ) ; System . out . println ( hyp ) ; } } import java . util . * ; public class test { public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; str = str . replace ( " eraser " , " " ) ; str = str . replace ( " erase " , " " ) ; str = str . replace ( " dreamer " , " " ) ; str = str . replace ( " dream " , " " ) ; if ( str . equals ( " " ) ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } } import java . util . * ; class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } 提出情報 public class Main { public static void main ( String [ ] args } { int year = args [ 0 ] . substring ( 0 , 3 ) ; int month = args [ 0 ] . substring ( 5 , 6 ) ; int day = args [ 0 ] . substring ( 8 , 9 ) ; Date inputDay = new Date ( year , month , day . 12 , 0 , 0 ) ; Date s = new Date ( 2019 , 4 , 30 , 12 , 0 , 0 ) ; if ( s . before ( inputDay ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } public class Main4 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String prm = sc . nextLine ( ) ; String [ ] numberArray = prm . split ( " " ) ; int distance = Integer . parseInt ( numberArray [ 5 ] ) ; int firstAntenna = Integer . parseInt ( numberArray [ 0 ] ) ; int lastAntenna = Integer . parseInt ( numberArray [ 4 ] ) ; if ( lastAntenna - firstAntenna > distance ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; class stillTBD { public static void main ( String args [ ] ) { try { Date boundaryDate = ConvertDateFromString ( " 2019 / 04 / 30 " ) ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; int result = ConvertDateFromString ( input ) . compareTo ( boundaryDate ) ; if ( ( result = = - 1 ) | | ( result = = 0 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } scanner . close ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static Date ConvertDateFromString ( String dateStr ) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date formatDate = sdf . parse ( dateStr ) ; System . out . println ( formatDate ) ; return formatDate ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String num = sc . next ( ) ; int [ ] x ; x = new int [ 1000 ] ; int length = num . length ( ) ; int sum = 0 ; if ( length = = 0 ) { break ; } else { for ( int i = 0 ; i < length ; i + + ) x [ i ] = num . charAt ( i ) - ' 0' ; } for ( int i = 0 ; i < length ; i + + ) { sum + = x [ i ] ; } System . out . println ( sum ) ; } } } public class Main { public static void main ( String [ ] arg ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String ipt = br . readLine ( ) ; int x = Integer . parseInt ( ipt ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; class Main { public static void main ( string [ ] args ) { Scanner sc = New Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ) ; } } class Test { ? ? ? import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int inputNum = Integer . parseInt ( str ) ; int intNum = inputNum * inputNum * inputNum ; System . out . println ( intNum ) ; } } import java . io . * ; public class Cubic { public static void main ( String [ ] args ) { String line ; int x ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } catch ( NumberFormatException e ) { System . out . println ( e ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } public class main { public static void main ( String [ ] args ) { int x ; int kekka ; x = 2 ; kekka = x * x ; System . out . println ( kekka ) ; x = 8 ; kekka = x * x ; System . out . println ( kekka ) ; x = 3 ; kekka = x * x ; System . out . println ( kekka ) ; x = 27 ; kekka = x * x ; System . out . println ( kekka ) ; } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int n = gi ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { A [ i ] = gi ( ) ; } Arrays . parallelSort ( A ) ; System . out . print ( A [ A . length - 1 ] - A [ 0 ] ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int n [ ] = new int [ 4 ] ; String m ; int p = 0 ; for ( int i = 0 ; i < N ; i + + ) { m = sc . next ( ) ; if ( m = = " ' P ' " ) n [ 0 ] + + ; if ( m = = " ' G ' " ) n [ 1 ] + + ; if ( m = = " ' W ' " ) n [ 2 ] + + ; if ( m = = " ' Y ' " ) n [ 3 ] + + ; } for ( int k = 0 ; k < 4 ; k + + ) if ( n [ k ] > 0 ) p + + ; if ( p = = 3 ) { System . out . println ( " three " ) ; } else if ( ) { System . out . println ( " four " ) ; } } } public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { String value ; int input ; int output ; System . out . println ( " ? ? ´ ? ? ° ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; v lue = n w j va.u t il.S c anner ( S y stem.i n ) . n e xtLine ( ) ; i put = I n teger.p a rseInt ( v a lue ) ; o tput = ( i n t ) ( M a th.p o w ( ( d o uble ) i n put , 3 ) ) ; S stem.o u t.p r intln ( o u tput ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class HelloWorld { public static void main ( String [ ] args ) { int target = 0 ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; target = Integer . parseInt ( reader . readLine ( ) ) ; } catch ( Exception E ) { E . printStackTrace ( ) ; } int min1 = ( int ) ( Math . pow ( target / 2 , 1.0 / 5 ) ) ; int max1 = ( int ) ( Math . pow ( target , 1.0 / 5 ) ) ; int a = max1 ; int judge = 1 ; while ( a > = min1 ) { double b = Math . pow ( target - Math . pow ( a , 5 ) , 1 / 5 ) ; if ( b - ( int ) ( b ) = = 0.0 ) { System . out . print ( a ) ; System . out . print ( " " + ( - ( int ) ( b ) ) ) ; judge = 0 ; break ; } a - = 1 ; } a = max1 ; if ( judge = = 1 ) { while ( Math . pow ( a , 5 ) - Math . pow ( a - 1 , 5 ) < = target ) { double b = Math . pow ( target + Math . pow ( a , 5 ) , 1 / 5 ) ; if ( b - ( int ) ( b ) = = 0.0 ) { System . out . print ( a ) ; System . out . print ( ( int ) ( b ) ) ; break ; } a + = 1 ; } } } } mport java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sort ( a , 0 , 2 ) ; int cost = ( a [ 1 ] - a [ 0 ] ) ; cost + = ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( cost ) ; } private static void sort ( int [ ] d , int left , int right ) { if ( left > = right ) { return ; } int p = d [ ( left + right ) / 2 ] ; int l = left , r = right ; int tmp ; while ( l < = r ) { while ( d [ l ] < p ) { l + + ; } while ( d [ r ] > p ) { r -- ; } if ( l < = r ) { tmp = d [ l ] ; d [ l ] = d [ r ] ; d [ r ] = tmp ; l + + ; r -- ; } } sort ( d , left , r ) ; sort ( d , l , right ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = in . next ( ) ; int s = in . next ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { for ( int z = 0 ; z < = k ; z + + ) { if ( s = = x + y + z ) ans + + ; } } } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A1 = scanner . nextInt ( ) ; int A2 = scanner . nextInt ( ) ; int A3 = scanner . nextInt ( ) ; int [ ] list = { A1 , A2 , A3 } ; int cost = 0 ; int cost1 = list [ 0 ] * 0 + Math . abs ( list [ 2 ] - list [ 0 ] ) + Math . abs ( list [ 1 ] - list [ 2 ] ) ; int cost2 = list [ 1 ] * 0 + Math . abs ( list [ 0 ] - list [ 1 ] ) + Math . abs ( list [ 2 ] - list [ 0 ] ) ; int cost3 = list [ 2 ] * 0 + Math . abs ( list [ 0 ] - list [ 2 ] ) + Math . abs ( list [ 1 ] - list [ 0 ] ) ; int [ ] min = { cost1 , cost2 , cost3 } ; Arrays . sort ( min ) ; for ( int i : min ) { cost = min [ 0 ] ; } System . out . println ( cost ) ; } } import java . util . Random ; public class Main { public static void main ( String args [ ] ) { int A , B ; Random ran = new Random ( ) ; A = ran . newInt ( 13 ) ; B = ran . newInt ( 13 ) ; A + = 1 ; B + = 1 ; if ( A = = 1 & & B = = 1 ) { System . out . println ( " Draw " ) ; } if ( A = = 1 & & B ! = 1 ) { System . out . println ( " Alice " ) ; } if ( A ! = 1 & & B = = 1 ) { System . out . println ( " Bob " ) ; } if ( A < B ) { System . out . println ( " Bob " ) ; } if ( A = = B ) { System . out . println ( " Draw " ) ; } if ( A > B ) { System . out . println ( " Alice " ) ; } } } public class main . java { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < = x & & x < = 100 ) { ; System . out . println ( x * x * x ) ; } } } import java . util . * ; public class AtCoder _ Beginner123 { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int distance [ ] = new int [ 10 ] ; distance [ 0 ] = b - a ; distance [ 1 ] = c - a ; distance [ 2 ] = d - a ; distance [ 3 ] = e - a ; distance [ 4 ] = c - b ; distance [ 5 ] = d - b ; distance [ 6 ] = e - b ; distance [ 7 ] = d - c ; distance [ 8 ] = e - c ; distance [ 9 ] = e - d ; int flag = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( k < distance [ i ] ) { flag = 0 ; break ; } } if ( flag = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new a [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ n - 1 ] - a [ 0 ] ) ; } } public class Main { public static void main ( String [ ] args ) { Main . cube ( 1 ) ; } public int cube ( int x ) { int volume = x * x * x ; return volume ; } } class Main ; import java . util . Scanner ; public class A145 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int r = scan . nextInt ( ) ; scan . close ( ) ; System . out . println ( ( int ) Math . pow ( r , 2 ) ) ; } } class Main { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; System . out . println ( Math . max ( a * b , c * d ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * 800 - ( a / 15 ) * 200 ) ; } import java . io . * ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int x ; s = buf . readLine ( ) ; x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( Integer [ ] a ) { Scanner x = new Scanner ( System . in ) ; int a = x . next ( ) ; double b = 3 ; int c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } import java . ulti . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int current = sc . nextInt ( ) ; int mini = current , maxi = current , distance = 0 ; do { int res = Math . max ( Math . abs ( current - mini ) , Math . abs ( current - maxi ) ) ; if ( res > distance ) { distance = res ; } current = sc . nextInt ( ) ; } while ( sc . next ( ) ! = null ) ; if ( distance > current ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " Yay ! " ) ; } } } # include < iostream > # include < algorithm > # include < string > # define rep ( i , n ) for ( i = 0 ; i < n ; i + + ) using namespace std ; int main ( ) { int a , b ; cin > > a > > b ; if ( a = = b ) { cout < < " Draw " < < endl ; } else if ( a = = 1 ) { cout < < " Alice " < < endl ; } else if ( b = = 1 ) { cout < < " Bob " < < endl ; } else { if ( a > b ) { cout < < " Alice " < < endl ; } else { cout < < " Bob " < < endl ; } } return 0 ; } import java . util . Scanner ; public class xcubic { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; sc . close ( ) ; } } import java . util . * public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int N4 = sc . nextInt ( ) ; ArrayList < int > a = new ArrayList < int > ( ) ; a . add ( 1 ) ; a . add ( 7 ) ; a . add ( 9 ) ; a . add ( 4 ) ; if ( a . indexOf ( N1 ) ! = - 1 ) { a . remove ( a . indexOf ( N1 ) ) ; if ( a . indexOf ( N2 ) ! = - 1 ) { a . remove ( a . indexOf ( N2 ) ) ; if ( a . indexOf ( N3 ) ! = - 1 ) { a . remove ( a . indexOf ( N3 ) ) ; if ( a . indexOf ( N4 ) ! = - 1 ) { System . out . println ( " YES " ) ; } } } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; private class Colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double arg1 = 30 * H + 0.5 * M ; double arg2 = 6 * M ; double x1 = A * Math . cos ( Math . toRadians ( arg1 ) ) ; double y1 = A * Math . sin ( Math . toRadians ( arg1 ) ) ; double x2 = B * Math . cos ( Math . toRadians ( arg2 ) ) ; double y2 = B * Math . sin ( Math . toRadians ( arg2 ) ) ; System . out . println ( Math . hypot ( x2 - x1 , y2 - y1 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; double ans = pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( new Main ( Main . readInt ( System . in ) ) . cubic ( ) ) ; } private static int readInt ( java . io . InputStream in ) { java . io . BufferReader reader = null ; try { reader = new java . io . BufferedReader ( new java . io . InputStreamReader ( in ) ) ; return Integer . parseInt ( reader . readLine ( ) ) ; } catch ( java . io . IOException e ) { e . printStackTrace ( ) ; } finally { if ( reader ! = null ) { try { reader . close ( ) ; } catch ( java . io . IOException e ) { e . printStackTrace ( ) ; } } } } private final int x ; private Main ( int x ) { this . x = x ; } private int cubic ( ) { return x * x * x ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] d = new int [ 3 ] ; d [ 0 ] = a ; d [ 1 ] = b ; d [ 2 ] = c ; Arrays . sort ( d ) ; if ( ( d [ 0 ] = = 5 & & d [ 1 ] = = 5 ) & & d [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class at _ iroha { public static void main ( String [ ] args ) { int A ; int B ; int C ; int i = A * B * C ; if ( i = = 175 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; public class HInaArare { public static void main ( ) throws IOException { int i = ( int ) System . in . read ( ) , sum = 0 ; int [ ] fin = new int [ 4 ] ; char [ ] a = new char [ i ] ; char [ ] check = { ' P ' , ' W ' , ' G ' , ' Y ' } ; for ( int j = 0 ; j < i ; j + + ) { a [ i ] = ( char ) System . in . read ( ) ; } for ( int j = 0 ; j < check . length ; j + + ) { for ( int k = 0 ; k < a . length ; k + + ) { if ( a [ k ] = = check [ j ] ) { fin [ j ] = 1 ; } } } for ( int m = 0 ; m < check . length ; m + + ) { if ( fin [ m ] = = 1 ) { sum + + ; } } if ( sum > 3 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . io . * ; class Test { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] list = new int [ 5 ] ; int [ ] check = { 9 , 0 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 } ; a Scanner sc = new Scanner ( System . in ) ; list [ 0 ] = sc . nextInt ( ) ; list [ 1 ] = sc . nextInt ( ) ; list [ 2 ] = sc . nextInt ( ) ; list [ 3 ] = sc . nextInt ( ) ; list [ 4 ] = sc . nextInt ( ) ; int result = 0 ; int cnt = 1 ; for ( int i = 0 ; i < check . length ; i + + ) { for ( int j = 0 ; j < list . length ; j + + ) { int amari = list [ j ] % 10 ; if ( amari = = check [ i ] ) { if ( cnt ! = 5 ) { if ( amari ! = 0 ) { result + = list [ j ] + 10 - amari ; } else { result + = list [ j ] ; } } else { result + = list [ j ] ; } cnt + + ; } } } System . out . println ( result ) ; } } import java . util . * ; import java . io . * ; public class first { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; return ; } } public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = " " ; for ( ; ; ) { System . out . print ( " > " ) ; input = in . readLine ( ) ; try { Integer . parseInt ( input ) ; } catch ( NumberFormatException e ) { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; nt nteger. p arseInt ( i nput ) ; f ( ( x ) | x 00 ) ) { ystem. o ut. p rintln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } e s e { x ; S y tem.ou t .pr i ntln ( x ) ; b r ak ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int count2 = 0 ; for ( int j = 0 ; j < = i ; j + + ) { if ( a = = true ) { break ; } boolean a = false ; if ( p [ i ] > p [ j ] ) { a = true ; break ; } count2 + + ; } if ( count2 = = i + 1 ) { count + + ; } } System . out . print ( count ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new Int [ 3 ] ; for ( i = 1 ; i < = 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; System . out . println ( A [ 3 ] - A [ 1 ] ) ; } } import java . util . * ; public class A _ RoundUptheMean { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = ( a + b ) % 2 ; int y = ( a + b ) / 2 ; if ( x = = 0 ) { System . out . println ( y ) ; } else { y = y + 1 ; System . out . println ( y ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int sum = 1 ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) < sum ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; for ( min ; min < max ; min + + ) { int challengeSum ; for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( min - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( challengeSum ) ; } } import java . util . Scanner ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String s = scanner . nextLine ( ) ; char [ ] c = s . toCharArray ( ) ; int sum = 0 ; if ( s = = " 0 " ) { break ; } for ( int i = 0 ; i < s . length ; i + + ) { sum + = Integer . parseInt ( c [ i ] ) ; } System . out . println ( sum ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ret = 0 ; for ( int a = 0 ; a < = A ; a + + ) { for ( int b = 0 ; b < = B ; b + + ) { X = X - 500 * a - 100 * b ; for ( int c ; c < = C ; c + + ) { if ( X = = 50 * c ) { ret + + ; } } } } System . out . println ( ret ) ; sc . close ( ) ; } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( scan . hasNext ( ) ) { double x1 = scan . nextDouble ( ) ; double y1 = scan . nextDouble ( ) ; double x2 = scan . nextDouble ( ) ; double y2 = scan . nextDouble ( ) ; double x3 = scan . nextDouble ( ) ; double y3 = scan . nextDouble ( ) ; double xp = scan . nextDouble ( ) ; double yp = scan . nextDouble ( ) ; double S _ abc = 1.0 / 2.0 * Math . abs ( x1 * ( y2 - y3 ) + x2 * ( y3 - y1 ) + x3 * ( y1 - y2 ) ) ; double S _ pab = 1.0 / 2.0 * Math . abs ( xp * ( y1 - y2 ) + x1 * ( y2 - yp ) + x2 * ( yp - y1 ) ) ; double S _ pac = 1.0 / 2.0 * Math . abs ( xp * ( y1 - y3 ) + x1 * ( y3 - yp ) + x3 * ( yp - y1 ) ) ; double S _ pbc = 1.0 / 2.0 * Math . abs ( xp * ( y2 - y3 ) + x2 * ( y3 - yp ) + x3 * ( yp - y2 ) ) ; if ( S _ abc = = S _ pab + S _ pac + P _ pbc ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int v = scanner . nextInt ( ) ; scanner . close ( ) ; System . out . println ( v * v * v ) ; } } class Main { public main ( ) { String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( x + y + z = = k ) { count + + } } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; public class XCubic { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int a = 2 ; int b = 3 ; double ans = Math . pow ( a , b ) ; System . out . println ( " ans " ) ; } } public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { double x1 = sc . nextDouble ( ) ; double y1 = sc . nextDouble ( ) ; double x2 = sc . nextDouble ( ) ; double y2 = sc . nextDouble ( ) ; double x3 = sc . nextDouble ( ) ; double y3 = sc . nextDouble ( ) ; double xp = sc . nextDouble ( ) ; double yp = sc . nextDouble ( ) ; double s = TriangleArea ( x3 - x1 , y3 - y1 , x2 - x1 , y2 - x1 ) ; double s1 = TriangleArea ( xp - x1 , yp - y1 , x2 - x1 , y2 - x1 ) ; double s2 = TriangleArea ( xp - x1 , yp - y1 , x3 - x1 , y3 - x1 ) ; double s3 = TriangleArea ( xp - x2 , yp - y2 , x3 - x2 , y3 - y2 ) ; if ( s = = s1 + s2 + s3 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } sc . close ( ) ; } double TriangleArea ( double x1 , double y1 , double x2 , double y2 ) { double s = ( ( x1 * y2 ) - ( x2 * y1 ) ) / 2 ; if ( s < = 0 ) { s * = - 1 ; } return s ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ) ; System . out . println ( i * i * i ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class main2 { private static Scanner sc = new Scanner ( System . in ) ; static double xp , yp ; public static void main ( String [ ] args ) { while ( sc . hasNextDouble ( ) ) { double xm [ ] = new double [ 3 ] ; double ym [ ] = new double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { xm [ i ] = sc . nextDouble ( ) ; ym [ i ] = sc . nextDouble ( ) ; } xp = sc . nextDouble ( ) ; yp = sc . nextDouble ( ) ; Arrays . sort ( xm ) ; Arrays . sort ( ym ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( xm [ i ] = = xp & & ym [ i ] = = yp ) break ; } if ( xm [ 0 ] < xp & & xm [ 2 ] > xp & & ym [ 0 ] < yp & & ym [ 2 ] > yp ) { System . out . println ( " Yes " ) ; } else { mm ( ) ; } } } private static void mm ( ) { System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String x = scan . nextInt ( ) ; if ( x < 1 ) { x = 1 ; } if ( x > 100 ) { x = 100 ; } System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( 3 ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { int x ; System . out . println ( " x " ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int answer = num * num * num ; } } import java . util . Scanner ; import java . util . InputMismatchException ; public class Antennas { public static void main ( String args [ ] ) { int distance [ ] = new int [ 5 ] ; int limit = 0 ; try { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < distance . length ; i + + ) { distance [ i ] = scanner . nextInt ( ) ; } limit = scanner . nextInt ( ) ; scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( e ) ; } for ( int i = distance . length - 1 ; i > = 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) { if ( distance [ i ] - distance [ j ] - 1 > limit ) { System . out . println ( " : ( " ) ; System . exit ( 1 ) ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int b = 0 ; int xcubic ; int a = 0 ; while ( b = 0 ) { while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 00 ) i = - 1 ; } x c bi a a a ; Sys e . u . p r n ln ( xcu i ) ; } } } public class Min { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; int a = sca . nextInt ( ) ; int b = sca . nextInt ( ) ; int c = sca . nextInt ( ) ; int x = sca . nextInt ( ) ; int y = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( 500 * i ) + ( 100 * j ) + ( 50 * k ) = = x ) { y + + ; } } } } System . out . println ( y ) ; } } import java . util . Scanner ; class kuma { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angH = 30 * h ; double angM = 5.5 * m ; double ang = Math . abs ( angH - angM ) ; double c = 0 ; c = a * a + b * b - 2 * a * b * Math . cos ( ang ) ; System . out . print ( c ) ; } } r import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( answer ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String bs = b . readLine ( ) ; int bi = Integer . parseInt ( bs ) ; int x = Math . pow ( bi , 3 ) ; System . out . println ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] argas ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { char b = a . charAt ( i ) ; if ( b . equals ( 1 ) ) count + + ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { int x = new Scanner ( System . in ) . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = x * * 3 System . out . println ( x ) ; } } public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) int x = in . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } package a042 ; public class Iroha { public static void Main ( String [ ] args ) { int [ ] oto = new int [ 3 ] ; for ( int i = 0 ; i < args . length ; i + + ) { oto [ i ] = Integer . parseInt ( args [ i ] ) ; } if ( oto [ 0 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 0 ] ; oto [ 0 ] = toriaezu ; } if ( oto [ 2 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 2 ] ; oto [ 2 ] = toriaezu ; } if ( oto [ 0 ] = = 5 & & oto [ 1 ] = = 7 & & oto [ 2 ] = = 5 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { System . out . println ( " Please input x : " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; try { s = reader . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int value ; value = Integer . parseInt ( in . readLine ( ) ) ; System . out . println ( value * value * value ) ; in . close ( ) ; } } import java . io . * ; import java . util . * ; public class Main { @ SuppressWarnings ( " unchecked " ) static boolean [ ] used ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int V = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; for ( int i = 0 ; i < V ; i + + ) { } } public static int dfs ( int now , int goal , int f ) { if ( now = = goal ) { return f ; } used [ now ] = true ; for ( int i = 0 ; i < edges [ now ] . size ( ) ; i + + ) { Edge e = edges [ now ] . get ( i ) ; if ( ! used [ e . to ] & & e . cap > 0 ) { int flow = dfs ( e . to , goal , Math . min ( f , e . cap ) ) ; if ( flow = = 0 ) continue ; e . cap - = flow ; edges [ e . to ] . get ( e . rev ) . cap + = flow ; return flow ; } } return 0 ; } public static int fordFulkerson ( int s , int e ) { int flow = 0 ; while ( true ) { Arrays . fill ( used , false ) ; int river = dfs ( s , e , Integer . MAX _ VALUE ) ; if ( river = = 0 ) return flow ; flow + = river ; } } public static void addEdge ( int f , int t , int c ) { edges [ f ] . add ( new Edge ( t , c , edges [ t ] . size ( ) ) ) ; edges [ t ] . add ( new Edge ( f , 0 , edges [ f ] . size ( ) - 1 ) ) ; } static class Edge { int to , cap , rev ; Edge ( int to , int cap , int rev ) { this . to = to ; this . cap = cap ; this . rev = rev ; } } } import java . io * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , ans ; x = Integer . ParseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . println ( ans ) ; } } import java . io . * ; class Test { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; int x = r . readLine ( ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 2 ; int y = x * x * x ; System . out . println ( y ) ; int x = 3 ; System . out . println ( y ) ; } } class Main { public static void main ( String [ ] args ) { BufferReader br = new BufferReader ; int x = Java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int A = 5 ; int B = 7 ; int C = 5 ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cost = 0 ; if ( a > = 13 ) { cost = b ; } else if ( a > = 6 & & a < = 12 ) { cost = b / 2 ; } else { cost = 0 ; } System . out . println ( cost ) ; } } import java . util . Arrays ; import java . util . Comparator ; import java . util . stream . Collectors ; public class AtCoder { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) , m = scanner . nextInt ( ) ; City [ ] cities = new City [ m ] ; for ( int i = 0 ; i < m ; i + + ) cities [ i ] = new City ( scanner . nextInt ( ) , scanner . nextInt ( ) ) ; Arrays . stream ( cities ) . collect ( Collectors . groupingBy ( city - > city . p ) ) . values ( ) . forEach ( cityList - > { cityList . sort ( Comparator . comparingInt ( city - > city . y ) ) ; for ( int i = 0 ; i < cityList . size ( ) ; ) cityList . get ( i ) . o = + + i ; } ) ; for ( City city : cities ) System . out . println ( String . format ( " % 06d % 06d " , city . p , city . o ) ) ; } static class City { int p , y , o ; City ( int p , int y ) { this . p = p ; this . y = y ; } } } public class test { public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; s = s . replace ( " eraser " , " " ) ; s = s . replace ( " erase " , " " ) ; s = s . replace ( " dreamer " , " " ) ; s = s . replace ( " dream " , " " ) ; if ( s . equals ( " " ) ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void Main ( Stirng [ ] args ) { int n = 0 ; while ( n = = 0 ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 & & A = = 7 ) { Scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } Scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . out . println ( " Yes ! " ) ; } else { break ; } } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; long a = 0 ; long b = 0 ; long swap = 0 ; long r = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long max = A [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } if ( max > M * 2 ) System . out . println ( 0 ) ; else { int ans = M / max + 1 ; System . out . println ( ans ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = System . in ; public static void cubic ( int x ) { result = x ^ 3 ; System . out . println ( result ) ; } } } package tinhlapphuong ; import java . util . Scanner ; public class TinhLapPhuong { public static void main ( String [ ] args ) { int n ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; lapPhuong ( n ) ; } public static void lapPhuong ( int n ) { int ketQua = n * n * n ; System . out . println ( " Lap phuong cua n la : " + ketQua ) ; } } import java . util . Scanner ; public class FiveAntennas { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < array . length ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean flag = true ; for ( int i = 0 ; i < array . length ; i + + ) { for ( int j = i + 1 ; j < array . length ; j + + ) { if ( array [ j ] - array [ i ] > k ) { System . out . println ( " : ( " ) ; flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yay ! " ) ; } } } public class X _ Cubic { private int x ; private int num ; public static void main ( String [ ] args ) { X _ Cubic cubic = new X _ Cubic ( ) ; cubic . run ( ) ; } private void run ( ) { num = x * 5 ; System . out . println ( num ) ; } } package abc091 ; import java . util . Scanner ; public class ABC091 _ A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C < = ( A + B ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class atcoder { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tempList [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { tempList [ i ] = sc . nextInt ( ) ; } Arrays . sort ( tempList ) ; int [ ] anserList = { 5 , 5 , 7 } ; if ( Arrays . equals ( tempList , anserList ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Test m = new Test ( ) ; String line = br . readLine ( ) ; double num = Double . parseDouble ( line ) ; double ans = Math . pow ( num , ( double ) 3 ) ; System . out . println ( ( int ) ans ) ; } import java . util . Scanner ; public class L _ 1 _ 2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; if ( a * b > = = c * d ) { System . out . println ( a * b ) ; } else { System . out . println ( c * d ) ; } } } import java . util . * ; public class a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > 12 ) { a = 0 ; } if ( b > 12 ) { b = 0 ; } if ( a > b ) { System . out . println ( " Alice " ) ; } else { if ( b > a ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; if ( a < 0 ) { int b = a * - 1 ; } if ( ( V - W ) * T > = b | | a = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . scanner ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; System . out . println ( a * a * a ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; class Scratch { public static void main ( String [ ] args ) { int a , b , c ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; b = input . nextInt ( ) ; c = input . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; int ans = pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word ; try { word = reader . readLine ( ) ; int num = Integer . parseInt ( word ) ; int ans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { reader . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } } class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; x = x * x * x ; System . out . plintln ( x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) thows IOException { BufferedResder br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; string str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String args [ ] ) { Scanner input = new Scanner ( System . in ) ; while ( true ) { System . out . println ( input . nextInt ( ) + input . nextInt ( ) ) ; } } } import java . util . Scanner ; import java . lang . Math ; public class XCubic { public static void main ( String [ ] args ) { Scanner standard = new Scanner ( System . in ) ; int x = 0 ; int y = 0 ; x = standard . nextInt ( ) ; if ( x > 0 & & x < 101 ) { y = x * x * x ; } System . out . print ( y ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class exe { public static void main ( String [ ] args ) { try { int i ; BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( d . readLine ( ) ) ; System . out . println ( i * i * i ) ; } catch ( IOException e ) { } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int x [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scan . nextInt ( ) ; } int answer = 10000 ; for ( int i = 0 ; i < 100 ; i + + ) { int sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { sum + = Math . pow ( ( x [ j ] - i ) , 2 ) ; } if ( answer > sum ) { answer = sum ; } } System . out . println ( sum ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int n = Integer . parseInt ( line ) ; System . out . println ( n + " / n " ) ; } catch ( Ioexception e ) { System . out . println ( e ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; System . out . println ( a * b > = c * d ? a * b ? c * d ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ; min = a [ 0 ] ; } for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } system . out . println ( count ) ; } } } import java . util . Arrays ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] abc = new int [ 3 ] ; int five = 0 ; int seven = 0 ; String ans = " NO " ; for ( int i = 0 ; i < 3 ; i + + ) { int abc [ i ] = sc . nextInt ( ) ; if ( abc [ i ] = = 5 ) { five + + ; } else if ( abc [ i ] = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { ans = " YES " ; } System . out . println ( ans ) ; } } import java . awt . * ; 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 ( ) ; Point [ ] junban = new Point [ m ] ; Map < Integer , ArrayList < Integer > > list = new HashMap < > ( ) ; for ( int i = 0 ; i < m ; i + + ) { int p = sc . nextInt ( ) ; int year = sc . nextInt ( ) ; junban [ i ] = new Point ( p , year ) ; ArrayList < Integer > value = list . get ( p ) ; if ( value = = null ) { value = new ArrayList < > ( ) ; } value . add ( year ) ; list . put ( p , value ) ; } for ( Integer key : list . keySet ( ) ) { ArrayList < Integer > l = list . get ( key ) ; Collections . sort ( l ) ; } for ( int i = 0 ; i < m ; i + + ) { Point p = junban [ i ] ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( " 0 " . repeat ( Math . max ( 0 , 6 - String . valueOf ( p . x ) . length ( ) ) ) ) ; builder . append ( p . x ) ; int v = list . get ( p . x ) . indexOf ( p . y ) + 1 ; builder . append ( " 0 " . repeat ( Math . max ( 0 , 6 - String . valueOf ( v ) . length ( ) ) ) ) ; builder . append ( v ) ; System . out . println ( builder ) ; } } } import static java . lang . System . out ; import java . util . Scanner ; public class Main { public void main ( String ... args ) { int input = new Scanner ( System . in ) . nextLine ( ) ; input = Integer . parseInt ( input ) ; out . println ( input * input * input ) ; } int power ( int num , int index ) { if ( index = = 0 ) { return 1 ; } if ( index < 2 ) { return num ; } return num * power ( num , index - 1 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = br . readLine ; int b = Integer . parseInt ( a ) ; System . out . println ( a * a * a ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextIn ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 ) & & ( C = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( A = = 5 & & C = = 5 ) & & ( B = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( B = = 5 & & C = = 5 ) & & ( A = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Day4H { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { if ( i > s ) break ; if ( i = = s ) { cnt + + ; break ; } for ( int j = 0 ; j < = k ; j + + ) { if ( i + j > s ) break ; if ( i + j = = s ) { cnt + + ; break ; } for ( int l = 0 ; l < = k ; l + + ) { if ( i + j + l > s ) break ; if ( i + j + l = = s ) { cnt + + ; break ; } } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA ; String [ ] imgB ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = " " ; imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = " " ; imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . * ; public class X _ cube { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a , b , c ; a = s . nextInt ( ) ; b = s . nextInt ( ) ; c = s . nextInt ( ) ; int fiv = 0 , sev = 0 ; if ( a = = 5 ) fiv + + ; if ( a = = 7 ) sev + + ; if ( b = = 5 ) fiv + + ; if ( b = = 7 ) sev + + ; if ( c = = 5 ) fiv + + ; if ( c = = 7 ) sev + + ; if ( fiv = = 2 & & sev = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int Ansewer = x * x * x ; System . out . println ( Ansewer ) ; } } aaa import java . util . Scanner ; public class Postdocs { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] out = s . toCharArray ( ) ; int index = 0 ; if ( out [ index ] = = ' ? ' ) out [ index ] = ' D ' ; index + + ; while ( index < out . length ) { if ( out [ index ] = = ' ? ' ) { if ( out [ index - 1 ] = = ' P ' ) { out [ index ] = ' D ' ; } else { if ( index < out . length - 1 & & out [ index + 1 ] = = ' ? ' ) { out [ index ] = ' P ' ; out [ index + 1 ] = ' D ' ; } else { out [ index ] = ' D ' ; } } } index + + ; } String outStr = new String ( out ) ; System . out . println ( outStr ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int x = Integer . parseInt ( line [ 0 ] ) ; } System . out . println ( x * x * x ) ; } } import java . io . * ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; Scanner stdIn = new Scanner ( System . in ) ; x = stdIn . nextINT ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) , v = sc . nextLong ( ) , b = sc . nextLong ( ) , w = sc . nextLong ( ) , t = sc . nextLong ( ) ; long g = 0 ; fot ( long i = 1 ; i < = t ; i + + ) { ai = a + v * i ; bi = b + w * i ; if ( ai = = bi ) { System . out . println ( " YES " ) ; g + + ; break ; } } if ( g = = 0 ) { System . out . println ( " NO " ) ; } } } package spring21 ; public class ABC055 _ A { public static void main ( String [ ] args ) { int N = 20 , x , y ; x = N * 800 ; y = 200 * ( N / 15 ) ; System . out . println ( x - y ) ; } } import java . util . Scanner ; class Main { public void main ( String ... args ) { String x = new Scanner ( System . in ) . nextLine ( ) ; int input = Integer . parseInt ( x ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x ; int y = 0 ; System . out . print ( " input integer : " ) ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; y = x * x * x ; System . out . println ( y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ; int age = sc . nextInt ( ) ; int priceB = sc . nextInt ( ) ; if ( priceB / 2 = = 0 ) { if ( age < = 13 ) { System . out . println ( priceB ) ; } else if ( age > = 6 | | age < = 12 ) { System . out . println ( priceB / 2 ) ; } else if ( ) { System . out . println ( " 無料です " ) ; } } e l s { S stem . ut.pri n tln ( " 値段は偶数を 入 力 してください " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . printlin ( x ) ; } } public class main { public static void main ( String args [ ] ) { int x public class javaren { public static void main ( String [ ] args ) { int n = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( n ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; for ( int i = 1 ; i < N ; i + + ) { int Min ; int Max ; if ( Min > a ) Min = a ; if ( Max < a ) Max = a ; System . out . println ( Max - Min ) ; } } } package internship ; import java . util . Scanner ; public class test1 { public static void main ( String [ ] args ) { int x = 0 , tot ; Scanner sc = new Scanner ( System . in ) ; int temp = sc . nextInt ( ) ; tot = temp * temp * temp ; System . out . println ( ( int ) tot ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long A = scanner . nextLong ( ) ; long V = scanner . nextLong ( ) ; long B = scanner . nextLong ( ) ; long W = scanner . nextLong ( ) ; long T = scanner . nextLong ( ) ; long speed = V - W ; long dist = B - A ; if ( dist < 0 | | speed < = 0 ) { System . out . prlongln ( " NO " ) ; return ; } System . out . prlongln ( ( dist - speed * T < = 0 ) ? " YES " : " NO " ) ; } } 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 avg = ( a + b ) / 2 if ( ( a + b ) % 2 = = 0 ) { System . out . println ( avg ) ; } else { System . out . println ( avg + 1 ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; int y ; x = Integer . parseInt ( args [ 0 ] ) ; y = x ^ 3 ; System . out . plintln ( y . toString ( ) ) ; } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String nb = br . readLine ( 3 ) ; int x ; = I teger.p a rseInt ( n b ) ; S y s em.out . pri n tln ( Mat h .pow ( x , 3 ) ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a > k ) { System . out . println ( " : ( " ) ; break ; } else if ( c - b > k ) { System . out . println ( " : ( " ) ; break ; } else if ( d - c > k ) { System . out . println ( " : ( " ) ; break ; } else if ( e - d > k ) { System . out . println ( " : ( " ) ; break ; } else { System . out . println ( " Yay ! " ) ; } } } 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 ans = ( a + b ) / 2 ; System , out . println ( ( a + b ) % 2 = = 0 ? ans : ans + 1 ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { DataInputStream input = new DataInputStream ( System . in ) ; String s = input . readLine ( ) ; int temp = Integer . parseInt ( s ) ; int answer = temp * temp * temp ; System . out . println ( answer ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; long ans = aaa + bbb + ccc + ddd + eee + min - 10 ; System . out . println ( ans ) ; } } va . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int R = scanner . nextInt ( ) ; int L = scanner . nextInt ( ) ; int [ ] P = new int [ N ] ; int [ ] T = new int [ N ] ; int PT = 0 ; int n1 = 0 ; for ( int i = 0 ; i < R ; i + + ) { int d = scanner . nextInt ( ) - 1 ; int t = scanner . nextInt ( ) ; int x = scanner . nextInt ( ) ; P [ d ] + = x ; if ( x > 0 ) { if ( P [ d ] > P [ n1 ] | | ( P [ d ] = = P [ n1 ] & & n1 > d ) ) { T [ n1 ] + = t - PT + 1 ; PT = t ; n1 = d ; } } if ( x < 0 ) { if ( d ! = n1 ) continue ; int n2 = n1 , p2 = P [ d ] ; for ( int j = N - 1 ; j > = 0 ; j -- ) { if ( p2 < = P [ j ] ) { n2 = j ; p2 = P [ j ] ; } } if ( n2 ! = n1 ) { T [ n1 ] + = t - PT + 1 ; PT = t ; n1 = n2 ; } } } T [ n1 ] + = L - PT + 1 ; int ans _ n = 0 , ans _ t = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( ans _ t < T [ i ] ) { ans _ t = T [ i ] ; ans _ n = i ; } } System . out . println ( ans _ n + 1 ) ; } } ffgghhgvvbbbbttSolution : ffgghhgvvbbbbttSolution : ffgghhgvvbbbbttSolution : ffgghhgvvbbbbttSolution : import java . io . BufferedReader ; import java . io . InputStreamReader ; public Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; int x = Integer . parseInt ( input ) ; System . out . println ( x * x * x ) ; br . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } if ( a % 10 ! = 0 ) { double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; } else { double aaa = a ; } if ( b % 10 ! = 0 ) { double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; } else { double bbb = b ; } if ( c % 10 ! = 0 ) { double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; } else { double ccc = c ; } if ( d % 10 ! = 0 ) { double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; } else { double ddd = d ; } if ( e % 10 ! = 0 ) { double eee = ( Math . ceil ( e / 10 ) ) * 10 ; } else { double eee = e ; } double zzz = aaa + bbb + ccc + ddd + eee + min - 10 ; int ans = ( int ) zzz ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int acoin = sc . nextInt ( ) ; int bcoin = sc . nextInt ( ) ; int ccoin = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = acoin ; i + + ) { if ( i * 500 > N ) { break ; } if ( i * 500 = = N ) { count + + ; break ; } for ( int j = 0 ; j < = bcoin ; j + + ) { if ( i * 500 + j * 100 > N ) { break ; } if ( i * 500 + j * 100 = = N ) { count + + ; break ; } for ( int k = 0 ; k < = ccoin ; k + + ) { if ( i * 500 + j * 100 + k * 50 > N ) { break ; } if ( i * 500 + j * 100 + k * 50 = = N ) { count + + ; break ; } } } } System . outprintln ( count ) ; } } } class antenna { public static void main ( String [ ] args ) { int [ ] ant = { ' A ' , ' B ' , ' C ' , ' D ' , ' E ' } ; int len = no . length ; for ( int k = 0 ; k > = ant . length ; k + + ) { System . out . println ( ( k + 1 ) + no [ i ] ) ; } System . out . println ( ant ) ; System . out . println ( args [ 1 ] ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize2 . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwize2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class itp11b { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; int a = Integer . parseInt ( s ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; 2. public class Main { 3. public static void main ( String [ ] args ) { 4 . Scanner sc = new Scanner ( System . in ) ; 5. int n = sc . nextInt ( ) ; 6. int x = 800 * n ; 7. int y = 200 * ( n / 15 ) ; 8 . System . out . println ( x - y ) ; 9 . } 10 . } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InpputStreamReader ( Systemin ) ) ; String word ; try { word = reader . readLine ( ) ; int num = Integer . parseInt ( word ) ; int ans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int k = scn . nextInt ( ) ; int s = scn . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { if ( s > = x + y & & s - ( x + y ) < = k ) { count = count + 1 ; } } } System . out . println ( count ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class pow { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; int kotae = ath p w x , 3 ) ; S y stem.out . pr i ntln ( x + " を 3 乗 し 値は " kotae " す " ) ; } } import java . util . * ; import java . io . * ; import java . text . * ; import java . lang . * ; import java . math . * ; public class Solution { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; List < Character > arr = new ArrayList < Character > ( ) ; in . nextLine ( ) ; String str = in . nextLine ( ) ; for ( int i = 0 ; i < str . length ( ) ; i + + ) { if ( str . charAt ( i ) ! = ' ' ) arr . add ( str . charAt ( i ) ) ; } if ( arr . contains ( ' P ' ) & & arr . contains ( ' W ' ) & & arr . contains ( ' G ' ) & & arr . contains ( ' Y ' ) ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; double ans = Math . pow ( Integer . parseInt ( line ) , 3 ) ; System . out . println ( ans ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } package test ; import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; String s = in . next ( ) ; if ( n % 2 = = 1 ) { System . out . println ( " No " ) ; } else { int mid = ( int ) n / 2 ; String s _ 1 = s . substring ( 0 , mid ) ; String s _ 2 = s . substring ( mid ) ; if ( s _ 1 . equals ( s _ 2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } import java . io . * ; class prob11b { public static void main ( String args [ ] ) { int aa , bb , cc ; try { BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ; aa = Integer . parseInt ( d . readLine ( ) ) ; bb = aa * aa * aa System . out . println ( bb ) ; } catch ( Exception e ) { System . out . println ( " 数字を 入れて ください " ) ; } } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( InputStreamReader ( System . in ) ) ; String str ; ArrayList < Integer > Ans = new ArrayList < Integer > ( ) ; while ( ( str = br . readLine ( ) ) ! = null ) { String temp [ ] = str . split ( " " ) ; int sum = 0 ; for ( int i = 0 ; i < temp . length ; i + + ) { int num = Integer . parseInt ( temp [ i ] ) ; sum + = num ; } if ( Integer . parseInt ( temp [ 0 ] ) = = 0 ) { break ; } Ans . add ( sum ) ; } for ( int i = 0 ; i < Ans . size ( ) ; i + + ) { System . out . println ( Ans . get ( i ) ) ; } } } class Main { public static void main ( String [ ] args ) { int variable x ; x = x * x * x ; System . out . println ( x ) ; } } public class xt { public static void main { int x ; System . out . println ( x * x * x ) ; } } int R = r * r * 3.14 ; System . out . println ( R ) ; import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; if ( A < B ) { if ( A + ( V * T ) < B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else if ( A + ( V * T ) > = B + ( W * T ) ) { System . out . println ( " No " ) ; } } else if ( B < A ) { if ( B - ( W * T ) > = A - ( V * T ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } else if ( A = = B ) { if ( A + ( V * T ) < = B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } import java . util . * ; import java . text . SimpleDateFormat ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; SimpleDateFormat f = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date d = f . parse ( s ) ; Date dh = f . parse ( " 2019 / 04 / 30 " ) ; if ( d . getTime ( ) > dh . getTime ( ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int y = Integer . parseInt ( Math . pow ( x , 3 ) ) ; System . out . println ( y ) ; } } import java . util . Arrays ; import java . util . Scanner ; class main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tempList [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { tempList [ i ] = sc . nextInt ( ) ; } Arrays . sort ( tempList ) ; int [ ] anserList = { 5 , 5 , 7 } ; if ( Arrays . equals ( tempList , anserList ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int bi = Integer . parseInt ( b ) ; int x = Math . pow ( bi , 3 ) ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 0 ; int min = N + 1 ; int count = 0 ; int P [ ] = new int [ N ] ; for ( i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; if ( A [ i ] < min ) { min = A [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer - 1 ) break ; } System . out . println ( sold ) ; } } import java . util . Random ; public class Main { public static void main ( String args [ ] ) { INT A , B ; Random ran = newRandom ( ) ; A = random . newInt ( 13 ) ; B = random . newInt ( 13 ) ; A + = 1 ; B + = 1 ; if ( A = = 1 & & B = = 1 ) { System . out . println ( " Draw " ) ; } if ( A = = 1 & & B ! = 1 ) { System . out . println ( " Alice " ) ; } if ( A ! = 1 & & B = = 1 ) { System . out . println ( " Bob " ) ; } if ( A < B ) { System . out . println ( " Bob " ) ; } if ( A = = B ) { System . out . println ( " Draw " ) ; } if ( A > B ) { System . out . println ( " Alice " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( IOException e ) { } int i = Math . pow ( x , 3 ) ; System . out . println ( i ) ; } } public class main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class exe { public static void main ( String [ ] args ) { try { int i ; BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( d . readLine ( ) ) ; System . out . println ( i * i * i ) ; } catch ( IOException e ) { } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class CopyOfMain01 _ 08B1 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int x = 0 ; String str = br . readLine ( ) ; if ( str . equals ( " 0 " ) ) break ; String [ ] st = str . split ( " " ) ; for ( int i = 0 ; i < st . length ; i + + ) { x + = Integer . parseInt ( st [ i ] ) ; } System . out . println ( x ) ; } br . close ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new ImputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int x = Integer . parseInt ( s ) ; int a = x * x * x ; System . out . println ( a ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch { } int i = x ^ 3 ; System . out . println ( i ) ; } } import java . util . Scanner ; public class Main { public static long m ( long a [ ] , int b , int e ) { int Min = a [ b ] ; for ( int i = b + 1 ; i < e ; i + + ) Min = Math . min ( Min , a [ i ] ) ; return Min ; } public static long M ( long a [ ] , int b , int e ) { int Max = a [ b ] ; for ( int i = b + 1 ; i < e ; i + + ) Max = Math . max ( Max , a [ i ] ) ; return Max ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int com = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; if ( com = = 0 ) System . out . println ( m ( a , b , e ) ) ; else System . out . println ( M ( a , b , e ) ) ; } } } public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner scanner = new Scanner ( " in1.txt " ) ; int arg = scanner . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( arg , 3 ) ) ; scanner . close ( ) ; } } class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( e ) ; } } } class ITP1 _ 1 _ B { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int answer = num * num * num ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( " 1 6 3 " ) ; int [ ] As = new int [ 3 ] ; As [ 0 ] = scanner . nextInt ( ) ; As [ 1 ] = scanner . nextInt ( ) ; As [ 2 ] = scanner . nextInt ( ) ; int bestCost = 99999 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( j = = i ) continue ; int sum = 3 - i - j ; int a = Math . abs ( As [ j ] - As [ i ] ) ; a + = Math . abs ( As [ sum ] - As [ j ] ) ; if ( a < bestCost ) { bestCost = a ; } } } System . out . println ( bestCost ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int ansA = 0 ; int ansB = 0 ; Out : for ( int A = 0 ; A < 300 ; A + + ) { for ( int B = - 300 ; B < 300 ; B + + ) { if ( A * A * A * A * A - B * B * B * B * B = = X ) { ansA = A ; ansB = B ; break Out ; } } } System . out . println ( ansA + " " + ansB ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int ansA = 0 ; int ansB = 0 ; Out : for ( int A = 0 ; A < 300 ; A + + ) { for ( int B = - 300 ; B < 300 ; B + + ) { if ( A * A * A * A * A - B * B * B * B * B = = X ) { ansA = A ; ansB = B ; break Out ; } } } System . out . println ( ansA + " " + ansB ) ; } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Date formatDate ; Date heiseiDate ; Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; try { formatDate = sdf . parse ( sdate ) ; heiseiDate = sdf . parse ( " 2019 / 04 / 30 " ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } if ( formatDate . before ( heiseiDate ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; package abc091 ; import java . util . Scanner ; public class ABC091 _ A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C < = ( A + B ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferdReader br = new BufferReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import static java . lang . System . out ; import java . util . Scanner ; public class Main { public void main ( String ... args ) { String x = new Scanner ( System . in ) . nextLine ( ) ; int input = Integer . parseInt ( x ) ; out . println ( x * x * x ) ; } int power ( int num , int index ) { if ( index = = 0 ) { return 1 ; } if ( index < 2 ) { return num ; } return num * power ( num , index - 1 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( i + 1 , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } foreach ( String key : map . keySet ( ) ) { Collections . sort ( map . get ( key ) ) ; for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } public class Index { public static void main ( Stirng [ ] args ) { INT A , B , C ; while ( 1 ) { scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 & & A = = 7 ) { scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . outprintln ( " Yes ! " ) ; } else { break ; } } } } } } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int n = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = r . readLine ( ) ; Integer . parseInt ( x ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class X _ Cubic { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String strInput = scan . next ( ) ; int numInput = Integer . parseInt ( strInput ) ; int result = numInput * numInput * numInput ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Itpa _ 1B { public static int x ; public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { solve ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] a ) { int num ; Scanner scanner = new Scanner ( System . in ) ; num = Integer . parseInt ( scanner . next ( ) ) ; System . out . println ( ( Math . pow ( num , 3 ) ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { ? ? ? int x = Scanner ( System . in ) ; System . out . println ( " x * x * x " ) ; } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . * ; import java . util . * ; class test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( Math . pow ( n , 3 ) ) ; } } import . java . util . Scanner ; public class Main { public static void main ( Strings [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; x = scanner . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Q042 { public static void Main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] count = new int [ 11 ] ; count [ scanner . nextInt ( ) ] + + ; count [ scanner . nextInt ( ) ] + + ; count [ scanner . nextInt ( ) ] + + ; if ( count [ 5 ] = = 2 & & count [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } class main { import java . util . Scanner ; ? ? ? public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x ; x = scan . nextInt ( ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; import java . lang . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; if ( Math . abs ( A - B ) / Math . abs ( V - W ) > T ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class BBBBBBBBBB { public static void main ( String [ ] args ) { long x , bal1 , bal2 , bal3 , ans , kk ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 0 ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { bal1 = a [ i ] ; bal2 = 0 ; bal3 = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = ( ( i - k ) + n ) % n ; if ( pi = = 0 ) pi = n ; if ( bal1 > a [ pi ] + ( ( long ) k ) * x ) { bal1 = a [ pi ] + ( k ) * x ; bal2 = k ; bal3 = a [ pi ] ; } } if ( bal2 > kk ) kk = bal2 ; ans + = bal3 ; } System . out . println ( ans + ( kk ) * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String txt1 = reader . readLine ( ) ; int x = Integer , parseInt ( txt1 ) ; int num ; num = x * x * x ; System . out . println ( num ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . io . IOException ; class Main { public static void main ( String [ ] args ) { int x ; int a ; try { x = System . in . read ( ) ; a = x * x * x ; } catch ( IOException e ) { } System . out . println ( a ) ; } } # include < stdio . h > # include < math . h > # include < stdlib . h > double main ( int argc , char * argv [ ] ) { double x , y ; x = double ( atoi ( argc [ 1 ] ) ) ; y = 3 ; double y = 3 ; y = pow ( x , y ) ; printf ( " % f \ n " , y ) ; return y ; } import java . util . Scanner ; public class Ex02 { public static void main ( String [ ] args ) { int x ; int ans ; Scanner stdin = new Scanner ( System . in ) ; x = stdin . nextInt ( ) ; ans = x * x * x ; System . out . println ( + ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int age = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; if ( age > = 13 ) { System . out . println ( b ) ; } else if ( age < = 5 ) { System . out . println ( 0 ) ; } else { System . out . println ( b / 2 ) } } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int h = in . nextInt ( ) ; int m = in . nextInt ( ) ; int pass _ time = h * 60 + m ; double digA = ( 0.5 * ( double ) pass _ time ) % 360 ; double digB = ( 6 * pass _ time ) % 360 ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( digA - digB ) ) ) ) ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; if ( Arrays . stream ( s ) . filter ( e - > e . equals ( " Y " ) ) . count ( ) > 0L ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } sc . close ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader rd = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int read = IntegerParseInt ( rd . ReadLine ( ) ) ; system . out . println ( ( int ) Math . pow ( read , 3 ) ) ; } } import java . util . Scanner ; protected class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ans = 0 ; System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int l = x ^ 3 ; System . out . println ( l ) ; } } Scanner input = new Scanner ( System . in ) ; int A , B , C ; A = input . nextInt ( ) ; B = input . nextInt ( ) ; C = input . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public int calcCircle ( int num ) { return num * num ; } public static void main ( String [ ] args ) { int A = Integer . parseInt ( args [ 0 ] ) ; int B = Integer . parseInt ( args [ 1 ] ) ; int C = Integer . parseInt ( args [ 2 ] ) ; if ( ( A = = 5 & & B = = 5 ) & & ( C = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( A = = 5 & & C = = 5 ) & & ( B = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( B = = 5 & & C = = 5 ) & & ( A = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static int gcd ( int a , int b ) { int temp ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return b ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; B [ i ] = A [ i ] ; } int t = gcd ( A [ 0 ] , A [ 1 ] ) ; for ( int i = 2 ; i < N ; i + + ) { t = gcd ( t , A [ i ] ) ; } if ( t ! = 0 ) { System . out . println ( " not coprime " ) ; } else { for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { t = gcd ( A [ i ] , A [ j ] ) ; if ( t ! = 1 ) { System . out . ( " setwise coprime " ) ; break ; } } } System . out . println ( " pairwise coprime " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; class Main { public static void main ( String args [ ] ) { try { BufferedReader stdReader = _ new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) ! = null ) { int num = Integer . parseInt ( line ) ; System . out . println ( ( int ) Math . pow ( num , 3 ) ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } public class Main { public static void main ( String [ ] args ) { int num = x * 3 ; System . out . println ( num ) ; } } mport java . util . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s = sc . next ( ) ; if ( s . equals ( " 0 " ) ) break ; int ret = 0 ; for ( int i = 0 ; i < s . length ( ) ; i + + ) ret + = s . charAt ( i ) - 48 ; System . out . println ( ret ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; Scanner scan = new Scanner ( System . in ) ; x = scan . nextInt ( ) ; System . out . print ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int [ ] [ ] arr = new int [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; j + + ) { arr [ i ] [ j ] = scanner . nextInt ( ) ; } } int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { int sum = 0 ; for ( int k = 0 ; k < d ; k + + ) { int value = Math . abs ( arr [ i ] [ k ] - arr [ j ] [ k ] ) ; sum + = ( value * value ) ; } double sqrt = Math . sqrt ( sum ) ; if ( sqrt = = ( int ) ( sqrt ) ) count + + ; } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class TaskSchedulingProblem { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int taskCost [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { taskCost [ i ] = s . nextInt ( ) ; } int minCost = 0 ; Arrays . sort ( taskCost ) ; for ( int i = 1 ; i > = 0 ; i -- ) { minCost = minCost + Math . abs ( taskCost [ i + 1 ] - taskCost [ i ] ) ; } System . out . println ( minCost ) ; } } import java . util . * ; import java . io . * ; public class Main { int n , sum = 0 ; int max1 = 0 , max2 = 0 ; int who1 = 0 , who2 = 0 ; int [ ] [ ] v ; Main ( Scanner in , PrintWriter out ) { n = in . nextInt ( ) ; v = new int [ 2 ] [ 100 _ 000 ] ; for ( int i = 0 ; i < ( n > > 1 ) ; i + + ) { int a = in . nextInt ( ) - 1 ; int b = in . nextInt ( ) - 1 ; v [ 0 ] [ a ] + + ; v [ 1 ] [ b ] + + if ( v [ 0 ] [ a ] > max1 ) { max1 = v [ 0 ] [ a ] ; who1 = a ; } if ( v [ 1 ] [ b ] > max2 ) { max2 = v [ 1 ] [ b ] ; who2 = b ; } } sum = max1 + max2 ; if ( who1 = = who2 ) sum - = Math . min ( max1 , max2 ) ; out . println ( n - sum ) ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( in , out ) ; out . close ( ) ; } } class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = in . readLine ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int x = stdId . nextInt ( ) ; x = x * x * x ; System . out . println ( String . valueOf ( x ) ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; boolean flag = true ; if ( A > B ) { flag = false ; } for ( int i = 0 ; i < T ; i + + ) { if ( flag ) { A + = V ; B + = W ; } else { A - = V ; B - = W ; } } if ( flag ) { if ( A > = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } else { if ( A < = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; boolean flag = true ; if ( A > B ) { flag = false ; } for ( int i = 0 ; i < T ; i + + ) { if ( flag ) { A + = V ; B + = W ; } else { A - = V ; B - = W ; } } if ( flag ) { if ( A > = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } else { if ( A < = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } } 提出情報 import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputstreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int a = Integer , perseInt ( str ) ; System . out . println ( a * a * a ) ; } } import java . util . * ; public class InteractiveSorting { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int result = ( int ) ( Math . pow ( r , 2 ) ) ; System . out . println ( result ) ; } } public class X _ Cubic { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } ds import java . util . Scanner ; public class ABC088C { public static void main ( String [ ] args ) { int [ ] [ ] a = new int [ 3 ] [ 3 ] ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = true ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = a [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = a [ i ] [ 0 ] - y [ 0 ] ; } flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( x [ i ] + y [ j ] ! = a [ i ] [ j ] ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; int T = S - 20190000 ; if ( T < = 430 ) { System . out . println ( Heisei ) ; } else { Syeten . out . println ( TBD ) ; } } } public class Main { ? ? ? public static void main ( String [ ] atrgs ) { ? ? ? ? ? ? Scanner scan = new Scanner ( System . in ) ; ? ? ? ? ? ? int x = scan . nextInt ( ) ; ? ? ? ? ? ? int i = ( x ^ 3 ) ; ? ? ? ? ? ? System . out . println ( i ) ; ? ? ? } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Scanner ; public class Test { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; String b = scan . next ( ) ; String c = scan . next ( ) ; int ab [ ] = new int [ 3 ] ; ab [ 0 ] = Integer . valueOf ( a ) . intValue ( ) ; ab [ 1 ] = Integer . valueOf ( b ) . intValue ( ) ; ab [ 2 ] = Integer . valueOf ( c ) . intValue ( ) ; Arrays . sort ( ab ) ; if ( ab [ 0 ] = = 5 & & ab [ 1 ] = = 5 & & ab [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer A = Integer . parseInt ( sc . next ( ) ) ; Integer B = Integer . parseInt ( sc . next ( ) ) ; Integer C = Integer . parseInt ( sc . next ( ) ) ; Integer D = Integer . parseInt ( sc . next ( ) ) ; int s1 = A * B ; int s2 = C * D ; if ( s1 > s2 ) System . out . println ( s1 ) ; else System . out . println ( s2 ) ; } } x = 1 ; y = x * x * x ; System . out . println ( y ) ; package Lesson ; import java . util . Scanner ; public class Itp1 _ 1B { public static int x ; public static void solve ( ) { System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; solve ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; String [ ] abc = s . split ( " , " ) ; int a = Integer . parseInt ( abc [ 0 ] ) ; int b = Integer . parseInt ( abc [ 1 ] ) ; int c = Integer . parseInt ( abc [ 2 ] ) ; StringBuilder buff = new StringBuilder ( ) ; while ( true ) { if ( a ! = 0 ) { buff . append ( " a " ) ; a -- ; } else if ( c ! = 0 ) { buff . append ( " c " ) ; } else if ( b ! = 0 ) { buff . append ( " b " ) ; } else { System . out . println ( buff ) ; return ; } } } import java . util . Scanner ; import java . util . Arrays ; public class Beginner88C { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int min = 100 ; for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] < min ) min = c [ i ] [ j ] ; } a [ i ] = min ; } for ( int j = 0 ; j < 3 ; j + + ) { int min = 100 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( c [ i ] [ j ] < min ) min = c [ i ] [ j ] ; } b [ j ] = min ; } int cnt = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { for ( int k = 0 ; k < = a [ i ] ; k + + ) { for ( int l = 0 ; l < = b [ j ] ; l + + ) { if ( k + l = = c [ i ] [ j ] ) cnt + + ; } } } } if ( cnt = = 9 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; double c = ( a + b ) / 2.0 ; int d = ( a + b ) / 2 ; if ( c = = d ) { System . out . println ( d ) ; } else { System . out . println ( d + 1 ) ; } } } import java . util . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] parts = s . split ( " / " ) ; int y = Integer . parseInt ( parts [ 0 ] ) ; int m = Integer . parseInt ( parts [ 1 ] ) ; int d = Integer . parseInt ( parts [ 2 ] ) ; if ( y > 2019 ) { System . out . println ( " TBD " ) ; return ; } if ( m > 4 ) { System . out . println ( " TBD " ) ; return ; } if ( d > 30 ) { System . out . println ( " TBD " ) ; return ; } System . out . println ( " Heisei " ) ; } } import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = Integer . parseInt ( scan . next ( ) ) ; int y = ( int ) Math . pow ( x , 3 ) ; System . out . println ( y ) ; scan . close ( ) ; } } # include < iostream > using namespace std ; int main ( ) { int r ; cin > > r ; cout < < r * r < < endl ; return 0 ; } class cubic { public static void main ( args [ ] ) { int x = 5 ; System . out . println ( 5 ^ 3 ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; System . out . println ( i * i * i ) ; } } import java . util . Scanner ; public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int a ; int b ; a = sc . nextInt ( ) ; b = sc . nectInt ( ) ; System . out . println ( a * b a + b * 2 ) ; } public static void main ( String [ ] args ) { Rectangle obj = new Main ( ) ; obj . solve ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; while ( n -- > 1 ) { long newA = sc . nextLong ( ) ; long newB = sc . nextLong ( ) ; long x = ( long ) Math . ceil ( Math . max ( ( double ) a / newA ) , Math . max ( ( double ) b / newB ) ) ; a = newA * x ; b = newB * x ; } System . out . println ( a + b ) ; } } import java . text . DateFormat ; import java . text . ParseException ; import java . util . Date ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; Date date1 = DateFormat . getDateInstance ( ) . parse ( a ) ; Date date2 = DateFormat . getDateInstance ( ) . parse ( " 2019 / 4 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff < 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } catch ( ParseException e ) { System . out . println ( e ) ; } } } int main ( ) { Scanner sc = new Scanner ( System . in ) ; int a ; int b ; while ( true ) { if ( ! sc . hasNext ( ) ) break ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; System . out . println ( a + b ) ; } return 0 ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s1 = sc . nextInt ( ) ; int s3 = sc . nextInt ( ) ; if ( s1 = s3 ) System . out . println ( " Draw " ) ; else if ( s1 = = 1 | | s1 > s3 ) System . out . println ( " Alice " ) ; else if ( s3 = = 1 | | s3 < s1 ) System . out . println ( " Bob " ) ; } } class Main { int x ; public static void main ( String [ ] args ) { x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int n = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } class main { public static void main ( String args [ ] ) { int x = 2 ; System . out . println ( x * x * x ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Q1 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String head ; try { head = br . readLine ( ) ; } catch ( IOException e ) { System . err . println ( " The input is missing . " + e . getMessage ( ) ) ; return ; } int n ; try { n = Integer . parseInt ( head ) ; } catch ( NumberFormatException e ) { System . err . println ( " The input is in an illegal form . " + e . getMessage ( ) ) ; return ; } System . out . println ( n * n * n ) ; } } Public Class Main { public static void ( int x ) { int y = 3 ; y = y * x ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x ^ 3 ; System . out . println ( answer ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int hdeg = 30 * h ; int mdeg = 6 * m ; int deg = Math . abs ( hedg - mdeg ) ; double cosdeg = Math . cos ( deg * Math . pi / 180 ) ; double asrq = a * a ; double bsqr = b * b ; double c = Math . sqrt ( asr + bsqr - 2 * a * b * cosdeg ) ; System . out . println ( c ) ; } } import java . utl . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) int result = x - y ; System . out . println ( result ) } } public class Main { public static void main ( String [ ] args ) { int x = System . in ; result = x ^ 3 ; System . out . println ( result ) ; } } import java . util . Scanner ; public class ABC145A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; double c = ( a + b ) / 2.0 ; int d = ( a + b ) / 2 ; if ( c = = d ) { System . out . println ( d ) ; } else { System . out . println ( d + 1 ) ; } } } import java . Io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( " 入出力エラーです " ) ; } } } package score100 ; import java . util . Sca 入れ替 えnn er ; public lass M in { ubli tatic oid ma n ( St ing [ ] args ) { Scan n r sc = ne S a ner System. i n ) ; in t a = sc. e t nt ( ) ; int b = sc. e t nt ( ) ; int c = sc. e t nt ( ) ; if ( a = b & & b = & c = 7 | b = c & c = & a = 7 | = a & a = & b = 7 ) ys e m . ut.pri n tln ( " YES " ) ; } el s e yste . ut.pri n tln ( " NO " ) ; } } } import java . util . Scanner ; public class FiveAntennas { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; if ( e - a > = k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } scanner . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ab = a * b ; int cd = c * d ; if ( ad = cd ) { System . out . println ( ab ) ; } else if ( ab > cd ) { System . out . println ( ab ) ; } else if ( cd > ab ) { System . out . println ( cd ) ; } } } public class Main { public static void main ( String args [ ] ) { int x ; System . out . println ( x * x * x ) ; } } class main { public static void main ( String [ ] args ) { x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { ? ? ? int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( " x * x * x " ) ; } } class pow { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; double a = ( oub e x double kotae = M at h .pow ( a , 3 ) ; S stem.o t p i ntln ( x + " を 乗した値は " kotae " す " ) ; } } public class Main { public static void main ( String [ ] args ) { int = x x = x * x * x system . out , println ( ? ? ? x ? ? ? 100 ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) ; for ( int i = 0 ; i < 2 ; i + + ) x = x * x ; System . out . println ( x ) ; } } import java . lang . Scanner ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int x = in . nextInt ( ) ; out . println ( x * x * x ) ; out . flush ( ) ; } } import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int n = r . nextInt ( ) ; System . out . println ( n * n ) ; } } import java . util . Scanner ; public class Itp1 _ 1b { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Itp1 _ 1b obj = new Itp1 _ 1b ( ) ; obj . solve ( ) ; } } import java . util . Scanner ; public class cityname { int location = 0 ; int year = 0 ; } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; cityname [ ] city = new cityname [ 3 ] ; for ( int i = 0 ; i < M ; i + + ) { city [ i ] = new cityname ( ) ; } for ( int i = 0 ; i < M ; i + + ) { city [ i ] . location = scan . nextInt ( ) ; city [ i ] . year = scan . nextInt ( ) ; } for ( int i = 0 ; i < M ; i + + ) { int index = 1 ; for ( int j = 0 ; j < M ; j + + ) { if ( ( city [ i ] . location = = city [ j ] . location ) & & ( city [ i ] . year > city [ j ] . year ) ) { index + + ; } } System . out . println ( String . format ( " % 06d " , city [ i ] . location ) + String . format ( " % 06d " , index ) ) ; } } } import java . util . * ; public class Competition2E { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double r = sc . nextDouble ( ) ; double c = 1 ; System . out . println ( ( int ) ( Math . pow ( r , 2 ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { int cc = x - 500 * i + 100 * j ; int c = cc / 50 ; if ( c > = 0 & & c < = 50 & & cc % 50 = = 0 ) { answer + + ; } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String { } args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; System . out . oriintin ( x - y ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; float rad = Math . abs ( H * 30 + 0.5 M - M * 6 ) ; if ( rad > = 180 ) { rad = 360 - rad ; } double C = 0 ; C = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( rad ) ) ; System . out . println ( Math . pow ( C , 0.5 ) ) ; } } # include < bits / stdc + + . h > using namespace std ; class Main { private : public : int n ; } ; int main ( ) { int n ; cin > > n ; vector < int > list ( n ) ; for ( int i = 0 ; i < n ; i + + ) { cin > > list . at ( i ) ; } vector < string > str ( n ) ; for ( int i = 0 ; i < n ; i + + ) { stringstream ss ; ss < < bitset < 100 > ( list . at ( i ) ) ; str . at ( i ) = ss . str ( ) ; } vector < int > m ( 100 ) ; for ( int j = 0 ; j < 100 ; j + + ) { if ( str . at ( 0 ) . at ( j ) ! = str . at ( 1 ) . at ( j ) ) { m . at ( j ) + = 1 ; } } for ( int i = 2 ; i < n ; i + + ) { for ( int j = 0 ; j < 100 ; j + + ) { if ( str . at ( i ) . at ( j ) = = ' 1' ) { m . at ( j ) + = 1 ; } } } for ( int i = 0 ; i < 100 ; i + + ) { m . at ( i ) = m . at ( i ) % 2 ; } string s ; s = ( accumulate ( m . begin ( ) , m . end ( ) , 0 ) = = 0 ) ? " YES " : " NO " ; cout < < s ; } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int p = scanner . nextInt ( ) + 1 ; int counter = scanner . nextInt ( ) ; int [ ] aArray = new int [ counter ] ; int [ ] bArray = new int [ counter ] ; ArrayList < Integer > [ ] arrayLists = new ArrayList [ p ] ; for ( int i = 0 ; i < counter ; i + + ) { int y = scanner . nextInt ( ) ; int t = scanner . nextInt ( ) ; aArray [ i ] = y ; bArray [ i ] = t ; if ( arrayLists [ y ] = = null ) arrayLists [ y ] = new ArrayList < > ( ) ; arrayLists [ y ] . add ( t ) ; } for ( int i = 0 ; i < p ; i + + ) { if ( arrayLists [ i ] ! = null & & arrayLists [ i ] . size ( ) > 1 ) { Collections . sort ( arrayLists [ i ] ) ; } } for ( int i = 0 ; i < counter ; i + + ) { int a = aArray [ i ] ; int b = bArray [ i ] ; String aString = Integer . toString ( a ) ; String c = Integer . toString ( arrayLists [ a ] . indexOf ( b ) + 1 ) ; System . out . println ( getZeros ( aString . length ( ) ) + aString + getZeros ( c . length ( ) ) + c ) ; } } public static String getZeros ( int a ) { if ( a = = 1 ) return " 00000 " ; if ( a = = 2 ) return " 0000 " ; if ( a = = 3 ) return " 000 " ; if ( a = = 4 ) return " 00 " ; if ( a = = 5 ) return " 0 " ; return " " ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int k ; List < Integer > spot = new ArrayList < > ( ) ; Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i + + ) { spot . add ( scanner . nextInt ( ) ) ; } k = scanner . nextInt ( ) ; List < Integer > tmpSpot = new ArrayList < > ( spot ) ; for ( int i = 0 ; i < 5 ; i + + ) { tmpSpot . remove ( i ) ; for ( int l : tmpSpot ) { if ( ( l - spot . get ( i ) ) > k ) { System . out . println ( " : ( " ) ; return ; } } } scanner . close ( ) ; System . out . println ( " Yay ! " ) ; } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList l = new ArrayList ( ) ; while ( sc . hasNext ( ) ) { double w = Double . parseDouble ( s [ 1 ] ) ; double h = Double . parseDouble ( s [ 2 ] ) ; if ( w / ( h * h ) > = 25 ) l . add ( Integer . parseInt ( s [ 0 ] ) ) ; } if ( l . isEmpty ( ) ) System . out . println ( " 該当なし " ) ; else f o ( Int ger i : l ) Sys e m . o ut.pri n tln ( i ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; int x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } class Main { public static void main ( Strings [ ] args ) { x = new int ( ) x = 3 ^ 3 System . out . println ( x ) ; } } import java . util . * ; import java . io . * ; public class first { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; return ; } } import java . util . Scanner ; public class Acc2005301 { public static void main ( String [ ] args ) { int s [ ] = new int [ 5 ] ; int h , h1 , h2 , okirum , m , m1 , m2 , k , ans ; Scanner sc = new Scanner ( System . in ) ; h1 = sc . nextInt ( ) ; m1 = sc . nextInt ( ) ; h2 = sc . nextInt ( ) ; m2 = sc . nextInt ( ) ; k = sc . nextInt ( ) ; h = h2 - h1 ; m = m2 - m1 ; okirum = m + 60 * h ; if ( okirum < = k ) { System . out . printf ( " 0 " ) ; } else { ans = okirum - k ; System . out . printf ( " % d " , ans ) ; } } } import java . util . * ; public class atcoder002 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } package abc055 ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( 800 * n - 200 * ( n / 15 ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r ^ 2 ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } import java . util . * ; class Test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main10 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = scan . nextInt ( ) ; } Arrays . sort ( A ) ; if ( A [ 0 ] = = 5 & & A [ 1 ] = = 5 & & A [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; ? ? public class Main { ? ? ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Scanner scan = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int x = scan . nextInt ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( x * x * x ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? scan . close ( ) ; ? ? ? ? ? ? ? ? ? ? } ? ? } class Main { public static void main ( String [ ] args ) { int x ; x = x * * 3 ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k = = 1 ) System . out . println ( 0 ) ; else System . out . println ( n - k ) ; } } public class Cubic { public static int calculateCube ( int x ) { int result = 0 ; if ( x > = 1 | | x < = 100 ) { result = x * x * x ; } return result ; } public static void main ( String [ ] args ) { int cubic = calculateCube ( 2 ) ; System . out . println ( cubic ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; Shi [ ] shi = new Shi [ m ] ; for ( int i = 0 ; i < m ; i + + ) { shi [ i ] = new Shi ( Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . nextInt ( ) ) , i ) ; } Arrays . sort ( shi , ( ac , bc ) - > ( ac . b - bc . b ) ) ; int cnt [ ] = new int [ n + 1 ] ; String [ ] strings = new String [ m ] ; for ( int i = 0 ; i < m ; i + + ) { cnt [ shi [ i ] . a ] + + ; strings [ shi [ i ] . index ] = String . format ( " % 06d " , shi [ i ] . a ) + String . format ( " % 06d " , cnt [ shi [ i ] . a ] ) ; } for ( String s : strings ) { System . out . println ( s ) ; } } } class Shi { int a , b , index ; public Shi ( int a , int b , int index ) { this . a = a ; this . b = b ; this . index = index ; } } num = int ( input ( ) ) base = 1 for i in range ( 3 ) : base * = num print ( base ) public static void main ( String [ ] args ) { int A = 30 ; int B = 100 ; if ( A < 6 ) { System . out . println ( " 0円 " ) ; } e se i ( < 1 ) { S stem.o u t.p r intln ( B / 2 + " 円 " ) ; } e s { Sy s em.out . pri n tln ( B + " 円 " ) ; } } class Hello { public static void main ( String [ ] args ) { int x ; for ( int i = 0 ; i < 2 ; i + + ) { x * = x ; } System . out . println ( x ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class FiveAntennas { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; int k = 0 ; for ( int i = 0 ; i < 6 & & s . hasNextLine ( ) ; i + + ) { if ( i < 5 ) { antennas [ i ] = Integer . parseInt ( s . nextLine ( ) ) ; } else if ( i = = 5 ) { k = Integer . parseInt ( s . nextLine ( ) ) ; } else { System . exit ( - 1 ) ; } } if ( available ( antennas , k ) ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } public static boolean available ( int [ ] antennas , int k ) { for ( int i = 0 ; i < antennas . length ; i + + ) { for ( int j = i + 1 ; j < antennas . length ; j + + ) { int distance = Math . abs ( antennas [ i ] - antennas [ j ] ) ; if ( distance > k ) { return false ; } } } return true ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; for ( int k = min ; k < max ; k + + ) { int challengeSum ; for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( k - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String num = scan . nextLine ( ) ; Integer . parseInt ( num ) ; num = num * 2 ; System . out . plintln ( unm ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; int ans1 = 0 ; int ans2 = 0 ; int ans3 = 0 ; for ( int i = 0 ; i < = A ; i + + ) { ans1 = + 500 * i ; } for ( int j = 0 ; j < = B ; j + + ) { ans2 = + 100 * j ; } for ( int k = 0 ; k < = C ; k + + ) { ans3 = + 50 * k ; if ( and1 + and2 + and3 = = X ) { ans + + ; break } } } } System . out . print ( ans ) ; } } import java . util . Scanner ; public class Main { pulic static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int [ ] hairetu = new int [ b ] ; for ( int i = 0 ; i < hairetu . length ; i + + ) { int c = sc . nextInt ( ) ; hairetu [ i ] = c ; } int count = 0 ; int champ = hairetu [ 0 ] ; for ( int k = 0 ; k < hairetu . length ; k + + ) { if ( champ > = hairetu [ i ] ) { champ = hairetu [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) , b = sc . nextDouble ( ) ; double num = ( a + b ) / 2 ; System . out . println ( Math . round ( num ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ( int ) Math . pow ( sc . nextDouble ( ) , 3 ) ) ; sc . close ( ) ; } } import java . io . * ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = new String ( in . readLine ( ) ) ; int x = Integer . parseInt ( a ) ; if ( x = = 1 | | x = = 0 ) { System . out . println ( x ) ; } System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; String inputString = scanner . nextLine ( ) ; String [ ] strStdIn = inputString . split ( " " , 0 ) ; int initialNum = Integer . parseInt ( strStdIn [ 0 ] ) ; int totalNum = Integer . parseInt ( strStdIn [ 1 ] ) ; int count = 0 ; if ( 3 * initialNum = = totalNum ) { System . out . println ( " 1 " ) ; return ; } else if ( 3 * initialNum < totalNum ) { System . out . println ( " 0 " ) ; return ; } int calculatedNum = ( 3 * initialNum ) - totalNum ; int terminater = 0 ; if ( ( initialNum - calculatedNum ) > 0 ) { terminater = initialNum - calculatedNum ; } count = 3 * ( initialNum - terminater ) ; } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] a ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( a = = 5 | | a = = 7 | | b = = 5 | | b = = 7 | | c = = 5 | | c = = 7 ) if ( a + b + c = = 17 ) System . out . printf ( " YES " ) ; else System . out . printf ( " NO " ) ; else System . out . printf ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ' \ n ' + scanner . next ( ) + ' \ n ' ) ; for ( int i = 1 ; i < sb . length ( ) - 1 ; i + + ) { if ( sb . getCharAt ( i ) = = ' ? ' ) { if ( sb . getCharAt ( i + 1 ) = = ' D ' ) { sb . append ( ' P ' ) ; } else { sb . append ( ' D ' ) ; } } } System . out . pritnln ( sb ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . next ( ) ; if ( x < = 2019 / 04 / 30 ) System . out . println ( " Heisei " ) ; else System . out . println ( " TBD " ) ; } } import java . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; x = 800 * n ; y = n / 15 * 200 ; x - y = ans ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int [ ] positions = new int [ n ] for ( int i = 0 ; i < n ; i + + ) { positions [ i ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean pass = true ; for ( int i = 0 ; i < n - 1 ; i + + ) { int difference = positions [ i + 1 ] - positions [ i ] ; if ( difference > border ) { pass = false ; break ; } } if ( pass ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int num = in . nextInt ( ) ; System . out . println ( num ^ 3 ) ; } } java . util . Scanner ; class Main { static int sqr ( int x ) { return x * x ; } public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] x = new int [ 8 ] ; int [ ] y = new int [ 8 ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = stdIn . nextInt ( ) ; y [ i ] = stdIn . nextInt ( ) ; } double sum = 0 ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = 1 ; j < n ; j + + ) { sum + = Math . sqrt ( sqr ( x [ i ] - x [ j ] ) + sqr ( y [ i ] - y [ j ] ) ) ; } } System . out . println ( sum * 2 / n ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } package contest ; import java . util . * ; public class example { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; } else { long m = 12 / N + 1 ; int n = 1 ; int mlcm = 1 ; for ( int i = 0 ; i < m ; i + + ) n * = 10 ; for ( int i = 1 ; i < n + 1 ; i + + ) { if ( P % ( Math . pow ( i , N ) ) = = 0 ) { mlcm = i ; } } System . out . println ( mlcm ) ; } } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( sc . hasNext ( ) & & sc . nextInt ( ) = = 7 ) { sevenCounter + + ; } else { fiveCounter + + ; } } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class a { public static void main ( String [ ] args ) { int f = 2 ; int s = 1 ; int i ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { for ( int j = 0 ; j < 3 ; j + + ) { i = Integer . parseUnsignedInt ( br . readLine ( ) ) ; if ( i = = 5 ) { -- f ; } else if ( i = = 7 ) { -- s ; } } } catch ( NumberFormatException | IOException e ) { System . out . println ( " NO " ) ; } if ( f = = 0 & & s = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s = sc . next ( ) ; if ( s = = " 0 " ) break ; int ret = 0 ; for ( int i = 0 ; i < s . length ( ) ; i + + ) ret + = s [ i ] - 48 ; System . out . println ( ret ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int num ; Scanner scanner = new Scanner ( System . in ) ; num = Integer . parseInt ( scanner . next ( ) ) ; System . out . println ( ( Math . pow ( num , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; int k = e - a ; if ( k < = 15 ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ; int x = int ( reader . readLine ( ) ) ; x = Math . pow ( x , 3 ) ; System . out . print ( x ) ; } } import java . util . * ; class Q1 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class VVVSequence { public static void main ( String [ ] args ) { int [ ] seq = { 1 , 1 , 1 , 1 } ; int res _ 2 = solution _ 2 ( seq . length , seq ) ; System . out . println ( res _ 2 ) ; } private static int solution _ 2 ( int length , int [ ] seq ) { int overflow = 0 ; int p1 = seq [ 0 ] ; int p2 = seq [ 1 ] ; for ( int i = 2 ; i < seq . length ; i + + ) { if ( p1 = = p2 ) { overflow + + ; } else if ( i % 2 = = 0 ) { if ( seq [ i ] ! = p1 ) overflow + + ; p1 = seq [ i ] ; } else if ( i % 2 ! = 0 ) { if ( seq [ i ] ! = p2 ) overflow + + ; } } return overflow ; } } import java . util . Scanner ; public class Restaurant { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int in = scan . nextInt ( ) ; System . out . println ( in * 800 - ( in / 15 ) * 200 ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } catch IOException { } } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] time = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { time [ i ] = scan . nextInt ( ) ; } int [ ] time2 = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { time2 [ i ] = ( int ) ceil ( ( double ) ( time [ i ] ) / 10.0 ) * 10 ; } int max = 0 ; int count = 0 ; int tmp = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { tmp = time2 [ i ] - time [ i ] ; if ( max < = tmp ) { max = tmp ; count = i ; } } int ans = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( i = = count ) { ans + = time [ i ] ; } else { ans + = time2 [ i ] ; } } System . out . println ( ans ) ; } import java . util . Scanner ; class sample { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = a * a * a print ( b ) ; } } 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 ( ) ; if ( ( a + b ) / 2 = = double ( a + b ) / 2 ) System . out . println ( ( a + b ) / 2 ) ; else System . out . println ( ( a + b ) / 2 + 1 ) ; } } class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; boolean gg = true ; Integer [ ] array = new Integer [ n ] ; int a = 1 ; int b = 0 ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = s . nextInt ( ) ; if ( i ! = 0 ) { if ( array [ i ] < b ) { b = array [ i ] ; a + + ; } else { } } else { b = array [ i ] ; } } System . out . print ( a ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readline ( ) ; System . out . println ( str * str * str ) ; } } import java . util . Scanner class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char s = sc . next ( ) . charAt ( 6 ) ; int month = Integer . parseCharacter ( s ) ; if ( month > 4 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] agrs ) { BufferedReader br = new BufferReder ( new InputStreamReader ( System . in ) ) ; int a = br . leadLine ( ) ; System . out . println ( ( a * a * a * ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; scan . nextLine ( ) ; List < Integer > values = Arrays . sort ( Arrays . of ( scan . nextLine ( ) . split ( " " ) ) . map ( i - > new Integer ( i ) ) ) ; Map < Integer , Integer > searchResult = new HashMap ( ) < > ; int i = 0 ; for ( i ; i < values . get ( values . size - 1 ) ; i + + ) { searchResult . put ( calc ( list , i ) , i ) ; } searchResult Object [ ] mapkey = mMap . keySet ( ) . toArray ( ) ; Arrays . sort ( mapkey ) ; for ( Integer nKey : mMap . keySet ( ) ) { System . out . println ( mMap . get ( nKey ) ) ; break ; } } public static int calc ( List < Integer > list , Integer point ) { Integer result = 0 ; int i = 0 ; for ( i ; i < list . size ; i + + ) { result + = ( ( list . get ( i ) - point ) * ( list . get ( i ) - point ) ) ; } return result ; } } import java . util . * public class x { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = int ( s . next ( ) ) ; System . out . print ( n ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Menu [ ] = new int [ 5 ] ; int min = 9 ; int last = 0 ; int count = 0 ; for ( i = 0 ; i < 5 ; i + + ) { Menu [ i ] = sc . nextInt ( ) ; if ( Menu [ i ] % 10 < = min & & Menu [ i ] % 10 = = 0 ) { min = Menu [ i ] % 10 ; last = i ; } } for ( i = 0 ; i < 5 ; i + + ) { if ( i ! = last ) { count = ( Menu [ i ] / 10 + 1 ) * 10 ; } } count = count + Menu [ last ] ; System . out . println ( count ) ; } } import java . util . * ; public class Good _ distance { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int X [ ] [ ] = new int [ N ] [ D ] ; int Distsq = 0 ; double Residue ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = 0 ; j < D ; j + + ) { X [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int k = 0 ; k < ( N - 1 ) ; k + + ) { for ( int l = ( k + 1 ) ; l < N ; l + + ) { for ( int m = 0 ; m < D ; m + + ) { Distsq + = ( int ) Math . pow ( ( X [ k ] [ m ] - X [ l ] [ m ] ) , 2 ) ; } Residue = Math . sqrt ( Distsq ) - Math . round ( Math . sqrt ( Distsq ) ) ; if ( Residue = = 0 ) { count + + ; } Distsq = 0 ; } } System . out . println ( count ) ; } } import java . io . * ; class Main { public static main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br ) ; x = x * x * x ; System . out . println ( x ) ; } } import javax . management . StringValueExp ; import java . lang . * ; import java . lang . reflect . Array ; import java . util . * ; import java . util . Scanner ; public class Codeforces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) n [ i ] = sc . nextInt ( ) ; int k = n [ 5 ] ; boolean check = false ; for ( int i = 4 ; i > 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) if ( n [ i ] - n [ j ] > = k ) { check = true ; break ; } if ( check ) break ; } if ( check ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } object Main extends App { final private val DELIMITER = " / " val input = io . StdIn . readLine . split ( DELIMITER ) val year = input ( 0 ) . toInt val month = input ( 1 ) . toInt val day = input ( 2 ) . toInt if ( year > 2019 ) println ( " TBD " ) else if ( year = = 2019 & & month > 5 ) println ( " TBD " ) else if ( year = = 2019 & & month = = 4 & & day > 30 ) println ( " TBD " ) else println ( " heisei " ) } import java . io . * ; class main { public static void main ( String [ ] a ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class ThreeCube { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int a = kb . nextInt ( ) ; System . out . printf ( " % d \ n " , a * a * a ) ; kb . close ( ) ; } } import java . util . * ; public class ABC057D { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int min = in . nextInt ( ) ; int max = in . nextInt ( ) ; long [ ] nums = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) nums [ i ] = in . nextLong ( ) ; Arrays . sort ( nums ) ; boolean same = true ; long ave = 0 ; int totalPostSame = 0 ; int postSame = 0 ; for ( int i = n - 1 ; i > = 0 ; i -- ) { if ( i > = 1 ) if ( nums [ i ] ! = nums [ i - 1 ] ) same = false ; if ( i > = n - min ) ave + = nums [ i ] ; if ( nums [ i ] = = nums [ n - min ] ) { totalPostSame + + ; if ( i > = n - min ) postSame + + ; } } System . out . println ( ( double ) ave / min ) ; long [ ] [ ] pascal = new long [ n + 1 ] [ n + 1 ] ; pascal [ 0 ] [ 0 ] = 1 ; for ( int i = 1 ; i < = n ; i + + ) { for ( int j = 0 ; j < = i ; j + + ) { if ( i = = j ) pascal [ i ] [ j ] = 1 ; else if ( j = = 0 ) pascal [ i ] [ j ] = 1 ; else pascal [ i ] [ j ] = pascal [ i - 1 ] [ j - 1 ] + pascal [ i - 1 ] [ j ] ; } } System . out . println ( Arrays . deepToString ( pascal ) ) ; if ( same ) { long total = 0 ; for ( int i = min ; i < = max ; i + + ) { total + = pascal [ i ] [ min ] ; } System . out . println ( total ) ; } else { System . out . println ( pascal [ totalPostSame ] [ postSame ] ) ; } } } public class Main { public static void main ( String args [ ] ) { int a = 3 ; int x = 7 ; int num = Math . pow ( a , x ) ; System . out . println ( ( int ) Math . pow ( a , x ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; import java . math . BigDecimal * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; if ( v < = w ) { System . out . println ( " NO " ) ; return ; } int l = Math . abs ( a - b ) ; int r = v - w ; BigDecimal L = BigDecimal . valueOf ( l ) ; BigDecimal R = BigDecimal . valueOf ( r ) ; BigDecimal T = L . divide ( R , 1 , BigDecimal . ROUND _ DOWN ) ; double p = T . doubleValue ( ) ; if ( ( l / r ) < = t ) { System . out . println ( " YES " ) ; return ; } else { System . out . println ( " NO " ) ; return ; } } } import java . util . Scanner ; public class IroHaAndHaiku { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class main { public void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int A = r . nextInt ( ) ; int B = r . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } else if ( A > = 6 & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) throws IOException { int count _ 5 = 0 , count _ 7 = 0 ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { int num = scan . nextInt ( ) ; if ( num = = 5 ) count _ 5 + + ; if ( num = = 7 ) count _ 7 + + ; } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public static Main { public static void main ( String [ ] args ) ; Scanner sc = new Scanner ( System . in ) ; int x = sc nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; if ( str . equals ( " 575 " ) ) { System . out . println ( " YES " ) ; } else if ( str . equals ( " 557 " ) ) { System . out . println ( " YES " ) ; } else if ( str . equals ( " 755 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class questionA { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = new String ( in . readLine ( ) ) ; String [ ] input = line . split ( " " , 0 ) ; int age = Integer . parseInt ( input [ 0 ] . trim ( ) ) ; int price = Integer . parseInt ( input [ 1 ] . trim ( ) ) ; if ( age < = 5 ) { System . out . print ( " 100 " ) ; } else if ( age < = 12 ) { System . out . print ( price / 2 ) ; } else { System . out . print ( price ) ; } } catch ( IOException e ) { System . out . print ( e ) ; } } } public class Main { public static void main ( String [ ] args ) { int d ; int a ; int k = d - e ; if ( k < = 15 ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 , min = n , p ; i < n ; i + + ) { p = sc . nextInt ( ) ; if ( p = < min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; String [ ] morse = s . split ( " " ) ; int height = Integer . parseInt ( morse [ 0 ] ) ; int width = Integer . parseInt ( morse [ 1 ] ) ; int area = height * width ; int rect = 2 * ( height + width ) ; System . out . println ( area + " " + rect ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line1 = br . readLine ( ) ; line1 = line1 . trim ( ) ; int N = Integer . parseInt ( line1 ) ; long PosA = 0 ; long PosB = 0 ; long a = 0 ; long b = 0 ; long mag = 0 ; for ( int i = 0 ; i < N ; i + + ) { String lines = br . readLine ( ) ; lines = lines . trim ( ) ; String [ ] temp = lines . split ( " " ) ; a = Integer . parseInt ( temp [ 0 ] ) ; b = Integer . parseInt ( temp [ 1 ] ) ; if ( PosA < = a & & PosB < = b ) { PosA = a ; PosB = b ; } else { mag = ( long ) Math . ceil ( Math . max ( ( double ) PosA / a , ( double ) PosB / b ) ) ; PosA = a * mag ; PosB = b * mag ; } } System . out . println ( PosA + PosB ) } } import java . util . Scanner ; public class A _ Restaurant { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int x = N * 800 ; int y = ( N / 15 ) * 200 ; int sum = x - y ; System . out . print ( " 合計金額 = " + sum ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( x * x * x ) ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; 1 < = x < = 100 ; Scanner sc = new Scanner ( System . in ) ; x = sc . nextINT ( ) ; N = x * x * x ; System . out . println ( N ) ; } } int x = 3 ; X = x * x * x ; Systemout . println ( X ) ; import java . io . * ; class Main { public static void main ( String args [ ] ) { int num ; String buf ; try { BufferdReader br = new BufferdeReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; num = Integer . parseInt ( buf ) ; System . out . println ( num * num * num ) ; } catch ( Exception e ) { } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( z < = 0 & & z < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; System . out . print ( Math . pow ( X , 3 ) ; ) } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; x = 800 * n ; y = n / 15 * 200 ; x - y = ans ; println ( ans ) ; public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { int x ; int kekka ; x = 2 ; kekka = x * x ; System . out . println ( kekka ) ; } } import java . util . Scanner ; class Test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; scanner . nextInt ( ) ; int cs = scanner . nextInt ( ) ; int [ ] ca = new int [ cs ] ; int [ ] ys = new int [ cs ] ; for ( int i = 0 ; i < cs ; i + + ) { ca [ i ] = scanner . nextInt ( ) ; ys [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < cs ; i + + ) { int num = ca [ i ] ; int seq = getseq ( num , ys [ i ] , ca , ys ) ; System . out . println ( getFullNumber ( num ) + getFullNumber ( seq ) ) ; } } static int getseq ( int num , int year , int [ ] ca , int [ ] ys ) { int sequ = 1 ; for ( int i = 0 ; i < ys . length ; i + + ) { if ( ca [ i ] = = num & & year > ys [ i ] ) { sequ + + ; } } return sequ ; } static String getFullNumber ( int number ) { String n = String . valueOf ( number ) ; int len = 6 - n . length ( ) ; for ( int i = 0 ; i < len ; i + + ) { n = " 0 " + n ; } return n ; } } package abc082 ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; public class A { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; String [ ] strings = new String [ 2 ] ; strings = s . split ( " \ \ s + " ) ; BigDecimal d1 = new BigDecimal ( strings [ 0 ] ) ; BigDecimal d2 = new BigDecimal ( strings [ 1 ] ) ; BigDecimal average = ( d1 . add ( d2 ) . divide ( new BigDecimal ( 2 ) ) ) ; BigDecimal ans = average . setScale ( 0 , BigDecimal . ROUND _ UP ) ; System . out . println ( ans ) ; } } あ import java . io . * ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { int x , x _ 3 ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; x _ 3 = x * x * x ; System . out . println ( x _ 3 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner teclado = new Scanner ( Sistema . Em ) ; int A , B , C , D , E ; Um = teclado . nextInt ( ) ; B = teclado . nextInt ( ) ; C = teclado . nextInt ( ) ; D = teclado . nextInt ( ) ; E = teclado . nextInt ( ) ; int k = teclado . nextInt ( ) ; se ( B - A < = k & & C - A < = k & & D - A < = k & & E - A < = k & & C - B < = k & & D - B < = k & & E - B < = k & & D - C < = k & & E - C < = k & & E - D < = k ) { Sistema . fora . println ( " Yay ! " ) ; } mais { Sistema . fora . println ( " : ( " ) ; } } class BinaryConversion { public static long [ ] decimalToBinary ( long num ) { long [ ] a = new long [ 60 ] ; int i = a . length - 1 ; while ( num ! = 0 ) { a [ i ] = num % 2 ; num / = 2 ; i -- ; } return a ; } public static long binaryToDecimal ( long [ ] a ) { long num = 0 ; for ( int i = 0 ; i < a . length ; i + + ) { num + = ( a [ i ] * Math . pow ( 2 , a . length - 1 - i ) ) ; } return num ; } } class XOR { public static long [ ] xor ( long num1 , long num2 ) { long [ ] a = BinaryConversion . decimalToBinary ( num1 ) ; long [ ] b = BinaryConversion . decimalToBinary ( num2 ) ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = ( a [ i ] + b [ i ] ) % 2 ; } return a ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] num = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { num [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < num . length - 1 ; i + + ) { for ( int j = i + 1 ; j < num . length ; j + + ) { long [ ] temp = XOR . xor ( num [ i ] , num [ j ] ) ; sum + = BinaryConversion . binaryToDecimal ( temp ) ; } } sum % = ( Math . pow ( 10 , 9 ) + 7 ) ; System . out . println ( sum ) ; } } r = int ( input ( ) . strip ( ) ) print ( r * * 2 ) import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double Pai = 3.141592653589793238462643383279 L ; double a = scan . nextInt ( ) ; double b = scan . nextInt ( ) ; double h = scan . nextInt ( ) ; double m = scan . nextInt ( ) ; double rad = Pai * 2 * ( ( h / 12.0 ) + ( ( 60.0 / m ) / 12.0 ) - m / 60.0 ) ; double rpe = ( a * a + b * b ) - ( 2 * a * b ) * Math . cos ( rad ) ; System . out . println ( rpe ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . print ( x * x * x ) ; } } import java . io . * class main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( Math . pow ( num , 3 ) ) ; } } import java . io . * ; public class maint . java { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOExpection { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { double x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int r = Integer . parseInt ( line ) ; System . out . println ( r * r ) ; class Main { public static void main ( String [ ] agrs ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; pablic class Main { pablic static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; if ( a . length ( ) = = 5 & & b . length ( ) = = 7 & & c . length ( ) = = 5 ) { System . out . println ( " YES " ) ; } else if ( a . length ( ) = = 5 & & b . length ( ) = = 5 & & c . length ( ) = = 7 ) { System . out . println ( " YES " ) ; } else if ( a . length ( ) = = 5 & & b . length ( ) = = 7 & & c . length ( ) = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class v { public static void main ( String [ ] args ) { int x ; x = 2 ; x = x * + x * + x ; System . out . println ( " x = " + x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int r = scan . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scannser sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io . * ; import java . util . * ; class main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; a [ 0 ] = 5 ; a [ 1 ] = 7 ; a [ 2 ] = 5 ; int b [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( b [ i ] = = a [ j ] ) { a [ j ] = 0 ; count + + ; break ; } } } if ( count = 3 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { int x = sc . nextInt ( ) ; int num = 0 ; if ( x = = 0 ) break ; for ( ; ; ) { num = num + ( x % 10 ) ; x = x / 10 ; if ( x = = 0 ) break ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3.0 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int AX = X * X * X ; System . out . println ( AX ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; int ans = aaa + bbb + ccc + ddd + eee - 10 + min ; 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 ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; int total = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int n = i ; count = 0 ; while ( int n > 0 ) { count + = n % 10 ; n = n / 10 ; } if ( A < = count & & count < = B ) { total + = i ; } } System . out . println ( total ) ; } } import java . io . * ; class prob11b { public static void main ( String args [ ] ) { int x , bb ; BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( d . readLine ( ) ) ; bb = x * x * x ; System . out . println ( bb ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) A [ i ] = sc . nextInt ( ) ; Array . sort ( A ) ; int ans = A [ 2 ] - A [ 0 ] ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; sum + = a [ i ] ; } sc . nextInt ( ) ; int w = sum / n ; int mod = sum % n ; if ( mod > n / 2 ) w + + ; int ans = 0 ; for ( int i : a ) { int abs = Math . abs ( i - w ) ; ans + = abs * abs ; } System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { InputStreamReader sr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( sr ) ; String xstr = br . readline ( ) ; int x = Integer . ParseInt ( xstr ) ; int y ; if ( x > = 1 & & x < = 100 ) { y = x * x * x ; System . out . println ( y ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ( ) ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; int C = s . nextInt ( ) ; int nana , go ; if ( A = = 5 ) { go + + ; } else if ( A = = 7 ) { nana + + ; } if ( B = = 5 ) { go + + ; } else if ( B = = 7 ) { nana + + ; } if ( C = = 5 ) { go + + ; } else if ( C = = 7 ) { nana + + ; } if ( go = = 2 & & nana = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } def factorial ( n ) : M = 1000000007 f = 1 for i in range ( 1 , n + 1 ) : f = ( f * i ) % M return f import java . util . Scanner ; public class Sample1 _ 6 { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; String line1 = sc1 . nextLine ( ) ; String [ ] inputText = line1 . split ( " " ) ; int a = Integer . parseInt ( inputText [ 0 ] ) + Integer . parseInt ( inputText [ 1 ] ) ; int b = Integer . parseInt ( inputText [ 2 ] ) ; int c = a - b ; if ( c < 0 ) { System . out . print ( " No " ) ; } else { System . out . print ( " Yes " ) ; } } } import java . io . * ; class oneCardPoker { public static void main ( String args [ ] ) throws IOException { int number [ ] ; number = new int [ 2 ] ; BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String strNum [ ] = str . split ( " " ) ; for ( int i = 0 ; i < 2 ; i + + ) { number [ i ] = Integer . parseInt ( strNum [ i ] ) ; if ( number [ i ] = = 1 ) number [ i ] + = 13 ; } if ( number [ 0 ] > number [ 1 ] ) { System . out . println ( " Alice " ) ; } else if ( number [ 0 ] < number [ 1 ] ) { System . out . println ( " BOb " ) ; } else if ( number [ 0 ] = = number [ 1 ] ) { System . out . println ( " Draw " ) ; } return ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x ) ; } } import java . io . * ; import java . util . * ; public class Main { static List < Edge > [ ] edges ; static boolean [ ] used ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int V = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; edges = new List [ V ] ; for ( int i = 0 ; i < V ; i + + ) { } } static class Edge { int to , cap , rev ; Edge ( int to , int cap , int rev ) { this . to = to ; this . cap = cap ; this . rev = rev ; } } } class Main { public static void main ( String [ ] args ) { BufferReader br = new BufferReader ( ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; antena ( a , e , k ) ; } public static void antena ( int a , int e , int k ) { if ( e - a > k ) { System . out . println ( " : ) " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Colon { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final double a = sc . nextInt ( ) ; final double b = sc . nextInt ( ) ; final double h = sc . nextInt ( ) ; final double m = sc . nextInt ( ) ; double h _ deg = h * 360 / 12 + m * 360 / 12 / 60 ; double m _ deg = m * 360 / 60 ; sc . close ( ) ; double result = 0 ; result = Math . pow ( ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( h _ deg - m _ deg ) ) ) ) , 0.5 ) ; System . out . println ( result ) ; } } import java . util . * ; class Main { public static void main ( int args [ ] ) { int coinVal ; int coinVal2 ; int total ; int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; total = coinVal + coinVal2 ; if ( total > = toyPrice ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x : x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = sc . nextInt ( ) ; boolean isEven = true ; count = 10000 ; newCount = 0 ; while ( isEven ) { isEven = true ; newCount = 0 ; for ( int i = 1 ; i < = max ; i + + ) { if ( i % 2 = = 0 ) { i = i / 2 ; } else { isEven = false ; } } if ( count > newCount ) { count = newCount ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( ( a * a ) ; } } class Main { public static void main ( String args [ ] ) { int x = 0 ; DataInputStream d = new DataInputStream ( System . in ) x = d ; x = x ^ 3 ; System . out . println ( x ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = buf . readLine ( ) ; int x = Integer . parseInt ( a ) ; x = x * x * x ; System . out . println ( x ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int i = in . nextInt ( ) ; System . out . println ( i * i * i ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( args ^ 3 ) ; } } import java . io ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BuferedReader ( new InputStreamReader ( Systen . in ) ) ; try { String temp = reader . readLine ( ) ; int x = Integer . parseInt ( temp ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " Input only 1data " ) ; } return ; } } # include < iostream > # include < string > # include < cstring > # include < map > # include < algorithm > # include < set > # include < vector > # include < cstdio > # include < cmath > # include < queue > using namespace std ; typedef long long LL ; const int maxn = 2e3 + 5 ; LL a [ maxn ] ; LL b [ maxn ] [ maxn ] ; int main ( ) { int n ; LL x , sum = 1L L < < 60L L ; cin > > n > > x ; for ( int i = 1 ; i < = n ; i + + ) cin > > a [ i ] ; for ( int i = 1 ; i < = n ; i + + ) { b [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < = n - 1 ; k + + ) { int pos = i - k ; if ( pos < = 0 ) pos = n - abs ( pos ) ; b [ i ] [ k ] = min ( b [ i ] [ k - 1 ] , a [ pos ] ) ; } } for ( int k = 0 ; k < = n - 1 ; k + + ) { LL ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { ans + = b [ i ] [ k ] ; } sum = min ( sum , ans + x * k ) ; } cout < < sum < < endl ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Comparator ; import java . util . List ; import java . util . logging . Level ; import java . util . logging . Logger ; import java . util . stream . Collectors ; import java . util . stream . Stream ; public class Main { public static void main ( String [ ] args ) { System . out . println ( new Main ( ) . run ( args , System . in ) ) ; } public String run ( String [ ] args , InputStream in ) { String result = null ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; int N = Integer . parseInt ( reader . readLine ( ) ) ; List < Integer > list = reader . lines ( ) . flatMap ( s - > Stream . of ( s . replaceAll ( " \ \ s + " , " " ) . split ( " " ) ) ) . limit ( N ) . map ( Integer : : parseInt ) . sorted ( ) . collect ( Collectors . toList ( ) ) ; int min = list . get ( 0 ) ; int max = list . get ( N - 1 ) ; result = String . valueOf ( max - min ) ; } catch ( IOException ex ) { Logger . getLogger ( abc064a . Main . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } return result ; } } import java . io . * ; import java . util . * ; public class ABC127d { public static void main ( String [ ] arg ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int m = Integer . parseInt ( scan . next ( ) ) ; long [ ] A = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { A [ i ] = scan . nextLong ( ) ; } for ( int i = 0 ; i < m ; i + + ) { int b = Integer . parseInt ( scan . next ( ) ) ; int c = Integer . parseInt ( scan . next ( ) ) ; Arrays . sort ( A ) ; for ( int j = 0 ; j < b ; j + + ) { while ( A [ j ] < c ) { A [ j ] = ( long ) c ; } } } long sum = 0 ; for ( long d : A ) { sum + = d ; System . out . print ( d ) ; } System . out . print ( sum ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Aizu { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * a * a ) ; } } class main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( System . in ) ; System . out . print ( i * i * i ) ; } } import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class Candles { static void func ( int n , int k , int [ ] xa ) { int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < = n - k ; i + + ) { min = Math . min ( min , Math . min ( Math . abs ( xa [ i ] ) , Math . abs ( xa [ i + k - 1 ] ) ) + xa [ i + k - 1 ] - xa [ i ] ) ; } System . out . println ( min ) ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int [ ] xa = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { xa [ i ] = in . nextInt ( ) ; } func ( n , k , xa ) ; in . close ( ) ; } } import java . io . * ; class Cubic { public static void main ( String [ ] args ) thorows IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Intger . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { try { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = fs . nextInt ( ) ; } int step = 0 ; int first = a [ 0 ] ; int second = a [ 1 ] ; if ( first = = second ) { step + + ; second = first + 1 ; } for ( int i = 2 ; i < n ; i + = 2 ) { if ( a [ i ] ! = first ) { step + + ; } } for ( int i = 3 ; i < n ; i + = 2 ) { if ( a [ i ] ! = second ) step + + ; } System . out . println ( step ) ; } catch ( Exception e ) { return ; } } static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; public class Restaurant { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int in = scan . nextInt ( ) ; System . out . println ( in * 800 - ( in / 15 ) * 200 ) ; scan . close ( ) ; } } improt java . util . * ; class Main { public static void main ( string [ ] args ) { Scanner sc = New Scanner ( System . In ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( i + 1 , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } map . entrySet ( ) . stream ( ) . sorted ( Map . Entry . comparingByValue ( ) ) ; for ( String key : map . keySet ( ) ) { for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } import java . util . Scanner ; public class Input { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class clear { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int x = Integer . parseInt ( str ) ; int anser = 0 ; double y = ( double ) x ; double z = Math . pow ( y , 3.0 ) ; anser = ( int ) z ; System . out . println ( anser ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; long double rad = ( h / 12 + ( 60 / m ) / 12 ) - ( m / 60.0 ) ; long double rpe = ( a * a + b * b ) - ( 2 * a * b ) * cosl ( rad ) ; System . out . println ( rpe ) ; } } class Main { public static void main ( String args [ ] ) { int x = args ; int Sanjou ; Sanjou = x * x * x ; System . out . println ( Sanjou ) ; } } import java . util . Scanner ; class ABC145 _ A { { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; System . out . println ( r * r ) ; } } public class XCubic { public static void main ( String [ ] args ) { int i = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( i * i * i ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class c { public static void main ( String [ ] argc ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] x = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int ans = ( int ) 2e9 ; for ( int i = 0 ; i < = N - K ; i + + ) { ans = Math . min ( ans , dist ( x [ i ] , x [ i + K - 1 ] ) ) ; } System . out . println ( ans ) ; } public static int dist ( int A , int B ) { int ret = 0 ; if ( A > = 0 & & B > = 0 ) { ret = B ; } else if ( A < 0 & & B < 0 ) { ret = A ; } else ret = Math . min ( 2 * Math . abs ( A ) + B , Math . abs ( A ) + 2 * Math . abs ( B ) ) ; return ret ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } package com . atcoder ; import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 3 ] ; array [ 0 ] = sc . nextInt ( ) ; array [ 1 ] = sc . nextInt ( ) ; array [ 2 ] = sc . nextInt ( ) ; int minCost = 300 ; for ( int i = 0 ; i < 3 ; i + + ) { int nextMinCost = 100 ; int nextMinNumber = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { int totalCost = 0 ; if ( j = = i ) { continue ; } for ( int z = 0 ; z < 3 ; z + + ) { if ( z ! = i & & z ! = j ) { totalCost + = Math . abs ( array [ j ] - array [ i ] ) + Math . abs ( array [ z ] - array [ j ] ) ; } } if ( totalCost < minCost ) { minCost = totalCost ; } } } System . out . println ( minCost ) ; } class Main { public static void main ( String [ ] args ) { int a ; int b a = b * b * b ; System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int [ ] B = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { A [ i ] = scan . nextInt ( ) ; B [ i ] = tenth ( A [ i ] ) ; } int min = 9 ; int pointer = 0 ; int all = 0 ; int k ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ichi ( B [ i ] ) < min ) { min = A [ i ] ; k = B [ i ] ; pointer = i ; } } all = B [ 0 ] + B [ 1 ] + B [ 2 ] + B [ 3 ] + B [ 4 ] - 2 * k ; all = all + min ; System . out . print ( all ) ; } public static int tenth ( int a ) { while ( a % 10 ! = 0 ) { a + + ; } return a ; } public static int ichi ( int b ) { while ( b > = 10 ) { b = b - 10 ; } return b ; } } import java . util . Scanner ; public class C _ takahashiInformation { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; int a = c11 - c21 ; int b = c12 - c22 ; int d = c13 - c23 ; int e = c21 - c31 ; int f = c22 - c32 ; int g = c23 - c33 ; if ( a = = b & b = = d & e = = f & f = = g ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class ITP1 _ 1b { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; System . out . print ( " x = " ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { ITP1 _ 1b obj = new ITP1 _ 1b ( ) ; obj . solve ( ) ; } } Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( num * num ) ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } if ( a % 10 ! = 0 ) { double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; } else { aaa = a ; } if ( b % 10 ! = 0 ) { double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; } else { bbb = b ; } if ( c % 10 ! = 0 ) { double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; } else { ccc = c ; } if ( d % 10 ! = 0 ) { double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; } else { ddd = d ; } if ( e % 10 ! = 0 ) { double eee = ( Math . ceil ( e / 10 ) ) * 10 ; } else { eee = e ; } double zzz = aaa + bbb + ccc + ddd + eee + min - 10 ; int ans = ( int ) zzz ; System . out . println ( ans ) ; } } import java . util . Scanner public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 7 | | B = = 7 | | C = = 7 ) { if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( B = = 7 ) { if ( C = = 5 & & A = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( C = = 7 ) { if ( A = = 5 & & B = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } else { System . out . println ( " no " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Div64 { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = ( long ) Math . round ( ( a + b ) / 2.0 ) ; System . out . println ( c ) ; } private 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 N = sc . nextInt ( ) ; int [ ] t = new int [ N ] ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { t [ i ] = sc . nextInt ( ) ; a [ i ] = sc . nextInt ( ) ; } long [ ] dp = new long [ N ] ; dp [ 0 ] = t [ 0 ] + a [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { long t = ( dp [ i - 1 ] * t [ i - 1 ] ) / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ; long a = ( dp [ i - 1 ] * a [ i - 1 ] ) / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ; long rate = Math . max ( ( long ) Math . ceil ( ( double ) t / ( double ) t [ i ] ) , ( long ) Math . ceil ( ( double ) a / ( double ) a [ i ] ) ) ; dp [ i ] = rate * ( long ) ( t [ i ] + a [ i ] ) ; } System . out . println ( dp [ N - 1 ] ) ; } } public class TEST { public static void main ( String [ ] args ) { int x = 3 ; for ( int i = 0 ; i < 2 ; i + + ) { x = x * 3 ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( system . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; system . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( 9 ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) e . printStackTrace ( ) ; } } } } import java . util . * ; public class xCubic { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; System . out . println ( Math . found ( Math . pow ( x , 3 ) ) ) ; } } public class Cubic { public static void main ( String [ ] args ) { int result = 0 ; System . out . println ( " Enter the x value " ) ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { result = x * x * x ; System . out . println ( " X cubic value " + result ) ; } else { System . out . println ( " Your input must between 1 and 100 ! " ) ; } } } public class Main { public int main ( String [ ] args ) { int r ; int mensseki = r ^ 2 ; system . Out . Println ( menseki ) ; return menseki ; } } class Main { public static void main ( String args [ ] ) { x = 3 ; System . out . println ( x ^ 3 ) ; } } import java . util . Scanner ; import java . lang . * ; public class Main { public static int count = 0 ; public static void counter ( int fh , int hd , int ft , int goal ) { int maxFH = Math . min ( goal / 500 , fh ) ; for ( int i = 0 ; i < = maxFH ; i + + ) { int postFH = goal - i * 500 ; int maxHD = 0 ; if ( postFH > 0 ) maxHD = Math . min ( postFH / 100 , hd ) ; } for ( int j = 0 ; j < = maxHD ; j + + ) { int postHD = postFH - j * 100 ; int maxFT = 0 ; if ( postHD > 0 ) { maxFT = Math . min ( postHD / 50 , ft ) ; } for ( int k = 0 ; k < = maxFT ; k + + ) { int remainder = postHD - k * 50 ; if ( remainder = = 0 ) count + + ; } } } } public static void main ( String [ ] args ) { Scanner dataScanner = new Scanner ( System . in ) ; int goal = Integer . parseInt ( dataScanner . nextLine ( ) ) ; int fiveHundred = Integer . parseInt ( dataScanner . nextLine ( ) ) ; int hundred = Integer . parseInt ( dataScanner . nextLine ( ) ) ; int fifty = Integer . parseInt ( dataScanner . nextLine ( ) ) ; counter ( fiveHundred , hundred , fifty , goal ) ; System . out . println ( count ) ; } } public class Main { public static void main ( String [ ] args ) { int num = x ; System . out . println ( cubic ( num ) ) ; public static int cubic ( int num ) { result = num ^ 3 ; return result ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scaner sc = new Scanner ( System . in ) ; Long n = sc . nextLong ( ) ; Long p = sc . nextLong ( ) ; if ( n = = 1 ) System . out . println ( p ) ; else System . out . println ( 1 ) ; } } public class HelloWorld { public static void main ( String [ ] args ) { System . out . println ( 1 ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) { int x ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String but = br . readLine ( ) ; } catch ( Exception e ) { x = 0 ; } x = Integer . parseInt ( but ) ; if ( x > = 0 & & x < = 100 ) { x = x * x * x ; } } } import java . util . Scanner ; public class x { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; System . out . println ( a * a * a ) ; } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; System . out . print ( " x : " ) ; i t x = s .n e xtInt ( ) ; S stem.o u t.p r intln ( x * x * x ; } p blic s atic v id m in ( S t ring [ ] a gs ) { M in o j = n w M in ( ) ; o j.s o lve ( ) ; } } class main1 { public Main ( ) { String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int A , B , H , M ; try { String [ ] contexts = reader . readLine ( ) . split ( " " ) ; A = Integer . parseInt ( contexts [ 0 ] ) ; B = Integer . parseInt ( contexts [ 1 ] ) ; H = Integer . parseInt ( contexts [ 2 ] ) ; M = Integer . parseInt ( contexts [ 3 ] ) ; } finally { reader . close ( ) ; } int intAngle = Math . abs ( ( 360 / 12 ) * H - ( 360 / 60 ) * M ) ; double dblLen ; dblLen + = Math . pow ( A * 1.0 , 2.0 ) dblLen + = Math . pow ( B * 1.0 , 2.0 ) dblLen - = 2.0 * A * B * Math . cos ( Math . toRadians ( intAngle ) ) ; System . out . print ( sqrt ( dblLen ) ) ; } main ( c , d ) { while ( scanf ( " % d % d " , & c , & d ) + 1 ) printf ( " % d \ n " , c + d ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Int coina ; Int coinb ; Int toyc ; Scanner sc = new Scanner ( System . in ) ; System . out . println ( " Coin A Coin B Toy 's price " ) ; coina = sc . nextInt ( ) ; coinb = sc . nextInt ( ) ; toyc = sc . nextInt ( ) ; if ( coina + coinb < toyc ) { System . out . println ( " no " ) ; } else { System . out . println ( " yes " ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner tc = new Scanner ( System . in ) ; int N , K ; N = tc . nextInt ( ) ; K = tc . nextInt ( ) ; if ( N > K ) { int D = N - K ; System . out . println ( D ) ; } if ( K > N ) { int D = K - N ; System . out . println ( D ) ; } } } ======= import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String in = br . readLine ( ) ; String chr [ ] = in . split ( " " ) ; int a = Integer . parseInt ( chr [ 0 ] ) ; int b = Integer . parseInt ( chr [ 1 ] ) ; int c = Integer . parseInt ( chr [ 2 ] ) ; System . out . println ( Math . max ( a , Math . max ( b , c ) ) - Math . min ( a , Math . min ( b , c ) ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double deg = ( double ) ( h + ( double ) m / 60 ) * 30 - ( double ) m * 6 ; deg = Math . toRadians ( deg ) ; double acos = a * Math . cos ( deg ) ; double asin = a * Math . sin ( deg ) ; double ans = Math . pow ( b - acos , 2 ) + Math . pow ( asin , 2 ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 2 ] ; b [ 0 ] = 0 ; b [ 1 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] = = 5 ) { b [ 0 ] + + ; } else if ( a [ i ] = = 7 ) { b [ 1 ] + + ; } } if ( ( b [ 0 ] = = 2 ) & & ( b [ 1 ] = = 1 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antennaArr = new int [ 5 ] ; for ( int i = 0 ; i < antennaArr . length ; i + + ) { antennaArr [ i ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean canConnect = true ; for ( int i = 0 ; i < antennaArr . length ; i + + ) { for ( int j = 0 ; j < antennaArr . length ; j + + ) { if ( i > = j ) { continue ; } if ( antennaArr [ j ] - antennaArr [ i ] > border ) { canConnect = false ; } } } if ( canConnect ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = n ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( n -- > 0 ) { if ( sc . next ( ) . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; break ; } if ( n = = 0 ) System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int H = scan . nextInt ( ) ; int R = scan . nextInt ( ) ; if ( H + R > 0 ) { System . out . println ( " 1 " ) ; } else if ( H + R < 0 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " 0 " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean i = true ; String [ ] s = new String [ N ] ; for ( int l = 0 ; l < N ; l + + ) { s [ l ] = sc . next ( ) ; if ( s [ l ] . equals ( " Y " ) ) i = false ; } sc . close ( ) ; if ( i ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } 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 k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int com = s - ( i + j ) ; if ( com > = 0 & & k > = com ) count + + ; } } System . out . println ( count ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( in . next ( ) . equals ( " Y " ) ) { out . print ( " Four " ) ; return ; } } out . print ( " Three " ) ; } } } import java . util . * ; public class Main { public static Map < Long , Long > map = new HashMap < > ( ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; bunkai ( P ) ; long ans = 1 ; for ( Long n : map . keySet ( ) ) { if ( map . get ( n ) > = N ) { long tmp = map . get ( n ) / N ; ans * = pow ( n , tmp ) ; } } System . out . println ( ans ) ; } public static void bunkai ( long n ) { while ( n ! = 1 ) { long num = sosuHantei ( n ) ; long count = 0 ; while ( n % num = = 0 ) { count + + ; n / = num ; } map . put ( num , count ) ; } } public static long sosuHantei ( long n ) { for ( long i = 2 ; i * i < = n ; i + + ) { if ( n % i = = 0 ) return i ; } return n ; } public static long pow ( long x , long y ) { long ans = 1 ; for ( long i = 0 ; i < y ; i + + ) { ans * = x ; } return ans ; } } import java . util . Arrays ; import java . util . Optional ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Integer [ ] num = new Integer [ new Scanner ( System . in ) . nextInt ( ) ] ; for ( int i = 1 ; i < = num . length ; i + + ) { num [ i - 1 ] = i ; } Optional < Integer > maxdivision = Arrays . asList ( num ) . stream ( ) . map ( Main : : countCanDivideBy2 ) . max ( Integer : : compare ) ; int result = ( int ) Math . pow ( 2d , maxdivision . get ( ) . doubleValue ( ) ) ; System . out . println ( result ) ; } public static int countCanDivideBy2 ( Integer i ) { int result = 0 ; for ( ; i % 2 = = 0 & & i > 0 ; result + + ) { i / = 2 ; } return result ; } } import java . util . Scanner ; class Main { public static void main ( final String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] antenna = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antenna [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; String ans = " Yay ! " ; x : for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 - j ; j + + ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > k ) { ans = " : ( " ; break x ; } } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { MyReader r = new MyReader ( ) ; int K , S ; { int [ ] a = r . ii ( ) ; K = a [ 0 ] ; S = a [ 1 ] ; } int count = 0 ; for ( int i = 0 ; i < K + 1 ; i + + ) for ( int j = 0 , k ; j < K + 1 ; j + + ) if ( 0 < = ( k = S - i - j ) & & k < = K ) count + + ; println ( count ) ; } static void print ( Object o ) { System . out . print ( o . toString ( ) ) ; } static void println ( Object o ) { System . out . println ( o . toString ( ) ) ; } static int Int ( String s ) { return Integer . parseInt ( s ) ; } static long Long ( String s ) { return Long . parseLong ( s ) ; } static class MyReader extends BufferedReader { MyReader ( ) { super ( new InputStreamReader ( System . in ) ) ; } String s ( ) throws IOException { return readLine ( ) ; } String [ ] ss ( ) throws IOException { return s ( ) . split ( " " ) ; } int i ( ) throws IOException { return Int ( s ( ) ) ; } int [ ] ii ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; int [ ] ii = new int [ size ] ; for ( int j = 0 ; j < size ; j + + ) ii [ j ] = Integer . parseInt ( ss [ j ] ) ; return ii ; } long l ( ) throws IOException { return Long ( s ( ) ) ; } long [ ] ll ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; long [ ] ll = new long [ size ] ; for ( int j = 0 ; j < size ; j + + ) ll [ j ] = Long . parseLong ( ss [ j ] ) ; return ll ; } } } import java . util . * ; public class Main { public static final int MAX = 3501 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = Long . parseLong ( sc . next ( ) ) ; for ( long x = 2 ; x < MAX ; x + = 2 ) { for ( long y = x ; y < MAX ; y + = 2 ) { long u = n * x * y ; long d = 4L * x * y - n * x - n * y ; if ( d ! = 0 & & u % d = = 0 & & u / d > 0 ) { long z = u / d ; System . out . println ( x + " " + y + " " + z ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 0 , count2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 5 ) { count + + ; } if ( a = = 7 ) { count2 + + ; } } if ( count = = 2 & & count2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; sc . close ( ) ; long h = - 1 ; long n = - 1 ; long w = - 1 ; for ( long x = 1 ; x < = 3500 ; x + + ) { for ( long y = 1 ; y < = 3500 ; y + + ) { long dived = 4 * x * y - N * ( x + y ) ; if ( dived = = 0 ) continue ; long z = ( N * x * y ) / dived ; if ( 4 * x * y * z = = N * ( x * y + y * z + z * x ) & & z > = 0 ) { h = x ; n = y ; w = z ; break ; } } if ( h > 0 ) break ; } System . out . println ( String . format ( " % d % d % d " , h , n , w ) ) ; } } 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 ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < m ; i + + ) { y [ i ] = sc . nextLong ( ) ; } long xSum = 0 ; n -- ; m -- ; for ( int i = 0 ; i < n / 2.0 ; i + + ) { xSum + = ( x [ n - i ] - x [ i ] ) * ( long ) ( n - 2 * i ) ; xSum = xSum % 1000000007l ; } long ySum = 0 ; for ( int i = 0 ; i < m / 2.0 ; i + + ) { ySum + = ( y [ m - i ] - y [ i ] ) * ( long ) ( m - 2 * i ) ; ySum = ySum % 1000000007l ; } long result = 0 ; result = xSum % 1000000007l ; result = ( result * ySum ) % 1000000007l ; System . out . println ( result ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long T1 = sc . nextLong ( ) , T2 = sc . nextLong ( ) ; long A1 = sc . nextLong ( ) , A2 = sc . nextLong ( ) ; long B1 = sc . nextLong ( ) , B2 = sc . nextLong ( ) ; long D1 = A1 - B1 , D2 = A2 - B2 ; if ( T1 * D1 + T2 * D2 = = 0 ) System . out . println ( " infinity " ) ; else if ( ( T1 * D1 > 0 ) = = ( T1 * D1 + T2 * D2 > 0 ) ) System . out . println ( 0 ) ; else { if ( D1 > 0 ) { D1 * = - 1 ; D2 * = - 1 ; } long cycleDistance = T1 * D1 + T2 * D2 ; long backLimit = Math . abs ( D1 * T1 ) ; System . out . println ( 2 * ( backLimit / cycleDistance ) + ( backLimit % cycleDistance = = 0 ? 0 : 1 ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String result = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { result = " Four " ; break ; } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int x = i ; int a = 0 ; while ( x % 2 = = 0 ) { x / = 2 ; a + + ; } if ( max < a ) { max = a ; ans = i ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int [ ] A = in . Int ( 3 ) ; Arrays . sort ( A ) ; int cost = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { cost + = ( A [ i ] - A [ i - 1 ] ) ; } out . println ( cost ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl = = null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } public int [ ] Int ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Int ( ) ; } return a ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int P = scanner . nextInt ( ) ; if ( P < = min ) { count + + ; min = P ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( e - a > k | | d - a > k | | c - a > k | | b - a > k ) { System . out . println ( " : ( " ) ; return ; } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int min = 200005 ; for ( int i = 0 ; i < n ; i + + ) { int val = sc . nextInt ( ) ; if ( val < min ) { + + count ; min = val ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { long a = N * h * n ; long b = 4 * h * n - N * n - N * h ; if ( b < = 0 ) continue ; if ( a % b = = 0 ) { System . out . printf ( " % d % d % d \ n " , h , n , a / b ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int array [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; Arrays . sort ( array ) ; if ( ( array [ 4 ] - array [ 0 ] ) < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int h = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; double a _ angle = h * ( 360 / 12 ) + m * 0.5 ; double b _ angle = m * ( 360 / 60 ) ; double c = a _ angle - b _ angle ; if ( c < 0 ) c + = 360 ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( c ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; scan . close ( ) ; int waru ; int max = 0 ; int cnt = 0 ; int max _ num = 1 ; while ( n > 0 ) { cnt = 0 ; waru = n ; while ( waru % 2 = = 0 ) { cnt + + ; waru = waru / 2 ; } if ( max < cnt ) { max = cnt ; max _ num = n ; } n -- ; } System . out . println ( max _ num ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( ( S - i - j ) < = K & & 0 < = ( S - i - j ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] num = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; + + i ) { int n = scanner . nextInt ( ) ; num [ n ] + + ; } if ( num [ 1 ] = = 1 & & num [ 9 ] = = 1 & & num [ 7 ] = = 1 & & num [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; List < Long > aList = new ArrayList < > ( ) ; List < Long > diffList = new ArrayList < > ( ) ; long sumA = 0 ; long sumB = 0 ; for ( long i = 0 ; i < n ; i + + ) { long a = sc . nextLong ( ) ; aList . add ( a ) ; sumA + = a ; } for ( long i = 0 ; i < n ; i + + ) { long b = sc . nextLong ( ) ; sumB + = b ; diffList . add ( b - aList . get ( ( int ) i ) ) ; } if ( sumA < sumB ) { System . out . println ( - 1 ) ; } else { Collections . sort ( diffList ) ; long totalNeed = diffList . stream ( ) . filter ( d - > d > 0 ) . mapToLong ( x - > x ) . sum ( ) ; long resultCount = diffList . stream ( ) . filter ( d - > d > 0 ) . mapToLong ( x - > x ) . count ( ) ; if ( totalNeed = = 0 ) { System . out . println ( 0 ) ; } else { for ( long i = 0 ; i < diffList . size ( ) ; i + + ) { long curSupplier = diffList . get ( ( int ) i ) ; totalNeed + = curSupplier ; resultCount + + ; if ( totalNeed < = 0 ) { break ; } } System . out . println ( resultCount ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ ] { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( a ) ; int cost = 0 ; cost + = a [ 1 ] - a [ 0 ] ; cost + = a [ 2 ] - a [ 1 ] ; System . out . println ( cost ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; for ( int i = n ; 0 < i ; i -- ) { int cnt = 0 ; for ( int j = 2 ; ; j * = 2 ) { if ( i % j = = 0 ) { cnt = j ; } else { break ; } } ans = Math . max ( ans , cnt ) ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 1 ; int count = 0 ; int x = 0 ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = n ; i + + ) { if ( i % 2 = = 0 ) { x = countHalf ( i ) ; if ( count < x ) { count = x ; ans = i ; } } } System . out . println ( ans ) ; sc . close ( ) ; } public static int countHalf ( int i ) { int count = 0 ; boolean a = true ; while ( a ) { if ( i % 2 = = 0 ) { i / = 2 ; count + + ; } else { a = false ; } } return count ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 0 ; int ans = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int x = i ; int y = 0 ; for ( int j = 1 ; j < = 100 ; j + + ) { if ( x % 2 ! = 0 ) { break ; } else { x = x / 2 ; y + = 1 ; } } max = Math . max ( max , y ) ; if ( max = = y ) { ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int counter = 0 ; double x = Math . log ( a ) / Math . log ( 2 ) ; int num = ( int ) x ; System . out . print ( ( int ) Math . pow ( 2 , num ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int k = 1 ; int now = 0 ; for ( int i = 1 ; i < n ; i + + ) { now = sc . nextInt ( ) ; if ( now < = min ) { min = now ; k + + ; } } System . out . println ( k ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i ; j < 5 ; j + + ) { if ( i = = j ) continue ; int dist = Math . abs ( antennas [ i ] - antennas [ j ] ) ; if ( dist > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str [ ] = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int h = Integer . parseInt ( str [ 2 ] ) ; int m = Integer . parseInt ( str [ 3 ] ) ; double mk = ( double ) ( m * 360 ) / 60 ; double hk = ( double ) ( h * 60 + m ) * 360 / ( 12 * 60 ) ; double sita = Math . abs ( mk - hk ) ; double cos = Math . cos ( ( double ) sita / 180 * Math . PI ) ; double naiseki = a * b * cos ; double ans = a * a + b * b - 2 * naiseki ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int res = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) res + + ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) , A2 = sc . nextInt ( ) , A3 = sc . nextInt ( ) ; sc . close ( ) ; int a1 = Math . abs ( A1 - A2 ) , a2 = Math . abs ( A2 - A3 ) , a3 = Math . abs ( A3 - A1 ) ; int max = Math . max ( a1 , Math . max ( a2 , a3 ) ) ; System . out . println ( a1 + a2 + a3 - max ) ; } } import java . util . Scanner ; public class Main { public static final String OK = " Yay ! " ; public static final String NO = " : ( " ; public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] abcde = new int [ 5 ] ; abcde [ 0 ] = sc . nextInt ( ) ; abcde [ 1 ] = sc . nextInt ( ) ; abcde [ 2 ] = sc . nextInt ( ) ; abcde [ 3 ] = sc . nextInt ( ) ; abcde [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { int idx = i ; for ( int j = 0 ; j < 5 ; j + + ) { int p = abcde [ idx ] ; int q = abcde [ j ] ; if ( i ! = j & & Math . abs ( p - q ) > k ) { System . out . println ( NO ) ; return ; } } } System . out . println ( OK ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; String line ; ArrayList < Integer > n = new ArrayList < Integer > ( ) ; for ( int i = 0 ; cin . hasNext ( ) ; i + + ) { line = cin . nextLine ( ) ; if ( i = = 0 ) { String [ ] _ n = line . split ( " " , 0 ) ; for ( int j = 0 ; j < 4 ; j + + ) { n . add ( Integer . parseInt ( _ n [ j ] ) ) ; } } else { } } Collections . sort ( n ) ; String res = " NO " ; if ( n . get ( 0 ) = = 1 & & n . get ( 1 ) = = 4 & & n . get ( 2 ) = = 7 & & n . get ( 3 ) = = 9 ) { res = " YES " ; } System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Integer N [ ] = new Integer [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { N [ i ] = sc . nextInt ( ) ; } if ( Arrays . asList ( N ) . contains ( 1 ) & & Arrays . asList ( N ) . contains ( 7 ) & & Arrays . asList ( N ) . contains ( 9 ) & & Arrays . asList ( N ) . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , h = sc . nextInt ( ) , m = sc . nextInt ( ) ; final double ji = 0.5 , fun = 6.0 ; double now _ ji = ji * ( h * 60 + m ) , now _ fun = fun * m ; if ( now _ ji = = now _ fun ) { System . out . println ( Math . abs ( a - b ) ) ; } else { double dis = Math . abs ( now _ ji - now _ fun ) * Math . PI / 180 ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( dis ) ) ; System . out . printf ( " % .10f \ n " , ans ) ; } } } import java . io . * ; import java . util . * ; class Main { static final long MOD = 1000000007 ; static long f ( long [ ] a ) { int n = a . length ; long ans = 0 ; for ( int i = 0 ; i < n ; + + i ) { a [ i ] % = MOD ; if ( a [ i ] < 0 ) a [ i ] + = MOD ; long f = ( 2 * i - n + 1 + MOD ) % MOD ; ans = ( ans + f * a [ i ] ) % MOD ; } return ans ; } public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long [ ] x = new long [ n ] , y = new long [ m ] ; for ( int i = 0 ; i < n ; + + i ) x [ i ] = sc . nextLong ( ) ; for ( int i = 0 ; i < m ; + + i ) y [ i ] = sc . nextLong ( ) ; out . println ( f ( x ) * f ( y ) % MOD ) ; out . close ( ) ; } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; double A = scn . nextInt ( ) ; double B = scn . nextInt ( ) ; double H = scn . nextInt ( ) ; double M = scn . nextInt ( ) ; double hx = A * Math . cos ( Math . PI * 2 * ( H * 60 + M ) / 720.0 ) ; double hy = A * Math . sin ( Math . PI * 2 * ( H * 60 + M ) / 720.0 ) ; double mx = B * Math . cos ( Math . PI * 2 * M / 60.0 ) ; double my = B * Math . sin ( Math . PI * 2 * M / 60.0 ) ; double L = Math . sqrt ( ( hx - mx ) * ( hx - mx ) + ( hy - my ) * ( hy - my ) ) ; System . out . println ( L ) ; } } import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; map . put ( a , map . getOrDefault ( a , 0 ) + 1 ) ; map . put ( b , map . getOrDefault ( b , 0 ) + 1 ) ; map . put ( c , map . getOrDefault ( c , 0 ) + 1 ) ; if ( map . get ( 5 ) = = 2 & & map . get ( 7 ) = = 1 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } } import java . util . Scanner ; import java . util . Stack ; public class Main { final int [ ] [ ] dir = { { - 1 , - 1 } , { - 1 , 1 } , { 1 , - 1 } , { 1 , 1 } } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = readInt ( sc ) ; int s = readInt ( sc ) ; int cnt = 0 ; for ( int a = 0 ; a < = k ; a + + ) { for ( int b = 0 ; b < = k ; b + + ) { int c = s - a - b ; if ( c > = 0 & & c < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } static int readInt ( Scanner sc ) { return Integer . parseInt ( sc . next ( ) ) ; } static double calcDistance ( Pair p1 , Pair p2 ) { return Math . pow ( Math . pow ( p1 . getX ( ) - p2 . getX ( ) , 2 ) + Math . pow ( p1 . getY ( ) - p2 . getY ( ) , 2 ) , 0.5 ) ; } } class Pair { private int x ; private int y ; public int getX ( ) { return x ; } public void setX ( int x ) { this . x = x ; } public int getY ( ) { return y ; } public void setY ( int y ) { this . y = y ; } public Pair ( ) { } public Pair ( int x , int y ) { this . x = x ; this . y = y ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; e = scan . nextInt ( ) ; e = scan . nextInt ( ) ; e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] input = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( input [ 0 ] ) ; int s = Integer . parseInt ( input [ 1 ] ) ; int x = 0 ; int y = 0 ; int z = 0 ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { x = i ; for ( int j = 0 ; j < = k ; j + + ) { y = j ; int rest = s - x - y ; if ( rest > = 0 & & rest < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; long ans = 2 ; for ( int i = 0 ; i < x ; i + + ) { ans = ans * 2 + 2 ; } 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 ( ) ; long count = 0 ; int price = 1 ; for ( int i = 0 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; if ( x = = price ) { price + + ; continue ; } int d = ( x - 1 ) / price ; count + = d ; if ( price = = 1 ) { price + + ; } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( arr ) ; int [ ] ok = { 1 , 4 , 7 , 9 } ; System . out . println ( Arrays . equals ( arr , ok ) ? " YES " : " NO " ) ; } } import java . math . BigDecimal ; import java . nio . ByteBuffer ; 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ans = 0.0D ; if ( h = = 0 & & m = = 0 ) { ans = Math . max ( a , b ) - Math . min ( a , b ) ; System . out . println ( ans ) ; } else { double kakudo1 = 30.0 * h + 0.5 * m ; double kakudo2 = 6.0 * m ; if ( kakudo1 = = 0 ) kakudo1 = 360.0 ; if ( kakudo2 = = 0 ) kakudo2 = 360.0 ; double kakudo3 = Math . max ( kakudo1 , kakudo2 ) - Math . min ( kakudo1 , kakudo2 ) ; double aa = Math . sqrt ( ( Math . pow ( a , 2.0 ) ) + ( Math . pow ( b , 2.0 ) ) - ( 2 * a * b * Math . cos ( Math . toRadians ( kakudo3 ) ) ) ) ; System . out . println ( BigDecimal . valueOf ( aa ) ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 1 ; for ( ; result < = N ; result * = 2 ) { } System . out . println ( result / 2 ) ; } } import java . util . Scanner ; public class Main { public static double pie = 3.14159265358979323846264338327950 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double rad = pie * 2 * ( ( double ) h / 12.0 + ( ( double ) m / 60.0 ) / 12.0 - ( double ) m / 60.0 ) ; double rsq = ( ( double ) ( a * a + b * b ) - ( double ) ( 2 * a * b ) * Math . cos ( rad ) ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int min = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; int c = input . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) System . out . println ( " YES " ) ; else if ( a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else if ( a = = 5 & & b = = 7 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } ; if ( Arrays . asList ( s ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { static int [ ] [ ] mat = new int [ 3 ] [ 3 ] ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i , j ; for ( i = 0 ; i < 3 ; i + + ) { for ( j = 0 ; j < 3 ; j + + ) { mat [ i ] [ j ] = sc . nextInt ( ) ; } } System . out . println ( ( mat [ 0 ] [ 0 ] - mat [ 0 ] [ 1 ] = = mat [ 1 ] [ 0 ] - mat [ 1 ] [ 1 ] & & mat [ 1 ] [ 0 ] - mat [ 1 ] [ 1 ] = = mat [ 2 ] [ 0 ] - mat [ 2 ] [ 1 ] & & mat [ 0 ] [ 1 ] - mat [ 0 ] [ 2 ] = = mat [ 1 ] [ 1 ] - mat [ 1 ] [ 2 ] & & mat [ 1 ] [ 1 ] - mat [ 1 ] [ 2 ] = = mat [ 2 ] [ 1 ] - mat [ 2 ] [ 2 ] & & mat [ 0 ] [ 0 ] - mat [ 1 ] [ 0 ] = = mat [ 0 ] [ 1 ] - mat [ 1 ] [ 1 ] & & mat [ 0 ] [ 1 ] - mat [ 1 ] [ 1 ] = = mat [ 0 ] [ 2 ] - mat [ 1 ] [ 2 ] & & mat [ 1 ] [ 0 ] - mat [ 2 ] [ 0 ] = = mat [ 1 ] [ 1 ] - mat [ 2 ] [ 1 ] & & mat [ 1 ] [ 1 ] - mat [ 2 ] [ 1 ] = = mat [ 1 ] [ 2 ] - mat [ 2 ] [ 2 ] ) ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; boolean b = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } loop : for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { if ( c [ i ] [ 0 ] - c [ j ] [ 0 ] = = c [ i ] [ 1 ] - c [ j ] [ 1 ] & & c [ i ] [ 1 ] - c [ j ] [ 1 ] = = c [ i ] [ 2 ] - c [ j ] [ 2 ] ) { } else { b = false ; break loop ; } } } loop : for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { if ( c [ 0 ] [ i ] - c [ 0 ] [ j ] = = c [ 1 ] [ i ] - c [ 1 ] [ j ] & & c [ 1 ] [ i ] - c [ 1 ] [ j ] = = c [ 2 ] [ i ] - c [ 2 ] [ j ] ) { } else { b = false ; break loop ; } } } if ( b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long suma = 0 ; long sumb = 0 ; long minus = 0 ; ArrayList < Long > list = new ArrayList < Long > ( ) ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; suma + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; sumb + = b [ i ] ; } if ( suma < sumb ) { System . out . println ( - 1 ) ; return ; } long ret = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < b [ i ] ) { minus + = b [ i ] - a [ i ] ; ret + + ; } else { list . add ( ( a [ i ] - b [ i ] ) ) ; } } if ( list . size ( ) = = n ) { System . out . println ( 0 ) ; return ; } Collections . sort ( list , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i + + ) { ret + + ; if ( list . get ( i ) > = minus ) { break ; } minus - = list . get ( i ) ; } System . out . println ( ret ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int ans = 0 , min = n ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < = min ) { ans + + ; min = p [ i ] ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner stdin = new Scanner ( System . in ) ; int inN = stdin . nextInt ( ) ; String result = " Three " ; for ( int i = 0 ; i < inN ; i + + ) { if ( stdin . next ( ) . equals ( " Y " ) ) { result = " Four " ; break ; } } System . out . println ( result ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int ab [ ] = new int [ 3 ] ; ab [ 0 ] = scan . nextInt ( ) ; ab [ 1 ] = scan . nextInt ( ) ; ab [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( ab ) ; if ( ab [ 0 ] = = 5 & & ab [ 1 ] = = 5 & & ab [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int N = sc . nextInt ( ) ; if ( N = = 1 ) n [ 0 ] + + ; else if ( N = = 9 ) n [ 1 ] + + ; else if ( N = = 7 ) n [ 2 ] + + ; else if ( N = = 4 ) n [ 3 ] + + ; } if ( n [ 0 ] = = 1 & & n [ 1 ] = = 1 & & n [ 2 ] = = 1 & & n [ 3 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int five = 2 ; int seven = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { int moji = scan . nextInt ( ) ; if ( moji = = 5 ) { five - = 1 ; } else if ( moji = = 7 ) { seven - = 1 ; } } if ( five = = 0 & & seven = = 0 ) { System . out . print ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( sc . nextInt ( ) ) { case 5 : five + + ; break ; case 7 : seven + + ; } } if ( five ! = 2 | | seven ! = 1 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = 3 * K & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double rad = Math . abs ( H * 30 + M * 0.5 - M * 6 ) ; if ( rad > = 180 ) { rad = 360 - rad ; } double C = 0 ; C = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( rad ) ) ; System . out . println ( Math . pow ( C , 0.5 ) ) ; } } import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int [ ] ns = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { ns [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ns ) ; if ( ns [ 0 ] = = 1 & & ns [ 1 ] = = 4 & & ns [ 2 ] = = 7 & & ns [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } 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 [ ] sa = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( sa [ 0 ] ) ; int m = Integer . parseInt ( sa [ 1 ] ) ; sa = br . readLine ( ) . split ( " " ) ; long [ ] x = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = Integer . parseInt ( sa [ i ] ) ; } sa = br . readLine ( ) . split ( " " ) ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < m ; i + + ) { y [ i ] = Integer . parseInt ( sa [ i ] ) ; } br . close ( ) ; int mod = 1000000007 ; long xx = 0 ; for ( int i = 0 ; i < n ; i + + ) { xx + = i * x [ i ] - ( n - i - 1 ) * x [ i ] ; xx % = mod ; } long yy = 0 ; for ( int i = 0 ; i < m ; i + + ) { yy + = i * y [ i ] - ( m - i - 1 ) * y [ i ] ; yy % = mod ; } long ans = xx * yy % mod ; if ( ans < 0 ) { ans + = mod ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) ; int A2 = sc . nextInt ( ) ; int A3 = sc . nextInt ( ) ; int max = Math . max ( A1 , Math . max ( A2 , A3 ) ) ; int min = Math . min ( A1 , Math . min ( A2 , A3 ) ) ; System . out . println ( max - min ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a + b > 0 ) { System . out . println ( " 1 " ) ; } else if ( a + b < 0 ) { System . out . println ( " -1 " ) ; } else { System . out . println ( " 0 " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long [ ] dif = new long [ n ] ; long suma = 0 ; long sumb = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; suma + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; sumb + = b [ i ] ; dif [ i ] = a [ i ] - b [ i ] ; } if ( suma < sumb ) { System . out . println ( - 1 ) ; return ; } Arrays . sort ( dif ) ; long csum = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( dif [ i ] < 0 ) { csum + = dif [ i ] ; ans + + ; } else { break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( csum > = 0 ) break ; csum + = dif [ n - 1 - i ] ; ans + + ; if ( csum > = 0 ) break ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; int max = 0 ; int min = 100000000 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int M = Integer . parseInt ( sc . next ( ) ) ; if ( M > max ) { max = M ; } if ( M < = min ) { min = M ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 , a2 , a3 , b1 , b2 , b3 ; boolean fans = false ; for ( int i = 0 ; i < = 100 ; i + + ) { boolean ans = true ; a1 = i ; b1 = c [ 0 ] [ 0 ] - i ; b2 = c [ 1 ] [ 0 ] - a1 ; b3 = c [ 2 ] [ 0 ] - a1 ; a2 = c [ 0 ] [ 1 ] - b1 ; a3 = c [ 0 ] [ 2 ] - b1 ; if ( a1 < 0 | | b1 < 0 | | a2 < 0 | | a3 < 0 | | b2 < 0 | | b3 < 0 ) ans = false ; if ( b2 + a2 ! = c [ 1 ] [ 1 ] ) ans = false ; if ( b2 + a3 ! = c [ 1 ] [ 2 ] ) ans = false ; if ( b3 + a2 ! = c [ 2 ] [ 1 ] ) ans = false ; if ( b3 + a3 ! = c [ 2 ] [ 2 ] ) ans = false ; if ( ans ) fans = true ; } if ( fans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double rad = Math . PI * 2 * ( h / 12.0 + ( m / 60.0 ) / 12.0 - m / 60.0 ) ; double rsq = Math . sqrt ( ( a * a + b * b ) - ( 2 * a * b ) * Math . cos ( rad ) ) ; System . out . printf ( " % .20f " , rsq ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; long num = 1 ; long n = 1 ; if ( N = = 1 ) { System . out . println ( P ) ; return ; } for ( long i = 1 ; n < = P ; i + + ) { if ( P % n = = 0 ) { num = i ; } n = ( long ) Math . pow ( i + 1 , N ) ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] f = new int [ 4 ] ; for ( int i = 0 ; i < n ; i + + ) { String a = sc . next ( ) ; if ( a . equals ( " P " ) ) f [ 0 ] = 1 ; if ( a . equals ( " W " ) ) f [ 1 ] = 1 ; if ( a . equals ( " G " ) ) f [ 2 ] = 1 ; if ( a . equals ( " Y " ) ) f [ 3 ] = 1 ; } sc . close ( ) ; int cnt = 0 ; for ( int i = 0 ; i < 4 ; i + + ) cnt + = f [ i ] ; System . out . println ( cnt = = 3 ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer input = new Integer ( scanner . next ( ) ) ; Integer count = 0 ; Integer data = 2 ; while ( input > = data ) { data = data * 2 ; count + + ; } System . out . println ( data / 2 ) ; scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " P " ) ) { count + + ; break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " W " ) ) { count + + ; break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " G " ) ) { count + + ; break ; } } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " Y " ) ) { count + + ; break ; } } if ( count = = 3 ) { System . out . println ( " Three " ) ; } else if ( count = = 4 ) { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n > = 64 ) { System . out . println ( 64 ) ; } else if ( n > = 32 ) { System . out . println ( 32 ) ; } else if ( n > = 16 ) { System . out . println ( 16 ) ; } else if ( n > = 8 ) { System . out . println ( 8 ) ; } else if ( n > = 4 ) { System . out . println ( 4 ) ; } else if ( n > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n > = 64 ) { System . out . println ( 64 ) ; } else if ( n > = 32 ) { System . out . println ( 32 ) ; } else if ( n > = 16 ) { System . out . println ( 16 ) ; } else if ( n > = 8 ) { System . out . println ( 8 ) ; } else if ( n > = 4 ) { System . out . println ( 4 ) ; } else if ( n > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int want = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int m = 0 ; m < = k ; m + + ) { if ( want - i - m < = k & & want - i - m > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int cnt = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( S - X - Y < = K & & S - X - Y > = 0 ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int a = sc . nextInt ( ) ; if ( a = = 1 ) { System . out . println ( 1 ) ; return ; } int result = 0 ; int max = 0 ; for ( int i = 1 ; i < = a ; i + + ) { int tmp = i ; for ( int j = 1 ; j < 8 ; j + + ) { if ( tmp % 2 = = 0 ) { tmp / = 2 ; } else { if ( max < j - 1 ) { result = i ; max = j - 1 ; } break ; } } } System . out . println ( result ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( ( S - x - y > = 0 ) & & ( S - x - y < = K ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int row = 1 ; row < = 3 ; row + + ) { for ( int col = 1 ; col < = 3 ; col + + ) { c [ row ] [ col ] = sc . nextInt ( ) ; } } String ans = " Yes " ; for ( int col = 2 ; col < = 3 ; col + + ) { int cur = c [ 1 ] [ 1 ] - c [ 1 ] [ col ] ; int d1 = c [ 2 ] [ 1 ] - c [ 2 ] [ col ] ; int d2 = c [ 3 ] [ 1 ] - c [ 3 ] [ col ] ; if ( cur ! = d1 | | cur ! = d2 ) ans = " No " ; } if ( ! ( c [ 1 ] [ 2 ] - c [ 1 ] [ 3 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 3 ] & & c [ 1 ] [ 2 ] - c [ 1 ] [ 3 ] = = c [ 3 ] [ 2 ] - c [ 3 ] [ 3 ] ) ) ans = " No " ; for ( int row = 2 ; row < = 3 ; row + + ) { int cur = c [ 1 ] [ 1 ] - c [ row ] [ 1 ] ; int d1 = c [ 1 ] [ 2 ] - c [ row ] [ 2 ] ; int d2 = c [ 1 ] [ 3 ] - c [ row ] [ 3 ] ; if ( cur ! = d1 | | cur ! = d2 ) ans = " No " ; } if ( ! ( c [ 2 ] [ 1 ] - c [ 3 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 3 ] [ 2 ] & & c [ 2 ] [ 1 ] - c [ 3 ] [ 1 ] = = c [ 2 ] [ 3 ] - c [ 3 ] [ 3 ] ) ) ans = " No " ; System . out . println ( ans ) ; } } import java . util . * ; import java . util . HashSet ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > colors = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { colors . add ( sc . next ( ) ) ; } if ( colors . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int kyori [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { kyori [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = kyori [ 4 ] - kyori [ 0 ] ; if ( max < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double angleMinute = ( ( double ) m ) * 6 ; double angleHours = ( ( ( double ) h ) * 60 + m ) / 2 ; double diff = Math . abs ( angleHours - angleMinute ) ; diff = diff > 180 ? 360 - diff : diff ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( diff * ( Math . PI / 180 ) ) ) ; System . out . println ( String . format ( " % .16f " , result ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double shortradian = ( double ) h * 30 + ( double ) m * 0.5 ; double y1 = Math . cos ( Math . toRadians ( shortradian ) ) * a ; double x1 = Math . tan ( Math . toRadians ( shortradian ) ) * y1 ; double longradian = ( double ) m * 6 ; double y2 = Math . cos ( Math . toRadians ( longradian ) ) * b ; double x2 = Math . tan ( Math . toRadians ( longradian ) ) * y2 ; double tmp = Math . sqrt ( ( y1 - y2 ) * ( y1 - y2 ) + ( x1 - x2 ) * ( x1 - x2 ) ) ; System . out . println ( tmp ) ; } } import java . util . * ; import java . io . * ; import java . util . * ; import java . io . * ; public class Main { public static long sum ( long [ ] array ) { long ans = 0 ; for ( long e : array ) ans + = e ; return ans ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; for ( int n = 0 ; n < N ; n + + ) A [ n ] = sc . nextLong ( ) ; for ( int n = 0 ; n < N ; n + + ) B [ n ] = sc . nextLong ( ) ; if ( sum ( A ) < sum ( B ) ) { System . out . println ( " -1 " ) ; return ; } int notEnoughStudy = 0 ; long extraStudy = 0 ; PriorityQueue < Long > margin = new PriorityQueue < > ( ) ; for ( int n = 0 ; n < N ; n + + ) { if ( A [ n ] < B [ n ] ) { notEnoughStudy + + ; extraStudy + = ( B [ n ] - A [ n ] ) ; } else { margin . add ( B [ n ] - A [ n ] ) ; } } int decrease = 0 ; while ( extraStudy > 0 ) { extraStudy + = margin . poll ( ) ; decrease + + ; } System . out . println ( notEnoughStudy + decrease ) ; } } import java . util . * ; class Main { static int [ ] [ ] c ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; a [ 3 ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; String ans = ( a [ 0 ] = = 1 & & a [ 1 ] = = 4 & & a [ 2 ] = = 7 & & a [ 3 ] = = 9 ) ? " YES " : " NO " ; System . out . println ( ans ) ; } } import java . util . * ; import java . util . HashSet ; import java . util . Map ; import java . util . HashMap ; import java . util . ArrayList ; import java . util . List ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . lang . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } long gcd ( long a , long b ) { if ( b = = 0 ) { return a ; } return gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { FastReader ob = new FastReader ( ) ; int arr [ ] = new int [ 100 ] ; arr [ ob . nextInt ( ) ] + + ; arr [ ob . nextInt ( ) ] + + ; arr [ ob . nextInt ( ) ] + + ; if ( arr [ 5 ] = = 2 & & arr [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; sc . close ( ) ; for ( int i = Math . max ( 0 , s - 2 * k ) ; i < = Math . min ( k , s ) ; i + + ) { for ( int j = Math . max ( 0 , s - i - k ) ; j < = Math . min ( k , s - i ) ; j + + ) { if ( ( s - i - j ) > = 0 & & ( s - i - j ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { Map < Integer , Integer > map = new HashMap < > ( ) ; IntStream . range ( 0 , N ) . forEach ( i - > { int a = scanner . nextInt ( ) ; map . put ( a , map . getOrDefault ( a , 0 ) + 1 ) ; } ) ; System . out . println ( ( ( 2 = = map . getOrDefault ( 5 , 0 ) ) & & ( 1 = = map . getOrDefault ( 7 , 0 ) ) ) ? " YES " : " NO " ) ; } } } import javax . print . DocFlavor ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . nio . charset . StandardCharsets ; import java . util . * ; import java . util . function . BiConsumer ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; ArrayList set = new ArrayList ( ) ; set . add ( sc . next ( ) ) ; set . add ( sc . next ( ) ) ; set . add ( sc . next ( ) ) ; set . add ( sc . next ( ) ) ; set . remove ( " 1 " ) ; set . remove ( " 9 " ) ; set . remove ( " 7 " ) ; set . remove ( " 4 " ) ; String ans = " NO " ; if ( set . size ( ) = = 0 ) { ans = " YES " ; } 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 ( ) ; int answer = 1 ; while ( n > = answer ) { answer * = 2 ; } System . out . println ( answer / 2 ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( str [ 0 ] ) ; int b = Integer . parseInt ( str [ 1 ] ) ; int h = Integer . parseInt ( str [ 2 ] ) ; int m = Integer . parseInt ( str [ 3 ] ) ; double hour = ( h * 30 ) + ( m * 0.5 ) ; double min = m * 6 ; double anglediff = Math . abs ( hour - min ) ; double ans = 0 ; double sqrt = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( anglediff ) ) ; System . out . println ( Math . sqrt ( sqrt ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = - 100 ; i < = 100 ; i + + ) { for ( int j = - 100 ; j < = 100 ; j + + ) { for ( int k = - 100 ; k < = 100 ; k + + ) { int [ ] b = new int [ 3 ] ; b [ 0 ] = c [ 0 ] [ 0 ] - i ; b [ 1 ] = c [ 1 ] [ 1 ] - j ; b [ 2 ] = c [ 2 ] [ 2 ] - k ; if ( i + b [ 0 ] = = c [ 0 ] [ 0 ] & & i + b [ 1 ] = = c [ 0 ] [ 1 ] & & i + b [ 2 ] = = c [ 0 ] [ 2 ] & & j + b [ 0 ] = = c [ 1 ] [ 0 ] & & j + b [ 1 ] = = c [ 1 ] [ 1 ] & & j + b [ 2 ] = = c [ 1 ] [ 2 ] & & k + b [ 0 ] = = c [ 2 ] [ 0 ] & & k + b [ 1 ] = = c [ 2 ] [ 1 ] & & k + b [ 2 ] = = c [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveC ( ) ; } private void solveC ( ) { Scanner sc = new Scanner ( System . in ) ; final long MOD = 1000000007 ; long N = sc . nextInt ( ) ; long M = sc . nextInt ( ) ; if ( N - M > 1 | | M - N > 1 ) { System . out . println ( 0 ) ; } else { if ( N = = M ) { System . out . println ( 2 * perm ( N , MOD ) * perm ( N , MOD ) % MOD ) ; } else { System . out . println ( perm ( N , MOD ) * perm ( M , MOD ) % MOD ) ; } } } private long perm ( long N , long mod ) { long mul = 1L ; for ( ; N > 0 ; N -- ) { mul = ( mul * N ) % mod ; } return mul ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = stdIn . nextInt ( ) ; if ( a [ i ] = = 5 ) count5 + = 1 ; else if ( a [ i ] = = 7 ) count7 + = 1 ; } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] ary = { a , b , c } ; Arrays . sort ( ary ) ; System . out . println ( ( ary [ 0 ] = = 5 & & ary [ 1 ] = = 5 & & ary [ 2 ] = = 7 ) ? " YES " : " NO " ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ ] { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( array ) ; if ( array [ 0 ] = = 5 & & array [ 1 ] = = 5 & & array [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String moji = sc . nextLine ( ) ; String [ ] moji2 = moji . split ( " " ) ; int [ ] moji3 = new int [ 3 ] ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { moji3 [ i ] = Integer . parseInt ( moji2 [ i ] ) ; } for ( int j = 0 ; j < 3 ; j + + ) { if ( moji3 [ j ] = = 5 ) { five + + ; } else if ( moji3 [ j ] = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int P [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int ok = Integer . MAX _ VALUE ; int count = 0 ; for ( int j = 0 ; j < N ; j + + ) { ok = Math . min ( ok , P [ j ] ) ; if ( ok = = P [ j ] ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int fiveCount = 0 , sevenCount = 0 ; if ( A = = 5 ) { fiveCount + + ; } if ( A = = 7 ) { sevenCount + + ; } if ( B = = 5 ) { fiveCount + + ; } if ( B = = 7 ) { sevenCount + + ; } if ( C = = 5 ) { fiveCount + + ; } if ( C = = 7 ) { sevenCount + + ; } System . out . println ( ( fiveCount = = 2 & & sevenCount = = 1 ) ? " YES " : " NO " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int num = in . nextInt ( ) ; int i ; for ( i = 1 ; i < = num ; i < < = 1 ) { if ( i > num ) { break ; } } out . println ( i / 2 ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int k , s ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { long count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; String str = sc . nextLine ( ) ; str = sc . nextLine ( ) ; sc . close ( ) ; if ( str . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; int result = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { result = result + Math . abs ( A [ i - 1 ] - A [ i ] ) ; } System . out . println ( result ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int short _ hand = in . nextInt ( ) ; int long _ hand = in . nextInt ( ) ; int hour = in . nextInt ( ) ; int minutes = in . nextInt ( ) ; double pai = Math . PI ; double x = Math . abs ( hour * pai / 6 + minutes * pai / 360 - minutes * pai / 30 ) ; double cos _ x = Math . cos ( x ) ; double result _ pow2 = short _ hand * short _ hand + long _ hand * long _ hand - 2 * short _ hand * long _ hand * cos _ x ; double result = 1.0 ; while ( Math . abs ( result - result _ pow2 / result ) > 1e-10 ) { result = ( result + result _ pow2 / result ) / 2 ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; int [ ] c = new int [ n ] ; long bwa = 0 ; long awa = 0 ; long lost = 0 ; int yono = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; awa + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; bwa + = b [ i ] ; c [ i ] = a [ i ] - b [ i ] ; if ( c [ i ] < 0 ) { lost - = c [ i ] ; yono + + ; } } sc . close ( ) ; if ( bwa > awa ) { System . out . println ( - 1 ) ; } else { int cha = 0 ; Arrays . sort ( c ) ; while ( lost > 0 ) { cha + + ; lost - = c [ n - cha ] ; } System . out . println ( cha + yono ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] a _ str = in . readLine ( ) . split ( " " ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = Integer . parseInt ( a _ str [ 0 ] ) ; a [ 1 ] = Integer . parseInt ( a _ str [ 1 ] ) ; a [ 2 ] = Integer . parseInt ( a _ str [ 2 ] ) ; int min = Math . min ( Math . min ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; int sum = a [ 0 ] + a [ 1 ] + a [ 2 ] ; int max = Math . max ( Math . max ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; System . out . println ( max - ( sum - min - max ) + ( sum - min - max ) - min ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] costArray = { scanner . nextInt ( ) , scanner . nextInt ( ) , scanner . nextInt ( ) } ; Arrays . sort ( costArray ) ; int ans = 0 + Math . abs ( costArray [ 1 ] - costArray [ 0 ] ) + Math . abs ( costArray [ 2 ] - costArray [ 1 ] ) ; System . out . println ( ans ) ; scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 7 | | B = = 7 | | C = = 7 ) { if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( B = = 7 ) { if ( C = = 5 & & A = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( C = = 7 ) { if ( A = = 5 & & B = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { } } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Character > set = new HashSet < Character > ( ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; char c = s . charAt ( 0 ) ; set . add ( c ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int n4 = sc . nextInt ( ) ; sc . close ( ) ; int [ ] r = new int [ 10 ] ; r [ n1 ] + + ; r [ n2 ] + + ; r [ n3 ] + + ; r [ n4 ] + + ; System . out . println ( r [ 1 ] = = 1 & & r [ 4 ] = = 1 & & r [ 7 ] = = 1 & & r [ 9 ] = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int number = scanner . nextInt ( ) ; if ( number = = 5 ) { five = five + 1 ; } else if ( number = = 7 ) { seven = seven + 1 ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int maxNum = scan . nextInt ( ) ; int sum = scan . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = maxNum ; + + x ) { for ( int y = 0 ; y < = maxNum ; + + y ) { int z = sum - x - y ; if ( 0 < = z & & z < = maxNum ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) , s = sc . nextInt ( ) , t = 0 ; Map < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { m . put ( i + j , m . get ( i + j ) = = null ? 1 : m . get ( i + j ) + 1 ) ; } } for ( int k = 0 ; k < = K ; k + + ) if ( m . containsKey ( s - k ) ) t + = m . get ( s - k ) ; System . out . println ( t ) ; sc . close ( ) ; } public static void main ( String args [ ] ) { solve ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = Integer . parseInt ( stdIn . next ( ) ) ; int [ ] p = new int [ n ] ; p [ 0 ] = Integer . parseInt ( stdIn . next ( ) ) ; int min = p [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( stdIn . next ( ) ) ; if ( min > p [ i ] ) { min = p [ i ] ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) y [ i ] = a [ 0 ] [ i ] ; x [ 1 ] = a [ 1 ] [ 0 ] - y [ 0 ] ; x [ 2 ] = a [ 2 ] [ 0 ] - y [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; public class Main { public static void main ( String [ ] args ) throws Exception { String [ ] lines = Io . read ( ) ; int [ ] parsed = parse ( lines ) ; int a = parsed [ 0 ] ; int e = parsed [ 4 ] ; int k = parsed [ 5 ] ; if ( e - a > k ) { Io . write ( " : ( " ) ; } else { Io . write ( " Yay ! " ) ; } } private static int [ ] parse ( String [ ] lines ) { int [ ] parsed = new int [ lines . length ] ; for ( int i = 0 ; i < lines . length ; i + + ) { parsed [ i ] = Integer . parseInt ( ( lines [ i ] ) ) ; } return parsed ; } } class Io { public static String [ ] read ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < String > inputs = new ArrayList < > ( ) ; String line ; while ( ( line = br . readLine ( ) ) ! = null ) { if ( line . equals ( " " ) ) break ; inputs . add ( line ) ; } br . close ( ) ; return inputs . toArray ( new String [ 0 ] ) ; } public static void write ( String answer ) { System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int rs = 2 ; int N = scan . nextInt ( ) ; for ( int i = 0 ; i < 7 ; i + + ) { if ( N = = 1 ) break ; if ( N < rs ) break ; rs = rs * 2 ; } if ( N = = 1 ) System . out . println ( 1 ) ; else System . out . println ( rs / 2 ) ; scan . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String iShortNeedle = sc . next ( ) ; String iLongNeedle = sc . next ( ) ; String h = sc . next ( ) ; String m = sc . next ( ) ; double hour = Double . parseDouble ( h ) ; double min = Double . parseDouble ( m ) ; double wholeMin = ( hour * 60 ) + min ; double shortNeedle = Double . parseDouble ( iShortNeedle ) ; double longNeedle = Double . parseDouble ( iLongNeedle ) ; double shortAngleByOneMin = ( 360.0 / 12.0 ) / 60.0 ; double longAngleByOneMin = 360.0 / 60.0 ; double rHour = 0 ; double rMin = 0 ; if ( wholeMin ! = 0 ) { rHour = shortAngleByOneMin * wholeMin ; } if ( min ! = 0 ) { rMin = longAngleByOneMin * min ; } double diffAngle = Math . abs ( rHour - rMin ) ; double aLength = 0 ; if ( diffAngle ! = 0 | | diffAngle ! = 180 ) { aLength = Math . sqrt ( Math . pow ( shortNeedle , 2 ) + Math . pow ( longNeedle , 2 ) - 2 * shortNeedle * longNeedle * Math . cos ( Math . toRadians ( diffAngle ) ) ) ; } else if ( diffAngle = = 0 ) { aLength = longNeedle - shortNeedle ; } else if ( diffAngle = = 180 ) { aLength = longNeedle + shortNeedle ; } System . out . println ( aLength ) ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int arare = scn . nextInt ( ) ; int count = 0 ; String [ ] arares = new String [ arare ] ; for ( int i = 0 ; i < arare ; i + + ) { arares [ i ] = scn . next ( ) ; } List < String > listA = Arrays . asList ( arares ) ; List < String > listB = new ArrayList < String > ( new HashSet < > ( listA ) ) ; for ( int j = 0 ; j < listB . size ( ) ; j + + ) { if ( listB . contains ( " P " ) ) count + + ; else if ( listB . contains ( " W " ) ) count + + ; else if ( listB . contains ( " G " ) ) count + + ; else if ( listB . contains ( " Y " ) ) count + + ; } if ( count = = 3 ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; try { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < 2 ; i + + ) { if ( ! check _ h ( c , i ) ) { System . out . println ( " No " ) ; return ; } } for ( int j = 0 ; j < 2 ; j + + ) { if ( ! check _ v ( c , j ) ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } finally { scanner . close ( ) ; } } private static boolean check _ v ( int [ ] [ ] c , int j ) { for ( int i = 0 ; i < 2 ; i + + ) { if ( c [ i ] [ j + 1 ] - c [ i ] [ j ] ! = c [ i + 1 ] [ j + 1 ] - c [ i + 1 ] [ j ] ) return false ; } return true ; } private static boolean check _ h ( int [ ] [ ] c , int i ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( c [ i + 1 ] [ j ] - c [ i ] [ j ] ! = c [ i + 1 ] [ j + 1 ] - c [ i ] [ j + 1 ] ) return false ; } return true ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angle = Math . abs ( h * 30 + m * 0.5 - m * 6 ) ; double result = Math . cos ( Math . toRadians ( angle ) ) ; double x = a * a + b * b - 2 * a * b * result ; double ans = Math . sqrt ( x ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = s . nextInt ( ) ; } } int flag = 0 ; for ( int i = 0 ; i < 2 ; i + + ) { if ( ( arr [ i ] [ 0 ] - arr [ i ] [ 1 ] ) ! = ( arr [ i + 1 ] [ 0 ] - arr [ i + 1 ] [ 1 ] ) ) flag = 1 ; if ( ( arr [ i ] [ 1 ] - arr [ i ] [ 2 ] ) ! = ( arr [ i + 1 ] [ 1 ] - arr [ i + 1 ] [ 2 ] ) ) flag = 1 ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( ( arr [ 0 ] [ i ] - arr [ 1 ] [ i ] ) ! = ( arr [ 0 ] [ i + 1 ] - arr [ 1 ] [ i + 1 ] ) ) flag = 1 ; if ( ( arr [ 1 ] [ i ] - arr [ 2 ] [ i ] ) ! = ( arr [ 1 ] [ i + 1 ] - arr [ 2 ] [ i + 1 ] ) ) flag = 1 ; } if ( flag ! = 0 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int A , B , C ; int Five = 0 ; int Seven = 0 ; Scanner sc = new Scanner ( System . in ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; if ( A = = 5 ) Five + + ; if ( A = = 7 ) Seven + + ; if ( B = = 5 ) Five + + ; if ( B = = 7 ) Seven + + ; if ( C = = 5 ) Five + + ; if ( C = = 7 ) Seven + + ; if ( ( Five = = 2 ) & & ( Seven = = 1 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] line = new int [ 5 ] ; boolean check = true ; for ( int i = 0 ; i < 5 ; i + + ) { line [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; ArrayList < Integer > lis = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( line [ i ] - line [ j ] ) > k ) { check = false ; break ; } } } if ( check ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Arrays ; import java . util . Scanner ; class A { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int [ ] N = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) N [ i ] = sc . nextInt ( ) ; Arrays . sort ( N ) ; System . out . println ( Arrays . equals ( N , new int [ ] { 1 , 4 , 7 , 9 } ) ? " YES " : " NO " ) ; } } public class Main { public static void main ( String ... args ) { A . main ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int P ; int min = 0 ; int counter = 0 ; for ( int i = 0 ; i < N ; i + + ) { P = sc . nextInt ( ) ; if ( min < 1 | | P < min ) { min = P ; counter + + ; } } System . out . println ( counter ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } String result = set . size ( ) = = 3 ? " Three " : " Four " ; System . out . println ( result ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; a [ 3 ] = sc . nextInt ( ) ; a [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean e = false ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ! ( Math . abs ( a [ i ] - a [ j ] ) < = k ) ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int [ ] min _ p = new int [ n ] ; int counter = 0 ; for ( int i = 0 ; i < p . length ; i + + ) { p [ i ] = sc . nextInt ( ) ; } min _ p [ 0 ] = p [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( i > = 1 ) { if ( min _ p [ i - 1 ] > p [ i ] ) { min _ p [ i ] = p [ i ] ; } else { min _ p [ i ] = min _ p [ i - 1 ] ; } } if ( p [ i ] = = min _ p [ i ] ) { counter + + ; } } System . out . println ( counter ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; int [ ] A = new int [ 3 ] ; int [ ] B = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = gi ( ) ; } } for ( A [ 0 ] = 0 ; A [ 0 ] < = C [ 0 ] [ 0 ] ; A [ 0 ] + + ) { B [ 0 ] = C [ 0 ] [ 0 ] - A [ 0 ] ; for ( A [ 1 ] = 0 ; A [ 1 ] < = C [ 1 ] [ 1 ] ; A [ 1 ] + + ) { B [ 1 ] = C [ 1 ] [ 1 ] - A [ 1 ] ; for ( A [ 2 ] = 0 ; A [ 2 ] < = C [ 2 ] [ 2 ] ; A [ 2 ] + + ) { B [ 2 ] = C [ 2 ] [ 2 ] - A [ 2 ] ; boolean f = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( A [ i ] + B [ j ] ! = C [ i ] [ j ] ) { f = false ; break ; } } } if ( f ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] val = new int [ 3 ] ; for ( int x = 0 ; x < 3 ; x + + ) val [ x ] = scanner . nextInt ( ) ; int sum = 0 ; Arrays . sort ( val ) ; for ( int y = 1 ; y < 3 ; y + + ) { sum = sum + Math . abs ( val [ y ] - val [ y - 1 ] ) ; } System . out . println ( sum ) ; } } import java . util . * ; public class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; ArrayList < Character > s = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { char c = scan . next ( ) . charAt ( 0 ) ; if ( ! s . contains ( c ) ) s . add ( c ) ; } System . out . println ( s . size ( ) = = 3 ? " Three " : " Four " ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int total = 2 ; while ( n > = total ) { total * = 2 ; } System . out . print ( total / 2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; int [ ] Y = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { N [ i ] = sc . nextInt ( ) ; Y [ N [ i ] ] + + ; } if ( Y [ 1 ] > 0 & & Y [ 4 ] > 0 & & Y [ 7 ] > 0 & & Y [ 9 ] > 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < s + 1 ; i + + ) { int x = i ; for ( int j = 0 ; j < s + 1 - i ; j + + ) { int y = j ; int z = s - x - y ; if ( x > k | | y > k | | z > k ) { continue ; } result + + ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int res = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int targetNumber = i ; int tmpCount = 0 ; while ( targetNumber % 2 = = 0 ) { tmpCount + + ; targetNumber / = 2 ; } if ( count < tmpCount ) { res = i ; count = tmpCount ; } } System . out . println ( n = = 1 ? 1 : res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int b0b1 _ 1 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; int b1b2 _ 1 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; int b0b1 _ 2 = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ; int b1b2 _ 2 = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ; int b0b1 _ 3 = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ; int b1b2 _ 3 = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ; int a0a1 _ 1 = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] ; int a1a2 _ 1 = c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] ; int a0a1 _ 2 = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ; int a1a2 _ 2 = c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] ; int a0a1 _ 3 = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ; int a1a2 _ 3 = c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] ; String result = " No " ; if ( b0b1 _ 1 = = b0b1 _ 2 & & b0b1 _ 2 = = b0b1 _ 3 ) { if ( b1b2 _ 1 = = b1b2 _ 2 & & b1b2 _ 2 = = b1b2 _ 3 ) { if ( a0a1 _ 1 = = a0a1 _ 2 & & a0a1 _ 2 = = a0a1 _ 3 ) { if ( a1a2 _ 1 = = a1a2 _ 2 & & a1a2 _ 2 = = a1a2 _ 3 ) { result = " Yes " ; } } } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double t = h * 60 + m ; double hx = Math . cos ( Math . toRadians ( t * 0.5 - 90 ) ) * a ; double hy = Math . sin ( Math . toRadians ( t * 0.5 - 90 ) ) * a ; double mx = Math . cos ( Math . toRadians ( t * 6 - 90 ) ) * b ; double my = Math . sin ( Math . toRadians ( t * 6 - 90 ) ) * b ; double d = Math . sqrt ( ( hy - my ) * ( hy - my ) + ( hx - mx ) * ( hx - mx ) ) ; System . out . println ( d ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String msg = " Yes " ; for ( int i = 1 ; i < 3 ; i + + ) { int a = c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] ; if ( c [ i ] [ 1 ] - c [ i ] [ 0 ] ! = a ) { msg = " No " ; break ; } a = c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] ; if ( c [ i ] [ 2 ] - c [ i ] [ 1 ] ! = a ) { msg = " No " ; break ; } a = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( c [ 1 ] [ i ] - c [ 0 ] [ i ] ! = a ) { msg = " No " ; break ; } a = c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] ; if ( c [ 2 ] [ i ] - c [ 1 ] [ i ] ! = a ) { msg = " No " ; break ; } } System . out . println ( msg ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { sum = S - ( i + j ) ; if ( 0 < = sum & & sum < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a > k ) { System . out . println ( " : ( " ) ; } else if ( c - a > k ) { System . out . println ( " : ( " ) ; } else if ( d - a > k ) { System . out . println ( " : ( " ) ; } else if ( e - a > k ) { System . out . println ( " : ( " ) ; } else if ( c - b > k ) { System . out . println ( " : ( " ) ; } else if ( d - b > k ) { System . out . println ( " : ( " ) ; } else if ( e - b > k ) { System . out . println ( " : ( " ) ; } else if ( d - c > k ) { System . out . println ( " : ( " ) ; } else if ( e - c > k ) { System . out . println ( " : ( " ) ; } else if ( e - d > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < c . length ; i + + ) { for ( int j = 0 ; j < c [ i ] . length ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < b . length ; i + + ) { b [ i ] = c [ 0 ] [ i ] ; } for ( int i = 1 ; i < a . length ; i + + ) { a [ i ] = c [ i ] [ 0 ] - b [ 0 ] ; } boolean jdg = true ; outer : for ( int i = 0 ; i < c . length ; i + + ) { for ( int j = 0 ; j < c [ i ] . length ; j + + ) { if ( ! ( jdg = ( a [ i ] + b [ j ] = = c [ i ] [ j ] ) ) ) break outer ; } } System . out . println ( jdg ? " Yes " : " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int [ ] n = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) { n [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 1 , min = n [ 0 ] ; for ( int i = 1 ; i < a ; i + + ) { if ( min > n [ i ] ) { cnt + + ; min = n [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] arr = new int [ 8 ] ; arr [ a ] + + ; arr [ b ] + + ; arr [ c ] + + ; if ( arr [ 5 ] = = 2 & & arr [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CADDi _ C solver = new CADDi _ C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CADDi _ C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long n = in . nextLong ( ) ; long p = in . nextLong ( ) ; long copy = p ; long ans = 1 ; long cnt = 0 ; for ( long i = 2 ; i < Math . sqrt ( ( double ) copy ) + 2 ; i + + ) { if ( p = = 1 ) break ; while ( p % i = = 0 ) { cnt + + ; p / = i ; } if ( cnt > = n ) { ans * = ( long ) Math . pow ( i , ( cnt / n ) ) ; } cnt = 0 ; } if ( p ! = 1 ) { if ( 1 > = n ) { ans * = p * ( 1 / n ) ; } } out . print ( ans ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int d = stdIn . nextInt ( ) ; int e = stdIn . nextInt ( ) ; int k = stdIn . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] S = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { S [ i ] = stdIn . nextInt ( ) ; } Arrays . sort ( S ) ; int j = S [ 2 ] - S [ 1 ] ; int k = S [ 1 ] - S [ 0 ] ; System . out . println ( j + k ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int firstAnt = 0 ; int lastAnt = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = Integer . parseInt ( sc . nextLine ( ) ) ; if ( i = = 0 ) { firstAnt = tmp ; } else if ( i = = 4 ) { lastAnt = tmp ; } } int allowedDistant = Integer . parseInt ( sc . nextLine ( ) ) ; String result = " " ; if ( ( lastAnt - firstAnt ) < = allowedDistant ) { result = " Yay ! " ; } else { result = " : ( " ; } System . out . println ( result ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int s = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s > = i + j & & s - ( i + j ) < = k ) { count + + ; } if ( s < i + j ) break ; } if ( s < i ) break ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 2 ; if ( n = = 1 ) { System . out . println ( 1 ) ; } else { while ( num * 2 < = n ) { num = num * 2 ; } System . out . println ( num ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { double ans = 0 ; Scanner scan = new Scanner ( System . in ) ; int minutes _ length = scan . nextInt ( ) ; int hour _ length = scan . nextInt ( ) ; double hour _ time = scan . nextInt ( ) ; double minutes _ time = scan . nextInt ( ) ; double minutes _ pi = Math . PI / 30 * minutes _ time ; double hour _ pi = Math . PI / 6 * ( hour _ time + minutes _ time / 60 ) ; double theta = Math . PI / 30 * ( 5 * ( hour _ time + minutes _ time / 60 ) - minutes _ time ) ; ans = minutes _ length * minutes _ length + hour _ length * hour _ length - 2 * hour _ length * minutes _ length * Math . cos ( theta ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanIn = new Scanner ( System . in ) ; int a = scanIn . nextInt ( ) ; int b = scanIn . nextInt ( ) ; int c = scanIn . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 ) | | ( b = = 5 & & c = = 5 ) | | ( c = = 5 & & a = = 5 ) ) { if ( a = = 7 | | b = = 7 | | c = = 7 ) { System . out . println ( " YES " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { MyReader r = new MyReader ( ) ; int n = r . i ( ) ; int digit = 1 ; while ( ( n = n > > 1 ) > 0 ) digit + + ; println ( 1 < < digit - 1 ) ; } static void print ( Object o ) { System . out . print ( o . toString ( ) ) ; } static void println ( Object o ) { System . out . println ( o . toString ( ) ) ; } static int Int ( String s ) { return Integer . parseInt ( s ) ; } static long Long ( String s ) { return Long . parseLong ( s ) ; } static class MyReader extends BufferedReader { MyReader ( ) { super ( new InputStreamReader ( System . in ) ) ; } String s ( ) throws IOException { return readLine ( ) ; } String [ ] ss ( ) throws IOException { return s ( ) . split ( " " ) ; } int i ( ) throws IOException { return Int ( s ( ) ) ; } int [ ] ii ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; int [ ] ii = new int [ size ] ; for ( int j = 0 ; j < size ; j + + ) ii [ j ] = Int ( ss [ j ] ) ; return ii ; } long l ( ) throws IOException { return Long ( s ( ) ) ; } long [ ] ll ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; long [ ] ll = new long [ size ] ; for ( int j = 0 ; j < size ; j + + ) ll [ j ] = Long ( ss [ j ] ) ; return ll ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int k = sc . nextInt ( ) ; if ( arr [ 4 ] - arr [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , n ) ; Set < Character > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( line [ i ] . charAt ( 0 ) ) ; } if ( set . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ABC = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { ABC [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ABC ) ; boolean flg = false ; if ( ABC [ 0 ] = = 5 ) { if ( ABC [ 1 ] = = 5 ) { if ( ABC [ 2 ] = = 7 ) { flg = true ; } } } if ( flg ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . Closeable ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { final Scanner sc = new Scanner ( System . in ) ; int [ ] count = new int [ 11 ] ; count [ sc . nextInt ( ) ] + + ; count [ sc . nextInt ( ) ] + + ; count [ sc . nextInt ( ) ] + + ; if ( count [ 5 ] = = 2 & & count [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static class Scanner implements Closeable { private BufferedReader br ; private StringTokenizer tok ; public Scanner ( InputStream is ) throws IOException { br = new BufferedReader ( new InputStreamReader ( is ) ) ; } private void getLine ( ) throws IOException { while ( ! hasNext ( ) ) { tok = new StringTokenizer ( br . readLine ( ) ) ; } } private boolean hasNext ( ) { return tok ! = null & & tok . hasMoreTokens ( ) ; } public String next ( ) throws IOException { getLine ( ) ; return tok . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public void close ( ) throws IOException { br . close ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; sc . close ( ) ; double Hx = A * Math . sin ( Math . toRadians ( 360 * ( H + M / 60 ) / 12 ) ) ; double Hy = A * Math . cos ( Math . toRadians ( 360 * ( H + M / 60 ) / 12 ) ) ; double Mx = B * Math . sin ( Math . toRadians ( 360 * M / 60 ) ) ; double My = B * Math . cos ( Math . toRadians ( 360 * M / 60 ) ) ; double x = ( Hx - Mx ) ; double y = ( Hy - My ) ; System . out . println ( Math . sqrt ( Math . pow ( x , 2 ) + Math . pow ( y , 2 ) ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Set ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } Arrays . sort ( nums ) ; System . out . println ( ( nums [ 1 ] - nums [ 0 ] ) + ( nums [ 2 ] - nums [ 1 ] ) ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; int ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int count1 = 0 ; int tmp = i ; while ( tmp % 2 = = 0 ) { tmp = tmp / 2 ; count1 = count1 + 1 ; } if ( count1 > count ) { count = count1 ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double angle = Math . toRadians ( ( h * 30 + m * 0.5 ) - m * 6 ) ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle ) ) ; System . out . printf ( " % .20f % n " , ans ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ; public class Main { int n ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; set . add ( s ) ; } if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > hashset = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hashset . add ( sc . next ( ) ) ; } if ( hashset . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } 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 . FileReader ; import java . io . InputStreamReader ; import java . io . File ; import java . io . FileNotFoundException ; 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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastScanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i + + ) { String s = in . nextString ( ) ; if ( s . equals ( " Y " ) ) cnt + + ; } if ( cnt = = 0 ) out . println ( " Three " ) ; else out . println ( " Four " ) ; } } static class FastScanner { private BufferedReader br ; private StringTokenizer st ; public FastScanner ( File f ) { try { br = new BufferedReader ( new FileReader ( f ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } public FastScanner ( InputStream f ) { br = new BufferedReader ( new InputStreamReader ( f ) ) ; } public String nextString ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { String s = null ; try { s = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } if ( s = = null ) return null ; st = new StringTokenizer ( s ) ; } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; boolean f = false ; for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { f = true ; break ; } } System . out . println ( f ? " Four " : " Three " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > arr = new ArrayList < > ( ) ; for ( ; sc . hasNext ( ) ; ) { arr . add ( sc . nextInt ( ) ) ; } int count = 0 ; int min = arr . get ( 0 ) ; for ( int num : arr ) { if ( num < = min ) { count + + ; min = num ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( ( e - a ) < = k ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double theta1 = ( h / 12.0 + m / 60.0 / 12.0 ) * Math . PI * 2 ; double theta2 = m / 60.0 * Math . PI * 2 ; double ret = a * a + b * b - 2 * a * b * Math . cos ( theta1 - theta2 ) ; ret = Math . sqrt ( ret ) ; System . out . printf ( " % .12f \ n " , ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; String ans = " No " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) { if ( c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] & & c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 0 ] ) { if ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) { if ( c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] & & c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] ) { ans = " Yes " ; } } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 11 ] ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; n [ a ] + + ; n [ b ] + + ; n [ c ] + + ; if ( n [ 5 ] = = 2 & & n [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean b = true ; b & = a [ 0 ] [ 0 ] - a [ 1 ] [ 0 ] = = a [ 0 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 0 ] [ 2 ] - a [ 1 ] [ 2 ] = = a [ 0 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 0 ] - a [ 1 ] [ 0 ] = = a [ 2 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 2 ] - a [ 1 ] [ 2 ] = = a [ 2 ] [ 1 ] - a [ 1 ] [ 1 ] ; b & = a [ 0 ] [ 0 ] - a [ 0 ] [ 1 ] = = a [ 1 ] [ 0 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 0 ] - a [ 2 ] [ 1 ] = = a [ 1 ] [ 0 ] - a [ 1 ] [ 1 ] ; b & = a [ 0 ] [ 2 ] - a [ 0 ] [ 1 ] = = a [ 1 ] [ 2 ] - a [ 1 ] [ 1 ] ; b & = a [ 2 ] [ 2 ] - a [ 2 ] [ 1 ] = = a [ 1 ] [ 2 ] - a [ 1 ] [ 1 ] ; System . out . println ( b ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = in . nextInt ( ) ; } } int [ ] sum = new int [ 6 ] ; sum [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; sum [ 1 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; sum [ 2 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; sum [ 3 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] ; sum [ 4 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; sum [ 5 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; boolean takahashi = true ; for ( int i = 1 ; i < 6 ; i + + ) { if ( sum [ 0 ] ! = sum [ i ] ) { takahashi = false ; break ; } } if ( takahashi ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; in . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = N ; i + + ) { for ( int j = 0 ; j < = N ; j + + ) { if ( 0 < = S - i - j & & S - i - j < = N ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int targetNumber = sc . nextInt ( ) ; int max _ dividing = 0 ; int max _ number = 1 ; for ( int i = 1 ; i < = targetNumber ; i + + ) { int ExTargetNumber = i ; int manyOfdividing = 0 ; while ( true ) { if ( ExTargetNumber % 2 = = 0 & & ExTargetNumber > 0 ) { ExTargetNumber = ExTargetNumber / 2 ; manyOfdividing + + ; } else { if ( max _ dividing < manyOfdividing ) { max _ dividing = manyOfdividing ; max _ number = i ; } break ; } } } System . out . println ( max _ number ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ 2 * ( int ) n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; a [ i + ( int ) n ] = a [ i ] ; } long [ ] [ ] costs = new long [ ( int ) n ] [ ( int ) n ] ; for ( int i = ( int ) n ; i < 2 * n ; i + + ) { long best = a [ i ] ; for ( int j = 0 ; j < n ; j + + ) { best = Math . min ( best , a [ i - j ] ) ; costs [ i - ( int ) n ] [ j ] = best ; } } long best = n * 1000000000 ; for ( int j = 0 ; j < n ; j + + ) { long curr = j * x ; for ( int i = 0 ; i < n ; i + + ) { curr + = costs [ i ] [ j ] ; } best = Math . min ( best , curr ) ; } System . out . println ( best ) ; } } import java . lang . reflect . Array ; import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] arr = { a , b , c } ; Arrays . sort ( arr ) ; System . out . println ( arr [ 2 ] - arr [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int cnt5 = 0 ; int cnt7 = 0 ; if ( a = = 5 ) { cnt5 + = 1 ; } else if ( a = = 7 ) { cnt7 + = 1 ; } if ( b = = 5 ) { cnt5 + = 1 ; } else if ( b = = 7 ) { cnt7 + = 1 ; } if ( c = = 5 ) { cnt5 + = 1 ; } else if ( c = = 7 ) { cnt7 + = 1 ; } sc . close ( ) ; System . out . println ( ( cnt5 = = 2 & & cnt7 = = 1 ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double Ar = ( 60 * H + M ) / 2 ; double Br = M * 6 ; double ans ; if ( Ar > Br ) { double ans2 ; ans2 = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Ar - Br ) ) ; ans = Math . sqrt ( ans2 ) ; } else if ( Ar = = Br ) { ans = Math . abs ( A - B ) ; } else { double ans2 ; ans2 = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Br - Ar ) ) ; ans = Math . sqrt ( ans2 ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count1 = 0 ; int count2 = 0 ; int a = sc . nextInt ( ) ; if ( a = = 5 ) { count1 + = 1 ; } if ( a = = 7 ) { count2 + = 1 ; } int b = sc . nextInt ( ) ; if ( b = = 5 ) { count1 + = 1 ; } if ( b = = 7 ) { count2 + = 1 ; } int c = sc . nextInt ( ) ; if ( c = = 5 ) { count1 + = 1 ; } if ( c = = 7 ) { count2 + = 1 ; } if ( count1 = = 2 & & count2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double a , b , h , m ; a = in . nextDouble ( ) ; b = in . nextDouble ( ) ; h = in . nextDouble ( ) ; m = in . nextDouble ( ) ; in . close ( ) ; double h _ angle = 0.5 * ( h * 60 + m ) ; double m _ angle = 6 * m ; double angle = Math . abs ( h _ angle - m _ angle ) ; angle = Math . min ( angle , 360 - angle ) ; double res = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle * Math . PI / 180 ) ) ; System . out . printf ( " % .20f \ n " , res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String result = " NO " ; int [ ] input = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { input [ i ] = sc . nextInt ( ) ; } int count5 = 0 ; int count7 = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { if ( input [ j ] = = 5 ) { count5 + + ; } else if ( input [ j ] = = 7 ) { count7 + + ; } else { break ; } } if ( count5 = = 2 & & count7 = = 1 ) { result = " YES " ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean flg = false ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { flg = true ; } } if ( flg ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; int curMin = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( i = = 0 ) { curMin = p ; cnt + + ; continue ; } if ( p < curMin ) { curMin = p ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int max = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; max = Math . max ( max , P [ i ] ) ; } int min = max ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; sc . next ( ) ; sc . next ( ) ; sc . next ( ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; String ans = ( e - a > k ) ? " : ( " : " Yay ! " ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int csum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; csum + = c [ i ] [ j ] ; } } int [ ] threesum = new int [ 6 ] ; threesum [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; threesum [ 1 ] = c [ 0 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 1 ] [ 2 ] ; threesum [ 2 ] = c [ 1 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 2 ] [ 2 ] ; threesum [ 3 ] = c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 0 ] [ 2 ] ; threesum [ 4 ] = c [ 2 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 0 ] [ 2 ] ; threesum [ 5 ] = c [ 2 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] ; for ( int i = 1 ; i < 6 ; i + + ) { if ( threesum [ 0 ] ! = threesum [ i ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . TreeSet ; import java . util . Arrays ; import java . util . SortedSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { SortedSet < Integer > k = new TreeSet < > ( Arrays . asList ( 1 , 4 , 7 , 9 ) ) ; SortedSet < Integer > m = new TreeSet < > ( ) ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 4 ; i + + ) { int z = sc . nextInt ( ) ; if ( k . contains ( z ) ) { m . add ( z ) ; } } if ( m . toArray ( ) . length = = 4 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt5 = 0 ; int cnt7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) { cnt5 + + ; } else if ( n = = 7 ) { cnt7 + + ; } } if ( cnt5 = = 2 & & cnt7 = = 1 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 , a , count , ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { count = 0 ; if ( i % 2 = = 1 ) continue ; a = i ; for ( ; ; ) { if ( a / 2 ! = 0 ) { a = a / 2 ; count + + ; } else { count + + ; break ; } } if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int k , s , x , y , z , n ; n = 0 ; Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( 0 < = z & & z < = k ) { n + + ; } } } System . out . println ( n ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxCnt = 0 ; int maxNum = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int cnt = 0 ; int num = i ; while ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } if ( cnt > maxCnt ) { maxCnt = cnt ; maxNum = i ; } } System . out . println ( maxNum ) ; sc . close ( ) ; } } import java . io . * ; import java . util . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; int a [ ] = new int [ n ] ; int min [ ] = new int [ n ] ; int c = 0 , minval = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = Integer . parseInt ( s [ i ] ) ; min [ 0 ] = a [ 0 ] ; minval = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < minval ) { minval = a [ i ] ; min [ i ] = minval ; } } for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < = min [ i ] ) c + + ; } out . println ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { byte [ ] distances = new byte [ 5 ] ; byte k ; for ( int i = 0 ; i < 5 ; i + + ) { distances [ i ] = scan . nextByte ( ) ; } k = scan . nextByte ( ) ; boolean isOk = true ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ! isCommunicatable ( distances [ i ] , distances [ j ] , k ) ) { isOk = false ; break ; } } } System . out . println ( isOk ? " Yay ! " : " : ( " ) ; } } private static boolean isCommunicatable ( int c1 , int c2 , int k ) { return ( c2 - c1 ) < = k ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < list . length ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int cnt = 1 ; int min = list [ 0 ] ; for ( int i = 1 ; i < list . length ; i + + ) { if ( min > = list [ i ] ) { cnt + + ; min = list [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] abc = new int [ 10 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int tmp = sc . nextInt ( ) ; abc [ tmp ] + + ; } if ( abc [ 5 ] = = 2 & & abc [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . math . BigInteger ; import java . security . NoSuchAlgorithmException ; import java . util . ArrayList ; import java . util . HashMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; int max = - 1 ; for ( int i = 1 ; i < = N ; i + + ) { int cc = 0 ; int ck = i ; while ( ck % 2 = = 0 ) { ck / = 2 ; cc + + ; } if ( max < cc ) { ans = i ; max = cc ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - ( i + j ) & & S - ( i + j ) < = K ) { answer + + ; } } } System . out . println ( answer ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) a [ i ] = sc . nextInt ( ) ; int [ ] min = a . clone ( ) ; long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { long temp = ( long ) x * i ; for ( int j = 0 ; j < N ; j + + ) { min [ j ] = Math . min ( min [ j ] , a [ ( j - i + N ) % N ] ) ; temp + = min [ j ] ; } ans = Math . min ( ans , temp ) ; } System . out . println ( ans ) ; sc . close ( ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double rate = ( h * 60 + m - 12 * m ) / 720.0 ; if ( rate > 0.5 ) { rate = 1.0 - rate ; } double rad = 2 * Math . PI * rate ; double c2 = a * a + b * b - 2 * a * b * Math . cos ( rad ) ; double c = Math . sqrt ( c2 ) ; System . out . println ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } boolean F = false ; int A = 0 ; int B = 0 ; int C = 0 ; A = c [ 0 ] [ 0 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 0 ] ; B = c [ 0 ] [ 1 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 1 ] ; C = c [ 0 ] [ 2 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 2 ] ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ( A - i ) % 3 = = 0 & & ( B - i ) % 3 = = 0 & & ( C - i ) % 3 = = 0 ) { F = true ; } } if ( F ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } 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 ; import java . util . * ; 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 c = in . nextInt ( ) ; int Max = Math . max ( a , Math . max ( b , c ) ) ; int Min = Math . min ( a , Math . min ( b , c ) ) ; int Mid = a + b + c - Max - Min ; if ( Min = = 5 & & Mid = = 5 & & Max = = 7 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } } 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 . 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 ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; out . println ( ( int ) Math . pow ( 2 , ( int ) ( Math . log ( n ) / Math . log ( 2 ) ) ) ) ; } } static class InputReader { private final InputStream stream ; private final byte [ ] buf = new byte [ 8192 ] ; private int curChar ; private int snumChars ; public InputReader ( InputStream st ) { this . stream = st ; } public int read ( ) { if ( snumChars = = - 1 ) throw new InputMismatchException ( ) ; if ( curChar > = snumChars ) { curChar = 0 ; try { snumChars = stream . read ( buf ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } if ( snumChars < = 0 ) return - 1 ; } return buf [ curChar + + ] ; } public int nextInt ( ) { int c = read ( ) ; while ( isSpaceChar ( c ) ) { c = read ( ) ; } int sgn = 1 ; if ( c = = ' -' ) { sgn = - 1 ; c = read ( ) ; } int res = 0 ; do { res * = 10 ; res + = c - ' 0' ; c = read ( ) ; } while ( ! isSpaceChar ( c ) ) ; return res * sgn ; } public boolean isSpaceChar ( int c ) { return c = = ' ' | | c = = ' \ n ' | | c = = ' \ r ' | | c = = ' \ t ' | | c = = - 1 ; } } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num1 = sc . nextInt ( ) ; int num2 = sc . nextInt ( ) ; int hour = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; double degOfMin = min * 6 ; double degOfHour = hour * 30 + degOfMin / 12 ; double deg = Math . abs ( degOfHour - degOfMin ) ; if ( deg > 180 ) { deg = 360 - deg ; } double rad = Math . toRadians ( deg ) ; double num3 = ( num1 * num1 ) + ( num2 * num2 ) - ( 2 * num1 * num2 * Math . cos ( rad ) ) ; System . out . print ( Math . sqrt ( num3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( ( a = = 5 ) & & ( b = = 5 ) & & ( c = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 5 ) & & ( b = = 7 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 7 ) & & ( b = = 5 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; String line = s . nextLine ( ) ; int N = Integer . parseInt ( line ) ; line = s . nextLine ( ) ; String [ ] str = line . split ( " " ) ; long [ ] A = new long [ N ] ; long sumA = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = Long . parseLong ( str [ i ] ) ; sumA + = A [ i ] ; } line = s . nextLine ( ) ; str = line . split ( " " ) ; long [ ] B = new long [ N ] ; long sumB = 0 ; for ( int i = 0 ; i < N ; i + + ) { B [ i ] = Long . parseLong ( str [ i ] ) ; sumB + = B [ i ] ; } if ( sumB > sumA ) { System . out . println ( - 1 ) ; return ; } int changeCnt = 0 ; long penaSum = 0L ; long [ ] pena = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { pena [ i ] = B [ i ] - A [ i ] ; if ( pena [ i ] > 0 ) { changeCnt + + ; penaSum + = pena [ i ] ; } } Arrays . sort ( pena ) ; for ( int i = 0 ; i < N ; i + + ) { if ( penaSum < = 0 ) break ; else { penaSum + = pena [ i ] ; changeCnt + + ; } } System . out . println ( changeCnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double A = in . nextDouble ( ) ; double B = in . nextDouble ( ) ; double ho = in . nextDouble ( ) ; double mi = in . nextDouble ( ) ; double rad = 60 / mi ; double radMi = 360 / rad ; double radiHo = ( ho * 30 ) + ( 30 / rad ) ; double radian = 0 ; if ( radiHo > radMi ) { radian = radiHo - radMi ; } else { radian = radMi - radiHo ; } double result = ( A * A ) + ( B * B ) - 2 * A * B * Math . cos ( Math . toRadians ( radian ) ) ; double ans = Math . sqrt ( result ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int c = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n > 5 ) { num [ 2 ] = n ; } else { num [ c + + ] = n ; } } if ( num [ 0 ] = = 5 & & num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int fiveCount = search ( str , ' 5' ) ; int sevenCount = search ( str , ' 7' ) ; if ( fiveCount = = 2 & & sevenCount = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } static int search ( String str , char target ) { int count = 0 ; for ( char x : str . toCharArray ( ) ) { if ( x = = target ) { count + + ; } } return count ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int deg2h = h * 60 + m ; int deg2m = m * 12 ; int deg2x = Math . max ( deg2m , deg2h ) - Math . min ( deg2m , deg2h ) ; if ( deg2x > 360 ) deg2x = 720 - deg2x ; double radx = Math . toRadians ( ( double ) ( deg2x / 2d ) ) ; double cc = ( double ) ( a * a ) + ( double ) ( b * b ) - 2d * ( double ) a * ( double ) b * Math . cos ( radx ) ; double c = Math . sqrt ( cc ) ; System . out . println ( c ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; long aSum = 0 ; long bSum = 0 ; long downCount = 0 ; long upSum = 0 ; long downSum = 0 ; long ansCount = 0 ; List < Integer > upList = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; aSum + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; bSum + = b [ i ] ; if ( a [ i ] - b [ i ] > = 0 ) { upList . add ( a [ i ] - b [ i ] ) ; upSum + = a [ i ] - b [ i ] ; } else { downCount + + ; downSum + = ( b [ i ] - a [ i ] ) ; } } Collections . sort ( upList , Comparator . reverseOrder ( ) ) ; if ( downCount = = 0 ) { System . out . println ( 0 ) ; return ; } if ( upSum < downSum ) { System . out . println ( - 1 ) ; return ; } for ( Integer integer : upList ) { downSum - = integer ; ansCount + + ; if ( downSum < = 0 ) { System . out . println ( ansCount + downCount ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; boolean [ ] b = new boolean [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 5 ) { count _ 5 + + ; } else if ( a = = 7 ) { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . List ; import java . util . Scanner ; import java . util . Collections ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = Integer . parseInt ( in . next ( ) ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( in . next ( ) ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Integer . parseInt ( in . next ( ) ) ; } List < Long > plus = new ArrayList < > ( ) ; long sum = 0 ; long num = 0 ; for ( int i = 0 ; i < n ; i + + ) { long diff = a [ i ] - b [ i ] ; if ( diff < 0 ) { sum - = diff ; + + num ; } else { plus . add ( diff ) ; } } if ( num = = 0 ) { out . println ( 0 ) ; return ; } else { long ans = num ; Collections . sort ( plus , Collections . reverseOrder ( ) ) ; long ptr = 0 ; for ( int i = 0 ; i < plus . size ( ) ; i + + ) { ptr + = plus . get ( i ) ; + + ans ; if ( ptr > = sum ) { break ; } } if ( ptr > = sum ) out . println ( ans ) ; else out . println ( - 1 ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - i - j & & s - i - j < = k ) { count + + ; } } } System . out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int limit = sc . nextInt ( ) ; int max = 0 ; int result = 1 ; for ( int i = 1 ; i < = limit ; i + + ) { int tmp = i ; int cnt = 0 ; while ( true ) { if ( tmp % 2 ! = 0 ) { break ; } tmp = tmp / 2 ; cnt + + ; } if ( cnt > max ) { max = cnt ; result = i ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; n [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; n [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; n [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( n [ i ] = = 5 ) count5 + + ; if ( n [ i ] = = 7 ) count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( i + j < = s & & s - i - j < = k ) { c + + ; } } } System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int g = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int i = sc . nextInt ( ) ; boolean ok = false ; for ( int x = - 100 ; x < = 100 ; x + + ) { if ( a + x = = d & & b + x = = e & & c + x = = f ) { ok = true ; break ; } } if ( ! ok ) { System . out . println ( " No " ) ; return ; } ok = false ; for ( int x = - 100 ; x < = 100 ; x + + ) { if ( g + x = = d & & h + x = = e & & i + x = = f ) { ok = true ; break ; } } if ( ! ok ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a1 = Integer . parseInt ( sc . next ( ) ) ; int a2 = Integer . parseInt ( sc . next ( ) ) ; int a3 = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ ] { a1 , a2 , a3 } ; Arrays . sort ( a ) ; int result = 0 ; result + = a [ 1 ] - a [ 0 ] ; result + = a [ 2 ] - a [ 1 ] ; System . out . println ( result ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] list = str . split ( " " ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < list . length ; i + + ) { if ( list [ i ] . equals ( " 5 " ) ) { count5 = count5 + 1 ; } else if ( list [ i ] . equals ( " 7 " ) ) { count7 = count7 + 1 ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ret = 64 ; while ( ret > n ) { ret / = 2 ; } System . out . println ( ret ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] ae = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { ae [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( ae [ 4 ] - ae [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; char arr [ ] = new char [ n ] ; ArrayList < Character > a = new ArrayList < Character > ( ) ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = scan . next ( ) . charAt ( 0 ) ; if ( ! a . contains ( arr [ i ] ) ) { a . add ( arr [ i ] ) ; } } System . out . println ( a . size ( ) = = 4 ? " Four " : " Three " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { FastScanner sc = new FastScanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; while ( n > = 2 ) { n / = 2 ; cnt + + ; } System . out . println ( ( int ) Math . pow ( 2 , cnt ) ) ; } } class FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public String nextLine ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \ n " ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int h = 1 ; h < = 3500 ; h + + ) { for ( int n = 1 ; n < = 3500 ; n + + ) { long a = ( long ) N * h * n ; long b = ( long ) 4 * h * n - ( long ) N * n - ( long ) N * h ; if ( b ! = 0 & & a % b = = 0 & & 1 < = a / b & & a / b < = 3500 ) { System . out . println ( h + " " + n + " " + a / b ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; N [ 0 ] = scan . nextInt ( ) ; N [ 1 ] = scan . nextInt ( ) ; N [ 2 ] = scan . nextInt ( ) ; N [ 3 ] = scan . nextInt ( ) ; Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 & & N [ 1 ] = = 4 & & N [ 2 ] = = 7 & & N [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 124 ; for ( int i = 0 ; i < 5 ; i + + ) { int antena = sc . nextInt ( ) ; if ( antena > max ) { max = antena ; } if ( antena < min ) { min = antena ; } } int k = sc . nextInt ( ) ; if ( max - min < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { 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 min = a [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < = min ) { count + + ; min = a [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; class Main { public static void main ( String [ ] args ) throws Exception { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputStringList = br . readLine ( ) . split ( " \ \ s + " ) ; List < String > fiveList = new ArrayList < > ( ) ; List < String > sevenList = new ArrayList < > ( ) ; for ( String inputString : inputStringList ) { if ( inputString . equals ( " 5 " ) ) { fiveList . add ( inputString ) ; } else if ( inputString . equals ( " 7 " ) ) { sevenList . add ( inputString ) ; } } String result ; if ( fiveList . size ( ) = = 2 & & sevenList . size ( ) = = 1 ) { result = " YES " ; } else { result = " NO " ; } System . out . println ( result ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; boolean gg = true ; Integer [ ] array = new Integer [ n ] ; int a = 1 ; int b = 0 ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = s . nextInt ( ) ; if ( i ! = 0 ) { if ( array [ i ] < b ) { b = array [ i ] ; a + + ; } else { } } else { b = array [ i ] ; } } System . out . print ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int count = 0 ; sc . nextLine ( ) ; String line = sc . nextLine ( ) ; String [ ] array = line . split ( " " ) ; int pi ; int min = a + 1 ; for ( int i = 0 ; i < a ; i + + ) { pi = Integer . parseInt ( array [ i ] ) ; if ( min > pi ) { count + + ; min = pi ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , H , M ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; H = sc . nextInt ( ) ; M = sc . nextInt ( ) ; double thetaA = 30 * H + 0.5 * M ; double thetaB = 6 * M ; double xA , yA , xB , yB ; xA = A * ( Math . sin ( Math . toRadians ( thetaA ) ) ) ; yA = A * ( Math . cos ( Math . toRadians ( thetaA ) ) ) ; xB = B * ( Math . sin ( Math . toRadians ( thetaB ) ) ) ; yB = B * ( Math . cos ( Math . toRadians ( thetaB ) ) ) ; double di = ( xA - xB ) * ( xA - xB ) + ( yA - yB ) * ( yA - yB ) ; double dist = Math . sqrt ( di ) ; System . out . println ( dist ) ; } } import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; public class Main { static Input in = new Input ( System . in ) ; static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int H = in . nextInt ( ) ; int M = in . nextInt ( ) ; double r = 2 * Math . PI * ( ( H / 12d ) + ( M / 60d / 12d ) - ( M / 60D ) ) ; out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( r ) ) ) ; out . flush ( ) ; } static class Input { private BufferedReader br ; private String [ ] buff ; private int index = 0 ; Input ( InputStream is ) { br = new BufferedReader ( new InputStreamReader ( is ) ) ; } String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return null ; } String next ( ) { while ( buff = = null | | index > = buff . length ) { buff = nextLine ( ) . split ( " " ) ; index = 0 ; } return buff [ index + + ] ; } byte nextByte ( ) { return Byte . parseByte ( next ( ) ) ; } short nextShort ( ) { return Short . parseShort ( next ( ) ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } BigInteger nextBigInteger ( ) { return new BigInteger ( next ( ) ) ; } BigDecimal nextBigDecimal ( ) { return new BigDecimal ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { int N = scan . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] C = new int [ N ] ; int count = 0 ; long goA = 0 ; long goB = 0 ; long hu = 0 ; int huco = 0 ; for ( int i = 0 ; i < N ; i + + ) A [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) B [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { C [ i ] = A [ i ] - B [ i ] ; if ( C [ i ] < 0 ) { hu + = ( long ) C [ i ] ; huco + + ; } goA + = ( long ) A [ i ] ; goB + = ( long ) B [ i ] ; if ( A [ i ] < B [ i ] ) count + + ; } if ( goA < goB ) { System . out . println ( - 1 ) ; return ; } if ( count = = 0 ) { System . out . println ( 0 ) ; return ; } int co = 0 ; Arrays . sort ( C ) ; for ( int i = N - 1 ; i > = 0 ; i -- ) { if ( C [ i ] > 0 ) { hu + = C [ i ] ; huco + + ; if ( hu > = 0 ) { break ; } } } System . out . println ( huco ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a , b , c ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; c = in . nextInt ( ) ; int countFive = 0 ; int countSeven = 0 ; if ( a = = 5 ) { countFive + + ; } else if ( a = = 7 ) { countSeven + + ; } if ( b = = 5 ) { countFive + + ; } else if ( b = = 7 ) { countSeven + + ; } if ( c = = 5 ) { countFive + + ; } else if ( c = = 7 ) { countSeven + + ; } if ( countFive = = 2 & & countSeven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws InterruptedException { Scanner in = new Scanner ( System . in ) ; double E = 1e-9 ; double N = in . nextDouble ( ) ; boolean answerFound = false ; double d = 4 / N ; for ( double i = 3500 ; i > 0 & & 1 / i < d & & ! answerFound ; i -- ) { double dd = d - 1 / i ; for ( double j = 3500 ; j > 0 & & 1 / j < dd & & ! answerFound ; j -- ) { double ddd = dd - 1 / j ; double x = 1 / ddd ; int k = 0 ; if ( Math . abs ( Math . ceil ( x ) - x ) < = E ) { k = ( int ) Math . ceil ( x ) ; answerFound = true ; } else if ( Math . abs ( Math . floor ( x ) - x ) < = E ) { k = ( int ) Math . floor ( x ) ; answerFound = true ; } if ( answerFound ) { System . out . printf ( " % d % d % d \ n " , ( int ) i , ( int ) j , k ) ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long sum = 0 ; long minus = 0 ; int C _ minus = 0 ; for ( int i = 0 ; i < N ; i + + ) { long Ai = sc . nextLong ( ) ; A [ i ] = Ai ; C [ i ] = Ai ; } for ( int i = 0 ; i < N ; i + + ) { long Bi = sc . nextLong ( ) ; B [ i ] = Bi ; C [ i ] = C [ i ] - Bi ; sum + = C [ i ] ; if ( C [ i ] < 0 ) { C _ minus + + ; minus + = C [ i ] ; } } if ( C _ minus = = 0 ) { System . out . println ( 0 ) ; } else if ( sum < 0 ) { System . out . println ( - 1 ) ; } else { int answer = 0 ; Arrays . sort ( C ) ; for ( int i = C . length - 1 ; i > = 0 ; i -- ) { minus + = C [ i ] ; if ( minus > 0 ) { answer = C . length - 1 - i + 1 ; break ; } } answer + = C _ minus ; System . out . println ( answer ) ; } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { list . add ( scanner . nextInt ( ) ) ; scanner . nextLine ( ) ; } int k = scanner . nextInt ( ) ; scanner . nextLine ( ) ; list . sort ( ( x , y ) - > x - y ) ; if ( ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k & & x + y + z = = s ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . ArrayDeque ; import java . util . Queue ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static long N = sc . nextLong ( ) ; static long P = sc . nextLong ( ) ; static class Pair { public long x ; public long y ; public Pair ( long x , long y ) { this . x = x ; this . y = y ; } } public static void main ( String [ ] args ) { long ans = 1 ; Queue < Pair > que = new ArrayDeque < > ( ) ; for ( long i = 2 ; i * i < = P ; i + + ) { if ( P % i ! = 0 ) continue ; long count = 0 ; while ( P % i = = 0 ) { count + + ; P / = i ; } Pair pair = new Pair ( i , count ) ; que . add ( pair ) ; } if ( P ! = 1 ) { que . add ( new Pair ( P , 1 ) ) ; } while ( ! que . isEmpty ( ) ) { Pair pair2 = que . poll ( ) ; for ( int i = 0 ; i < pair2 . y / N ; i + + ) { ans * = pair2 . x ; } } System . out . println ( ans ) ; } } import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String result = " No " ; for ( int a1 = - 200 ; a1 < = 200 ; a1 + + ) { boolean bool = true ; int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; int a2 = c [ 1 ] [ 0 ] - b1 ; int a3 = c [ 2 ] [ 0 ] - b1 ; if ( c [ 1 ] [ 1 ] ! = a2 + b2 ) bool = false ; if ( c [ 1 ] [ 2 ] ! = a2 + b3 ) bool = false ; if ( c [ 2 ] [ 1 ] ! = a3 + b2 ) bool = false ; if ( c [ 2 ] [ 2 ] ! = a3 + b3 ) bool = false ; if ( bool ) { result = " Yes " ; break ; } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ sc . nextInt ( ) ] = 1 ; } if ( a [ 1 ] = = 1 & & a [ 7 ] = = 1 & & a [ 9 ] = = 1 & & a [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int z = S - i - j ; if ( 0 < = z & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; class C { public static void main ( String ... args ) { final Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int [ ] A = new int [ N ] ; Arrays . setAll ( A , i - > sc . nextInt ( ) ) ; final int [ ] B = new int [ N ] ; Arrays . setAll ( B , i - > sc . nextInt ( ) ) ; for ( int i = 0 ; i < N ; i + + ) A [ i ] - = B [ i ] ; Arrays . sort ( A ) ; long minus = 0 ; int ans = 0 ; for ( int i = 0 ; i < N & & A [ i ] < 0 ; i + + , ans + + ) minus + = A [ i ] ; for ( int i = N - 1 ; i > = 0 & & A [ i ] > 0 & & minus < 0 ; i -- , ans + + ) minus + = A [ i ] ; System . out . println ( minus < 0 ? - 1 : ans ) ; } } public class Main { public static void main ( String ... args ) { C . main ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String in = br . readLine ( ) ; String chr [ ] = in . split ( " " ) ; int five = 0 ; int seve = 0 ; for ( int i = 0 ; i < chr . length ; i + + ) { if ( Integer . parseInt ( chr [ i ] ) = = 5 ) { five + + ; } else if ( Integer . parseInt ( chr [ i ] ) = = 7 ) { seve + + ; } else { break ; } } if ( five = = 2 & & seve = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . * ; class Main { static int mod = 1000000007 ; static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = s . nextInt ( ) - 1 , m = s . nextInt ( ) - 1 ; long [ ] a = new long [ n ] , b = new long [ m ] ; f ( a ) ; f ( b ) ; System . err . println ( Arrays . toString ( a ) ) ; System . err . println ( Arrays . toString ( b ) ) ; long A = g ( n , a ) , B = g ( m , b ) ; System . out . println ( A * B % mod ) ; } static void f ( long [ ] a ) { long p = s . nextLong ( ) ; for ( int i = 0 ; i < a . length ; + + i ) { long q = s . nextLong ( ) ; a [ i ] = q - p ; p = q ; } } static long g ( int n , long [ ] a ) { long A = 0 ; for ( int i = 0 ; i < n ; + + i ) { long p = Math . min ( i , n - 1 - i ) ; A + = ( ( p + 1 ) * p + ( n - p * 2 ) * ( p + 1 ) ) % mod * a [ i ] ; A % = mod ; } return A ; } } import java . util . Scanner ; import java . io . File ; import java . io . FileNotFoundException ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = scanner . nextInt ( ) ; } int min = ( 1 < < 30 ) , ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] < min ) { min = arr [ i ] ; ans + = 1 ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { for ( int j = 0 ; j < = 100 ; j + + ) { for ( int k = 0 ; k < = 100 ; k + + ) { if ( a [ 0 ] [ 0 ] - i = = a [ 1 ] [ 0 ] - j & & a [ 1 ] [ 0 ] - j = = a [ 2 ] [ 0 ] - k & & a [ 2 ] [ 0 ] - k = = a [ 0 ] [ 0 ] - i ) { if ( a [ 0 ] [ 1 ] - i = = a [ 1 ] [ 1 ] - j & & a [ 1 ] [ 1 ] - j = = a [ 2 ] [ 1 ] - k & & a [ 2 ] [ 1 ] - k = = a [ 0 ] [ 1 ] - i ) { if ( a [ 0 ] [ 2 ] - i = = a [ 1 ] [ 2 ] - j & & a [ 1 ] [ 2 ] - j = = a [ 2 ] [ 2 ] - k & & a [ 2 ] [ 2 ] - k = = a [ 0 ] [ 2 ] - i ) { System . out . println ( " Yes " ) ; return ; } } } } } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] data = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { data [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 = 0 ; int b1 = data [ 0 ] [ 0 ] ; int b2 = data [ 1 ] [ 0 ] ; int b3 = data [ 2 ] [ 0 ] ; int a2 = data [ 0 ] [ 1 ] - b1 ; int a3 = data [ 0 ] [ 2 ] - b1 ; if ( data [ 0 ] [ 0 ] = = a1 + b1 & & data [ 0 ] [ 1 ] = = a2 + b1 & & data [ 0 ] [ 2 ] = = a3 + b1 & & data [ 1 ] [ 0 ] = = a1 + b2 & & data [ 1 ] [ 1 ] = = a2 + b2 & & data [ 1 ] [ 2 ] = = a3 + b2 & & data [ 2 ] [ 0 ] = = a1 + b3 & & data [ 2 ] [ 1 ] = = a2 + b3 & & data [ 2 ] [ 2 ] = = a3 + b3 ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { int N ; public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . read ( ) ; m . solve ( ) ; } private void read ( ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; } private void solve ( ) { long w = 0 , n , h = 0 ; long a , b ; for ( n = 1 ; n < = 3500 ; n + + ) { for ( h = 1 ; h < = 3500 ; h + + ) { a = 4 * h * n - N * ( n + h ) ; b = N * h * n ; if ( a > 0 & & b > 0 & & b % a = = 0 ) { w = b / a ; break ; } } if ( w ! = 0 ) break ; } System . out . printf ( " % d % d % d \ n " , n , h , w ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } boolean f1 = false , f2 = false , f3 = false , f4 = false ; for ( int i = 0 ; i < 4 ; i + + ) { if ( num [ i ] = = 1 ) f1 = true ; else if ( num [ i ] = = 9 ) f2 = true ; else if ( num [ i ] = = 7 ) f3 = true ; else if ( num [ i ] = = 4 ) f4 = true ; } if ( f1 & & f2 & & f3 & & f4 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( sc . hasNext ( ) ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . Arrays ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; long ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) for ( int j = 0 ; j < = K ; j + + ) if ( 0 < = S - i - j & & S - i - j < = K ) ans + + ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String A = scan . next ( ) ; String B = scan . next ( ) ; String C = scan . next ( ) ; if ( A . equals ( " 5 " ) & & B . equals ( " 5 " ) ) { System . out . println ( " YES " ) ; } else if ( B . equals ( " 5 " ) & & C . equals ( " 5 " ) ) { System . out . println ( " YES " ) ; } else if ( A . equals ( " 5 " ) & & C . equals ( " 5 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] ks = scanner . nextLine ( ) . split ( " " , 2 ) ; int k = Integer . parseInt ( ks [ 0 ] ) ; int s = Integer . parseInt ( ks [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = 0 ; y < = Math . min ( k , s - x ) ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { list . add ( sc . next ( ) ) ; } System . out . println ( list . contains ( " 1 " ) & & list . contains ( " 9 " ) & & list . contains ( " 7 " ) & & list . contains ( " 4 " ) ? " YES " : " NO " ) ; } } import java . util . * ; class Main { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double A = 2 * Math . PI * m / 60 ; double B = 2 * Math . PI * ( ( h + m / 60 ) / 12 ) ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . abs ( A - B ) ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N = = 1 ) { System . out . println ( 1 ) ; } else { int ans = 0 ; for ( int i = 2 ; i < = N ; i = i * 2 ) { ans = i ; } System . out . println ( ans ) ; } } } import java . io . IOException ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int [ ] num = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = scanner . nextInt ( ) ; } Arrays . sort ( num ) ; if ( num [ 0 ] = = 5 ) { if ( num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { long N , P ; List < Long > coords ; long limit ; long result = 1 ; Main ( ) { Scanner in = new Scanner ( System . in ) ; N = in . nextLong ( ) ; P = in . nextLong ( ) ; in . close ( ) ; calcLimit ( ) ; } void calcLimit ( ) { long times = N ; limit = P ; while ( times > = 2 ) { limit = ( long ) Math . sqrt ( ( double ) limit ) ; times / = 2 ; } } void calc ( ) { for ( long v = limit ; v > 0 ; -- v ) { if ( Math . pow ( v , N ) > P ) { continue ; } if ( P % ( long ) Math . pow ( v , N ) = = 0 ) { result = v ; break ; } } } public static void main ( String [ ] args ) { Main ins = new Main ( ) ; ins . calc ( ) ; System . out . println ( ins . result ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = scan . next ( ) ; if ( ! list . contains ( s ) ) list . add ( s ) ; } if ( list . size ( ) = = 4 ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int m = H * 60 + M ; double distance = Math . sqrt ( ( A * Math . cos ( m * Math . PI / 30 ) - B * Math . cos ( m * Math . PI / 360 ) ) * ( A * Math . cos ( m * Math . PI / 30 ) - B * Math . cos ( m * Math . PI / 360 ) ) + ( A * Math . sin ( m * Math . PI / 30 ) - B * Math . sin ( m * Math . PI / 360 ) ) * ( A * Math . sin ( m * Math . PI / 30 ) - B * Math . sin ( m * Math . PI / 360 ) ) ) ; System . out . println ( distance ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 0 ; int cout = 0 ; int temp = 0 ; int ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { x = i ; while ( x % 2 = = 0 ) { temp + + ; x / = 2 ; } if ( temp > cout ) { cout = temp ; ans = i ; } temp = 0 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; long A [ ] = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = scan . nextLong ( ) ; } long res = 0 ; long min = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( i = = 0 ) { res + = A [ i ] - 1 ; min = 1 ; continue ; } if ( min + 1 = = A [ i ] ) { min = A [ i ] ; } else if ( min + 1 < A [ i ] ) { res + = ( A [ i ] - 1 ) / ( min + 1 ) ; } } System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; int count = 1 ; int min = sc . nextInt ( ) ; for ( long i = 0 ; i < n - 1 ; i + + ) { int a = sc . nextInt ( ) ; if ( a < = min ) count + + ; min = Math . min ( min , a ) ; } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import static java . lang . Integer . parseInt ; public class Main { static final int INF = 1 < < 29 ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; String [ ] words ; line = br . readLine ( ) ; int H , W ; H = parseInt ( line . substring ( 0 , line . indexOf ( ' ' ) ) ) ; W = parseInt ( line . substring ( line . indexOf ( ' ' ) + 1 ) ) ; int [ ] [ ] map = new int [ H ] [ W ] ; for ( int i = 0 ; i < H ; i + + ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; for ( int j = 0 ; j < W ; j + + ) { map [ i ] [ j ] = parseInt ( st . nextToken ( ) ) ; } } int ans = INF ; for ( int i = 0 ; i < H ; i + + ) { for ( int j = 0 ; j < W ; j + + ) { int sum = 0 ; for ( int m = 0 ; m < H ; m + + ) { for ( int n = 0 ; n < W ; n + + ) { sum + = Math . min ( Math . abs ( i - m ) , Math . abs ( j - n ) ) * map [ m ] [ n ] ; } } ans = Math . min ( ans , sum ) ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . Comparator ; import java . util . PriorityQueue ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; PriorityQueue < Integer > P = new PriorityQueue < > ( Comparator . reverseOrder ( ) ) ; P . add ( Math . abs ( A - B ) ) ; P . add ( Math . abs ( B - C ) ) ; P . add ( Math . abs ( C - A ) ) ; P . poll ( ) ; System . out . println ( P . poll ( ) + P . poll ( ) ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] an = new int [ 5 ] ; an [ 0 ] = sc . nextInt ( ) ; an [ 1 ] = sc . nextInt ( ) ; an [ 2 ] = sc . nextInt ( ) ; an [ 3 ] = sc . nextInt ( ) ; an [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( an [ i ] - an [ j ] ) > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; in . nextLine ( ) ; boolean hasYellow = false ; String s = " " ; for ( int i = 0 ; i < n ; i + + ) { s = in . next ( ) ; if ( s . equals ( " Y " ) ) { hasYellow = true ; break ; } } if ( hasYellow ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 , z = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { z = S - x - y ; if ( z > = 0 & & z < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N ; N = new int [ 4 ] ; N [ 0 ] = sc . nextInt ( ) ; N [ 1 ] = sc . nextInt ( ) ; N [ 2 ] = sc . nextInt ( ) ; N [ 3 ] = sc . nextInt ( ) ; Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 ) { if ( N [ 1 ] = = 4 ) { if ( N [ 2 ] = = 7 ) { if ( N [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] list = new int [ 5 ] ; for ( int i = 0 ; i < list . length ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = 0 ; for ( int i = 0 ; i < list . length ; i + + ) { for ( int j = i + 1 ; j < list . length ; j + + ) { max = Math . max ( max , list [ j ] - list [ i ] ) ; } } if ( max > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; int c = input . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) System . out . println ( " YES " ) ; else if ( a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else if ( a = = 5 & & b = = 7 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double d = 0 ; int x = 6 * m ; double y = 0.5 * m + 30 * h ; double z = Math . abs ( x - y ) ; if ( z < = 180 ) { d = z ; } else { d = 360 - z ; } double rad = Math . toRadians ( z ) ; double A = a * a ; double B = b * b ; double C = 2 * a * b * Math . cos ( rad ) ; System . out . println ( Math . sqrt ( A + B - C ) ) ; } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner sc = new Scanner ( is ) ; int p [ ] = new int [ 5 ] ; for ( int i = 0 ; i < p . length ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < p . length ; i + + ) { for ( int j = 0 ; j < p . length ; j + + ) { if ( Math . abs ( p [ j ] - p [ i ] ) > k ) { os . println ( " : ( " ) ; return ; } } } os . println ( " Yay ! " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; long count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } out . println ( count ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int time = h * 60 + m ; double hd = 0.5 * time ; double md = 6.0 * m ; double hx = Math . sin ( Math . toRadians ( hd ) ) * a ; double hy = Math . cos ( Math . toRadians ( hd ) ) * a ; double mx = Math . sin ( Math . toRadians ( md ) ) * b ; double my = Math . cos ( Math . toRadians ( md ) ) * b ; double x = ( hx - mx ) ; if ( x < 0 ) { x * = - 1 ; } double y = ( hy - my ) ; if ( y < 0 ) { y * = - 1 ; } double ans = x * x + y * y ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int m2 = h * 60 + m ; int rev = 12 * 60 ; double hrot = ( double ) ( m2 ) / rev ; double mrot = ( double ) ( m ) / 60 ; double hx = a * Math . sin ( 2 * Math . PI * hrot ) ; double hy = a * Math . cos ( 2 * Math . PI * hrot ) ; double mx = b * Math . sin ( 2 * Math . PI * mrot ) ; double my = b * Math . cos ( 2 * Math . PI * mrot ) ; double dx = hx - mx ; double dy = hy - my ; double dist = Math . pow ( dx * dx + dy * dy , 0.5 ) ; System . out . println ( dist ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int b = a [ 4 ] - a [ 0 ] ; if ( b > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double r1 = sc . nextDouble ( ) ; double r2 = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double deg1 = ( ( h - 3 ) * - 30 ) + ( m / - 2 ) ; double deg2 = ( ( m - 15 ) * - 6 ) ; while ( deg1 < 0 ) deg1 + = 360d ; while ( deg2 < 0 ) deg2 + = 360d ; deg1 = ( deg1 * Math . PI ) / 180 ; deg2 = ( deg2 * Math . PI ) / 180 ; double x1 = Math . cos ( deg1 ) * r1 ; double y1 = Math . sin ( deg1 ) * r1 ; double x2 = Math . cos ( deg2 ) * r2 ; double y2 = Math . sin ( deg2 ) * r2 ; double xx = ( x1 - x2 ) * ( x1 - x2 ) ; double yy = ( y1 - y2 ) * ( y1 - y2 ) ; double dis = Math . sqrt ( xx + yy ) ; System . out . printf ( " % .16f \ n " , dis ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; int score = 0 ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; if ( S [ i ] . equals ( " Y " ) ) { score + = 1 ; } } if ( score = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; import javax . lang . model . util . ElementScanner6 ; import java . lang . Math ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ao = 2 * Math . PI / ( 12 * 60 ) ; double ax = a * ( Math . sin ( ( h * 60 + m ) * ao ) ) ; double ay = a * ( Math . cos ( ( h * 60 + m ) * ao ) ) ; ; double bx = b * ( Math . sin ( 2 * Math . PI * m / 60 ) ) ; double by = b * ( Math . cos ( 2 * Math . PI * m / 60 ) ) ; ; double out = Math . sqrt ( Math . pow ( ax - bx , 2 ) + Math . pow ( ay - by , 2 ) ) ; System . out . println ( out ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int n ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; n = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { int ans = 1 ; while ( ans < = n ) { ans * = 2 ; } ans / = 2 ; System . out . println ( ans ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int output = 0 ; try { String [ ] keyboardInput = br . readLine ( ) . split ( " " ) ; int K = Integer . parseInt ( keyboardInput [ 0 ] ) ; int S = Integer . parseInt ( keyboardInput [ 1 ] ) ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( S - x - y > = 0 & & S - x - y < = K ) { output + + ; } } } System . out . println ( output ) ; } catch ( IOException e ) { System . out . println ( e . getMessage ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int k = scn . nextInt ( ) ; int s = scn . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = k ; + + y ) { if ( s > = x + y & & s - ( x + y ) < = k ) { count = count + 1 ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } long cnt = a [ 0 ] - 1 ; int max = 2 ; for ( int i = 1 ; i < n ; i + + ) { if ( max < a [ i ] ) { int c = a [ i ] % max = = 0 ? ( int ) Math . floor ( a [ i ] / max ) - 1 : ( int ) Math . floor ( a [ i ] / max ) ; cnt + = c ; a [ i ] = 1 ; } max = Math . max ( a [ i ] + 1 , max ) ; } sb . append ( cnt ) ; System . out . println ( sb ) ; } } 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 . FileReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CLowElements solver = new CLowElements ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CLowElements { public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) arr [ i ] = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int c = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] < min ) c + + ; min = Math . min ( min , arr [ i ] ) ; } pw . println ( c ) ; } } static class Scanner { StringTokenizer st ; BufferedReader br ; public Scanner ( FileReader r ) { br = new BufferedReader ( r ) ; } public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] N = new Integer [ 4 ] ; int sum = 0 , product = 1 ; for ( int i = 0 ; i < 4 ; i + + ) { N [ i ] = sc . nextInt ( ) ; sum + = N [ i ] ; product * = N [ i ] ; } if ( sum = = 21 & & product = = 252 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int [ ] positions = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { positions [ i ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean pass = true ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { int difference = positions [ j ] - positions [ i ] ; if ( difference > border ) { pass = false ; break ; } } } if ( pass ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; import java . math . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double s = h / 12 * 360 ; double l = m / 60 * 360 ; s + = l / 12 ; double res = Math . abs ( s - l ) ; res = Math . min ( 360 - res , res ) ; double r = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( res ) ) ) ; System . out . println ( r ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( k < = K & & 0 < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " " ) ; int k = Integer . parseInt ( line [ 0 ] ) ; int s = Integer . parseInt ( line [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { int n = ni ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; + + i ) { a [ i ] = ni ( ) ; } int max = 1 ; long cnt = a [ 0 ] - 1 ; for ( int i = 1 ; i < n ; + + i ) { if ( a [ i ] = = max + 1 ) { + + max ; continue ; } long v = ( a [ i ] - 1 ) / ( max + 1 ) ; cnt + = v ; } System . out . println ( cnt ) ; } int ni ( ) { return Integer . parseInt ( sc . next ( ) ) ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int digit = sc . nextInt ( ) ; if ( min > digit ) { min = digit ; ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int N = input . nextInt ( ) ; long [ ] a = new long [ N ] ; long [ ] b = new long [ N ] ; long [ ] d = new long [ N ] ; boolean [ ] vis = new boolean [ N ] ; long Sa = 0 ; long Sb = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = input . nextLong ( ) ; Sa + = a [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { b [ i ] = input . nextLong ( ) ; Sb + = b [ i ] ; } if ( Sb > Sa ) ans = - 1 ; else { for ( int i = 0 ; i < N ; i + + ) { d [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( d ) ; int L = 0 ; int R = N - 1 ; while ( true ) { if ( d [ L ] > = 0 ) break ; long min = Math . min ( Math . abs ( d [ L ] ) , d [ R ] ) ; d [ L ] + = min ; d [ R ] - = min ; if ( ! vis [ L ] ) ans + + ; if ( ! vis [ R ] ) ans + + ; vis [ L ] = true ; vis [ R ] = true ; if ( d [ R ] = = 0 ) R -- ; if ( d [ L ] = = 0 ) L + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; long X = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] [ ] min = new int [ N ] [ N ] ; for ( int i = 0 ; i < N ; + + i ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; + + i ) { min [ i ] [ i ] = A [ i ] ; } for ( int i = 0 ; i < N ; + + i ) { for ( int j = i + 1 ; j < N ; + + j ) { min [ i ] [ j ] = Math . min ( min [ i ] [ j - 1 ] , A [ j ] ) ; } } long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; + + i ) { long cur = X * i ; for ( int j = 0 ; j < N ; + + j ) { if ( j > = i ) { cur + = min [ j - i ] [ j ] ; } else { cur + = Math . min ( min [ 0 ] [ j ] , min [ N - ( i - j ) ] [ N - 1 ] ) ; } } ans = Math . min ( ans , cur ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( array [ i ] - array [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n , i = 0 ; String result = " Three " , in ; n = Integer . parseInt ( reader . readLine ( ) ) ; char a [ ] = new char [ n ] ; in = reader . readLine ( ) ; while ( i < n ) { a [ i ] = in . charAt ( i ) ; i = + + i ; } for ( i = 0 ; i < n ; i + + ) { if ( a [ i ] = = ' Y ' ) { result = " Four " ; } } System . out . println ( result ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int count = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 4 ; i > 0 ; i -- ) { for ( int j = 3 ; j > = 0 ; j -- ) { if ( A [ i ] - A [ j ] > k ) { count + + ; } } } if ( count > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int j , cnt = 0 ; int min = 999999999 ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( min , p [ i ] ) ; if ( min = = p [ i ] ) cnt + + ; } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int min = Integer . MAX _ VALUE ; int max = Integer . MIN _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = sc . nextInt ( ) ; min = Math . min ( min , tmp ) ; max = Math . max ( max , tmp ) ; sc . nextLine ( ) ; } if ( max - min > sc . nextInt ( ) ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( a , b ) , c ) - Math . min ( Math . min ( a , b ) , c ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int [ ] hairetu = new int [ b ] ; for ( int i = 0 ; i < hairetu . length ; i + + ) { int c = sc . nextInt ( ) ; hairetu [ i ] = c ; } int count = 0 ; int champ = hairetu [ 0 ] ; for ( int k = 0 ; k < hairetu . length ; k + + ) { if ( champ > = hairetu [ k ] ) { champ = hairetu [ k ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N1 = stdIn . nextInt ( ) ; int N2 = stdIn . nextInt ( ) ; int N3 = stdIn . nextInt ( ) ; int N4 = stdIn . nextInt ( ) ; int h1 = 0 , h2 = 0 , h3 = 0 , h4 = 0 ; if ( N1 = = 1 ) h1 + + ; if ( N2 = = 1 ) h1 + + ; if ( N3 = = 1 ) h1 + + ; if ( N4 = = 1 ) h1 + + ; if ( h1 = = 0 | | h1 > 1 ) System . out . println ( " NO " ) ; else { if ( N1 = = 9 ) h2 + + ; if ( N2 = = 9 ) h2 + + ; if ( N3 = = 9 ) h2 + + ; if ( N4 = = 9 ) h2 + + ; if ( h2 = = 0 | | h2 > 1 ) System . out . println ( " NO " ) ; else { if ( N1 = = 7 ) h3 + + ; if ( N2 = = 7 ) h3 + + ; if ( N3 = = 7 ) h3 + + ; if ( N4 = = 7 ) h3 + + ; if ( h3 = = 0 | | h3 > 1 ) System . out . println ( " NO " ) ; else { if ( N1 = = 4 ) h4 + + ; if ( N2 = = 4 ) h4 + + ; if ( N3 = = 4 ) h4 + + ; if ( N4 = = 4 ) h4 + + ; if ( h4 = = 0 | | h4 > 1 ) System . out . println ( " NO " ) ; else { System . out . println ( " YES " ) ; } } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; long n = stdin . nextLong ( ) ; long p = stdin . nextLong ( ) ; if ( n = = 1 ) { System . out . println ( p ) ; System . exit ( 0 ) ; } long q = ( long ) Math . sqrt ( p ) ; long ans = 1 ; for ( long i = 2 ; i < = q ; i + + ) { long v = 0 ; while ( p % i = = 0 ) { v + + ; p / = i ; } if ( n < = v ) { ans * = ( long ) Math . pow ( ( double ) i , ( double ) ( v / n ) ) ; } } System . out . println ( ans ) ; } private static boolean isPrime ( long x ) { if ( x < 2 ) return false ; if ( x = = 2 ) return true ; if ( x % 2 = = 0 ) return false ; for ( long i = 3 ; i * i < = x ; i + = 2 ) { if ( x % i = = 0 ) return false ; } return true ; } } import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { new Solution ( ) ; } } class Solution { Scanner scanner ; public Solution ( ) { scanner = new Scanner ( System . in ) ; while ( scanner . hasNext ( ) ) { run _ case ( ) ; } } private void run _ case ( ) { scanner . nextLine ( ) ; String line = scanner . nextLine ( ) ; int [ ] arr = strToIntArray ( line ) ; int res = 0 ; TreeMap < Integer , Integer > map = new TreeMap < > ( ) ; for ( int u : arr ) { map . put ( u , 1 ) ; if ( map . lowerKey ( u ) = = null ) res + + ; } System . out . println ( res ) ; return ; } private int [ ] strToIntArray ( String str ) { String [ ] vals = str . split ( " \ \ s + " ) ; int sz = vals . length ; int [ ] res = new int [ sz ] ; for ( int i = 0 ; i < sz ; i + + ) { res [ i ] = Integer . parseInt ( vals [ i ] ) ; } return res ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] [ ] a = new int [ 3 ] [ 3 ] ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = true ; for ( int k = 0 ; k < 100 ; k + + ) { x [ 0 ] = k ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = a [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = a [ i ] [ 0 ] - y [ 0 ] ; } flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( x [ i ] + y [ j ] ! = a [ i ] [ j ] ) { flag = false ; break ; } } } if ( flag ) { break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int kai = 2 ; int conut = 0 ; if ( N = = 1 ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } for ( int i = 0 ; i < N ; i + + ) { kai = kai * 2 ; if ( kai > N ) { kai = kai / 2 ; break ; } } System . out . println ( kai ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = Double . parseDouble ( sc . next ( ) ) ; double B = Double . parseDouble ( sc . next ( ) ) ; double H = Double . parseDouble ( sc . next ( ) ) ; double M = Double . parseDouble ( sc . next ( ) ) ; sc . close ( ) ; double degree = 0 ; double shortDegree = ( H * 60 + M ) * 0.5 ; double longDegree = M * 6 ; if ( Math . abs ( longDegree - shortDegree ) < = 180 ) { degree = Math . abs ( longDegree - shortDegree ) ; } else { degree = 360 - Math . abs ( longDegree - shortDegree ) ; } double r = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( String . format ( " % .15f " , r ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } int temp1 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; int temp2 = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ; int temp3 = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ; int temp4 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; int temp5 = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ; int temp6 = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ; boolean ans = true ; if ( temp1 ! = temp2 ) { ans = false ; } if ( temp1 ! = temp3 ) { ans = false ; } if ( temp4 ! = temp5 ) { ans = false ; } if ( temp4 ! = temp6 ) { ans = false ; } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N ] ; int C [ ] = new int [ N ] ; int z = 0 , y = 0 , x = 0 , w = 0 ; long m = 0 ; while ( z < N ) { A [ z ] = stdIn . nextInt ( ) ; z + + ; } z = 0 ; while ( z < N ) { B [ z ] = stdIn . nextInt ( ) ; m + = A [ z ] - B [ z ] ; if ( A [ z ] - B [ z ] > 0 ) { C [ y ] = A [ z ] - B [ z ] ; y + + ; } if ( A [ z ] - B [ z ] < 0 ) { x + + ; } z + + ; } z = 0 ; if ( x = = 0 ) System . out . println ( 0 ) ; else if ( m < 0 ) System . out . println ( - 1 ) ; else { Arrays . sort ( C ) ; while ( z < N ) { m - = C [ z ] ; if ( C [ z ] ! = 0 ) w + + ; if ( m < = 0 ) break ; z + + ; } if ( m < 0 ) w - = 1 ; System . out . println ( x + ( y - w ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int antennas [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; if ( antennas [ 4 ] - antennas [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; long sum = 0 ; int check = s - 2 * k ; int initial = ( int ) Math . max ( 0 , check ) ; for ( int i = initial ; i < = k ; i + + ) { int current = s - i ; int start = 0 ; int end = k ; if ( current > 2 * k ) { continue ; } else if ( current > k ) { start = current - k ; sum + = end - start + 1 ; } else if ( current > = 0 ) { end = current ; sum + = end - start + 1 ; } } System . out . println ( sum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } System . out . println ( five = = 2 & & seven = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean P = false ; boolean W = false ; boolean G = false ; boolean Y = false ; for ( int i = 0 ; i < N ; i + + ) { String c = sc . next ( ) ; if ( c . equals ( " P " ) ) { P = true ; } else if ( c . equals ( " W " ) ) { W = true ; } else if ( c . equals ( " G " ) ) { G = true ; } else if ( c . equals ( " Y " ) ) { Y = true ; } } int answer = 0 ; if ( P = = true ) { answer + + ; } if ( W = = true ) { answer + + ; } if ( G = = true ) { answer + + ; } if ( Y = = true ) { answer + + ; } if ( answer = = 3 ) { System . out . println ( " Three " ) ; } else if ( answer = = 4 ) { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int min = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( min > a [ i ] ) { ans + + ; min = a [ i ] ; } } System . out . println ( ans + 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int [ ] [ ] table = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { table [ i ] [ j ] = scanner . nextInt ( ) ; } } int a1 = 0 ; int a2 = 0 ; int a3 = 0 ; int b1 = 0 ; int b2 = 0 ; int b3 = 0 ; for ( a1 = 0 ; a1 < = table [ 0 ] [ 0 ] ; a1 + + ) { b1 = table [ 0 ] [ 0 ] - a1 ; a2 = table [ 1 ] [ 0 ] - b1 ; if ( a2 < 0 ) continue ; a3 = table [ 2 ] [ 0 ] - b1 ; if ( a3 < 0 ) continue ; b2 = table [ 0 ] [ 1 ] - a1 ; if ( b2 < 0 ) continue ; b3 = table [ 0 ] [ 2 ] - a1 ; if ( b3 < 0 ) continue ; if ( a2 + b2 ! = table [ 1 ] [ 1 ] ) continue ; if ( a2 + b3 ! = table [ 1 ] [ 2 ] ) continue ; if ( a3 + b2 ! = table [ 2 ] [ 1 ] ) continue ; if ( a3 + b3 ! = table [ 2 ] [ 2 ] ) continue ; System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . io . * ; import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( args ) ; } public void solve ( String [ ] args ) { MyScanner scanner = new MyScanner ( ) ; int N = scanner . nextInt ( ) ; int a = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { int b = a * 2 ; if ( b > N ) { System . out . println ( a ) ; return ; } else { a = b ; } } System . out . println ( a ) ; } private class MyScanner { String [ ] s ; int i ; BufferedReader br ; String reg = " " ; MyScanner ( ) { s = new String [ 0 ] ; i = 0 ; br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } public String next ( ) { try { if ( i < s . length ) return s [ i + + ] ; String line = br . readLine ( ) ; while ( line . equals ( " " ) ) { line = br . readLine ( ) ; } s = line . split ( reg , 0 ) ; i = 0 ; return s [ i + + ] ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; } public int nextInt ( ) { try { return Integer . parseInt ( next ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return - 1 ; } public double nextDouble ( ) { try { return Double . parseDouble ( next ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return - 1 ; } public long nextLong ( ) { try { return Long . parseLong ( next ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return - 1 ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 1 ; i < 9 ; i + + ) { if ( ans = = N ) break ; else if ( ans > N ) { ans = ans / 2 ; break ; } ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; double x = c * 30 ; double y = d * 6 ; x + = d * 0.5 ; x = ( x - y ) * Math . PI / 180 ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( x ) ) ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double arc = ( 5.5 * ( 60.0 * h + m ) ) % 360 * Math . PI / 180 ; double answer = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( arc ) ) ; System . out . println ( String . format ( " % .20f " , answer ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int c = 0 ; int o = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( o > p ) { c + + ; o = p ; } } System . out . println ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String input [ ] = new String [ n ] ; int yellow = 0 ; for ( int i = 0 ; i < n ; i + + ) { input [ i ] = sc . next ( ) ; if ( input [ i ] . equals ( " Y " ) ) yellow + + ; } if ( yellow > 0 ) { System . out . println ( " Four " ) ; } else System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int result = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int total = x + y ; if ( ! ( total > S ) & & ( total + K ) > = S ) { result + + ; } } } System . out . println ( result ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double angleH = ( H / 12 + M / 60 / 12 ) * Math . PI * 2 ; double angleM = M / 60 * Math . PI * 2 ; double difference = angleH - angleM ; double cosTheta = Math . cos ( difference ) ; double answer = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * cosTheta ) ) ; System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; double jikakudo = ( double ) h * 30 + ( double ) m / 2.0 ; double hunkakudo = 6.0 * ( double ) m ; double kakudo = 0 ; if ( sa ( jikakudo , hunkakudo ) > = 180 ) kakudo = 360 - sa ( jikakudo , hunkakudo ) ; else kakudo = sa ( jikakudo , hunkakudo ) ; double ans = a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( kakudo ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } static double sa ( double a , double c ) { if ( a < = c ) return c - a ; else return a - c ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int sum = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z < = K & & z > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public Main ( ) { Scanner sc = new Scanner ( System . in ) ; int n = 3 ; int [ ] [ ] a = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) for ( int j = 0 ; j < n ; j + + ) a [ i ] [ j ] = sc . nextInt ( ) ; int [ ] b1 = dif ( a [ 0 ] ) ; int [ ] b2 = dif ( a [ 1 ] ) ; int [ ] b3 = dif ( a [ 2 ] ) ; if ( b1 [ 0 ] = = b2 [ 0 ] & & b1 [ 1 ] = = b2 [ 1 ] & & b2 [ 0 ] = = b3 [ 0 ] & & b2 [ 1 ] = = b3 [ 1 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } private int [ ] dif ( int a [ ] ) { return new int [ ] { a [ 1 ] - a [ 0 ] , a [ 2 ] - a [ 1 ] } ; } public static void main ( String [ ] args ) { new Main ( ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; String [ ] lst = line . split ( " " ) ; int five _ cnt = 0 ; int seven _ cnt = 0 ; for ( int i = 0 ; i < lst . length ; i + + ) { int cnt = Integer . parseInt ( lst [ i ] ) ; if ( cnt = = 5 ) { five _ cnt + = 1 ; } else if ( cnt = = 7 ) { seven _ cnt + = 1 ; } } if ( five _ cnt = = 2 & & seven _ cnt = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . nextLine ( ) ) ; String line = sc . nextLine ( ) ; Set < String > sList = new HashSet < > ( Arrays . asList ( line . split ( " " ) ) ) ; if ( sList . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } Arrays . sort ( num ) ; if ( num [ 0 ] = = 1 & & num [ 1 ] = = 4 & & num [ 2 ] = = 7 & & num [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) < = k & & 0 < = s - ( i + j ) ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int z , cnt = 0 , i , j ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { z = s - ( i + j ) ; if ( 0 < = z & & z < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String s = sc . nextLine ( ) ; boolean haveFour = s . contains ( " Y " ) ; System . out . println ( haveFour ? " Four " : " Three " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; double a = s . nextDouble ( ) ; double b = s . nextDouble ( ) ; double h = s . nextDouble ( ) ; double m = s . nextDouble ( ) ; double cosh = Math . cos ( Math . toRadians ( angleh ( h , m ) ) ) ; double sinh = Math . sin ( Math . toRadians ( angleh ( h , m ) ) ) ; double cosm = Math . cos ( Math . toRadians ( anglem ( m ) ) ) ; double sinm = Math . sin ( Math . toRadians ( anglem ( m ) ) ) ; double dist = Math . pow ( ( a * cosh ) - ( b * cosm ) , 2 ) + Math . pow ( ( a * sinh ) - ( b * sinm ) , 2 ) ; dist = Math . sqrt ( dist ) ; System . out . println ( dist ) ; } public static double angleh ( double h , double m ) { double degree = 0 ; degree = degree + ( 360d / 12d ) * h ; degree = degree + ( ( 360d / ( 12 * 60 ) ) * m ) ; return degree ; } public static double anglem ( double m ) { double degree = 0 ; degree = degree + ( ( 360d / 60d ) * m ) ; return degree ; } } import java . io . PrintStream ; import java . util . Scanner ; public class Main { static void exec ( Scanner in , PrintStream out ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + = 1 ) { for ( int j = 0 ; j < 3 ; j + = 1 ) { c [ i ] [ j ] = in . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + = 1 ) { int a1 = i ; int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; int a2 = c [ 1 ] [ 0 ] - b1 ; if ( a2 + b2 ! = c [ 1 ] [ 1 ] | | a2 + b3 ! = c [ 1 ] [ 2 ] ) { continue ; } int a3 = c [ 2 ] [ 0 ] - b1 ; if ( a3 + b2 ! = c [ 2 ] [ 1 ] | | a3 + b3 ! = c [ 2 ] [ 2 ] ) { continue ; } out . println ( " Yes " ) ; return ; } out . println ( " No " ) ; } public static void main ( String [ ] args ) { exec ( new Scanner ( System . in ) , System . out ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double h = 30 * ( H + M / 60.0 ) ; double m = M * 6.0 ; double k = 360 - Math . abs ( m - h ) ; double cos = Math . cos ( Math . toRadians ( k ) ) ; double a = A * A + B * B - ( 2 * A * B * cos ) ; System . out . println ( Math . sqrt ( a ) ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { String line = " " ; try { line = readLine ( ) ; StringTokenizer st = new StringTokenizer ( line , " " ) ; String tempK = st . nextToken ( ) ; String tempS = st . nextToken ( ) ; int k = Integer . parseInt ( tempK ) ; int s = Integer . parseInt ( tempS ) ; int cnt = 0 ; for ( int i = 0 ; i < s + 1 ; i + + ) { if ( i > k ) { continue ; } for ( int j = 0 ; j < s + 1 ; j + + ) { if ( j > k ) { continue ; } else if ( s - i - j > k ) { continue ; } if ( i + j < = s ) { cnt + + ; } } } System . out . println ( cnt ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static String readLine ( ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return br . readLine ( ) ; } } import java . util . * ; import java . awt . * ; import java . awt . geom . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int [ ] a = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ sc . nextInt ( ) ] = 1 ; } if ( a [ 1 ] + a [ 9 ] + a [ 7 ] + a [ 4 ] = = 4 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int [ ] num = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = input . nextInt ( ) ; } Arrays . sort ( num ) ; if ( num [ 0 ] = = 1 & & num [ 1 ] = = 4 & & num [ 2 ] = = 7 & & num [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double x = ( m * 11 / 360 - h / 6 ) * Math . PI ; System . out . println ( Math . pow ( a * a + b * b - 2 * a * b * Math . cos ( x ) , 0.5 ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] data = { a , b , c } ; Arrays . sort ( data ) ; if ( data [ 0 ] = = 5 & & data [ 1 ] = = 5 & & data [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; Arrays . setAll ( a , i - > sc . nextInt ( ) ) ; int five = 0 , seven = 0 ; for ( int n : a ) { if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } System . out . println ( five = = 2 & & seven = = 1 ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; int e = in . nextInt ( ) ; int k = in . nextInt ( ) ; System . out . println ( ( e - a ) > k ? " : ( " : " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) , C = sc . nextInt ( ) ; System . out . println ( Math . max ( Math . max ( A , B ) , C ) - Math . min ( Math . min ( A , B ) , C ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scan . nextInt ( ) ; } } scan . close ( ) ; int check = 0 ; for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( c [ j ] [ i ] - c [ j ] [ i + 1 ] ! = c [ j + 1 ] [ i ] - c [ j + 1 ] [ i + 1 ] ) { check = 1 ; break ; } } if ( check = = 1 ) break ; } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( c [ i ] [ j ] - c [ i + 1 ] [ j ] ! = c [ i ] [ j + 1 ] - c [ i + 1 ] [ j + 1 ] ) { check = 1 ; break ; } } if ( check = = 1 ) break ; } System . out . println ( ( check = = 0 ) ? " Yes " : " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] n = sc . nextLine ( ) . toCharArray ( ) ; int count = 0 ; int seven = 0 ; for ( char c : n ) { if ( c = = ' 5' ) { count + + ; } if ( c = = ' 7' ) { seven + + ; } } if ( count = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static void printArray ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i + + ) { if ( i = = array . length ) { System . out . println ( array [ i ] ) ; } else { System . out . print ( String . format ( " % d " , array [ i ] ) ) ; } } } } import java . util . * ; public class Main { static int a , b , c , d , e , k ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; e = sc . nextInt ( ) ; k = sc . nextInt ( ) ; if ( hoge ( ) ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } static boolean hoge ( ) { if ( b - a > k ) return false ; else if ( c - a > k ) return false ; else if ( d - a > k ) return false ; else if ( e - a > k ) return false ; else if ( c - b > k ) return false ; else if ( d - b > k ) return false ; else if ( e - b > k ) return false ; else if ( d - c > k ) return false ; else if ( e - c > k ) return false ; else if ( e - d > k ) return false ; return true ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { int z = S - x - y ; if ( z < 0 | | z > K ) continue ; + + ans ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; boolean ans = false ; for ( int n = 0 ; n < = c [ 0 ] [ 0 ] ; n + + ) { a [ 0 ] = n ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; loop : for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] = = a [ i ] + b [ j ] ) { ans = true ; } else { ans = false ; break loop ; } } } } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( arr [ 4 ] - arr [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 1 ; while ( true ) { if ( i > n ) { System . out . println ( i / 2 ) ; return ; } i * = 2 ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x [ ] = new long [ 3 ] ; int a = 0 , b = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = sc . nextLong ( ) ; if ( x [ i ] = = 5 ) { a + + ; } else if ( x [ i ] = = 7 ) { b + + ; } } if ( a = = 2 & & b = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; double a = Double . parseDouble ( sc . next ( ) ) ; double b = Double . parseDouble ( sc . next ( ) ) ; double h = Double . parseDouble ( sc . next ( ) ) ; double m = Double . parseDouble ( sc . next ( ) ) ; h = 2 * Math . PI * h / 12 + 2 * Math . PI * m / 720 ; m = 2 * Math . PI * m / 60 ; if ( Math . abs ( h - m ) > Math . PI ) h = 2 * Math . PI - Math . abs ( h - m ) ; else h = Math . abs ( h - m ) ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( h ) ) ; System . out . println ( result ) ; } } import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; String arare [ ] = new String [ a ] ; for ( int x = 0 ; x < a ; x + + ) { arare [ x ] = scanner . next ( ) ; } int n = 0 ; boolean i = false ; String str = " Y " ; for ( n = 0 ; n < a ; n + + ) { if ( str . equals ( arare [ n ] ) ) i = true ; } if ( i ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 1 ; while ( num * 2 < = n ) { num * = 2 ; } System . out . println ( num ) ; sc . close ( ) ; } } import java . util . ArrayDeque ; import java . util . Collections ; import java . util . Deque ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import java . util . stream . Stream ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; long x = scan . nextLong ( ) ; long [ ] a = new long [ 2 * N ] ; for ( int i = 0 ; i < N ; + + i ) a [ i ] = scan . nextLong ( ) ; for ( int i = 0 ; i < N ; + + i ) a [ N + i ] = a [ i ] ; long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; + + i ) { Deque < Integer > que = new ArrayDeque < > ( ) ; long value = x * i ; for ( int j = N - i ; j < N ; + + j ) { que . addLast ( j ) ; while ( a [ que . peekFirst ( ) ] > a [ j ] ) { que . removeFirst ( ) ; } } for ( int j = N ; j < 2 * N ; + + j ) { while ( ! que . isEmpty ( ) & & j > que . peekFirst ( ) + i ) { que . removeFirst ( ) ; } while ( ! que . isEmpty ( ) & & a [ que . peekLast ( ) ] > a [ j ] ) { que . removeLast ( ) ; } que . addLast ( j ) ; value + = a [ que . peekFirst ( ) ] ; } ans = Math . min ( ans , value ) ; } System . out . println ( ans ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; Set < String > hinaSet = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hinaSet . add ( sc . next ( ) ) ; } sc . close ( ) ; if ( hinaSet . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = i ; j + + ) { for ( int k = 0 ; k < = j ; k + + ) { int a = i + j + k ; if ( a = = S ) { if ( i = = j & & j = = k ) { count + + ; } else if ( i ! = j & & j ! = k & & k ! = i ) { count + = 6 ; } else { count + = 3 ; } } } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ j ] = = 7 ) { count + + ; } } if ( count = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 0 ; i < = 100 ; i + + ) { if ( ans > n ) { System . out . println ( ans / 2 ) ; return ; } ans * = 2 ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxCount = 0 ; int maxNum = 0 ; for ( int i = 0 ; i < n ; i + + ) { int count = 0 ; int num = i + 1 ; while ( true ) { if ( num % 2 ! = 0 ) { break ; } num / = 2 ; count + + ; } if ( i = = 0 | | count > maxCount ) { maxCount = count ; maxNum = i + 1 ; } } System . out . println ( maxNum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double minuteHand = M / 60 ; double hourHand = ( H + minuteHand ) / 12 ; double angle = Math . abs ( minuteHand - hourHand ) ; System . out . println ( Math . pow ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * Math . cos ( 2 * Math . PI * angle ) ) , 0.5 ) ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Tenka1 _ 2017 _ C solver = new Tenka1 _ 2017 _ C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Tenka1 _ 2017 _ C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long N = in . nextLong ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { try { long child = N * h * n ; long mother = ( 4 * h * n ) - ( N * n ) - ( N * h ) ; if ( child % mother = = 0 & & mother > 0 ) { out . print ( h + " " + n + " " + child / mother ) ; return ; } } catch ( ArithmeticException e ) { } } } } } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int d = 0 ; for ( int i = 1 ; i < = 4 ; i + + ) { d = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( d - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . lang . * ; import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } } class TaskA { public void solve ( InputReader in , PrintWriter out ) { int k = in . nextInt ( ) , s = in . nextInt ( ) ; int x , y , z ; int ans = 0 ; for ( x = 0 ; x < = k & & x < = s ; + + x ) { for ( y = 0 ; y < = k & & x + y < = s ; + + y ) { z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) + + ans ; } } out . println ( ans ) ; } } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int n = A . length ; for ( int i = 0 ; i < n ; i + + ) { A [ i ] = stdIn . nextInt ( ) ; } int k = stdIn . nextInt ( ) ; String result = " Yay ! " ; for ( int m = 0 ; m < n - 1 ; m + + ) { for ( int j = m + 1 ; j < n ; j + + ) { if ( A [ j ] - A [ m ] > k ) { result = " : ( " ; break ; } } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double r1 = h / 12.0 + m / ( 12.0 * 60 ) ; r1 * = Math . PI * 2 ; double x1 = a * Math . cos ( r1 ) ; double y1 = a * Math . sin ( r1 ) ; double r2 = m / 60.0 * Math . PI * 2 ; double x2 = b * Math . cos ( r2 ) ; double y2 = b * Math . sin ( r2 ) ; System . out . println ( Math . hypot ( x1 - x2 , y1 - y2 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; int diff21 = c21 - c11 ; int diff31 = c31 - c11 ; if ( c22 - c12 = = diff21 & & c23 - c13 = = diff21 & & c32 - c12 = = diff31 & & c33 - c13 = = diff31 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long K = sc . nextInt ( ) ; long S = sc . nextInt ( ) ; long res = 0 ; for ( long i = Math . min ( K , S ) ; i > = 0 ; i -- ) { long v = S - i ; if ( v < K ) res + = ( v + 1 ) ; else if ( v = = K ) res + = ( K + 1 ) ; else if ( v < = 2 * K ) { long a = v - K ; res + = K - a + 1 ; } } System . out . println ( res ) ; } } import java . io . * ; import java . util . * ; class Main { Scanner sc ; int N ; int [ ] P ; private void calc ( ) { sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int N = sc . nextInt ( ) ; P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = sc . nextInt ( ) ; int c = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { if ( min > P [ i ] ) c + + ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( c ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double naga = m * 360 / 60 ; double miji = ( h * 60 + m ) * 360 / ( 12 * 60 ) ; double kaku = miji - naga ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( kaku ) ) ) ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; int max = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int mod = i ; int cnt = 0 ; while ( mod % 2 = = 0 ) { mod = mod / 2 ; cnt + + ; } if ( cnt > = max ) { max = cnt ; ans = i ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; Test [ ] tests = new Test [ N ] ; for ( int i = 0 ; i < N ; i + + ) tests [ i ] = new Test ( ) ; for ( int i = 0 ; i < N ; i + + ) tests [ i ] . a = scanner . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) tests [ i ] . b = scanner . nextInt ( ) ; Arrays . sort ( tests , Comparator . comparingInt ( test - > test . a > test . b ? test . a - test . b : 1 _ 000 _ 000 _ 000 ) ) ; long [ ] casum = new long [ N ] ; casum [ N - 1 ] = tests [ N - 1 ] . a ; for ( int i = N - 2 ; i > = 0 ; i -- ) casum [ i ] = casum [ i + 1 ] + tests [ i ] . a ; long [ ] cbsum = new long [ N ] ; cbsum [ N - 1 ] = tests [ N - 1 ] . b ; for ( int i = N - 2 ; i > = 0 ; i -- ) cbsum [ i ] = cbsum [ i + 1 ] + tests [ i ] . b ; if ( casum [ 0 ] < cbsum [ 0 ] ) { System . out . println ( - 1 ) ; return ; } int i = 0 ; while ( i < N & & tests [ i ] . a > = tests [ i ] . b & & casum [ i ] > = cbsum [ i ] ) i + + ; if ( i = = N ) System . out . println ( 0 ) ; else System . out . println ( N - i + 1 ) ; } private static class Test { private int a ; private int b ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int i = 0 ; i < = k & & i < = s ; i + + ) { for ( int j = 0 ; j < = k & & j < = s - i ; j + + ) { z = s - i - j ; if ( z > = 0 & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String output = " Three " ; int num = sc . nextInt ( ) ; String [ ] colors = new String [ num ] ; for ( int i = 0 ; i < num ; i + + ) { colors [ i ] = sc . next ( ) ; } sc . close ( ) ; for ( int i = 0 ; i < colors . length ; i + + ) { if ( colors [ i ] . equals ( " Y " ) ) { output = " Four " ; break ; } } System . out . println ( output ) ; } } import java . io . * ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String line ; while ( ( line = br . readLine ( ) ) ! = null ) { String [ ] s = line . split ( " " ) ; int n = Integer . parseInt ( s [ 0 ] ) ; long x = Long . parseLong ( s [ 1 ] ) ; s = br . readLine ( ) . split ( " " ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( s [ i ] ) ; } long [ ] [ ] b = new long [ n ] [ ] ; for ( int i = 0 ; i < n ; i + + ) { long [ ] bi = new long [ n ] ; for ( int k = 0 ; k < n ; k + + ) { if ( k = = 0 ) { bi [ 0 ] = a [ ( i - k > = 0 ) ? i - k : i - k + n ] ; } else { bi [ k ] = Math . min ( bi [ k - 1 ] , a [ ( i - k > = 0 ) ? i - k : i - k + n ] ) ; } } b [ i ] = bi ; } long min = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { sum + = b [ i ] [ k ] ; } if ( min > k * x + sum ) { min = k * x + sum ; } } System . out . println ( min ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int Bangle = 6 * M ; double Aangle = H * 30 + 0.5 * M ; double X = Aangle - Bangle ; if ( X < 0 ) { X = Bangle - Aangle ; } if ( X > 180 ) { X = 360 - X ; } System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . PI * X / 180 ) ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { 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 ( ) ; } System . out . println ( cal ( n , a ) ) ; } private static long cal ( final int n , final int [ ] a ) { long res = 0L ; int maxP = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( maxP = = 0 ) { res + = a [ i ] - 1 ; maxP = 1 ; } else { int num = a [ i ] / ( maxP + 1 ) ; if ( a [ i ] = = maxP + 1 ) { maxP + + ; } else if ( a [ i ] % ( maxP + 1 ) = = 0 ) { res + = num - 1 ; } else { res + = num ; } } } return res ; } } import java . util . * ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > hina = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hina . add ( sc . next ( ) ) ; } String ans = " Three " ; if ( hina . size ( ) = = 4 ) { ans = " Four " ; } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String args [ ] ) { ConsoleScanner cin = new ConsoleScanner ( ) ; PrintWriter cout = new PrintWriter ( System . out ) ; solve ( cin , cout ) ; cout . flush ( ) ; } private static void solve ( ConsoleScanner cin , PrintWriter cout ) { for ( int i = 1 ; i < = 100 ; i + + ) assert null ! = System . out . format ( " % d % d \ n " , i , solve ( i ) ) ; int n = cin . nextInt ( ) ; long millis = System . currentTimeMillis ( ) ; int ans = solve ( n ) ; cout . println ( ans ) ; assert null ! = cout . format ( " % d elapsed " , System . currentTimeMillis ( ) - millis ) ; } private static int solve ( int n ) { int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < 30 ; i + + ) if ( n > > i ! = 0 ) ans = Math . min ( ans , ( n > > i ) < < i ) ; return ans ; } static class ConsoleScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ; String next ( ) { try { while ( ! st . hasMoreElements ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int aaa [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { aaa [ i ] = scn . nextInt ( ) ; } int k = scn . nextInt ( ) ; if ( aaa [ 1 ] - aaa [ 0 ] < = k & & aaa [ 2 ] - aaa [ 0 ] < = k & & aaa [ 3 ] - aaa [ 0 ] < = k & & aaa [ 4 ] - aaa [ 0 ] < = k & & aaa [ 2 ] - aaa [ 1 ] < = k & & aaa [ 3 ] - aaa [ 1 ] < = k & & aaa [ 4 ] - aaa [ 1 ] < = k & & aaa [ 3 ] - aaa [ 2 ] < = k & & aaa [ 4 ] - aaa [ 2 ] < = k & & aaa [ 4 ] - aaa [ 3 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . close ( ) ; int i = 1 ; while ( n > = i ) { i * = 2 ; } System . out . println ( i / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc1 = new Scanner ( System . in ) ; int a = sc1 . nextInt ( ) ; int b = sc1 . nextInt ( ) ; int c = sc1 . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . print ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . print ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; Long facN = this . calcfac ( N ) ; Long facM = this . calcfac ( M ) ; if ( N = = M ) { System . out . println ( 2 * facN * facM % 1000000007 ) ; } else if ( N + 1 = = M | | N = = M + 1 ) { System . out . println ( facN * facM % 1000000007 ) ; } else { System . out . println ( 0 ) ; } } Long calcfac ( int num ) { Long sum = new Long ( 1 ) ; for ( int i = num ; i > 0 ; i -- ) { sum * = i ; sum % = 1000000007 ; } return sum ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < A . length ; i + + ) { A [ i ] = sc . nextInt ( ) ; } int [ ] abs = new int [ 3 ] ; int k = 0 ; for ( int i = 0 ; i < A . length ; i + + ) { for ( int j = i + 1 ; j < A . length ; j + + ) { abs [ k ] = Math . abs ( A [ j ] - A [ i ] ) ; k + + ; } } Arrays . sort ( abs ) ; System . out . println ( abs [ 0 ] + abs [ 1 ] ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double sita = ( ( double ) H / 12 + ( double ) M / 12 / 60 - ( double ) M / 60 ) * 2 * Math . PI ; sita = sita < 0 ? - ( double ) sita : sita ; double answer = Math . sqrt ( ( double ) ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( double ) ( ( double ) ( 2 * A * B ) * Math . cos ( sita ) ) ) ) ; System . out . print ( answer ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int H = in . nextInt ( ) , r = in . nextInt ( ) , res ; if ( H + r = = 0 ) res = 0 ; else if ( H + r > 0 ) res = 1 ; else res = - 1 ; System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( ( s - i - j ) < = k & & ( s - i - j ) > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; String Str = " Two " ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { Str = " Four " ; break ; } else Str = " Three " ; } System . out . println ( Str ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; ; } } System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] ABC = br . readLine ( ) . split ( " " ) ; boolean flgNG = false ; Integer cntFive = 0 ; Integer cntSeven = 0 ; for ( Integer cnt = 0 ; cnt < 3 ; cnt + + ) { Integer i = Integer . valueOf ( ABC [ cnt ] ) ; if ( i = = 5 ) { cntFive + + ; if ( cntFive > 2 ) { flgNG = true ; break ; } } else if ( i = = 7 ) { cntSeven + + ; if ( cntSeven > 1 ) { flgNG = true ; break ; } } else { flgNG = true ; break ; } } if ( flgNG ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { while ( sc . hasNext ( ) ) { if ( sc . nextInt ( ) = = 7 ) sevenCounter + + ; else fiveCounter + + ; } } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int K = Integer . parseInt ( scanner . next ( ) ) ; int S = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int index = ( int ) ( Math . log ( new Scanner ( System . in ) . nextInt ( ) ) / Math . log ( 2.0 ) ) ; System . out . println ( ( int ) Math . pow ( 2 , index ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int D = sc . nextInt ( ) , N = sc . nextInt ( ) ; int [ ] T = new int [ D ] ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] C = new int [ N ] ; int [ ] curr = new int [ N ] ; int [ ] next = new int [ N ] ; for ( int i = 0 ; i < D ; i + + ) T [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; B [ i ] = sc . nextInt ( ) ; C [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < D - 1 ; i + + ) { for ( int j = 0 ; j < N ; j + + ) for ( int k = 0 ; k < N ; k + + ) { if ( A [ j ] < = T [ i ] & & T [ i ] < = B [ j ] & & A [ k ] < = T [ i + 1 ] & & T [ i + 1 ] < = B [ k ] ) { int currNext = 0 ; currNext + = curr [ j ] ; currNext + = Math . abs ( C [ j ] - C [ k ] ) ; if ( currNext > next [ k ] ) next [ k ] = currNext ; } } for ( int j = 0 ; j < N ; j + + ) { curr [ j ] = next [ j ] ; next [ j ] = 0 ; } } int max = curr [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) max = Math . max ( max , curr [ i ] ) ; System . out . println ( max ) ; } } import java . util . * ; public class Main { public static final int MAX = 3501 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = Long . parseLong ( sc . next ( ) ) ; for ( long x = 1 ; x < MAX ; x + + ) { for ( long y = 1 ; y < MAX ; y + + ) { long u = n * x * y ; long d = 4L * x * y - n * x - n * y ; if ( d ! = 0 & & u % d = = 0 & & u / d > 0 ) { long z = u / d ; System . out . println ( x + " " + y + " " + z ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int a ; int b ; int cnt = 0 ; for ( a = 0 ; a < = K ; a + + ) { int qw = K ; if ( S - a < qw ) { qw = S - a ; } for ( b = 0 ; b < = qw ; b + + ) { if ( S - a - b < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] l = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) l [ i ] [ j ] = sc . nextInt ( ) ; if ( l [ 0 ] [ 0 ] + l [ 1 ] [ 1 ] = = l [ 1 ] [ 0 ] + l [ 0 ] [ 1 ] & & l [ 0 ] [ 0 ] + l [ 2 ] [ 1 ] = = l [ 2 ] [ 0 ] + l [ 0 ] [ 1 ] & & l [ 1 ] [ 0 ] + l [ 0 ] [ 2 ] = = l [ 0 ] [ 0 ] + l [ 1 ] [ 2 ] & & l [ 0 ] [ 0 ] + l [ 2 ] [ 2 ] = = l [ 2 ] [ 0 ] + l [ 0 ] [ 2 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double zishinKakudo = ( Math . PI * h / 6.0 ) + ( Math . PI * m / 6.0 / 60.0 ) ; double hunshinKakudo = Math . PI * 2.0 * m / 60.0 ; double diffOfKakudo = Math . abs ( zishinKakudo - hunshinKakudo ) ; double L = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2.0 * a * b * Math . cos ( diffOfKakudo ) ) ; double l = Math . sqrt ( L ) ; System . out . println ( l ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y < = k & & s - x - y > = 0 ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; int z = 0 ; for ( int x = 0 ; x < K + 1 ; x + + ) { for ( int y = 0 ; y < K + 1 ; y + + ) { z = S - x - y ; if ( z < = K & & z > = 0 ) { count + + ; } } } System . out . print ( count ) ; System . out . println ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K & & x < = S ; x + + ) { for ( int y = 0 ; y < = K & & x + y < = S ; y + + ) { if ( S - x - y < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; class Point { double x ; double y ; public Point ( double deg , double r ) { double rad = deg * Math . PI / 180.0 ; x = Math . cos ( rad ) * r ; y = Math . sin ( rad ) * r ; } public double getX ( ) { return x ; } public double getY ( ) { return y ; } public double distance ( Point b ) { double c = Math . pow ( x - b . getX ( ) , 2 ) ; double d = Math . pow ( y - b . getY ( ) , 2 ) ; return Math . sqrt ( c + d ) ; } public void show ( ) { System . out . printf ( " [ % f , % f ] \ n " , x , y ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; try { double a = scanner . nextDouble ( ) ; double b = scanner . nextDouble ( ) ; double h = scanner . nextDouble ( ) ; double m = scanner . nextDouble ( ) ; Point bigHand = new Point ( m * 6.0 , b ) ; Point smallHand = new Point ( h * 30.0 + m * 0.5 , a ) ; double ans = bigHand . distance ( smallHand ) ; System . out . println ( ans ) ; } finally { scanner . close ( ) ; } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { List < Integer > list = IntStream . range ( 0 , 5 ) . map ( i - > { int number = scanner . nextInt ( ) ; scanner . nextLine ( ) ; return number ; } ) . sorted ( ) . collect ( ArrayList : : new , ArrayList : : add , ArrayList : : addAll ) ; int k = scanner . nextInt ( ) ; scanner . nextLine ( ) ; if ( ( list . get ( list . size ( ) - 1 ) - list . get ( 0 ) ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double allmin = h * 60 + m ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( ( allmin / 2 ) - ( m * 6 ) ) ) ) ) ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static PrintWriter out ; static CF _ Reader in ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; in = new CF _ Reader ( ) ; int n = in . intNext ( ) ; int [ ] nums = in . nextIntArray ( n ) ; int res = 0 ; int minVal = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( nums [ i ] < = minVal ) { minVal = nums [ i ] ; res + = 1 ; } } out . println ( res ) ; out . close ( ) ; } static class CF _ Reader { BufferedReader br ; StringTokenizer st ; public CF _ Reader ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } long longNext ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } int intNext ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } double doubleNext ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } char charNext ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } public int [ ] nextIntArray ( final int n ) throws IOException { final int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = intNext ( ) ; return a ; } public long [ ] nextLongArray ( final int n ) throws IOException { final long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = longNext ( ) ; return a ; } String line ( ) throws IOException { return br . readLine ( ) . trim ( ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < String > hs = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { hs . add ( sc . next ( ) ) ; } if ( hs . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; sc . close ( ) ; int index = 0 ; int x , y , z ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( 0 < = z & & z < = k ) { index + + ; } } } System . out . print ( index ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int SideA = keyboard . nextInt ( ) ; int SideB = keyboard . nextInt ( ) ; int SideC = keyboard . nextInt ( ) ; int [ ] arr = new int [ ] { SideA , SideB , SideC } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } keyboard . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int a = 0 ; int b = 0 ; int c = 0 ; int d = 0 ; int e = 0 ; int k = 0 ; Scanner sc = new Scanner ( System . in ) ; a = Integer . parseInt ( sc . next ( ) ) ; b = Integer . parseInt ( sc . next ( ) ) ; c = Integer . parseInt ( sc . next ( ) ) ; d = Integer . parseInt ( sc . next ( ) ) ; e = Integer . parseInt ( sc . next ( ) ) ; k = Integer . parseInt ( sc . next ( ) ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final String FIVE = " 5 " ; final String SEVEN = " 7 " ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; scanner . close ( ) ; String [ ] arrStr = ( input . split ( " " , 0 ) ) ; int fivCnt = 0 ; int sevCnt = 0 ; for ( String num : arrStr ) { if ( num . equals ( FIVE ) ) { fivCnt + + ; } else if ( num . equals ( SEVEN ) ) { sevCnt + + ; } } String res ; if ( fivCnt = = 2 & & sevCnt = = 1 ) { res = " YES " ; } else { res = " NO " ; } System . out . println ( res ) ; } } import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int sum = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int tmp = 0 ; int tmp2 = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { tmp + = c [ j ] [ ( i + j ) % 3 ] ; tmp2 + = c [ j ] [ ( i - j + 3 ) % 3 ] ; } if ( tmp ! = sum ) { pr . println ( " No " ) ; return ; } if ( tmp2 ! = sum ) { pr . println ( " No " ) ; return ; } } pr . println ( " Yes " ) ; } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } } import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Main { public static class FastReader { BufferedReader br ; StringTokenizer root ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( root = = null | | ! root . hasMoreTokens ( ) ) { try { root = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception addd ) { addd . printStackTrace ( ) ; } } return root . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( Exception addd ) { addd . printStackTrace ( ) ; } return str ; } } public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; public static FastReader sc = new FastReader ( ) ; static int mod = ( int ) ( 1e9 + 7 ) , MAX = ( int ) ( 2e5 ) ; static List < Integer > [ ] edges ; public static void main ( String [ ] args ) throws IOException { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double k = Math . abs ( ( ( 11 * m ) / 2 - 30 * h ) ) ; if ( k > 180 ) k = 360 - k ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( k * ( Math . PI / 180 ) ) ) ; out . print ( ans ) ; out . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int x [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { x [ i ] = stdIn . nextInt ( ) ; } int k = stdIn . nextInt ( ) ; if ( x [ 4 ] - x [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; System . out . println ( ( n [ 0 ] = = 5 & & n [ 1 ] = = 5 & & n [ 2 ] = = 7 ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < min ) { min = p ; count + + ; } } print ( count ) ; sc . close ( ) ; } public static void print ( Object obj ) { System . out . println ( obj ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angle = Math . abs ( ( double ) h / 12 + ( ( double ) m / 60 ) / 12.0 - ( double ) m / 60.0 ) * 2 * Math . PI ; double res = ( double ) a * a + ( double ) b * b - ( double ) 2 * a * b * Math . cos ( angle ) ; res = Math . sqrt ( res ) ; System . out . printf ( " % .20f " , res ) ; } } import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } long MODULO = 1 _ 000 _ 000 _ 000 + 7 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < n ; + + i ) { x [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < m ; + + i ) { y [ i ] = sc . nextLong ( ) ; } System . out . println ( cnt ( x ) * cnt ( y ) % MODULO ) ; } long cnt ( long [ ] arr ) { int n = arr . length ; long ret = 0 ; for ( int i = 0 ; i < arr . length ; + + i ) { ret = ret + arr [ i ] * ( - ( n - 1 - i ) + i ) % MODULO ; ret % = MODULO ; } return ret ; } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { execute ( ) ; } private static void execute ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; System . out . println ( isHaiku ( br . readLine ( ) . split ( " " ) ) ) ; } public static String isHaiku ( String [ ] sentences ) { if ( sentences . length ! = 3 ) { return " NO " ; } List < String > haiku = new LinkedList < > ( Arrays . asList ( " 5 " , " 7 " , " 5 " ) ) ; for ( String str : sentences ) { if ( haiku . contains ( str ) ) { haiku . remove ( str ) ; } } return haiku . isEmpty ( ) ? " YES " : " NO " ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; for ( int i = 0 ; i < count ; i + + ) { String color = sc . next ( ) ; if ( color . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . exec ( ) ; } private void exec ( ) { Scanner scan = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( scan . nextInt ( ) ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } } import java . util . Scanner ; public class Main { static Main instance = new Main ( ) ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double Aspeed = 360.0 / 60 / 12 ; double Bspeed = 360.0 / 60 / 1 ; double Aposition = Aspeed * ( H * 60 + M ) ; double Bposition = Bspeed * ( H * 60 + M ) ; double result = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Bposition - Aposition ) ) ) ; System . out . println ( result ) ; } } import java . io . * ; import java . util . * ; class Main { Scanner sc ; int N ; int [ ] P ; private void calc ( ) { sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int N = sc . nextInt ( ) ; P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = Integer . parseInt ( sc . next ( ) ) ; int c = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { if ( min > P [ i ] ) c + + ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( c ) ; } public static void main ( String [ ] args ) { new Main ( ) . calc ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int [ ] a = new int [ 5 ] ; int i ; Scanner sc = new Scanner ( System . in ) ; for ( i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; sc . close ( ) ; sc = null ; boolean f = true ; LABEL : for ( i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( a [ i ] - a [ j ] ) > k ) { f = false ; break LABEL ; } } } if ( f ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskC solver = new TaskC ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskC { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = in . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( a [ 0 ] = 0 ; a [ 0 ] < 101 ; a [ 0 ] + + ) { b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; for ( a [ 1 ] = 0 ; a [ 1 ] < 101 ; a [ 1 ] + + ) { b [ 1 ] = c [ 1 ] [ 1 ] - a [ 1 ] ; for ( a [ 2 ] = 0 ; a [ 2 ] < 101 ; a [ 2 ] + + ) { b [ 2 ] = c [ 2 ] [ 2 ] - a [ 2 ] ; boolean ok = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { ok = false ; } } } if ( ok ) { out . println ( " Yes " ) ; return ; } } } } out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " " ) ; int n = Integer . parseInt ( line [ 0 ] ) ; int m = Integer . parseInt ( line [ 1 ] ) ; long result = 0 ; if ( Math . abs ( n - m ) > 1 ) { result = 0 ; } else if ( Math . abs ( n - m ) = = 1 ) { result = factorialsModBillion ( n , m ) ; } else { result = factorialsModBillion ( n , m ) ; result = ( result * 2 ) % 1000000007L ; } System . out . println ( result ) ; } private static long factorialsModBillion ( int n , int m ) { long result = 1 ; for ( long i = 1 ; i < = n ; i + + ) { result = ( result * i ) % 1000000007L ; } for ( long i = 1 ; i < = m ; i + + ) { result = ( result * i ) % 1000000007L ; } return result ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; char a [ ] = new char [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = scan . next ( ) . charAt ( 0 ) ; } scan . close ( ) ; int check = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] = = ' Y ' ) { check = 1 ; break ; } } System . out . println ( ( check = = 1 ) ? " Four " : " Three " ) ; } } import java . util . * ; import java . io . * ; import java . awt . geom . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; long MOD = 1 _ 000 _ 000 _ 007 ; String [ ] s = br . readLine ( ) . split ( " " ) ; long n = Long . parseLong ( s [ 0 ] ) ; long m = Long . parseLong ( s [ 1 ] ) ; if ( m > n + 1 | | m < n - 1 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } long fact1 = 1 ; long fact2 = 1 ; for ( int i = 0 ; i < m ; i + + ) { fact1 * = ( i + 1 ) ; fact1 % = MOD ; } for ( int i = 0 ; i < n ; i + + ) { fact2 * = ( i + 1 ) ; fact2 % = MOD ; } long ans = ( fact1 * fact2 ) % MOD ; if ( m = = n ) ans * = 2 ; ans % = MOD ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double da = Math . abs ( h * 30 + m * 0.5 - m * 6 ) ; double d = Math . min ( 360 - da , da ) ; double c = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( d ) ) ) ; System . out . println ( c ) ; scan . close ( ) ; } } import java . util . PriorityQueue ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( 0 < = S - x - y & & S - x - y < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { max = Math . max ( Math . abs ( a [ i ] - a [ j ] ) , max ) ; } } if ( max > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; String S = gs ( ) + gs ( ) + gs ( ) + gs ( ) ; if ( S . contains ( " 1 " ) & & S . contains ( " 7 " ) & & S . contains ( " 9 " ) & & S . contains ( " 4 " ) ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } public static long d ( long n ) { String a = String . valueOf ( n ) ; return ( long ) a . length ( ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int s = 1 ; for ( int i = 0 ; i < 3 ; i + + ) s * = sc . nextInt ( ) ; if ( s = = 175 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = 0 ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a = sc . nextInt ( ) ; if ( a = = 7 ) { count + = 1 ; } else if ( a = = 5 ) { count + = 10 ; } } if ( count = = 21 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z < 0 ) continue ; if ( z > K ) continue ; if ( x + y + z = = S ) ans + + ; } } System . out . println ( ans ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] ary = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . sort ( ary ) ; out . append ( Arrays . equals ( ary , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . * ; import static java . lang . Integer . * ; import static java . lang . Long . parseLong ; import static java . lang . Math . * ; import static java . lang . System . * ; import java . io . PrintWriter ; public class Main { public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; int n = parseInt ( sc . next ( ) ) ; HashSet < String > s = new HashSet < > ( ) ; for ( i = 0 ; i < n ; i + + ) { s . add ( sc . next ( ) ) ; } sc . close ( ) ; out . println ( s . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { z = s - i - j ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . * ; import java . util . * ; public class Main { static int MOD = 1000000007 ; static double EPS = 1e-9 ; public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int x = Integer . parseInt ( st . nextToken ( ) ) ; if ( x = = 5 ) fiveCount + + ; if ( x = = 7 ) sevenCount + + ; } if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; in . close ( ) ; } } import java . io . ByteArrayInputStream ; import java . io . UnsupportedEncodingException ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Scanner ; public class Main { private static String solve ( Scanner scanner ) { long N = Integer . parseInt ( scanner . nextLine ( ) ) ; for ( long n = 3500 ; n > = 1 ; n -- ) { for ( long w = 3500 ; w > = 1 ; w -- ) { long denom = 4 * n * w - N * w - N * n ; long numer = N * n * w ; if ( denom > 0 & & numer % denom = = 0 ) { long h = numer / denom ; return n + " " + w + " " + h ; } } } return null ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( solve ( scanner ) ) ; } private static String [ ] testCases = { " 2 " , " 3485 " , " 4664 " } ; private static void tests ( ) { for ( String t : testCases ) { System . out . println ( solve ( new Scanner ( testCaseToInputStream ( t ) ) ) ) ; } } private static ByteArrayInputStream testCaseToInputStream ( String ex ) { try { return new ByteArrayInputStream ( ex . getBytes ( " utf-8 " ) ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; throw new RuntimeException ( ) ; } } private static int [ ] lineToIntNums ( String line ) { String [ ] numStrs = line . split ( " " ) ; int [ ] nums = new int [ numStrs . length ] ; for ( int i = 0 ; i < nums . length ; i + + ) { nums [ i ] = Integer . parseInt ( numStrs [ i ] ) ; } return nums ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new java . io . InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; double A = Double . parseDouble ( st . nextToken ( ) ) ; double B = Double . parseDouble ( st . nextToken ( ) ) ; double H = Double . parseDouble ( st . nextToken ( ) ) ; double M = Double . parseDouble ( st . nextToken ( ) ) ; double angle _ H = ( 60 * H + M ) / 720 * 360 ; double angle _ M = M / 60 * 360 ; double A _ x = A * Math . cos ( Math . toRadians ( angle _ H ) ) ; double A _ y = A * Math . sin ( Math . toRadians ( angle _ H ) ) ; double B _ x = B * Math . cos ( Math . toRadians ( angle _ M ) ) ; double B _ y = B * Math . sin ( Math . toRadians ( angle _ M ) ) ; double ans = Math . sqrt ( Math . pow ( ( A _ x - B _ x ) , 2 ) + Math . pow ( ( A _ y - B _ y ) , 2 ) ) ; pw . println ( ans ) ; br . close ( ) ; pw . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double theta1 = Math . toRadians ( H * 30.0 + M * 0.5 ) ; double theta2 = Math . toRadians ( M * 6.0 ) ; double dist = 0.0 ; if ( theta1 > theta2 ) { dist = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( theta1 - theta2 ) ) ; } else { dist = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( theta2 - theta1 ) ) ; } System . out . println ( dist ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double max = 1 ; if ( N = = 1 ) { max = 2 ; } else { for ( int i = 0 ; i < N ; i + + ) { max = Math . pow ( 2 , i ) ; if ( max > N ) { break ; } } } max = max / 2 ; int answer = ( int ) max ; System . out . println ( answer ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; Set < String > set = new HashSet < String > ( ) ; int i = 0 ; for ( i = 0 ; i < n ; i + + ) { set . add ( scan . next ( ) ) ; } if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( n - i - j < = k & & n - i - j > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int a = 0 ; a < = k ; a + + ) { if ( a = = s ) { ans + + ; break ; } int bc = ( int ) Math . ceil ( ( double ) ( s - a ) / 2 ) ; if ( bc < = k ) { for ( int b = 0 ; b < = k ; b + + ) { if ( s - a - b > = 0 & & s - a - b < = k ) { ans + + ; } } } } System . out . println ( ans ) ; } finally { sc . close ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = ( int ) ( Math . log ( n ) / Math . log ( 2 ) ) ; System . out . println ( ( int ) Math . pow ( 2 , m ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int p [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = scan . nextInt ( ) ; } scan . close ( ) ; int cnt = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( min > p [ i ] ) { cnt + + ; min = p [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { private static void p ( Object x ) { System . out . println ( x ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } p ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] nums = { a , b , c , d , e } ; for ( int i = 0 ; i < nums . length ; i + + ) { for ( int j = i + 1 ; j < nums . length ; j + + ) { if ( Math . abs ( nums [ i ] - nums [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } else { continue ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int e = s . nextInt ( ) ; int k = s . nextInt ( ) ; int [ ] f = { a , b , c , d , e , k } ; for ( int i = 0 ; i < f . length ; i + + ) { int n1 = 0 ; int n2 = 0 ; int ans = 0 ; for ( int j = 0 ; j < f . length ; j + + ) { if ( i = = j ) { continue ; } n1 = f [ i ] ; n2 = f [ j ] ; if ( n1 > n2 ) { ans = n1 - n2 ; } else { ans = n2 - n1 ; } ; if ( ans > k ) { System . out . println ( " : ( " ) ; return ; } } ; } ; System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 , a , count , ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { count = 0 ; if ( i % 2 = = 1 ) continue ; a = i ; for ( ; ; ) { if ( a / 2 ! = 0 ) { a = a / 2 ; count + + ; } else { count + + ; break ; } } if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = Integer . parseInt ( sc . nextLine ( ) ) ; String [ ] str = sc . nextLine ( ) . split ( " " ) ; boolean f = false ; for ( int i = 0 ; i < n ; i + + ) { if ( str [ i ] . equals ( " Y " ) ) { f = true ; break ; } } if ( f ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; sc . close ( ) ; int x = 0 ; int y = 0 ; int z = 0 ; int count = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - ( x + y ) ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 , i , j ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( i + j < = s & & s - ( i + j ) < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] suuji = new int [ N ] ; int count = 1 ; for ( int i = 0 ; i < N ; i + + ) { suuji [ i ] = sc . nextInt ( ) ; } int min = suuji [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( min > suuji [ i ] ) { min = suuji [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] an = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { an [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " : ( " ; sc . close ( ) ; if ( an [ 4 ] - an [ 0 ] < = k ) { ans = " Yay ! " ; } 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 ( ) ; Stack < Integer > st = new Stack < > ( ) ; int min = 200001 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int p = sc . nextInt ( ) ; if ( p < min ) { min = p ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c5 = 0 ; int c7 = 0 ; String ans = " NO " ; for ( int i = 0 ; i < 3 ; i + + ) { int que = sc . nextInt ( ) ; if ( que = = 5 ) c5 + + ; if ( que = = 7 ) c7 + + ; } if ( c5 = = 2 & & c7 = = 1 ) ans = " YES " ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long x = sc . nextLong ( ) ; long ans = 1 ; if ( a = = 1 ) { System . out . println ( x ) ; return ; } for ( long i = 2 ; Math . pow ( i , a ) < = x ; i + + ) { double c = Math . pow ( i , a ) ; if ( x % c = = 0 ) { ans = Math . max ( ans , i ) ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j > = 0 & & s - i - j < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int product = 175 ; if ( A * B * C = = product ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int sub = array [ 4 ] - array [ 0 ] ; if ( sub > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double a = ( double ) A ; double b = ( double ) B ; double h = ( H * 60 + M ) * 360d / 720d ; double m = M * 360d / 60d ; double ans = Math . sqrt ( a * a + b * b - 2.0d * a * b * Math . cos ( Math . toRadians ( Math . abs ( h - m ) ) ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; String str ; int Y = 0 ; for ( int i = 0 ; i < N ; i + + ) { str = s . next ( ) ; if ( str . equals ( " Y " ) ) { Y + + ; } } if ( Y = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int mod = 1000000007 ; 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 ( ) ) ; } public static void main ( String [ ] _ _ ) { int d = getInt ( ) , m = getInt ( ) ; if ( Math . abs ( d - m ) > = 2 ) { System . out . println ( 0 ) ; return ; } long r = 1 ; for ( int i = 1 ; i < = d ; i + + ) { r * = i ; r % = mod ; } for ( int i = 1 ; i < = m ; i + + ) { r * = i ; r % = mod ; } System . out . println ( d = = m ? r * 2 % mod : r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int H = scanner . nextInt ( ) ; int R = scanner . nextInt ( ) ; if ( H > = 0 ) { System . out . println ( 1 ) ; } else if ( H + R = = 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( - 1 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { int X = i ; for ( int j = 0 ; j < = K ; j + + ) { int Y = j ; if ( S - X - Y > = 0 & & S - X - Y < = K ) { ans + = 1 ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int max = A [ 4 ] - A [ 0 ] ; if ( max < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; System . out . println ( Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( ( 11 * m - 60 * h ) * Math . PI / 360 ) ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . io . BufferedReader ; import java . io . InputStreamReader ; 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 ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] permutaion = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { permutaion [ i ] = in . nextInt ( ) ; } int min = permutaion [ 0 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( permutaion [ i ] < = min ) { ans + + ; min = permutaion [ i ] ; } } System . out . println ( ans ) ; } } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; import java . util . List ; import java . util . ArrayList ; import java . util . Comparator ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] pow2 = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; for ( int i = 6 ; i > = 0 ; i -- ) { if ( N > = pow2 [ i ] ) { System . out . println ( pow2 [ i ] ) ; break ; } } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner scan = new Scanner ( System . in ) ) { int h = scan . nextInt ( ) ; int w = scan . nextInt ( ) ; int [ ] [ ] arrays = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { arrays [ i ] [ j ] = scan . nextInt ( ) ; } } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { int sum = 0 ; for ( int k = 0 ; k < h ; k + + ) { for ( int l = 0 ; l < w ; l + + ) { sum + = Math . min ( Math . abs ( i - k ) , Math . abs ( j - l ) ) * arrays [ k ] [ l ] ; } } min = Math . min ( min , sum ) ; } } System . out . println ( min ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = 0 ; int min = sc . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < n - 1 ; i + + ) { m = sc . nextInt ( ) ; if ( m < min ) { min = m ; count + + ; } if ( m = = 1 ) { break ; } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 & & a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Arrays ; 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 ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } if ( Arrays . asList ( s ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; Map < String , Integer > minMap = new HashMap < > ( ) ; final String MIN = " min " ; int [ ] numList = new int [ 220000 ] ; for ( int i = 0 ; i < N ; i + + ) { numList [ i ] = Integer . parseInt ( sc . next ( ) ) ; } minMap . put ( MIN , numList [ 0 ] ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( numList [ i ] < = minMap . get ( MIN ) ) { minMap . put ( MIN , numList [ i ] ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] x = { a , b , c , d , e } ; int count = 0 ; limit : for ( int i = 0 ; i < x . length ; i + + ) { for ( int j = i + 1 ; j < x . length ; j + + ) { if ( x [ j ] - x [ i ] > k ) { count + + ; break limit ; } } } System . out . println ( count = = 1 ? " : ( " : " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] a = new int [ N ] ; long asum = 0 ; int [ ] b = new int [ N ] ; int [ ] d = new int [ N ] ; long bsum = 0 ; long msum = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = sc . nextInt ( ) ; asum + = a [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { b [ i ] = sc . nextInt ( ) ; bsum + = b [ i ] ; d [ i ] = a [ i ] - b [ i ] ; if ( d [ i ] < 0 ) { msum + = d [ i ] ; ans + + ; } } if ( asum < bsum ) { System . out . println ( - 1 ) ; } else { Arrays . sort ( d ) ; int idx = N - 1 ; while ( msum < 0 ) { ans + + ; msum + = d [ idx ] ; idx -- ; } System . out . println ( ans ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; long min = Long . MAX _ VALUE ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { long temp = Long . parseLong ( sc . next ( ) ) ; if ( min > temp ) { ans + + ; min = temp ; } } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i + + ) { list . add ( sc . nextInt ( ) ) ; } int count = 0 ; int min = Collections . max ( list ) ; for ( int i = 0 ; i < N ; i + + ) { if ( list . get ( i ) < = min ) { min = list . get ( i ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int n = kb . nextInt ( ) ; int min = kb . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < n - 1 ; i + + ) { int j = kb . nextInt ( ) ; int b = j ; if ( b > min ) { } else { count + = 1 ; min = b ; } } System . out . println ( count ) ; kb . close ( ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > arare = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { arare . add ( sc . next ( ) ) ; } System . out . println ( arare . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int c = Integer . parseInt ( scan . next ( ) ) ; int [ ] abc = { a , b , c } ; int five = 0 ; int seven = 0 ; for ( int i : abc ) { if ( i = = 5 ) { + + five ; } else if ( i = = 7 ) { + + seven ; } } if ( five = = 2 & & seven = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 123 ; int x ; for ( int i = 0 ; i < 5 ; i + + ) { x = sc . nextInt ( ) ; max = Math . max ( max , x ) ; min = Math . min ( min , x ) ; } int k = sc . nextInt ( ) ; if ( max - min > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N ; N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { C [ i ] = A [ i ] - B [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { sum = sum + C [ i ] ; } if ( sum < 0 ) { System . out . print ( " -1 " ) ; } else { Arrays . sort ( C ) ; long tar = 0 ; for ( int k = 0 ; k < C . length ; k + + ) { if ( C [ k ] > = 0 ) break ; tar = tar + C [ k ] ; ans + + ; } for ( int k = 0 ; k < C . length ; k + + ) { if ( tar > = 0 ) break ; tar = tar + C [ C . length - k - 1 ] ; ans + + ; } System . out . print ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; if ( N % 4 = = 0 ) { System . out . println ( 3 * N / 4 + " " + 3 * N / 4 + " " + 3 * N / 4 ) ; return ; } for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long temp = N * h * w ; long t = 4 * h * w - N * ( h + w ) ; if ( t > 0 & & temp % t = = 0 ) { System . out . println ( h + " " + w + " " + temp / t ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < N ; i + + ) { int now = sc . nextInt ( ) ; if ( now < = min ) { min = now ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int b = sc . nextInt ( ) ; if ( b = = 1 ) a [ 0 ] = 1 ; if ( b = = 4 ) a [ 1 ] = 1 ; if ( b = = 7 ) a [ 2 ] = 1 ; if ( b = = 9 ) a [ 3 ] = 1 ; } if ( a [ 0 ] = = 1 & & a [ 1 ] = = 1 & & a [ 2 ] = = 1 & & a [ 3 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; boolean judge = true ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = c [ 0 ] [ i ] - a [ 0 ] ; } for ( int i = 1 ; i < 3 ; i + + ) { a [ i ] = c [ i ] [ 0 ] - b [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = ( a [ i ] + b [ j ] ) ) { judge = false ; } } } if ( judge ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( solve ( A , B , C ) ? " YES " : " NO " ) ; sc . close ( ) ; } static boolean solve ( int A , int B , int C ) { return Arrays . equals ( IntStream . of ( A , B , C ) . sorted ( ) . toArray ( ) , new int [ ] { 5 , 5 , 7 } ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . run ( ) ; } public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int g [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { g [ i ] [ j ] = sc . nextInt ( ) ; } } boolean ok = false ; for ( int i = 0 ; i < = 100 ; i + + ) { int a1 = i ; int b1 = g [ 0 ] [ 0 ] - a1 ; int b2 = g [ 0 ] [ 1 ] - a1 ; int b3 = g [ 0 ] [ 2 ] - a1 ; int a2 = g [ 1 ] [ 0 ] - b1 ; int a3 = g [ 2 ] [ 0 ] - b1 ; if ( g [ 0 ] [ 0 ] = = a1 + b1 & & g [ 0 ] [ 1 ] = = a1 + b2 & & g [ 0 ] [ 2 ] = = a1 + b3 & & g [ 1 ] [ 0 ] = = a2 + b1 & & g [ 1 ] [ 1 ] = = a2 + b2 & & g [ 1 ] [ 2 ] = = a2 + b3 & & g [ 2 ] [ 0 ] = = a3 + b1 & & g [ 2 ] [ 1 ] = = a3 + b2 & & g [ 2 ] [ 2 ] = = a3 + b3 ) { ok = true ; break ; } } if ( ok ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double degree = calculateAngle ( H , M ) ; double side = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( side ) ; } static double calculateAngle ( double h , double m ) { double hour _ angle = ( 0.5 * ( h * 60 + m ) ) ; double minute _ angle = ( 6 * m ) ; double angle = Math . abs ( hour _ angle - minute _ angle ) ; angle = Math . min ( 360 - angle , angle ) ; return angle ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; Integer n = scan . nextInt ( ) ; ArrayList < Integer > array = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i + + ) array . add ( scan . nextInt ( ) ) ; int min = array . get ( 0 ) ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( array . get ( i ) < min ) { min = array . get ( i ) ; count + + ; } } System . out . println ( count + 1 ) ; } static int factorial ( int n ) { if ( n = = 0 ) { return 1 ; } return n * factorial ( n - 1 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int X = 0 ; int Y = 0 ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { X = i ; Y = j ; int Z = S - ( X + Y ) ; if ( ( Z > = 0 ) & & ( Z < = K ) ) { sum = sum + 1 ; } } } System . out . println ( sum ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int counter = 0 ; int min = Integer . MAX _ VALUE ; ArrayList < Integer > pi = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; + + i ) { int numPi = Integer . parseInt ( scan . next ( ) ) ; if ( i = = 0 ) { counter + + ; } else { if ( numPi < = min ) { counter + + ; } } if ( min > numPi ) { min = numPi ; } } System . out . println ( counter ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; if ( ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; int tmp = A [ 2 ] - A [ 1 ] ; tmp = tmp + ( A [ 1 ] - A [ 0 ] ) ; System . out . println ( tmp < 0 ? " 0 " : tmp ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = s . nextInt ( ) ; } int min = N + 1 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( min > P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static final String OK = " Yay ! " ; public static final String NO = " : ( " ; public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a > k ) System . out . println ( NO ) ; else System . out . println ( OK ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int x , y , z ; int count = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( x + y < = s & & s - x - y < = k ) count + + ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; int e = in . nextInt ( ) ; int k = in . nextInt ( ) ; System . out . println ( solve ( a , e , k ) ) ; in . close ( ) ; } private static String solve ( int a , int e , int k ) { if ( e - a > k ) return " : ( " ; else return " Yay ! " ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int limit = scanner . nextInt ( ) ; int target = scanner . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int i = 0 ; i < = limit ; i + + ) { for ( int j = 0 ; j < = limit ; j + + ) { z = target - i - j ; if ( z > = 0 & & z < = limit ) { count + = 1 ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int b [ ] = { c [ 0 ] [ 0 ] - 0 , c [ 0 ] [ 1 ] - 0 , c [ 0 ] [ 2 ] - 0 } ; int a [ ] = { 0 , c [ 1 ] [ 0 ] - b [ 0 ] , c [ 2 ] [ 0 ] - b [ 0 ] } ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; int [ ] PList = new int [ N ] ; PList [ 0 ] = sc . nextInt ( ) ; int minNumber = PList [ 0 ] ; int cnt = 1 ; for ( int i = 1 ; i < N ; i + + ) { PList [ i ] = sc . nextInt ( ) ; if ( minNumber > = PList [ i ] ) { minNumber = PList [ i ] ; cnt + + ; } else { } } System . out . println ( cnt ) ; } } import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) list . add ( sc . nextInt ( ) ) ; List < Integer > sorted = list . stream ( ) . sorted ( Comparator . naturalOrder ( ) ) . collect ( Collectors . toList ( ) ) ; System . out . println ( ( sorted . get ( 1 ) - sorted . get ( 0 ) ) + ( sorted . get ( 2 ) - sorted . get ( 1 ) ) ) ; } } import java . util . AbstractMap ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Scanner ; class Main { static final int MOD = 1000000007 ; public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int a = 1 ; a < = 3500 ; a + + ) { for ( int b = 1 ; b < = 3500 ; b + + ) { double num = ( double ) n * a * b / ( 4 * a * b - n * b - n * a ) ; if ( num > 0 & & Math . abs ( num - Math . round ( num ) ) = = 0 ) { System . out . println ( a + " " + b + " " + Math . round ( num ) ) ; return ; } } } throw new Exception ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n ; String s = " " ; n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; + + i ) { s = sc . next ( ) ; if ( s . equals ( " Y " ) ) break ; } if ( s . equals ( " Y " ) ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = sc . nextInt ( ) ; int answer = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a < = max ; a + + ) { for ( int b = 0 ; b < = max ; b + + ) { if ( answer - a - b < = max & & answer - a - b > = 0 ) count + + ; } } System . out . println ( count ) ; ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int K ; int S ; Main ( Scanner sc ) { this . sc = sc ; K = sc . nextInt ( ) ; S = sc . nextInt ( ) ; } private int solve ( ) { int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K & & x + y + z = = S ) { count + + ; } } } return count ; } public void show ( int answer ) { System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { N [ i ] = sc . nextInt ( ) ; } Arrays . sort ( N ) ; if ( N [ 0 ] = = 5 & & N [ 1 ] = = 5 & & N [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double angH = 30 * H ; double angM = 5.5 * M ; double red = Math . toRadians ( Math . abs ( angH - angM ) ) ; double res = 0 ; res = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( red ) ) ; System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double ans ; double sho = ( H * 60 + M ) * 360 / ( 12 * 60 ) ; double lon = M * 360 / 60 ; double ang ; ang = Math . abs ( sho - lon ) ; ans = Math . sqrt ( A * A + B * B - 2.0 * A * B * Math . cos ( Math . toRadians ( ang ) ) ) ; System . out . print ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int a1 , b1 , b2 , b3 ; a1 = 0 ; b1 = c [ 0 ] [ 0 ] ; b2 = c [ 0 ] [ 1 ] ; b3 = c [ 0 ] [ 2 ] ; if ( c [ 1 ] [ 0 ] - b1 = = c [ 1 ] [ 1 ] - b2 & & c [ 1 ] [ 1 ] - b2 = = c [ 1 ] [ 2 ] - b3 ) { } else { System . out . println ( " No " ) ; return ; } if ( c [ 2 ] [ 0 ] - b1 = = c [ 2 ] [ 1 ] - b2 & & c [ 2 ] [ 1 ] - b2 = = c [ 2 ] [ 2 ] - b3 ) { } else { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } } 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 ) ; C4N solver = new C4N ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C4N { static final int CAP = 3500 ; public void solve ( int testNumber , InputReader in , PrintWriter out ) { long n = in . nextInt ( ) ; for ( long b = 1 ; b < = CAP ; b + + ) { for ( long c = 1 ; c < = CAP ; c + + ) { long d = 4 * b * c - n * b - n * c ; if ( d = = 0 ) { continue ; } long a = ( n * b * c ) / d ; if ( a > 0 & & a < = CAP & & n * ( a * b + b * c + c * a ) = = 4 * a * b * c ) { out . println ( a + " " + b + " " + c ) ; return ; } } } } } 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int n4 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; list . add ( n1 ) ; list . add ( n2 ) ; list . add ( n3 ) ; list . add ( n4 ) ; if ( list . contains ( 1 ) & & list . contains ( 9 ) & & list . contains ( 7 ) & & list . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . lang . reflect . Array ; import java . util . * ; public class Main { static int N ; static int K ; static long Q ; static int A ; static long B ; static long C ; static double min = 9999999 ; static long ans = 0 ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] map = new int [ 10 ] ; int a = scanner . nextInt ( ) ; map [ a ] = 1 ; int b = scanner . nextInt ( ) ; map [ b ] = 1 ; a = scanner . nextInt ( ) ; map [ a ] = 1 ; a = scanner . nextInt ( ) ; map [ a ] = 1 ; if ( map [ 1 ] = = 1 & & map [ 7 ] = = 1 & & map [ 9 ] = = 1 & & map [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; sc . close ( ) ; int abs = ( int ) Math . abs ( n - m ) ; long count = 1 ; if ( abs > 1 ) { System . out . println ( " 0 " ) ; System . exit ( 0 ) ; } else { while ( n ! = 1 ) { count = count * n % ( long ) ( Math . pow ( 10 , 9 ) + 7 ) ; n -- ; } while ( m ! = 1 ) { count = count * m % ( long ) ( Math . pow ( 10 , 9 ) + 7 ) ; m -- ; } } if ( abs = = 0 ) System . out . println ( ( int ) count * 2 % ( long ) ( Math . pow ( 10 , 9 ) + 7 ) ) ; else System . out . println ( ( int ) count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a ! = 7 ) { if ( a ! = 5 ) { System . out . println ( " NO " ) ; } if ( a = = 5 ) { if ( b = = 7 ) { if ( c ! = 5 ) { System . out . println ( " NO " ) ; } if ( c = = 5 ) { System . out . println ( " YES " ) ; } } if ( b = = 5 ) { if ( c ! = 7 ) { System . out . println ( " NO " ) ; } if ( c = = 7 ) { System . out . println ( " YES " ) ; } } if ( b ! = 7 & & b ! = 5 ) { System . out . println ( " NO " ) ; } } } if ( a = = 7 ) { if ( b = = 7 ) { System . out . println ( " NO " ) ; } if ( b = = 5 ) { if ( c = = 5 ) { System . out . println ( " YES " ) ; } if ( c ! = 5 ) { System . out . println ( " NO " ) ; } } if ( b ! = 7 & & b ! = 5 ) { System . out . println ( " NO " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int max = Integer . MIN _ VALUE ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = s . nextInt ( ) ; if ( max < tmp ) { max = tmp ; } if ( min > tmp ) { min = tmp ; } } int k = s . nextInt ( ) ; s . close ( ) ; if ( max - min > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] b = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) b [ i ] = sc . nextInt ( ) ; int ans = 1 ; int tmp = b [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( tmp > b [ i ] ) { tmp = b [ i ] ; ans + + ; } } 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 ( ) ; int [ ] values = new int [ N + 1 ] ; for ( int i = 1 ; i < = N ; i + + ) { values [ i ] = i ; } int count = 1 ; hoge : while ( true ) { int cnt = 0 ; for ( int i = 1 ; i < = N ; i + + ) { if ( values [ i ] % 2 = = 0 ) { values [ i ] = values [ i ] / 2 ; count = i ; } else { cnt + + ; } } if ( cnt = = N ) { break hoge ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > number = new ArrayList < > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { number . add ( sc . nextInt ( ) ) ; } Collections . sort ( number ) ; if ( number . get ( 0 ) ! = 1 | | number . get ( 3 ) ! = 9 | | number . get ( 2 ) ! = 7 | | number . get ( 1 ) ! = 4 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; } PriorityQueue < Integer > under = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; PriorityQueue < Integer > over = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; if ( B [ i ] > A [ i ] ) { under . offer ( B [ i ] - A [ i ] ) ; } else if ( A [ i ] > B [ i ] ) { over . offer ( A [ i ] - B [ i ] ) ; } } int ans = 0 ; int remain = 0 ; while ( under . size ( ) > 0 ) { int au = under . poll ( ) ; ans + + ; while ( au > 0 ) { if ( remain = = 0 ) { if ( over . size ( ) = = 0 ) { break ; } int ao = over . poll ( ) ; remain = ao ; ans + + ; } int dec = Math . min ( au , remain ) ; au - = dec ; remain - = dec ; } if ( au > 0 ) { ans = - 1 ; break ; } } 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 ( ) ; int [ ] [ ] arr = new int [ n ] [ 2 ] ; long sumA = 0 ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] [ 0 ] = sc . nextInt ( ) ; sumA + = arr [ i ] [ 0 ] ; } long sumB = 0 ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] [ 1 ] = sc . nextInt ( ) ; sumB + = arr [ i ] [ 1 ] ; } if ( sumA < sumB ) { System . out . println ( - 1 ) ; return ; } Arrays . sort ( arr , ( a1 , a2 ) - > ( a1 [ 0 ] - a1 [ 1 ] ) - ( a2 [ 0 ] - a2 [ 1 ] ) ) ; int cnt = 0 ; long diffSum = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] [ 0 ] > = arr [ i ] [ 1 ] ) break ; cnt + + ; diffSum + = arr [ i ] [ 1 ] - arr [ i ] [ 0 ] ; } for ( int i = n - 1 ; i > = 0 & & diffSum > 0 ; i -- ) { diffSum - = ( arr [ i ] [ 0 ] - arr [ i ] [ 1 ] ) ; cnt + + ; } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int [ ] array = { n1 , n2 , n3 } ; int matchCount1 = 0 ; int matchCount2 = 0 ; for ( int val : array ) { if ( val = = 5 ) { matchCount1 + + ; } else if ( val = = 7 ) { matchCount2 + + ; } } if ( matchCount1 = = 2 & & matchCount2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) arr [ i ] = sc . nextInt ( ) ; int cnt = 1 ; int min = arr [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( min > arr [ i ] ) cnt + + ; min = Math . min ( min , arr [ i ] ) ; } System . out . println ( cnt ) ; } } import java . io . IOException ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; int A [ ] = new int [ 3 ] ; A [ 0 ] = scan . nextInt ( ) ; A [ 1 ] = scan . nextInt ( ) ; A [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( A ) ; int sum ; sum = A [ 2 ] - A [ 1 ] ; sum + = A [ 1 ] - A [ 0 ] ; System . out . println ( sum ) ; } public static String myReverse ( String pStr ) { if ( pStr . length ( ) < 1 ) { return " " ; } StringBuffer sb = new StringBuffer ( pStr ) ; return sb . reverse ( ) . toString ( ) ; } public static long myMod ( long a , long b ) { long ret = 0 ; ret = a % b ; if ( ret < 0 ) { ret + = b ; } return ret ; } public static long myPowWithMod ( long kisu , long josu , long primeNumMod _ 0 ) { long ans = 1 ; if ( josu = = 0 ) return 1 ; if ( primeNumMod _ 0 = = 0 ) { while ( josu > 0 ) { if ( josu % 2 = = 0 ) { kisu * = kisu ; josu = josu / 2 ; } else { ans * = kisu ; josu -- ; } } return ans ; } else { kisu = myMod ( kisu , primeNumMod _ 0 ) ; while ( josu > 0 ) { if ( josu % 2 = = 0 ) { kisu * = myMod ( kisu , primeNumMod _ 0 ) ; josu = josu / 2 ; } else { ans * = myMod ( kisu , primeNumMod _ 0 ) ; josu -- ; } } return myMod ( ans , primeNumMod _ 0 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { final long INF = ( long ) 1e15 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } long [ ] b = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = INF ; } long ans = INF ; for ( int k = 0 ; k < n ; k + + ) { long tmp = x * k ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i - k + n ) % n ] ) ; tmp + = b [ i ] ; } ans = Math . min ( ans , tmp ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] list = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int a = Integer . parseInt ( sc . next ( ) ) ; list [ i ] [ j ] = a ; } } if ( list [ 0 ] [ 0 ] - list [ 1 ] [ 0 ] = = list [ 0 ] [ 1 ] - list [ 1 ] [ 1 ] & & list [ 0 ] [ 1 ] - list [ 1 ] [ 1 ] = = list [ 0 ] [ 2 ] - list [ 1 ] [ 2 ] & & list [ 1 ] [ 0 ] - list [ 2 ] [ 0 ] = = list [ 1 ] [ 1 ] - list [ 2 ] [ 1 ] & & list [ 1 ] [ 1 ] - list [ 2 ] [ 1 ] = = list [ 1 ] [ 2 ] - list [ 2 ] [ 2 ] & & list [ 0 ] [ 0 ] - list [ 0 ] [ 1 ] = = list [ 1 ] [ 0 ] - list [ 1 ] [ 1 ] & & list [ 0 ] [ 0 ] - list [ 0 ] [ 1 ] = = list [ 2 ] [ 0 ] - list [ 2 ] [ 1 ] & & list [ 0 ] [ 1 ] - list [ 0 ] [ 2 ] = = list [ 1 ] [ 1 ] - list [ 1 ] [ 2 ] & & list [ 0 ] [ 1 ] - list [ 0 ] [ 2 ] = = list [ 2 ] [ 1 ] - list [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 11 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; nums [ num ] + + ; } if ( nums [ 5 ] = = 2 & & nums [ 7 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int a = 0 ; int b = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = b ) { a + + ; b = P [ i ] ; } } System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( a = = 5 ) { five + + ; } else if ( a = = 7 ) { seven + + ; } if ( b = = 5 ) { five + + ; } else if ( b = = 7 ) { seven + + ; } if ( c = = 5 ) { five + + ; } else if ( c = = 7 ) { seven + + ; } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . nextLine ( ) ) ; int b = Integer . parseInt ( sc . nextLine ( ) ) ; int c = Integer . parseInt ( sc . nextLine ( ) ) ; int d = Integer . parseInt ( sc . nextLine ( ) ) ; int e = Integer . parseInt ( sc . nextLine ( ) ) ; int k = Integer . parseInt ( sc . nextLine ( ) ) ; int a1 = ( int ) Math . abs ( a - b ) ; int a2 = ( int ) Math . abs ( a - c ) ; int a3 = ( int ) Math . abs ( a - d ) ; int a4 = ( int ) Math . abs ( a - e ) ; int b1 = ( int ) Math . abs ( b - c ) ; int b2 = ( int ) Math . abs ( b - d ) ; int b3 = ( int ) Math . abs ( b - e ) ; int c1 = ( int ) Math . abs ( c - d ) ; int c2 = ( int ) Math . abs ( c - e ) ; int d1 = ( int ) Math . abs ( d - e ) ; if ( a1 < = k & & a2 < = k & & a3 < = k & & a4 < = k & & b1 < = k & & b2 < = k & & b3 < = k & & c1 < = k & & c2 < = k & & d1 < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = N ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] distance = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { distance [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int count = 0 ; boolean flag = true ; for ( int i = distance . length - 1 ; i > = 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) { if ( k < distance [ i ] - distance [ j ] ) { flag = false ; break ; } } if ( ! flag ) { break ; } } if ( flag ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long ans1 = 0 ; long ans2 = 0 ; long ans3 = 0 ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = i ; j < = 3500 ; j + + ) { if ( ( ( 4 * i * j - n * i - n * j ) > 0 ) & & ( ( n * i * j ) % ( 4 * i * j - n * i - n * j ) = = 0 ) ) { ans1 = i ; ans2 = j ; ans3 = ( n * i * j ) / ( 4 * i * j - n * i - n * j ) ; break ; } } if ( ans1 > 0 ) break ; } System . out . print ( ans1 + " " ) ; System . out . print ( ans2 + " " ) ; System . out . print ( ans3 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] d = new int [ 6 ] ; for ( int i = 0 ; i < d . length ; i + + ) { d [ i ] = sc . nextInt ( ) ; } System . out . println ( d [ 4 ] - d [ 0 ] < = d [ 5 ] ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; Arrays . sort ( a ) ; if ( k > = a [ 4 ] - a [ 0 ] ) ou . println ( " Yay ! " ) ; else ou . println ( " : ( " ) ; ou . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int kari = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; boolean hanbetsu = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( ( c [ i ] [ j ] + c [ ( i + 1 ) % 3 ] [ ( j + 1 ) % 3 ] + c [ ( i + 2 ) % 3 ] [ ( j + 2 ) % 3 ] ! = kari ) ) { hanbetsu = false ; break ; } } } if ( hanbetsu ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int l = s - ( i + j ) ; if ( l > = 0 & & l < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . File ; import java . io . IOException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] t = { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 101 } ; for ( int i = 0 ; i < t . length ; i + + ) { if ( t [ i ] > N ) { System . out . println ( t [ i - 1 ] ) ; break ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String result = " Yay ! " ; out : for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( num [ i ] - num [ j ] ) > k ) { result = " : ( " ; break out ; } } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] point = new int [ 5 ] ; int k ; String ans = " Yay ! " ; for ( int i = 0 ; i < point . length ; i + + ) { point [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; cmp : for ( int i = 0 ; i < point . length ; i + + ) { for ( int j = i + 1 ; j < point . length ; j + + ) { int p = point [ i ] ; int q = point [ j ] ; if ( ( q - p ) > k ) { ans = " : ( " ; break cmp ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int ary [ ] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; int ans = 0 ; for ( int i = 0 ; i < ary . length ; i + + ) { if ( ary [ i ] < = num ) { ans = ary [ i ] ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { String str = sc . next ( ) ; if ( str . equals ( " Y " ) ) { System . out . println ( " Four " ) ; sc . close ( ) ; return ; } } System . out . println ( " Three " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double h = ( H + ( double ) M / 60 ) * 30 ; double m = ( double ) M * 6 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( h - m ) ) ) ; System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( scan . nextInt ( ) ) ; } int count = 0 ; int min = Collections . max ( list ) ; for ( int i = 0 ; i < n ; i + + ) { if ( list . get ( i ) < = min ) { min = list . get ( i ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdIn . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; b [ 0 ] = c [ 0 ] [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] ; b [ 2 ] = c [ 0 ] [ 2 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; boolean flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int maxNum = scan . nextInt ( ) ; int sum = scan . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = maxNum ; + + x ) { for ( int y = 0 ; y < = maxNum ; + + y ) { int z = sum - x - y ; if ( 0 < = z & & z < = maxNum ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; } } import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; final String [ ] sl = s . split ( " " ) ; HashMap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < sl . length ; i + + ) { int k = Integer . parseInt ( sl [ i ] ) ; if ( hm . containsKey ( k ) ) { hm . put ( k , hm . get ( k ) + 1 ) ; } else { hm . put ( k , 1 ) ; } } String ans = " NO " ; if ( hm . containsKey ( 5 ) & & hm . containsKey ( 7 ) & & hm . get ( 5 ) = = 2 & & hm . get ( 7 ) = = 1 ) ans = " YES " ; System . out . println ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean isY = false ; for ( int i = 0 ; i < N ; i + + ) { String S = sc . next ( ) ; if ( S . equals ( " Y " ) ) isY = true ; } System . out . println ( isY ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int [ ] N = { N1 , N2 , N3 } ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( N [ i ] = = 5 ) { count _ 5 + + ; } else { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . PrintStream ; import java . util . Arrays ; import java . util . Scanner ; public class Main { private static final PrintStream so = System . out ; private static final Scanner sc = new Scanner ( System . in ) ; static final String KEYENCE = " keyence " ; static int INF = Integer . MAX _ VALUE ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; Prep [ ] P = new Prep [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; int diff = A [ i ] - B [ i ] ; P [ i ] = new Prep ( A [ i ] , B [ i ] , diff < 0 ? INF : diff ) ; } Arrays . sort ( P , ( p1 , p2 ) - > p1 . d - p2 . d ) ; long sumA = sum ( A ) ; long sumB = sum ( B ) ; long sumDiff = sumA - sumB ; if ( sumDiff < 0 ) { so . println ( - 1 ) ; return ; } int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( sumDiff < P [ i ] . d ) { break ; } sumDiff - = P [ i ] . d ; ans + + ; } so . println ( N - ans ) ; } static long sum ( int [ ] a ) { return Arrays . stream ( a ) . mapToLong ( i - > i ) . sum ( ) ; } static class Prep { int a ; int b ; int d ; public Prep ( int a , int b , int d ) { this . a = a ; this . b = b ; this . d = d ; } @ Override public String toString ( ) { return " ( a : " + a + " , b : " + b + " , d : " + d + " ) " ; } } } import java . util . Scanner ; public class Main { static long bignum = 1000000000 + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double degree = ( ( h + m / 60 ) * 30 - m * 6 ) / 360 * 2 * Math . PI ; double height = Math . sin ( degree ) * a ; double width = b - Math . cos ( degree ) * a ; double ans = Math . pow ( Math . pow ( height , 2 ) + Math . pow ( width , 2 ) , 0.5 ) ; System . out . println ( ans ) ; } static long divn ( int target , int times ) { int sqtimes = ( int ) Math . sqrt ( times ) ; long ans = 1 ; for ( int i = 0 ; i < sqtimes ; i + + ) { ans = ( ans * target ) % ( 1000000000 + 7 ) ; } long holder = ans ; ans = 1 ; for ( int i = 0 ; i < sqtimes ; i + + ) { ans = ( ans * holder ) % ( 1000000000 + 7 ) ; } for ( int i = 0 ; i < times - sqtimes * sqtimes ; i + + ) { ans = ( ans * target ) % ( 1000000000 + 7 ) ; } return ans ; } static long div ( long a ) { if ( a < 0 ) a + = 1000000000 + 7 ; return a % ( 1000000000 + 7 ) ; } } import java . util . * ; import java . util . Map . Entry ; class Main { static int mod = ( int ) 998244353 ; static List < ArrayList < Integer > > list = new ArrayList < ArrayList < Integer > > ( ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = i ; j < = 3500 ; j + + ) { long up = 3501 ; long down = 0 ; while ( up > = down ) { long mid = ( up + down ) / 2 ; if ( 4 * i * j * mid = = N * ( i * j + j * mid + mid * i ) ) { System . out . print ( i ) ; System . out . print ( " " ) ; System . out . print ( j ) ; System . out . print ( " " ) ; System . out . println ( mid ) ; return ; } else if ( 4 * i * j * mid < N * ( i * j + j * mid + mid * i ) ) { down = mid + 1 ; } else { up = mid - 1 ; } } } } System . out . println ( " end " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; long ret = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = 0 ; y < = Math . min ( k , s - x ) ; y + + ) { if ( s - x - y < = k ) { ret + + ; } } } pr . println ( ret ) ; } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } long [ ] [ ] b = new long [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] [ 0 ] = a [ i ] ; for ( int j = 1 ; j < n ; j + + ) { if ( ( i - j ) > = 0 ) { b [ i ] [ j ] = Math . min ( b [ i ] [ j - 1 ] , a [ i - j ] ) ; } else { b [ i ] [ j ] = Math . min ( b [ i ] [ j - 1 ] , a [ n - ( j - i ) ] ) ; } } } long ans = ( long ) Math . pow ( 10 , 18 ) ; for ( int k = 0 ; k < n ; k + + ) { long t = ( x * k ) ; for ( int i = 0 ; i < n ; i + + ) { t + = b [ i ] [ k ] ; } ans = Math . min ( ans , t ) ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner inp = new Scanner ( System . in ) ; int a = inp . nextInt ( ) ; int b = inp . nextInt ( ) ; int c = inp . nextInt ( ) ; int aa [ ] = { a , b , c } ; Arrays . sort ( aa ) ; int ans = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { ans + = ( aa [ i ] - aa [ i - 1 ] ) ; } System . out . println ( ans ) ; inp . close ( ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double a _ angle = ( h * 60 + m ) / ( 12.0 * 60 ) * 360 ; double b _ angle = m / ( 60.0 ) * 360 ; double angle = a _ angle - b _ angle ; System . out . println ( Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b ) * Math . cos ( Math . toRadians ( angle ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String str = scanner . nextLine ( ) ; String [ ] strs = str . split ( " " ) ; int five = 0 ; int seven = 0 ; for ( String s : strs ) { if ( s . equals ( " 5 " ) ) { five + = 1 ; } else if ( s . equals ( " 7 " ) ) { seven + = 1 ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scanner . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] strlist = str . split ( " " ) ; int k = Integer . parseInt ( strlist [ 0 ] ) ; int s = Integer . parseInt ( strlist [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count = count + 1 ; continue ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( ( ( S - x - y ) > = 0 ) & & ( ( S - x - y ) < = K ) ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int m = n ; int a = 0 ; for ( int i = 0 ; i < n ; i + + ) { int c = Integer . parseInt ( sc . next ( ) ) ; m = Math . min ( m , c ) ; if ( m > = c ) { a + = 1 ; } } System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; long T1 = scn . nextLong ( ) , T2 = scn . nextLong ( ) , A1 = scn . nextLong ( ) , A2 = scn . nextLong ( ) , B1 = scn . nextLong ( ) , B2 = scn . nextLong ( ) ; long ans = 0 ; if ( A1 < B1 ) { long buf1 = A1 , buf2 = A2 ; A1 = B1 ; A2 = B2 ; B1 = buf1 ; B2 = buf2 ; } if ( A2 < B2 ) { long d = ( B1 * T1 + B2 * T2 ) - ( A1 * T1 + A2 * T2 ) ; if ( d = = 0 ) { System . out . println ( " infinity " ) ; return ; } if ( d > 0 ) { if ( ( A1 - B1 ) * T1 % d = = 0 ) { ans = ( ( A1 - B1 ) * T1 / d ) * 2 ; } else { ans = ( ( A1 - B1 ) * T1 / d ) * 2 + 1 ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int retu = scan . nextInt ( ) ; Integer [ ] jun = new Integer [ retu ] ; int count = 0 ; for ( int i = 0 ; i < retu ; i + + ) { jun [ i ] = scan . nextInt ( ) ; } int re = 1 ; int min = jun [ 0 ] ; for ( int i = 0 ; i < retu ; i + + ) { if ( min > = jun [ i ] ) { count + + ; } min = Math . min ( min , jun [ i ] ) ; } System . out . println ( count ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int temp = s - x - y ; if ( temp > = 0 & & temp < = k ) count + + ; } } System . out . println ( count ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; + + i ) { if ( in . next ( ) . equals ( " Y " ) ) { ans = " Four " ; } } out . println ( ans ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( input . readLine ( ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; String [ ] charac = { " P " , " W " , " G " , " Y " } ; boolean [ ] state = new boolean [ 4 ] ; String h ; for ( int i = 0 ; i < n ; i + + ) { h = tokenizer . nextToken ( ) ; for ( int j = 0 ; j < 4 ; j + + ) { if ( h . equals ( charac [ j ] ) ) { state [ j ] = true ; break ; } } } System . out . println ( state [ 3 ] ? " Four " : " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int A = 5 ; int B = 7 ; int C = 5 ; Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = A & & b = = B & & c = = C ) { System . out . println ( " YES " ) ; } else if ( a = = B & & b = = C & & c = = A ) { System . out . println ( " YES " ) ; } else if ( a = = C & & b = = A & & c = = B ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = stdIn . nextInt ( ) ; } Arrays . sort ( num ) ; System . out . println ( num [ 2 ] - num [ 0 ] ) ; } } import java . util . Scanner ; public class Main { private void solve ( ) { Scanner in = new Scanner ( System . in ) ; long N = in . nextInt ( ) ; double d _ k = 0 ; long i _ k = 0 ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = 1 ; j < = 3500 ; j + + ) { if ( 4 * i * j - N * i - N * j = = 0 ) continue ; d _ k = ( double ) ( N * i * j ) / ( 4 * i * j - N * i - N * j ) ; i _ k = N * i * j / ( 4 * i * j - N * i - N * j ) ; if ( d _ k = = i _ k & & i _ k > = 0 & & i _ k < = 3500 ) { System . out . println ( i + " " + j + " " + i _ k ) ; return ; } } } } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double hangle = ( h * 30 ) + ( m * 0.5 ) ; double manble = m * 6 ; double angle = Math . abs ( hangle - manble ) ; if ( angle > 180 ) { angle = 360 - angle ; } double length = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ) ; System . out . println ( length ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( ( a = = b & & c = = 7 ) | | ( b = = c & & a = = 7 ) | | ( c = = a & & b = = 7 ) ) & & a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N > = 64 ) { System . out . println ( 64 ) ; } else if ( N > = 32 ) { System . out . println ( 32 ) ; } else if ( N > = 16 ) { System . out . println ( 16 ) ; } else if ( N > = 8 ) { System . out . println ( 8 ) ; } else if ( N > = 4 ) { System . out . println ( 4 ) ; } else if ( N > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } public static int sample ( ) { return 1 ; } } import java . util . Scanner ; public class Main { public Main ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; boolean four = false ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } for ( String i : s ) { if ( i . equals ( " Y " ) ) four = true ; } if ( four ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } public static void main ( String [ ] args ) { new Main ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ) ; int n = sc . nextInt ( ) ; int i = 2 ; for ( ; i < = n ; i = i * 2 ) { } System . out . println ( i / 2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; for ( int a1 = 0 ; a1 < 201 ; a1 + + ) { int b1 = c11 - a1 ; int b2 = c12 - a1 ; int b3 = c13 - a1 ; int a2 = c23 - b3 ; int a3 = c33 - b3 ; if ( a2 + b1 = = c21 & & a2 + b2 = = c22 & & a2 + b3 = = c23 & & a3 + b1 = = c31 & & a3 + b2 = = c32 & & a3 + b3 = = c33 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; return ; } } import java . io . * ; import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( long h = 1 ; h < 3501 ; + + h ) { for ( long n = 1 ; n < 3501 ; + + n ) { long u = N * h * n ; long d = 4 * h * n - N * n - N * h ; if ( d < = 0 ) continue ; if ( u < d ) continue ; if ( u % d ! = 0 ) continue ; long w = u / d ; if ( 4 * h * n * w = = N * n * w + N * h * w + N * h * n ) { System . out . println ( h + " " + n + " " + w ) ; return ; } } } System . out . println ( " NO ! " ) ; } } import java . util . * ; import java . io . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String result = " NO " ; if ( a * b * c = = 5 * 5 * 7 ) result = " YES " ; System . out . println ( result ) ; } public static class Scanner { private BufferedReader br ; private StringTokenizer tok ; public Scanner ( InputStream is ) throws IOException { br = new BufferedReader ( new InputStreamReader ( is ) ) ; } private void getLine ( ) throws IOException { while ( ! hasNext ( ) ) tok = new StringTokenizer ( br . readLine ( ) ) ; } private boolean hasNext ( ) { return tok ! = null & & tok . hasMoreTokens ( ) ; } public String next ( ) throws IOException { getLine ( ) ; return tok . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; import java . lang . Math ; import java . util . ArrayList ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; List < Integer > n = new ArrayList < > ( ) ; int [ ] n1 = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) n1 [ i ] = stdIn . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) n . add ( n1 [ i ] ) ; if ( n . contains ( 1 ) ) { int b = n . indexOf ( 1 ) ; n . remove ( b ) ; } if ( n . contains ( 9 ) ) { int c = n . indexOf ( 9 ) ; n . remove ( c ) ; } if ( n . contains ( 7 ) ) { int d = n . indexOf ( 7 ) ; n . remove ( d ) ; } if ( n . contains ( 4 ) ) { int e = n . indexOf ( 4 ) ; n . remove ( e ) ; } if ( n . isEmpty ( ) = = true ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int min = Math . min ( Math . abs ( a - b ) + Math . abs ( b - c ) , Math . abs ( a - c ) + Math . abs ( c - b ) ) ; min = Math . min ( min , Math . abs ( c - a ) + Math . abs ( a - b ) ) ; System . out . println ( min ) ; } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ans = Math . abs ( 30 * h + m / 2.0 - 6 * m ) ; if ( ans > 180 ) ans = 360 - ans ; if ( ans = = 180 ) System . out . println ( x + y ) ; else if ( ans = = 0 ) System . out . println ( Math . abs ( x - y ) ) ; else { double a = Math . toRadians ( ans ) ; double p = x * x + y * y - 2 * x * y * Math . cos ( a ) ; p = Math . sqrt ( p ) ; System . out . println ( p ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x , y , z ; int s , k ; int count = 0 ; Scanner sc = new Scanner ( System . in ) ; k = Integer . parseInt ( sc . next ( ) ) ; s = Integer . parseInt ( sc . next ( ) ) ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( k < Math . abs ( a - b ) ) flag = true ; if ( k < Math . abs ( a - c ) ) flag = true ; if ( k < Math . abs ( a - d ) ) flag = true ; if ( k < Math . abs ( a - e ) ) flag = true ; if ( k < Math . abs ( b - c ) ) flag = true ; if ( k < Math . abs ( b - d ) ) flag = true ; if ( k < Math . abs ( b - e ) ) flag = true ; if ( k < Math . abs ( c - d ) ) flag = true ; if ( k < Math . abs ( c - e ) ) flag = true ; if ( k < Math . abs ( d - e ) ) flag = true ; if ( flag = = false ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double m _ angle = 6.0 * m ; double h _ angle = ( 30.0 * h ) + ( 0.5 * m ) ; double mh _ angle = Math . abs ( h _ angle - m _ angle ) ; double cc = ( a * a ) + ( b * b ) - 2 * a * b * Math . cos ( Math . toRadians ( mh _ angle ) ) ; System . out . println ( Math . sqrt ( cc ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) s [ i ] = sc . next ( ) ; int cnt = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " Y " ) ) cnt + + ; } if ( cnt > = 1 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kbd = new Scanner ( System . in ) ; int a = kbd . nextInt ( ) ; int b = kbd . nextInt ( ) ; int h = kbd . nextInt ( ) ; int m = kbd . nextInt ( ) ; double A = h * 30 + m * 0.5 ; double B = m * 6 ; double C = 0 ; if ( A - B > = 0 ) { C = A - B ; } else { C = B - A ; } if ( C > 180 ) { C = 360 - C ; } C = Math . toRadians ( C ) ; double x = b * Math . sin ( C ) * b * Math . sin ( C ) ; double y = ( b * Math . cos ( C ) - a ) * ( b * Math . cos ( C ) - a ) ; System . out . println ( Math . sqrt ( x + y ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int min = a [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = a [ i ] ) { min = a [ i ] ; count + + ; } else { } } System . out . println ( count ) ; sc . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BSumOfThreeIntegers solver = new BSumOfThreeIntegers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BSumOfThreeIntegers { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int k = in . nextInt ( ) , s = in . nextInt ( ) ; long ans = 0 ; for ( int x = Math . max ( 0 , s - 2 * k ) ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = Math . max ( 0 , s - x - k ) ; y < = Math . min ( k , s - x ) ; y + + ) { ans + + ; } } out . println ( ans ) ; } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; final int n = scanner . nextInt ( ) ; int min = 200001 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = scanner . nextInt ( ) ; if ( p < = min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( final String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { if ( a = = 5 & & b = = 5 | | a = = 5 & & c = = 5 | | b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int abcde [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { abcde [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { int ans = Math . abs ( abcde [ i ] - abcde [ j ] ) ; if ( ans > k ) { count + + ; } } } if ( count > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter ou = new PrintWriter ( System . out ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; Arrays . sort ( a ) ; ou . println ( a [ 2 ] - a [ 0 ] ) ; ou . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; int z = 0 , y = 0 , fin = 0 ; while ( z < 5 ) { a [ z ] = stdIn . nextInt ( ) ; z + + ; } z = 0 ; int k = stdIn . nextInt ( ) ; while ( z < 5 ) { y = z + 1 ; while ( y < 5 ) { if ( a [ y ] - a [ z ] > k ) { fin = 1 ; break ; } y + + ; } z + + ; } if ( fin = = 1 ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] d = new int [ 3 ] [ 2 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { d [ i ] [ j ] = c [ i ] [ j + 1 ] - c [ i ] [ j ] ; } } if ( d [ 0 ] [ 0 ] = = d [ 1 ] [ 0 ] & & d [ 1 ] [ 0 ] = = d [ 2 ] [ 0 ] & & d [ 0 ] [ 1 ] = = d [ 1 ] [ 1 ] & & d [ 1 ] [ 1 ] = = d [ 2 ] [ 1 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; long N = sc . nextLong ( ) ; for ( long i = 3500 ; i > = 1 ; i -- ) { if ( 4 * i - N > 0 ) { long a = 4 * i - N ; long b = N * i ; for ( int j = 3500 ; j > = 1 ; j -- ) { if ( a * j - b > 0 ) { if ( ( b * j ) % ( a * j - b ) = = 0 ) { pl ( i + " " + j + " " + ( ( b * j ) / ( a * j - b ) ) ) ; System . exit ( 0 ) ; } } } } } } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } public static void pl ( Object o ) { System . out . println ( o ) ; } public static void pl ( ) { System . out . println ( ) ; } public static void p ( Object o ) { System . out . print ( o ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; Map < Integer , Integer > input = new HashMap < Integer , Integer > ( ) ; int in = 0 ; int x = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { in = scan . nextInt ( ) ; if ( input . get ( in ) ! = null ) { x = input . get ( in ) ; x = x + 1 ; input . put ( in , x ) ; } else { x = x + 1 ; input . put ( in , x ) ; } x = 0 ; } int number5 = 0 ; int number7 = 0 ; String ans = " NO " ; number5 = input . get ( 5 ) ; if ( number5 ! = 0 ) { if ( number5 = = 2 ) { number7 = input . get ( 7 ) ; if ( number7 ! = 0 ) { if ( number7 = = 1 ) { ans = " YES " ; } } } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] line = scanner . nextLine ( ) . split ( " " , 4 ) ; int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { arr [ i ] = Integer . parseInt ( line [ i ] ) ; } Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 1 & & arr [ 1 ] = = 4 & & arr [ 2 ] = = 7 & & arr [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String argv [ ] ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; int time = 0 ; if ( H + R < 0 ) time = - 1 ; else if ( H + R > = 2 * R ) time = 1 ; else if ( H + R = = 0 ) time = 0 ; else if ( H + R > = 1 ) time = 1 ; System . out . println ( time ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( solve ( a , b , c , d , e , k ) ) ; sc . close ( ) ; } static String solve ( int a , int b , int c , int d , int e , int k ) { return ( e - a < = k ) ? " Yay ! " : " : ( " ; } } import java . util . Scanner ; public class Main { static int n ; static long x ; static long [ ] [ ] dp ; static long [ ] a ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } dp = new long [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { dp [ 0 ] [ i ] = a [ i ] ; } for ( int i = 1 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { dp [ i ] [ j ] = Math . min ( dp [ i - 1 ] [ ( n + j - 1 ) % n ] , dp [ i - 1 ] [ j ] ) ; } } long ret = Long . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { long sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { sum + = dp [ i ] [ j ] ; } ret = Math . min ( ret , sum + x * i ) ; } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; long ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z > = 0 & & z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; return ; } System . out . println ( " Yay ! " ) ; } } 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 [ ] input = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { input [ i ] = sc . nextInt ( ) ; } int min = Integer . MAX _ VALUE ; int res = 0 ; for ( int i = 0 ; i < input . length ; i + + ) { if ( input [ i ] < min ) { min = input [ i ] ; res + + ; } } System . out . print ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int answer = 0 ; if ( S > K * 3 ) { System . out . println ( 0 ) ; return ; } for ( int i = K ; i > = 0 ; i -- ) { int tmp1 = S - i ; if ( tmp1 > K + K ) { break ; } for ( int j = K ; j > = 0 ; j -- ) { int tmp2 = tmp1 - j ; if ( tmp2 < 0 ) { continue ; } else if ( tmp2 > K ) { break ; } answer + + ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; IrohaAndEasy solver = new IrohaAndEasy ( ) ; System . out . println ( solver . solve ( input ) ) ; } static class IrohaAndEasy { public String solve ( String input ) { String answer ; String abc [ ] = input . split ( " " ) ; int five = 0 ; int seven = 0 ; int other = 0 ; for ( String n : abc ) { Integer i = new Integer ( n ) ; if ( i = = 5 ) { five + + ; } else if ( i = = 7 ) { seven + + ; } else { other + + ; } } if ( five = = 2 & & seven = = 1 ) { answer = " YES " ; } else { answer = " NO " ; } return answer ; } } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int A1 = Integer . parseInt ( sc . next ( ) ) ; int A2 = Integer . parseInt ( sc . next ( ) ) ; int A3 = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int A12 = Math . abs ( A1 - A2 ) ; int A13 = Math . abs ( A1 - A3 ) ; int A23 = Math . abs ( A2 - A3 ) ; int min = Integer . MAX _ VALUE ; if ( A12 + A23 < min ) { min = A12 + A23 ; } if ( A13 + A23 < min ) { min = A13 + A23 ; } if ( A12 + A13 < min ) { min = A12 + A13 ; } if ( A23 + A13 < min ) { min = A23 + A13 ; } if ( A13 + A12 < min ) { min = A13 + A12 ; } if ( A23 + A12 < min ) { min = A23 + A12 ; } out . printf ( " % d \ n " , min ) ; out . flush ( ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; list . add ( Integer . parseInt ( scanner . next ( ) ) ) ; list . add ( Integer . parseInt ( scanner . next ( ) ) ) ; list . add ( Integer . parseInt ( scanner . next ( ) ) ) ; Collections . sort ( list ) ; if ( list . get ( 0 ) = = 5 & & list . get ( 1 ) = = 5 & & list . get ( 2 ) = = 7 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } scanner . close ( ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( n ) ; boolean b = false ; if ( n [ 0 ] = = 1 ) { if ( n [ 1 ] = = 4 ) { if ( n [ 2 ] = = 7 ) { if ( n [ 3 ] = = 9 ) System . out . println ( " YES " ) ; b = true ; } } } if ( b = = false ) System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; class Main { public static void main ( final String [ ] args ) throws Exception { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ) { int N = Integer . parseInt ( br . readLine ( ) ) ; int ans = 1 ; while ( ans < N ) { ans * = 2 ; } if ( ans > N ) { ans / = 2 ; } System . out . println ( ans ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int distance [ ] = new int [ 10 ] ; distance [ 0 ] = b - a ; distance [ 1 ] = c - a ; distance [ 2 ] = d - a ; distance [ 3 ] = e - a ; distance [ 4 ] = c - b ; distance [ 5 ] = d - b ; distance [ 6 ] = e - b ; distance [ 7 ] = d - c ; distance [ 8 ] = e - c ; distance [ 9 ] = e - d ; int flag = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( k < distance [ i ] ) { flag = 0 ; break ; } } if ( flag = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int min = ( int ) 1e9 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < min ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . Comparator ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CExamAndWizard solver = new CExamAndWizard ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CExamAndWizard { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; ArrayList < Long > amari = new ArrayList < > ( ) ; long husoku = 0 ; long res = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = in . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = in . nextInt ( ) ; if ( a [ i ] > b [ i ] ) { amari . add ( a [ i ] - b [ i ] ) ; } if ( b [ i ] > a [ i ] ) { husoku + = b [ i ] - a [ i ] ; res + + ; } } amari . sort ( Comparator . reverseOrder ( ) ) ; int index = 0 ; while ( husoku > 0 ) { if ( index = = amari . size ( ) ) { out . println ( - 1 ) ; return ; } husoku - = amari . get ( index + + ) ; res + + ; } out . println ( res ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; String answer = " Three " ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { answer = " Four " ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; sc . close ( ) ; if ( a * b * c = = 175 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; int [ ] data = { a , b , c } ; for ( int i = 0 ; i < 3 ; i + + ) { if ( data [ i ] = = 5 ) count5 + + ; if ( data [ i ] = = 7 ) count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) arr [ i ] [ j ] = in . nextInt ( ) ; for ( int i = 0 ; i < = 100 ; i + + ) { int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; boolean ok = true ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = arr [ j ] [ 0 ] - i ; for ( int j = 0 ; j < 3 ; j + + ) b [ j ] = arr [ 0 ] [ j ] - a [ 0 ] ; for ( int k = 0 ; k < 3 ; k + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( arr [ k ] [ j ] ! = a [ k ] + b [ j ] ) ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; return ; } a = null ; b = null ; } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > List = new ArrayList < > ( ) ; ArrayList < Integer > OPT = new ArrayList < > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) List . add ( sc . nextInt ( ) ) ; for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { int opt = Math . abs ( List . get ( i ) - List . get ( j ) ) ; OPT . add ( opt ) ; } } Collections . sort ( OPT ) ; System . out . println ( OPT . get ( 0 ) + OPT . get ( 1 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int min = 0 ; int count = 0 ; min = array [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( min > = array [ i ] ) { min = array [ i ] ; } else { count + + ; } } System . out . println ( n - count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int w = Integer . parseInt ( sc . next ( ) ) ; double at = ( double ) ( Math . PI * h ) / 6 ; at - = ( double ) ( Math . PI * w * 11 ) / 360 ; double ans = a * a + b * b - 2 * a * b * Math . cos ( at ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . * ; import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { String [ ] input = br . readLine ( ) . split ( " " ) ; double A = Double . parseDouble ( input [ 0 ] ) ; double B = Double . parseDouble ( input [ 1 ] ) ; double H = Double . parseDouble ( input [ 2 ] ) ; double M = Double . parseDouble ( input [ 3 ] ) ; double h _ r = 0 ; double m _ r = 0 ; double r = 0 ; double result = 0 ; if ( M = = 0 ) { m _ r = 360 ; h _ r = H * 30 ; } else { m _ r = M * 6 ; h _ r = H * 30 + M * 0.5 ; } if ( H = = 0 & & M = = 0 ) { result = A - B ; } else { r = Math . abs ( h _ r - m _ r ) ; if ( r = = 0 ) { result = 0 ; } else { double cos = Math . cos ( Math . toRadians ( r ) ) ; double a = Math . pow ( A , 2 ) ; double b = Math . pow ( B , 2 ) ; double tmp = a + b - ( 2 * A * B * cos ) ; result = Math . sqrt ( tmp ) ; } } System . out . println ( result ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; int [ ] [ ] nums = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 9 ; i + + ) { nums [ i / 3 ] [ i % 3 ] = sc . nextInt ( ) ; } System . out . println ( nums [ 1 ] [ 0 ] - nums [ 0 ] [ 0 ] = = nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] & & nums [ 1 ] [ 1 ] - nums [ 0 ] [ 1 ] = = nums [ 1 ] [ 2 ] - nums [ 0 ] [ 2 ] & & nums [ 2 ] [ 0 ] - nums [ 1 ] [ 0 ] = = nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] & & nums [ 2 ] [ 1 ] - nums [ 1 ] [ 1 ] = = nums [ 2 ] [ 2 ] - nums [ 1 ] [ 2 ] ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static char [ ] cs = { ' .' , ' # ' } ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } long ans = A [ 0 ] - 1 ; int min = 2 ; for ( int i = 1 ; i < N ; + + i ) { if ( A [ i ] = = min ) { + + min ; continue ; } ans + = ( A [ i ] - 1 ) / min ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( sc . nextInt ( ) ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A + B + C ) ! = 17 ) { System . out . println ( " NO " ) ; } else if ( A ! = 7 & & B ! = 7 & & C ! = 7 ) { System . out . println ( " NO " ) ; } else if ( A ! = 5 & & B ! = 5 & & C ! = 5 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } ; } ; } ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 123 ; int input ; for ( int i = 0 ; i < 5 ; i + + ) { input = sc . nextInt ( ) ; max = Math . max ( max , input ) ; min = Math . min ( min , input ) ; } int k = sc . nextInt ( ) ; if ( k > = max - min ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; int z = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { z = S - x - y ; if ( 0 < = z & & z < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Long > a = new ArrayList < > ( ) ; long aTotal = 0 ; for ( int i = 0 ; i < n ; i + + ) { long x = sc . nextInt ( ) ; a . add ( x ) ; aTotal + = x ; } List < Long > b = new ArrayList < > ( ) ; long bTotal = 0 ; for ( int i = 0 ; i < n ; i + + ) { long x = sc . nextInt ( ) ; b . add ( x ) ; bTotal + = x ; } if ( aTotal < bTotal ) { System . out . println ( - 1 ) ; return ; } List < Long > sub = new ArrayList < > ( ) ; long cnt = 0 ; long minusTotal = 0 ; for ( int i = 0 ; i < n ; i + + ) { long s = a . get ( i ) - b . get ( i ) ; if ( s < 0 ) { cnt + + ; minusTotal + = s ; } sub . add ( s ) ; } if ( cnt = = 0 ) { System . out . println ( 0 ) ; return ; } Collections . sort ( sub , Comparator . reverseOrder ( ) ) ; boolean ok = false ; for ( long i : sub ) { if ( i < 0 ) { continue ; } minusTotal + = i ; cnt + + ; if ( minusTotal > = 0 ) { ok = true ; break ; } } if ( ! ok ) { System . out . println ( - 1 ) ; return ; } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int P [ ] = new int [ N ] ; int Pj = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; Pj = P [ 0 ] ; } for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = Pj ) { count + + ; Pj = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean ok = true ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { if ( array [ j ] - array [ i ] > k ) ok = false ; } } if ( ok ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . math . BigInteger ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { int n , i , j , m , k , p , q , o , l , s , tt = 1 ; Double x , y , z ; int ar [ ] , br [ ] ; char ch ; BigInteger an , su , u , v ; String a , b = " " , c = " " , d ; Scanner sc = new Scanner ( System . in ) ; Scanner scc = new Scanner ( System . in ) ; ar = new int [ 200001 ] ; br = new int [ 200001 ] ; n = sc . nextInt ( ) ; k = 50000000 ; for ( i = 0 ; i < n ; i + + ) { o = sc . nextInt ( ) ; if ( k > o ) { k = o ; } ar [ i ] = o ; br [ i ] = k ; } k = 0 ; for ( i = 1 ; i < n ; i + + ) { if ( ar [ i ] < = br [ i ] ) { k + + ; } } System . out . println ( k + 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 0 ; for ( i = 1 ; i < = n ; i = i * 2 ) { } i = i / 2 ; System . out . println ( i ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 1 ; while ( x * 2 < = n ) { x * = 2 ; } System . out . println ( x ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 , a , count , ans = 1 ; for ( int i = 2 ; i < = n ; i + + ) { count = 0 ; if ( i % 2 = = 1 ) continue ; a = i ; for ( ; ; ) { if ( a / 2 ! = 0 ) { a = a / 2 ; count + + ; } else { count + + ; break ; } } if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; int sub = 0 ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { if ( i ! = S ) { for ( int j = 0 ; j < = K ; j + + ) { if ( i + j ! = S ) { sub = S - ( i + j ) ; if ( sub > = 0 & & sub < = K ) { count + + ; } } else if ( i + j = = S ) { count + + ; break ; } } } else if ( i = = S ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayDeque ; import java . util . Deque ; import java . util . Collection ; import java . util . LinkedList ; import java . util . Queue ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; boolean f = false ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { f = true ; } if ( A = = 7 & & B = = 5 & & C = = 5 ) { f = true ; } if ( A = = 5 & & B = = 5 & & C = = 7 ) { f = true ; } if ( f ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int answer = 0 ; for ( int x = 0 ; x < = k ; x + + ) { if ( x > s ) { break ; } for ( int y = 0 ; y < = k ; y + + ) { if ( x + y > s ) { break ; } else { if ( x + y + k > = s ) { answer + + ; } } } } System . out . println ( answer ) ; } } 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 s = br . readLine ( ) ; String [ ] array = s . split ( " " ) ; int count1 = 0 ; int count2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( Integer . parseInt ( array [ i ] ) = = 5 ) { count1 + = 1 ; } else if ( Integer . parseInt ( array [ i ] ) = = 7 ) { count2 + = 1 ; } } if ( count1 = = 2 & & count2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int N , A , B , C ; int a = 0 , b = 0 , c = 0 , d = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { N = stdin . nextInt ( ) ; if ( N = = 1 & & a = = 0 ) a + + ; if ( N = = 9 & & b = = 0 ) b + + ; if ( N = = 7 & & c = = 0 ) c + + ; if ( N = = 4 & & d = = 0 ) d + + ; } if ( a + b + c + d > = 4 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; public class Main { private final static int MOD = 1 _ 000 _ 000 _ 000 + 7 ; private final static BigDecimal B _ MOD = BigDecimal . valueOf ( MOD ) ; public static void main ( String ... args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] vals = reader . readLine ( ) . split ( " " ) ; final int N = Integer . parseInt ( vals [ 0 ] ) ; final int M = Integer . parseInt ( vals [ 1 ] ) ; if ( Math . abs ( N - M ) > 1 ) { System . out . print ( 0 ) ; return ; } BigDecimal result ; if ( N = = M ) { result = BigDecimal . valueOf ( 2 ) . multiply ( getPermutation ( N ) ) . multiply ( getPermutation ( N ) ) ; } else { result = getPermutation ( N ) . multiply ( getPermutation ( M ) ) ; } System . out . print ( result . remainder ( B _ MOD ) ) ; } private static BigDecimal getPermutation ( final int n ) { BigDecimal result = BigDecimal . ONE ; for ( int i = 1 ; i < = n ; i + + ) { result = result . multiply ( BigDecimal . valueOf ( i ) ) ; if ( result . compareTo ( B _ MOD ) = = 1 ) result = result . remainder ( B _ MOD ) ; } return result ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int temp ; int devideCnt ; int maxDevideCnt = - 1 ; int ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { temp = i ; devideCnt = 0 ; while ( true ) { if ( temp % 2 = = 0 ) { temp = temp / 2 ; devideCnt + + ; } else { break ; } } if ( devideCnt > maxDevideCnt ) { ans = i ; maxDevideCnt = devideCnt ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double aAng = h * 30 + m * 0.5 ; double bAng = m * 6 ; System . out . println ( Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( 360 - ( aAng - bAng ) ) ) ) ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int antena [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean a = false ; out : for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ( antena [ i ] - antena [ j ] > k ) | | ( antena [ i ] - antena [ j ] < - k ) ) { a = true ; break out ; } } } if ( ! a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ax = a * Math . sin ( Math . PI * 2 * ( 1d / 12 * h + 1d / 12 / 60 * m ) ) ; double ay = a * Math . cos ( Math . PI * 2 * ( 1d / 12 * h + 1d / 12 / 60 * m ) ) ; double bx = b * Math . sin ( Math . PI * 2 / 60 * m ) ; double by = b * Math . cos ( Math . PI * 2 / 60 * m ) ; System . out . printf ( " % .20f \ n " , Math . hypot ( bx - ax , by - ay ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean ans = true ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; sc . close ( ) ; } } import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 1 ] + a [ 1 ] - a [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 1 ; while ( i < = N ) { i * = 2 ; } System . out . println ( i / 2 ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; boolean flag = true ; if ( a [ 0 ] ! = 1 ) flag = false ; if ( a [ 1 ] ! = 4 ) flag = false ; if ( a [ 2 ] ! = 7 ) flag = false ; if ( a [ 3 ] ! = 9 ) flag = false ; if ( flag ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( A * B * C = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . PriorityQueue ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { MScanner sc = new MScanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { pw . println ( " : ( " ) ; } else { pw . println ( " Yay ! " ) ; } pw . flush ( ) ; } static class MScanner { StringTokenizer st ; BufferedReader br ; public MScanner ( InputStream system ) { br = new BufferedReader ( new InputStreamReader ( system ) ) ; } public MScanner ( String file ) throws Exception { br = new BufferedReader ( new FileReader ( file ) ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public char nextChar ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } public Long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public void waitForInput ( ) throws InterruptedException { Thread . sleep ( 3000 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; int [ ] [ ] allType = new int [ n ] [ n ] ; long min = 0 ; for ( int i = 0 ; i < n ; i + + ) { allType [ 0 ] [ i ] = sc . nextInt ( ) ; min + = allType [ 0 ] [ i ] ; } for ( int i = 1 ; i < n ; i + + ) { long sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { allType [ i ] [ j ] = Math . min ( allType [ i - 1 ] [ j ] , allType [ 0 ] [ ( j - i + n ) % n ] ) ; sum + = allType [ i ] [ j ] ; } min = Math . min ( min , sum + i * x ) ; } System . out . println ( min ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int count1 = 0 ; int count2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int token1 = sc . nextInt ( ) ; if ( token1 = = 7 & & count1 < = 1 ) { count1 + + ; } else if ( token1 = = 5 & & count1 < = 2 ) { count2 + + ; } } if ( count1 = = 1 & & count2 = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double ret2 = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2.0 * a * b * Math . cos ( Math . toRadians ( Math . abs ( ( 60.0 * h - 11.0 * m ) / 2 ) ) ) ; double ret = Math . sqrt ( ret2 ) ; System . out . println ( ret ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; final double SHORT _ HAND _ ANGLE _ PER _ MINUTE = 0.5 ; final double LONG _ HAND _ ANGLE _ PER _ MINUTE = 6 ; double angleHour = ( h * 60 + m ) * SHORT _ HAND _ ANGLE _ PER _ MINUTE ; double angleMinute = m * LONG _ HAND _ ANGLE _ PER _ MINUTE ; double eggplantAngle = 0 ; if ( angleHour < = angleMinute ) { eggplantAngle = angleMinute - angleHour ; } else { eggplantAngle = angleHour - angleMinute ; } if ( eggplantAngle > 180 ) { eggplantAngle = 360 - eggplantAngle ; } double radian = Math . toRadians ( eggplantAngle ) ; double c = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( radian ) ) ; System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 999999999 ; long sum = 0 ; for ( int i = 0 ; i < N ; i + + ) { int now = sc . nextInt ( ) ; if ( now < max ) { max = now ; sum + + ; } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int [ ] nums = new int [ k + 1 ] ; for ( int i = 0 ; i < nums . length ; i + + ) { nums [ i ] = i ; } int count = 0 ; for ( int i = 0 ; i < nums . length ; i + + ) { int x = nums [ i ] ; for ( int j = 0 ; j < nums . length ; j + + ) { int y = nums [ j ] ; int z = s - x - y ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = 0 ; int min = 123 ; for ( int i = 0 ; i < 5 ; i + + ) { int a = sc . nextInt ( ) ; if ( a > max ) { max = a ; } if ( a < min ) { min = a ; } } int k = sc . nextInt ( ) ; if ( max - min > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; int s = in . nextInt ( ) ; int answer = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = x ; y < = k ; y + + ) { int z = s - y - x ; if ( y < = z & & z < = k ) { if ( x = = y & & y = = z & & x = = z ) { answer + = 1 ; } else if ( x = = y | | y = = z | | x = = z ) { answer + = 3 ; } else { answer + = 6 ; } } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a , b , c , abc ; a = sc . next ( ) ; b = sc . next ( ) ; c = sc . next ( ) ; abc = a + b + c ; if ( abc . equals ( " 557 " ) | | abc . equals ( " 575 " ) | | abc . equals ( " 755 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] check = new int [ 3 ] ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; check [ 0 ] = A ; check [ 1 ] = B ; check [ 2 ] = C ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < check . length ; i + + ) { if ( check [ i ] = = 5 ) { count _ 5 + + ; } else if ( check [ i ] = = 7 ) { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int b = scan . nextInt ( ) ; int a = scan . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = b ; i + + ) { for ( int n = 0 ; n < = b ; n + + ) { int f = a - i - n ; if ( f < = b & & f > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } Scanner sc = new Scanner ( System . in ) ; void run ( ) { int a [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int b [ ] = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = b [ i ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int [ ] v = new int [ 8 ] ; for ( int i = 0 ; i < 3 ; + + i ) v [ in . nextInt ( ) ] + + ; if ( v [ 5 ] = = 2 & & v [ 7 ] = = 1 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; long [ ] map = new long [ 5 ] ; for ( int i = 0 ; i < N ; i + + ) { String s = scanner . next ( ) ; if ( s . charAt ( 0 ) = = ' P ' ) map [ 0 ] + + ; if ( s . charAt ( 0 ) = = ' Y ' ) map [ 1 ] + + ; if ( s . charAt ( 0 ) = = ' W ' ) map [ 2 ] + + ; if ( s . charAt ( 0 ) = = ' G ' ) map [ 3 ] + + ; } long ans = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( map [ i ] > 0 ) ans + + ; } if ( ans = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = in . nextInt ( ) ; } int minZ = p [ 0 ] , cnt = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( minZ > = p [ i ] ) { minZ = p [ i ] ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) b [ i ] = in . nextInt ( ) ; List < Integer > enough = new ArrayList < > ( ) ; List < Integer > shortage = new ArrayList < > ( ) ; long shortage _ sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] - b [ i ] > 0 ) enough . add ( a [ i ] - b [ i ] ) ; else if ( a [ i ] - b [ i ] < 0 ) { shortage . add ( a [ i ] - b [ i ] ) ; shortage _ sum + = - a [ i ] + b [ i ] ; } } if ( shortage _ sum = = 0 ) System . out . println ( 0 ) ; else { enough . sort ( ( x , y ) - > - x + y ) ; int i = 0 ; for ( ; i < enough . size ( ) ; i + + ) { shortage _ sum - = enough . get ( i ) ; if ( shortage _ sum < = 0 ) break ; } if ( i = = enough . size ( ) ) System . out . println ( - 1 ) ; else System . out . println ( shortage . size ( ) + i + 1 ) ; } in . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; boolean yellow = false ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { yellow = true ; break ; } } if ( yellow ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) a [ i ] [ j ] = sc . nextInt ( ) ; } int sum1 , sum2 , sum3 , sum4 ; sum1 = a [ 0 ] [ 0 ] + a [ 1 ] [ 1 ] + a [ 2 ] [ 2 ] ; sum2 = a [ 0 ] [ 1 ] + a [ 1 ] [ 2 ] + a [ 2 ] [ 0 ] ; sum3 = a [ 1 ] [ 0 ] + a [ 2 ] [ 1 ] + a [ 0 ] [ 2 ] ; if ( sum1 = = sum2 & & sum2 = = sum3 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } int c012 = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; int c021 = c [ 0 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] ; int c102 = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; int c120 = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; int c210 = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; int c201 = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; if ( c012 = = c021 & & c021 = = c102 & & c102 = = c120 & & c120 = = c210 & & c210 = = c201 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = 0 , y = 0 , z , cnt = 0 ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( s - ( x + y ) > = 0 & & s - ( x + y ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } public class Main { static Scanner in = new Scanner ( System . in ) ; public static void solve ( ) { DecimalFormat df = new DecimalFormat ( " # . # # # # # # # # # # # # # # # # # # # # " ) ; double a = in . nextDouble ( ) , b = in . nextDouble ( ) ; double h = in . nextDouble ( ) , m = in . nextDouble ( ) ; double angle = Math . abs ( 30 * h - 11 * m / 2.0 ) ; double ans = Math . toRadians ( angle ) ; double c = Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( ans ) ) ; System . out . println ( df . format ( c ) ) ; } public static void main ( String [ ] args ) throws java . lang . Exception { int t = 1 ; while ( t > 0 ) { solve ( ) ; t -- ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 ) | | ( b = = 5 & & c = = 5 ) | | ( a = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int [ ] ia = new int [ 5 ] ; ia [ 0 ] = sc . nextInt ( ) ; ia [ 1 ] = sc . nextInt ( ) ; ia [ 2 ] = sc . nextInt ( ) ; ia [ 3 ] = sc . nextInt ( ) ; ia [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; Arrays . sort ( ia ) ; if ( ia [ 4 ] - ia [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String strArr [ ] = br . readLine ( ) . split ( " " ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < strArr . length ; i + + ) { int temp = Integer . parseInt ( strArr [ i ] ) ; if ( temp = = 5 ) { count5 + + ; } else if ( temp = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; int b = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; int d = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; if ( a = = b & & b = = d ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & S - i - j > = 0 ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; String ans = " NO " ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) ans = " YES " ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int a = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; int c = stdin . nextInt ( ) ; int d = stdin . nextInt ( ) ; int e = stdin . nextInt ( ) ; int k = stdin . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; String count = " Three " ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; if ( S [ i ] . equals ( " Y " ) ) count = " Four " ; } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int [ ] aa = new int [ 3 ] ; aa [ 0 ] = a ; aa [ 1 ] = b ; aa [ 2 ] = c ; Arrays . sort ( aa ) ; if ( aa [ 0 ] = = aa [ 1 ] & & aa [ 2 ] > aa [ 0 ] ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int min = 124 ; int max = - 1 ; for ( int i = 0 ; i < 5 ; i + + ) { int n = in . nextInt ( ) ; if ( n < min ) min = n ; if ( n > max ) max = n ; } int k = in . nextInt ( ) ; System . out . println ( ( max - min < = k ) ? " Yay ! " : " : ( " ) ; in . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c = = 17 ) & & ( a = = 5 | | a = = 7 ) & & ( b = = 5 | | b = = 7 ) & & ( c = = 5 | | c = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a , b , c ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; if ( a + b + c = = 17 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ( ) ; } min = a [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void Solver ( int A , int B , int C ) { int sevenCount = 0 ; int fiveCount = 0 ; if ( A = = 5 ) fiveCount + + ; if ( B = = 5 ) fiveCount + + ; if ( C = = 5 ) fiveCount + + ; if ( A = = 7 ) sevenCount + + ; if ( B = = 7 ) sevenCount + + ; if ( C = = 7 ) sevenCount + + ; if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; Solver ( input . nextInt ( ) , input . nextInt ( ) , input . nextInt ( ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a , b , c ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; c = scan . nextInt ( ) ; if ( a = = 5 ) { if ( b = = 5 ) { if ( c = = 7 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } else if ( b = = 7 ) { if ( c = = 5 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } } else if ( a = = 7 ) { if ( b = = 5 ) { if ( c = = 5 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } else System . out . print ( " NO " ) ; } else System . out . print ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int H = s . nextInt ( ) ; int R = s . nextInt ( ) ; int a = H + R ; int ans = 1 ; if ( a < 0 ) { ans = - 1 ; } else if ( a = = 0 ) { ans = 0 ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int max = Integer . parseInt ( sc . next ( ) ) ; int target = Integer . parseInt ( sc . next ( ) ) ; int cnt = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int total = i + j ; if ( target - total < = max & & target - total > = 0 ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; c [ 0 ] [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 0 ] [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 0 ] [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 1 ] [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 1 ] [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 1 ] [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 2 ] [ 0 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 2 ] [ 1 ] = Integer . parseInt ( sc . next ( ) ) ; c [ 2 ] [ 2 ] = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; a [ 1 ] = c [ 1 ] [ 1 ] - b [ 1 ] ; a [ 2 ] = c [ 2 ] [ 1 ] - b [ 1 ] ; String ans = " Yes " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { ans = " No " ; break ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { String m = sc . next ( ) ; if ( m . equals ( " Y " ) ) { ans = " Four " ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . math . BigInteger ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { 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 ( ) ; } sc . close ( ) ; long ans = a [ 0 ] - 1 ; int p = 2 ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] ! = p ) { ans + = ( a [ i ] - 1 ) / p ; } else { p + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int g [ ] [ ] = new int [ 3 ] [ 3 ] ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { g [ i ] [ j ] = sc . nextInt ( ) ; } } if ( ( g [ 0 ] [ 0 ] + g [ 1 ] [ 1 ] = = g [ 0 ] [ 1 ] + g [ 1 ] [ 0 ] ) & & ( g [ 0 ] [ 1 ] + g [ 1 ] [ 2 ] = = g [ 0 ] [ 2 ] + g [ 1 ] [ 1 ] ) & & ( g [ 1 ] [ 0 ] + g [ 2 ] [ 1 ] = = g [ 1 ] [ 1 ] + g [ 2 ] [ 0 ] ) & & ( g [ 1 ] [ 1 ] + g [ 2 ] [ 2 ] = = g [ 1 ] [ 2 ] + g [ 2 ] [ 1 ] ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public void main ( Scanner sc ) { int n = sc . nextInt ( ) ; long x = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } long b [ ] = new long [ n ] ; Arrays . fill ( b , Long . MAX _ VALUE ) ; long ans = n * 1000000000L ; for ( int magic = 0 ; magic < n ; magic + + ) { for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i + n - magic ) % n ] ) ; } ans = Math . min ( ans , magic * x + Arrays . stream ( b ) . sum ( ) ) ; } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; new Main ( ) . main ( sc ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { BufferedReader rd ; Main ( ) throws IOException { rd = new BufferedReader ( new InputStreamReader ( System . in ) ) ; compute ( ) ; } private void compute ( ) throws IOException { rd . readLine ( ) ; String s = rd . readLine ( ) ; out ( s . contains ( " Y " ) ? " Four " : " Three " ) ; } private static void out ( Object x ) { System . out . println ( x ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) ; } } import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; long count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { if ( x = = S ) { count + + ; break ; } if ( x > S ) { break ; } if ( x + K + K < S ) { continue ; } for ( int y = 0 ; y < = K ; y + + ) { if ( x + y = = S ) { count + + ; break ; } if ( x + y > S ) { break ; } if ( x + y + K < S ) { continue ; } count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( 0 < = S - x - y & & S - x - y < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . stream . IntStream ; import java . util . stream . Stream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BHinaArare solver = new BHinaArare ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BHinaArare { public void solve ( int testNumber , Scanner in , PrintWriter out ) { out . println ( IntStream . range ( 0 , in . nextInt ( ) ) . mapToObj ( x - > in . next ( ) ) . distinct ( ) . count ( ) = = 3 ? " Three " : " Four " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int count1 = 0 ; int count9 = 0 ; int count7 = 0 ; int count4 = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { int N = in . nextInt ( ) ; switch ( N ) { case 1 : count1 + + ; break ; case 9 : count9 + + ; break ; case 7 : count7 + + ; break ; case 4 : count4 + + ; break ; } } String str = " NO " ; if ( count1 = = 1 & & count9 = = 1 & & count7 = = 1 & & count4 = = 1 ) { str = " YES " ; } out . println ( str ) ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( sc . next ( ) ) ; } } int [ ] t = new int [ 6 ] ; t [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; t [ 1 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 0 ] ; t [ 2 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; t [ 3 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; t [ 4 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; t [ 5 ] = c [ 0 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 1 ] [ 2 ] ; String ans = " Yes " ; for ( int i = 1 ; i < 6 ; i + + ) { if ( t [ i ] ! = t [ 0 ] ) { ans = " No " ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new java . util . Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] p = new int [ n ] ; int a = 1 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = scan . nextInt ( ) ; } int min = p [ 0 ] ; for ( int i = 0 ; i < n - 1 ; i + + ) { if ( p [ i + 1 ] < = min & & p [ i ] > p [ i + 1 ] ) { min = p [ i + 1 ] ; a + + ; } } System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int a = sc . nextInt ( ) ; if ( min > = a ) { ans + + ; min = a ; } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . * ; public class Main { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; void solve ( ) throws IOException { int n = nextInt ( ) ; int x = nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = nextInt ( ) ; } long [ ] cost = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { int best = Integer . MAX _ VALUE ; for ( int j = 0 ; j < n ; j + + ) { int now = ( i + n - j ) % n ; best = Math . min ( best , a [ now ] ) ; cost [ j ] + = best ; } } long outp = Long . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { outp = Math . min ( outp , cost [ i ] + ( long ) i * x ) ; } out . println ( outp ) ; } Main ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) ; } String nextToken ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { eof = true ; return null ; } } return st . nextToken ( ) ; } String nextString ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { eof = true ; return null ; } } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . show ( m . solve ( ) ) ; sc . close ( ) ; } Scanner sc ; int [ ] list = new int [ 3 ] ; Main ( Scanner sc ) { this . sc = sc ; for ( int i = 0 ; i < 3 ; i + + ) { list [ i ] = sc . nextInt ( ) ; } } private String solve ( ) { String answer = " NO " ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( list [ i ] = = 5 ) { count5 + + ; } else if ( list [ i ] = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { answer = " YES " ; } return answer ; } public void show ( String answer ) { System . out . println ( answer ) ; } } import java . util . * ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 0 ; int max = 0 ; int ans = 0 ; if ( N = = 1 ) { System . out . println ( 1 ) ; return ; } for ( int i = 1 ; i < = N ; i + + ) { cnt = 0 ; int A = i ; while ( A % 2 = = 0 ) { A / = 2 ; cnt + + ; } if ( cnt > max ) { ans = i ; max = cnt ; } } System . out . println ( ans ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . stream . IntStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BSumOfThreeIntegers solver = new BSumOfThreeIntegers ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BSumOfThreeIntegers { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int k = in . nextInt ( ) , s = in . nextInt ( ) ; out . println ( IntStream . rangeClosed ( Math . max ( 0 , s - 2 * k ) , Math . min ( k , s ) ) . map ( x - > Math . min ( k , s - x ) - Math . max ( 0 , s - x - k ) + 1 ) . filter ( v - > v > 0 ) . sum ( ) ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( ( set . size ( ) = = 3 ) ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( i = = 0 ) { min = p [ i ] ; count + + ; } else if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 = 0 ; int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; int a2 = c [ 1 ] [ 0 ] - b1 ; int a3 = c [ 2 ] [ 0 ] - b1 ; if ( a2 + b2 = = c [ 1 ] [ 1 ] & & a2 + b3 = = c [ 1 ] [ 2 ] & & a3 + b2 = = c [ 2 ] [ 1 ] & & a3 + b3 = = c [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; long ok = Long . MAX _ VALUE / 3 ; long ng = 0 ; while ( ok - ng > 1 ) { long m = ( ok + ng ) / 2 ; if ( f ( m ) > X ) { ok = m ; } else { ng = m ; } } System . out . println ( ok - 1 ) ; } static int f ( long n ) { if ( n < = 2 ) return 0 ; return 1 + f ( ( n - 1 ) / 2 ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . io . File ; import java . io . IOException ; import java . lang . reflect . Array ; import java . util . * ; import java . util . Map . Entry ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; boolean ans = true ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = in . nextInt ( ) ; } } if ( ! ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ) ) ans = false ; if ( ! ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) ) ans = false ; if ( ! ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ) ) ans = false ; if ( ! ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) ) ans = false ; System . out . println ( ans ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n ; n = sc . nextInt ( ) ; if ( n > = 64 ) { System . out . println ( 64 ) ; } else if ( n > = 32 ) { System . out . println ( 32 ) ; } else if ( n > = 16 ) { System . out . println ( 16 ) ; } else if ( n > = 8 ) { System . out . println ( 8 ) ; } else if ( n > = 4 ) { System . out . println ( 4 ) ; } else if ( n = = 3 | | n = = 2 ) { System . out . println ( 2 ) ; } else if ( n = = 1 ) { System . out . println ( 1 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; int K = Integer . parseInt ( s [ 0 ] ) ; int S = Integer . parseInt ( s [ 1 ] ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( k < = K & & k > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . lang . reflect . Array ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) , ret = 0 ; for ( int i = 0 ; i < = k ; i + + ) for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - i - j & & s - i - j < = k ) ret + = 1 ; } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; long ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j > = 0 & & s - i - j < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int a , b , c ; int five = 0 ; int seven = 0 ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; c = scanner . nextInt ( ) ; if ( a = = 5 ) { five + + ; } else if ( a = = 7 ) { seven + + ; } if ( b = = 5 ) { five + + ; } else if ( b = = 7 ) { seven + + ; } if ( c = = 5 ) { five + + ; } else if ( c = = 7 ) { seven + + ; } if ( five = = 2 ) { if ( seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long p = sc . nextLong ( ) ; long maxRoot = ( long ) Math . ceil ( Math . pow ( p , 1.0 / n ) ) ; for ( long l = maxRoot ; l > 0 ; l -- ) { if ( p % ( long ) Math . pow ( l , n ) = = 0 ) { System . out . println ( l ) ; break ; } } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int ans = 64 ; while ( num < ans ) { ans / = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int na = scan . nextInt ( ) ; int [ ] nb = new int [ na ] ; int i = 0 ; for ( i = 0 ; i < na ; i + + ) { nb [ i ] = scan . nextInt ( ) ; } int sum = 0 ; int rul = 0 ; for ( i = 0 ; i < na ; i + + ) { if ( i = = 0 ) { sum = sum + 1 ; rul = nb [ i ] ; } else if ( rul > nb [ i ] ) { sum = sum + 1 ; rul = nb [ i ] ; } } System . out . println ( sum ) ; } } import java . util . * ; public class Main { static final double H _ SPEED = 2 * Math . PI / 720 ; static final double M _ SPEED = 2 * Math . PI / 60 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double res = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( ( 60 * h + m ) * H _ SPEED - m * M _ SPEED ) ) ; System . out . println ( res ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { private static int N ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; for ( int a = 1 ; a < = 3500 ; a + + ) { for ( int b = 1 ; b < = 3500 ; b + + ) { double tmp = 4.0 / N - 1.0 / a - 1.0 / b ; if ( tmp < = 0 ) continue ; if ( isInt ( 1.0 / tmp ) ) { int c = ( int ) ( 1.0 / tmp ) ; System . out . println ( a + " " + b + " " + c ) ; return ; } } } } private static boolean isInt ( double a ) { return ( Math . abs ( a - ( int ) a ) < 0.00000001 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int standard = 1 ; while ( true ) { int target = standard * 2 ; if ( target < = n ) { standard = target ; } else { break ; } } System . out . println ( standard ) ; } } public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = s . nextInt ( ) ; int max = a [ 0 ] ; int min = a [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < = max & & a [ i ] < min ) { count + + ; min = a [ i ] ; } else { max = a [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; boolean ch = true ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; out : for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] < = k ) ch = true ; else { ch = false ; break out ; } } } if ( ch = = true ) System . out . print ( " Yay ! " ) ; else System . out . print ( " : ( " ) ; } } 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 [ ] sa = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( sa [ 0 ] ) ; long x = Integer . parseInt ( sa [ 1 ] ) ; sa = br . readLine ( ) . split ( " " ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sa [ i ] ) ; } br . close ( ) ; int [ ] mins = new int [ n ] ; System . arraycopy ( a , 0 , mins , 0 , n ) ; long ans = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { mins [ i ] = Math . min ( mins [ i ] , a [ minus ( i , k , n ) ] ) ; sum + = mins [ i ] ; } ans = Math . min ( ans , sum + k * x ) ; } System . out . println ( ans ) ; } static int minus ( int a , int b , int n ) { int c = a - b ; if ( c < 0 ) { c + = n ; } return c ; } static int plus ( int a , int b , int n ) { int c = a + b ; if ( c > = n ) { c - = n ; } return c ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int H = scan . nextInt ( ) ; int R = scan . nextInt ( ) ; int t ; t = H + R ; if ( t = = 0 ) { System . out . println ( 0 ) ; } else if ( t > 0 ) { System . out . println ( 1 ) ; } else if ( t < 0 ) { System . out . println ( - 1 ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . lang . reflect . Array ; import java . util . * ; public class Main { static FastReader in ; static StringBuilder out ; public static double dist ( int x1 , int b , double angle ) { double x2 = b * Math . cos ( angle ) , y2 = b * Math . sin ( angle ) ; return Math . sqrt ( Math . pow ( ( x2 - x1 ) , 2 ) + y2 * y2 ) ; } public static void main ( String [ ] args ) { in = new FastReader ( ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) , h = in . nextInt ( ) , m = in . nextInt ( ) ; double minAn = 2 * Math . PI / 60 ; minAn = minAn * ( m % 60 ) ; double houAn = 2 * Math . PI / 720 ; houAn = houAn * ( ( ( h * 60 ) + m ) % 720 ) ; System . out . println ( dist ( a , b , Math . abs ( houAn - minAn ) ) ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . * ; public class Main { static void bubbleSort ( int [ ] arr ) { int n = arr . length ; int temp = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 1 ; j < ( n - i ) ; j + + ) { if ( arr [ j - 1 ] > arr [ j ] ) { temp = arr [ j - 1 ] ; arr [ j - 1 ] = arr [ j ] ; arr [ j ] = temp ; } } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; arr [ 0 ] = sc . nextInt ( ) ; arr [ 1 ] = sc . nextInt ( ) ; arr [ 2 ] = sc . nextInt ( ) ; bubbleSort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = N ; 0 < i ; i -- ) { for ( int j = 0 ; j < N ; j + + ) { if ( i = = Math . pow ( 2 , j ) ) { System . out . println ( i ) ; return ; } } } } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = Integer . parseInt ( scanner . nextLine ( ) ) ; String line = scanner . nextLine ( ) ; String [ ] split = line . split ( " " ) ; List < Integer > intList = new ArrayList < Integer > ( ) ; for ( String s : split ) { intList . add ( Integer . parseInt ( s ) ) ; } int cnt = 1 ; int min = intList . get ( 0 ) ; for ( int i = 1 ; i < intList . size ( ) ; i + + ) { int target = intList . get ( i ) ; if ( target < = min ) { cnt + + ; min = target ; } } int result = cnt ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int tmp = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; if ( tmp > p [ i ] ) { tmp = p [ i ] ; count + + ; } } System . out . println ( count ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } boolean s = true ; for ( int i = 0 ; i < 6 ; i + + ) { for ( int j = i ; j < 6 ; j + + ) { if ( a [ 5 ] < Math . abs ( a [ i ] - a [ j ] ) ) { s = false ; break ; } } } System . out . println ( ( s ) ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; set . add ( s ) ; } char target = ' Y ' ; if ( set . contains ( String . valueOf ( target ) ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF _ 8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } Main ( BufferedReader in ) throws IOException { String [ ] tokens = in . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( tokens [ 0 ] ) ; int B = Integer . parseInt ( tokens [ 1 ] ) ; int H = Integer . parseInt ( tokens [ 2 ] ) ; int M = Integer . parseInt ( tokens [ 3 ] ) ; int totalMin = 60 * H + M ; double hourRatio = ( double ) totalMin / ( double ) ( 12 * 60 ) ; double hourX = ( double ) A * Math . sin ( 2 . * Math . PI * hourRatio ) ; double hourY = ( double ) A * Math . cos ( 2 . * Math . PI * hourRatio ) ; double minuteRatio = ( double ) M / ( double ) 60 ; double minuteX = ( double ) B * Math . sin ( 2 . * Math . PI * minuteRatio ) ; double minuteY = ( double ) B * Math . cos ( 2 . * Math . PI * minuteRatio ) ; double distance = Math . sqrt ( Math . pow ( hourX - minuteX , 2.0 ) + Math . pow ( hourY - minuteY , 2.0 ) ) ; System . out . println ( distance ) ; } void calc ( ) { } void showResult ( ) { } } import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < = 100 ; i + + ) { b [ 0 ] = i ; a [ 0 ] = c [ 0 ] [ 0 ] - i ; a [ 1 ] = c [ 1 ] [ 0 ] - i ; a [ 2 ] = c [ 2 ] [ 0 ] - i ; b [ 1 ] = c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] + i ; b [ 2 ] = c [ 0 ] [ 2 ] - c [ 0 ] [ 0 ] + i ; int d = 0 ; for ( int j = 1 ; j < = 2 ; j + + ) { for ( int k = 1 ; k < = 2 ; k + + ) { if ( a [ j ] + b [ k ] ! = c [ j ] [ k ] ) d + + ; } } if ( d = = 0 ) { out . println ( " Yes " ) ; break ; } else if ( i = = 100 ) out . println ( " No " ) ; } } } import java . util . * ; import javax . lang . model . util . ElementScanner6 ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] word = new int [ 3 ] ; word [ 0 ] = sc . nextInt ( ) ; word [ 1 ] = sc . nextInt ( ) ; word [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( word ) ; String out ; if ( word [ 0 ] = = 5 & & word [ 1 ] = = 5 & & word [ 2 ] = = 7 ) { out = " YES " ; } else { out = " NO " ; } System . out . println ( out ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 1 ; while ( true ) { if ( i > N ) { break ; } i * = 2 ; } if ( i = = 1 ) { System . out . println ( " 1 " ) ; } else System . out . println ( i / 2 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; String answer = " Yay ! " ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antennas [ j ] - antennas [ i ] > k ) { answer = " : ( " ; } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( ( int ) ( Math . pow ( 2 , ( int ) ( Math . log10 ( n ) / Math . log10 ( 2 ) ) ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; if ( S . contains ( " 1 " ) & & S . contains ( " 9 " ) & & S . contains ( " 7 " ) & & S . contains ( " 4 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; ArrayList < Integer > p = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { p . add ( scanner . nextInt ( ) ) ; } int count = 0 ; int min = Collections . max ( p ) ; for ( int i = 0 ; i < n ; i + + ) { if ( p . get ( i ) < = min ) { min = p . get ( i ) ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; String p = " P " ; String w = " W " ; String g = " G " ; String y = " Y " ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( p . equals ( s [ i ] ) ) { count + + ; p = " " ; } if ( w . equals ( s [ i ] ) ) { count + + ; w = " " ; } if ( g . equals ( s [ i ] ) ) { count + + ; g = " " ; } if ( y . equals ( s [ i ] ) ) { count + + ; y = " " ; } } switch ( count ) { case 1 : System . out . println ( " One " ) ; break ; case 2 : System . out . println ( " Two " ) ; break ; case 3 : System . out . println ( " Three " ) ; break ; case 4 : System . out . println ( " Four " ) ; break ; default : break ; } } } import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; sum + = a [ i ] ; } int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; sum - = b [ i ] ; } if ( sum < 0 ) { System . out . println ( - 1 ) ; return ; } int d [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { d [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( d ) ; int i , ii ; long diff = 0 ; for ( i = 0 ; i < n ; i + + ) { if ( d [ i ] > = 0 ) break ; diff + = d [ i ] ; } for ( ii = n - 1 ; ii > = 0 ; ii -- ) { if ( diff > = 0 ) break ; diff + = d [ ii ] ; } System . out . println ( i + ( n - 1 - ii ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long gap = 0 ; long sum = 0 ; int n = 0 ; for ( int i = 0 ; i < N ; i + + ) { long Ai = scn . nextLong ( ) ; A [ i ] = Ai ; sum + = Ai ; } for ( int i = 0 ; i < N ; i + + ) { long Bi = scn . nextLong ( ) ; B [ i ] = Bi ; sum - = Bi ; if ( Bi > A [ i ] ) { gap + = Bi - A [ i ] ; n + + ; } C [ i ] = A [ i ] - B [ i ] ; } if ( sum > = 0 ) { Arrays . sort ( C ) ; for ( int i = C . length - 1 ; i > = 0 ; i -- ) { if ( gap < = 0 ) { break ; } gap - = C [ i ] ; n + + ; } } else { n = - 1 ; } System . out . println ( n ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = ( s - x - y ) & & ( s - x - y ) < = k ) { count + = 1 ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x5 = 0 ; int x7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int x = sc . nextInt ( ) ; if ( x = = 5 ) x5 + + ; else if ( x = = 7 ) x7 + + ; else System . out . println ( " NO " ) ; } if ( x5 = = 2 & & x7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int D = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int [ ] T = new int [ D ] ; for ( int i = 0 ; i < D ; + + i ) { T [ i ] = sc . nextInt ( ) ; } int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] C = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { A [ i ] = sc . nextInt ( ) ; B [ i ] = sc . nextInt ( ) ; C [ i ] = sc . nextInt ( ) ; } int [ ] [ ] dp = new int [ D ] [ N ] ; for ( int [ ] a : dp ) { Arrays . fill ( a , - 1 ) ; } for ( int i = 0 ; i < N ; + + i ) { if ( A [ i ] < = T [ 0 ] & & T [ 0 ] < = B [ i ] ) dp [ 0 ] [ i ] = 0 ; } for ( int i = 1 ; i < D ; + + i ) { for ( int j = 0 ; j < N ; + + j ) { if ( A [ j ] < = T [ i ] & & T [ i ] < = B [ j ] ) { for ( int k = 0 ; k < N ; + + k ) { if ( dp [ i - 1 ] [ k ] < 0 ) continue ; dp [ i ] [ j ] = Math . max ( dp [ i ] [ j ] , dp [ i - 1 ] [ k ] + Math . abs ( C [ j ] - C [ k ] ) ) ; } } } } int ans = 0 ; for ( int i = 0 ; i < N ; + + i ) { ans = Math . max ( ans , dp [ D - 1 ] [ i ] ) ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; int k ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int Z = S - i - j ; if ( Z > = 0 & & Z < = K ) { ans + + ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antenna = new int [ 5 ] ; boolean can = true ; for ( int i = 0 ; i < 5 ; i + + ) { antenna [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { int distance = antenna [ j ] - antenna [ i ] ; if ( distance > k ) { can = false ; break ; } } } if ( can ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; class Point { int x ; int y ; int z ; Point ( int a , int b , int c ) { this . x = a ; this . y = b ; this . z = c ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = sc . nextInt ( ) ; } } sc . close ( ) ; int [ ] [ ] V = new int [ 3 ] [ 3 ] ; V [ 0 ] [ 0 ] = 0 ; V [ 1 ] [ 0 ] = 0 ; V [ 2 ] [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( j > 0 ) { V [ i ] [ j ] = C [ i ] [ j ] - C [ i ] [ j - 1 ] ; } } } if ( V [ 0 ] [ 0 ] = = V [ 1 ] [ 0 ] & & V [ 1 ] [ 0 ] = = V [ 2 ] [ 0 ] ) { if ( V [ 0 ] [ 1 ] = = V [ 1 ] [ 1 ] & & V [ 1 ] [ 1 ] = = V [ 2 ] [ 1 ] ) { if ( V [ 0 ] [ 2 ] = = V [ 1 ] [ 2 ] & & V [ 1 ] [ 2 ] = = V [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] list = new int [ 5 ] ; Scanner sc = new Scanner ( System . in ) ; list [ 0 ] = sc . nextInt ( ) ; list [ 1 ] = sc . nextInt ( ) ; list [ 2 ] = sc . nextInt ( ) ; list [ 3 ] = sc . nextInt ( ) ; list [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String result = " Yay ! " ; boolean error = false ; for ( int i = 0 ; i < list . length ; i + + ) { for ( int j = i + 1 ; j < list . length ; j + + ) { if ( list [ j ] - list [ i ] > k ) { result = " : ( " ; error = true ; break ; } } if ( error ) break ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int sum = scanner . nextInt ( ) ; int count = 0 ; int i = 0 , j = 0 , k = 0 ; for ( i = 0 ; i < = n ; i + + ) { for ( j = 0 ; j < = n ; j + + ) { for ( k = 0 ; k < = n ; k + + ) { if ( i + j + k < = sum ) { k = Math . min ( n , sum - i - j ) ; if ( i + j + k < = sum ) { j = Math . min ( n , sum - i - k ) ; if ( i + j + k < = sum ) { i = Math . min ( n , sum - j - k ) ; } } } else { break ; } if ( ( i + j + k ) = = sum ) count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n = = 1 ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } int count = 0 ; int tmpCount = 0 ; int outputNum = 0 ; for ( int i = n ; i > 0 ; i -- ) { if ( i % 2 = = 0 ) { int tmp = i ; while ( true ) { if ( tmp % 2 = = 0 ) { tmp / = 2 ; tmpCount + + ; } else { break ; } } if ( count < tmpCount ) { outputNum = i ; count = tmpCount ; } } tmpCount = 0 ; } System . out . println ( outputNum ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { long x , kk , ans ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; long [ ] [ ] dp = new long [ n + 500 ] [ n + 500 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 9000000000000000000L ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { dp [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = i - k ; if ( pi < = 0 ) pi = n + pi ; if ( dp [ i ] [ k - 1 ] > = a [ pi ] ) dp [ i ] [ k ] = a [ pi ] ; else dp [ i ] [ k ] = dp [ i ] [ k - 1 ] ; } } long sum = 0 ; for ( int k = 0 ; k < n ; k + + ) { sum = 0 ; for ( int i = 1 ; i < = n ; i + + ) { sum + = dp [ i ] [ k ] ; } if ( sum + k * x < ans ) ans = sum + k * x ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer Haiku [ ] = new Integer [ 3 ] ; int sum = 0 ; for ( int i = 0 ; i < Haiku . length ; i + + ) { Haiku [ i ] = scanner . nextInt ( ) ; sum + = Haiku [ i ] ; } String ans = " NO " ; if ( sum = = 17 & & Arrays . asList ( Haiku ) . contains ( 5 ) & & Arrays . asList ( Haiku ) . contains ( 7 ) ) { ans = " YES " ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int K2 = K * 2 ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { if ( K2 + X > = S ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int sxy = S - X - Y ; if ( 0 < = sxy & & sxy < = K ) { count + + ; } } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; boolean check = true ; if ( N > = 2 ) { while ( N > 0 ) { ans + + ; N = N / 2 ; } } else { check = false ; } if ( check = = false ) { System . out . println ( N ) ; } else { System . out . println ( ( int ) Math . pow ( 2 , ( ans - 1 ) ) ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . UncheckedIOException ; import java . util . Arrays ; import java . util . StringTokenizer ; class Main { public static void main ( String [ ] args ) { SC sc = new SC ( System . in ) ; int [ ] unko = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { unko [ i ] = sc . nextInt ( ) ; } Arrays . sort ( unko ) ; if ( unko [ 0 ] = = 1 & & unko [ 1 ] = = 4 & & unko [ 2 ] = = 7 & & unko [ 3 ] = = 9 ) { pl ( " YES " ) ; } else { pl ( " NO " ) ; } } public static void pl ( Object o ) { System . out . println ( o ) ; } public static void pl ( ) { System . out . println ( ) ; } public static void p ( Object o ) { System . out . print ( o ) ; } static class SC { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public SC ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { 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 ( ) ; } long ans = A [ 0 ] - 1 ; int max = 2 ; for ( int i = 1 ; i < N ; i + + ) { if ( A [ i ] = = max ) max + + ; else if ( A [ i ] > max ) { ans + = ( A [ i ] - 1 ) / max ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int z = sc . nextInt ( ) ; if ( x = = 5 & & y = = 7 & & z = = 5 ) { System . out . println ( " YES " ) ; } else if ( x = = 5 & & y = = 5 & & z = = 7 ) { System . out . println ( " YES " ) ; } else if ( x = = 7 & & y = = 5 & & z = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) { count + = 1 ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int k = scanner . nextInt ( ) , s = scanner . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = Math . max ( 0 , s - x - k ) ; y < = Math . min ( k , s - x ) ; y + + ) { int z = s - x - y ; if ( ( z > = 0 ) & & ( z < = k ) ) { count + + ; } } } System . out . println ( count ) ; } } } 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 [ ] inp = br . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( inp [ 0 ] ) ; int b = Integer . parseInt ( inp [ 1 ] ) ; int c = Integer . parseInt ( inp [ 2 ] ) ; if ( a < 5 | | a > 7 | | b < 5 | | b > 7 | | c < 5 | | c > 7 ) { System . out . println ( " NO " ) ; } else if ( ( a + b + c ) = = 17 ) { if ( a ! = 6 & & b ! = 6 & & c ! = 6 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = Math . abs ( Math . max ( Math . max ( a , b ) , c ) - Math . min ( Math . min ( a , b ) , c ) ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long k = 1 ; k < = 3500 ; k + + ) { if ( 4 * h * k - n * ( h + k ) = = 0 ) { continue ; } if ( n * h * k % ( 4 * h * k - n * ( h + k ) ) ! = 0 ) { continue ; } long w = n * h * k / ( 4 * h * k - n * ( h + k ) ) ; if ( w < = 0 ) { continue ; } System . out . printf ( " % d % d % d % n " , h , k , w ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scn = new Scanner ( System . in ) ) { int A = scn . nextInt ( ) ; int B = scn . nextInt ( ) ; int H = scn . nextInt ( ) ; int M = scn . nextInt ( ) ; double longAngle = M * 6 ; double shortAngle = H * ( 360 / 12 ) + M * 0.5 ; double angle = 0 ; if ( longAngle < shortAngle ) { longAngle = 360 + longAngle ; angle = longAngle - shortAngle ; } else { angle = longAngle - shortAngle ; } System . out . println ( Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int ans = a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ; System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . File ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static final long MOD = ( long ) 1e9 + 7 ; static final int MAX = ( int ) 1e5 + 1 ; public static void main ( String [ ] args ) throws IOException { MyScanner sc = new MyScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; long [ ] fact = new long [ MAX ] ; fact [ 0 ] = fact [ 1 ] = 1 ; for ( int i = 2 ; i < MAX ; i + + ) fact [ i ] = ( i * fact [ i - 1 ] ) % MOD ; if ( n = = m ) out . println ( ( ( ( fact [ n ] * fact [ m ] ) % MOD ) < < 1 ) % MOD ) ; else if ( n + 1 = = m | | n - 1 = = m ) out . println ( ( fact [ n ] * fact [ m ] ) % MOD ) ; else out . println ( 0 ) ; out . flush ( ) ; out . close ( ) ; } static class MyScanner { StringTokenizer st ; BufferedReader br ; public MyScanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public MyScanner ( String file ) throws IOException { br = new BufferedReader ( new FileReader ( new File ( file ) ) ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; boolean G = false , W = false , P = false , Y = false ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " G " ) & & ! G ) { G = true ; ans + + ; } if ( s . equals ( " P " ) & & ! P ) { P = true ; ans + + ; } if ( s . equals ( " W " ) & & ! W ) { W = true ; ans + + ; } if ( s . equals ( " Y " ) & & ! Y ) { Y = true ; ans + + ; } } if ( ans = = 3 ) System . out . println ( " Three " ) ; else if ( ans = = 4 ) System . out . println ( " Four " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > num = new ArrayList < Integer > ( ) ; ArrayList < String > param = new ArrayList < String > ( ) ; while ( sc . hasNext ( ) ) { if ( sc . hasNextInt ( ) ) { num . add ( sc . nextInt ( ) ) ; } else { param . add ( sc . nextLine ( ) ) ; } } Method ( num , param ) ; } static void Method ( ArrayList < Integer > num , ArrayList < String > param ) { int count = 0 ; if ( num . get ( 0 ) = = 7 ) count + = 7 ; if ( num . get ( 0 ) = = 5 ) count + = 5 ; if ( num . get ( 1 ) = = 7 ) count + = 7 ; if ( num . get ( 1 ) = = 5 ) count + = 5 ; if ( num . get ( 2 ) = = 7 ) count + = 7 ; if ( num . get ( 2 ) = = 5 ) count + = 5 ; if ( count = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ret = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ret + + ; } } } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; int c = input . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ansi = 1 ; int ans = 0 ; int tmp = 0 ; int X = 0 ; for ( int i = 1 ; i < N + 1 ; i + + ) { tmp = 0 ; X = i ; for ( ; X % 2 = = 0 ; ) { tmp + + ; X = X / 2 ; } if ( tmp > ans ) { ans = tmp ; ansi = i ; } } System . out . println ( ansi ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = n ; i * = 2 ) if ( n < i * 2 ) System . out . println ( i ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String [ ] strs = sc . nextLine ( ) . split ( " " ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { list . add ( Integer . parseInt ( strs [ i ] ) ) ; } Collections . sort ( list ) ; if ( list . get ( 0 ) = = 1 & & list . get ( 1 ) = = 4 & & list . get ( 2 ) = = 7 & & list . get ( 3 ) = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; double A = s . nextDouble ( ) ; double B = s . nextDouble ( ) ; double H = s . nextDouble ( ) ; double M = s . nextDouble ( ) ; double Atheta = ( ( 60 * H + M ) / 360 ) * Math . PI ; double Btheta = ( M / 30 ) * Math . PI ; double deltaA = Math . pow ( ( A * ( Math . cos ( Atheta ) ) - B * ( Math . cos ( Btheta ) ) ) , 2 ) ; double deltaB = Math . pow ( ( A * ( Math . sin ( Atheta ) ) - B * ( Math . sin ( Btheta ) ) ) , 2 ) ; System . out . println ( Math . sqrt ( deltaA + deltaB ) ) ; } } import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; m . run ( ) ; } Scanner sc = new Scanner ( System . in ) ; void run ( ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } PriorityQueue < Integer > pq = new PriorityQueue < Integer > ( ) ; long loss = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < b [ i ] ) { ans + + ; loss + = b [ i ] - a [ i ] ; } else { pq . add ( b [ i ] - a [ i ] ) ; } } if ( ans = = 0 ) { System . out . println ( 0 ) ; return ; } for ( ; ! pq . isEmpty ( ) ; ) { ans + + ; loss + = pq . poll ( ) ; if ( loss < = 0 ) { System . out . println ( ans ) ; return ; } } System . out . println ( - 1 ) ; } } 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 ) ; BHinaArare solver = new BHinaArare ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BHinaArare { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; boolean four = false ; for ( int i = 0 ; i < n ; i + + ) { char c = in . next ( ) . charAt ( 0 ) ; if ( c = = ' Y ' ) four = true ; } out . println ( four ? " Four " : " Three " ) ; } } 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 . * ; public class Main { public static void main ( String [ ] args ) { int k , s , l , cnt = 0 ; Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { l = s - ( i + j ) ; if ( l > = 0 & & l < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int ans = 1000 ; ans = Math . min ( ans , Math . abs ( a1 - a2 ) + Math . abs ( a1 - a3 ) ) ; ans = Math . min ( ans , Math . abs ( a2 - a1 ) + Math . abs ( a2 - a3 ) ) ; ans = Math . min ( ans , Math . abs ( a3 - a1 ) + Math . abs ( a3 - a2 ) ) ; System . out . println ( ans ) ; } } import java . util . stream . IntStream ; import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int [ ] a = IntStream . range ( 0 , 3 ) . map ( i - > Integer . parseInt ( sc . next ( ) ) ) . sorted ( ) . toArray ( ) ; int ans = 0 ; for ( int i = 1 ; i > = 0 ; i -- ) { ans + = ( int ) Math . abs ( a [ i ] - a [ i + 1 ] ) ; } out . println ( ans ) ; out . flush ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int sum1 = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; int sum2 = c [ 2 ] [ 0 ] + c [ 0 ] [ 1 ] + c [ 1 ] [ 2 ] ; int sum3 = c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] + c [ 0 ] [ 2 ] ; if ( sum1 = = sum2 & & sum2 = = sum3 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] a _ str = in . readLine ( ) . split ( " " ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = Integer . parseInt ( a _ str [ 0 ] ) ; a [ 1 ] = Integer . parseInt ( a _ str [ 1 ] ) ; a [ 2 ] = Integer . parseInt ( a _ str [ 2 ] ) ; int min = Math . min ( Math . min ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; int sum = a [ 0 ] + a [ 1 ] + a [ 2 ] ; int max = Math . max ( Math . max ( a [ 0 ] , a [ 1 ] ) , a [ 2 ] ) ; System . out . println ( max - ( sum - min - max ) + ( sum - min - max ) - min ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . List ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) throws Exception { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; List < String > inputNumbers = Arrays . asList ( br . readLine ( ) . split ( " " ) ) ; List < Integer > numbers = new ArrayList < > ( ) ; for ( String inputNumber : inputNumbers ) { numbers . add ( Integer . parseInt ( inputNumber ) ) ; } numbers . sort ( ( i1 , i2 ) - > i1 - i2 ) ; int firstCost = numbers . get ( 1 ) - numbers . get ( 0 ) ; int secondCost = numbers . get ( 2 ) - numbers . get ( 1 ) ; int sumCost = firstCost + secondCost ; System . out . println ( sumCost ) ; } catch ( IOException | NumberFormatException e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TripletSum solver = new TripletSum ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TripletSum { public void solve ( int testNumber , FastReader fs , PrintWriter pw ) { int k = fs . nextInt ( ) , Sum = fs . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int p = Sum - i - j ; if ( p < 0 | | p > k ) continue ; ans + = 1 ; } } pw . println ( ans ) ; } } static class FastReader { BufferedReader bf ; StringTokenizer st ; public FastReader ( InputStream is ) { bf = new BufferedReader ( new InputStreamReader ( is ) ) ; st = null ; } public String next ( ) { try { while ( st = = null | | ! st . hasMoreTokens ( ) ) { String line = bf . readLine ( ) ; if ( line = = null ) return null ; st = new StringTokenizer ( line ) ; } } catch ( Exception e ) { } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String x = " NO " ; if ( a = = 5 ) { if ( ( b = = 5 ) & & ( c = = 7 ) ) { x = " YES " ; } else if ( ( b = = 7 ) & & ( c = = 5 ) ) { x = " YES " ; } } else if ( a = = 7 ) { if ( ( b = = 5 ) & & ( c = = 5 ) ) { x = " YES " ; } } System . out . println ( x ) ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int map [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int h = 0 ; h < 3 ; h + + ) { for ( int w = 0 ; w < 3 ; w + + ) { map [ h ] [ w ] = sc . nextInt ( ) ; } } int dw1 = map [ 0 ] [ 1 ] - map [ 0 ] [ 0 ] ; if ( dw1 ! = map [ 1 ] [ 1 ] - map [ 1 ] [ 0 ] | | dw1 ! = map [ 2 ] [ 1 ] - map [ 2 ] [ 0 ] ) { answer ( false ) ; return ; } int dw2 = map [ 0 ] [ 2 ] - map [ 0 ] [ 1 ] ; if ( dw2 ! = map [ 1 ] [ 2 ] - map [ 1 ] [ 1 ] | | dw2 ! = map [ 2 ] [ 2 ] - map [ 2 ] [ 1 ] ) { answer ( false ) ; return ; } int dh1 = map [ 1 ] [ 0 ] - map [ 0 ] [ 0 ] ; if ( dh1 ! = map [ 1 ] [ 1 ] - map [ 0 ] [ 1 ] | | dh1 ! = map [ 1 ] [ 2 ] - map [ 0 ] [ 2 ] ) { answer ( false ) ; return ; } int dh2 = map [ 2 ] [ 0 ] - map [ 1 ] [ 0 ] ; if ( dh2 ! = map [ 2 ] [ 1 ] - map [ 1 ] [ 1 ] | | dh2 ! = map [ 2 ] [ 2 ] - map [ 1 ] [ 2 ] ) { answer ( false ) ; return ; } answer ( true ) ; } private static void answer ( boolean ans ) { if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; if ( n [ 0 ] = = 1 & & n [ 1 ] = = 4 & & n [ 2 ] = = 7 & & n [ 3 ] = = 9 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int N = reader . nextInt ( ) ; int ans = 1 ; while ( N / 2 > 0 ) { ans * = 2 ; N / = 2 ; } System . out . println ( ans ) ; reader . close ( ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double hour = 2 * Math . PI * ( H / 12.0 + M / 60.0 / 12.0 ) ; double min = 2 * Math . PI * M / 60.0 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( hour - min ) ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] S = sc . nextLine ( ) . split ( " " ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( S [ i ] . equals ( " 5 " ) ) { count5 + + ; } else if ( S [ i ] . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( ( s - ( x + y ) ) > = 0 & & ( s - ( x + y ) ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } 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 ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] sa = br . readLine ( ) . split ( " " ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sa [ i ] ) ; } br . close ( ) ; int ans = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { ans + + ; min = p [ i ] ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) , ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int num = s - i - j ; if ( 0 < = num & & num < = k ) ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double hdeg = h / 12 * 360 + ( m / 60 ) * 30 ; double mdeg = m / 60 * 360 ; double deg = Math . min ( Math . abs ( hdeg - mdeg ) , Math . abs ( 360 - ( hdeg - mdeg ) ) ) ; double ans = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( deg ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int number [ ] = new int [ n ] ; int mini = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) number [ i ] = scan . nextInt ( ) ; scan . close ( ) ; for ( int j = 0 ; j < n ; j + + ) { mini = Math . min ( mini , number [ j ] ) ; if ( mini > = number [ j ] ) count + + ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double l = ( h / 6 + m / 360 ) ; double s = ( m / 30 ) ; double kakudo = Math . abs ( s - l ) * Math . PI ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( kakudo ) ) ; System . out . println ( ans ) ; } } 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 ) ) ; int line = Integer . parseInt ( br . readLine ( ) ) ; if ( line = = 1 ) { System . out . println ( line ) ; } else { int x = 1 ; for ( ; x < = line ; ) { x = x * 2 ; } x = x / 2 ; System . out . println ( x ) ; } } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { private static boolean debug = false ; private static boolean elapsed = false ; private static PrintWriter _ out = new PrintWriter ( System . out ) ; private static PrintWriter _ err = new PrintWriter ( System . err ) ; private void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; int max = - 1 ; int maxNum = - 1 ; for ( int i = 1 ; i < = n ; + + i ) { int ct = 0 ; int j = i ; while ( j % 2 = = 0 ) { + + ct ; j / = 2 ; } if ( ct > max ) { max = ct ; maxNum = i ; } } _ out . println ( maxNum ) ; } private static BigInteger C ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } for ( long i = r ; i > 1 ; -- i ) { res = res . divide ( BigInteger . valueOf ( i ) ) ; } return res ; } private static BigInteger P ( long n , long r ) { BigInteger res = BigInteger . ONE ; for ( long i = n ; i > n - r ; -- i ) { res = res . multiply ( BigInteger . valueOf ( i ) ) ; } return res ; } public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _ out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _ err . println ( ( G - S ) + " ms " ) ; } _ err . flush ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d , e , k , temp ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; d = sc . nextInt ( ) ; e = sc . nextInt ( ) ; k = sc . nextInt ( ) ; if ( a - b > 0 ) { temp = a ; a = b ; b = temp ; } if ( a - c > 0 ) { temp = a ; a = b ; b = temp ; } if ( a - d > 0 ) { temp = a ; a = b ; b = temp ; } if ( a - e > 0 ) { temp = a ; a = b ; b = temp ; } if ( e - b < 0 ) { temp = e ; e = b ; b = temp ; } if ( e - c < 0 ) { temp = e ; e = b ; b = temp ; } if ( e - d < 0 ) { temp = e ; e = b ; b = temp ; } if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a < = k & & c - a < = k & & d - a < = k & & e - a < = k & & c - b < = k & & d - b < = k & & e - b < = k & & d - c < = k & & e - c < = k & & e - d < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int max = 999999 ; int tmp ; int c = 0 ; for ( int i = 0 ; i < n ; i + + ) { tmp = sc . nextInt ( ) ; if ( tmp < max ) { max = tmp ; c + + ; } } System . out . println ( c ) ; return ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = a [ 1 ] & & a [ 0 ] = = 5 & & a [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { static int gcd ( int a , int b ) { return b > 0 ? gcd ( b , a % b ) : a ; } static int mod = 998244353 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double Arad = H + ( double ) M / 60 ; double Brad = ( double ) M ; double Ax = A * Math . cos ( Math . toRadians ( 90 - Arad * 30 ) ) ; double Ay = A * Math . sin ( Math . toRadians ( 90 - Arad * 30 ) ) ; double Bx = B * Math . cos ( Math . toRadians ( 90 - Brad * 6 ) ) ; double By = B * Math . sin ( Math . toRadians ( 90 - Brad * 6 ) ) ; System . out . println ( Math . sqrt ( ( Bx - Ax ) * ( Bx - Ax ) + ( By - Ay ) * ( By - Ay ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < = 8 ; i + + ) { if ( Math . pow ( 2 , i ) < = N & & N < Math . pow ( 2 , i + 1 ) ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } } } } import java . util . Arrays ; import java . util . Scanner ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( Arrays . stream ( scanner . nextLine ( ) . split ( " " ) ) . sorted ( ) . collect ( Collectors . toList ( ) ) . equals ( Arrays . asList ( " 5 " , " 5 " , " 7 " ) ) ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 1 ; int ans = 1 ; while ( true ) { if ( n < num ) { break ; } else { ans = num ; num * = 2 ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int minNum = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int maxNum = sc . nextInt ( ) ; int limit = sc . nextInt ( ) ; String ans ; if ( maxNum - minNum > limit ) { ans = " : ( " ; } else { ans = " Yay ! " ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int con = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int item = sc . nextInt ( ) ; if ( min > item ) { min = item ; } if ( min > = item ) { con + + ; } } System . out . println ( con ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z < = K & & Z > = 0 ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; scanner . close ( ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { Integer bar [ ] = { 1 , 9 , 7 , 4 } ; int in _ bar [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { in _ bar [ i ] = sc . nextInt ( ) ; } int ok _ count = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = 0 ; j < 4 ; j + + ) { if ( bar [ i ] = = in _ bar [ j ] ) { ok _ count + + ; break ; } } } if ( ok _ count = = 4 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . charset . StandardCharsets ; import java . util . * ; public class Main { int [ ] inputArray ; public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int input = sc . nextInt ( ) ; int n = 1 ; while ( true ) { if ( n > input ) { n / = 2 ; break ; } n * = 2 ; } if ( input = = 1 ) System . out . println ( 1 ) ; else System . out . println ( n ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int hour = scan . nextInt ( ) ; int minute = scan . nextInt ( ) ; double rad = Math . PI * 2 * ( ( double ) hour / 12.0 + ( ( double ) minute / 60.0 ) / 12.0 - ( double ) minute / 60.0 ) ; double len = ( double ) ( b * b + a * a ) - ( double ) ( 2 * b * a ) * Math . cos ( rad ) ; System . out . printf ( " % .20f " , Math . sqrt ( len ) ) ; scan . close ( ) ; } } 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 ( ) ; ArrayList < Integer > numList = new ArrayList < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { numList . add ( sc . nextInt ( ) ) ; } int min = numList . get ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { if ( numList . get ( i ) < min ) { min = numList . get ( i ) ; } if ( numList . get ( i ) < = min ) { ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . HashMap ; import java . util . ArrayList ; import java . util . Scanner ; import java . util . regex . Pattern ; public class Main { public static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) throws Exception { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) , x = sc . nextLong ( ) ; long [ ] a = new long [ ( int ) N ] ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = sc . nextLong ( ) ; } long ans = 1L < < 60 ; long [ ] amemo = new long [ ( int ) N ] ; for ( int i = 0 ; i < N ; i + + ) { amemo [ i ] = 1L < < 60 ; } for ( long i = 0 ; i < N ; i + + ) { long memo = i * x ; for ( long j = 0 ; j < N ; j + + ) { amemo [ ( int ) j ] = Math . min ( amemo [ ( int ) j ] , a [ ( int ) ( ( j - i + N ) % N ) ] ) ; memo + = amemo [ ( int ) j ] ; } ans = Math . min ( ans , memo ) ; } 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 ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . * ; import java . math . * ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K & & S - i > = 0 ; i + + ) { int sum = S - i ; if ( sum < = K ) { count + = sum + 1 ; } else { int dif = Math . max ( 0 , 2 * K - sum + 1 ) ; count + = dif ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double hd = ( 60 * h + m ) * 0.5 ; double md = m * 6 ; double r = 0.000000000 ; if ( hd < md ) { r = md - hd ; if ( r > 180 ) { r = 360 - r ; } double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( r * Math . PI / 180 ) ) ; System . out . println ( ans ) ; } else if ( hd > md ) { r = hd - md ; if ( r > 180 ) { r = 360 - r ; } double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( r * Math . PI / 180 ) ) ; System . out . println ( ans ) ; } else { System . out . println ( Math . abs ( a - b ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveA ( ) ; } private void solveA ( ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( sc . nextInt ( ) ) { case 5 : five + + ; break ; case 7 : seven + + ; break ; default : } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( sc . next ( ) ) ; } } for ( int i = 0 ; i < = c [ 0 ] [ 0 ] ; i + + ) { int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; if ( c [ 1 ] [ 0 ] - b1 ! = c [ 1 ] [ 1 ] - b2 | | c [ 1 ] [ 1 ] - b2 ! = c [ 1 ] [ 2 ] - b3 ) { continue ; } if ( c [ 2 ] [ 0 ] - b1 ! = c [ 2 ] [ 1 ] - b2 | | c [ 2 ] [ 1 ] - b2 ! = c [ 2 ] [ 2 ] - b3 ) { continue ; } System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] P = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextLong ( ) ; } long min = Long . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < P . length ; i + + ) { if ( min > P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] pos = new int [ 5 ] ; int k ; String result ; for ( int i = 0 ; i < 5 ; i + + ) pos [ i ] = sc . nextInt ( ) ; k = sc . nextInt ( ) ; if ( pos [ 4 ] - pos [ 0 ] < = k ) result = " Yay ! " ; else result = " : ( " ; System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int c [ ] = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; + + i ) c [ i ] = scan . nextInt ( ) ; for ( int i = 0 ; i < 2 ; + + i ) { int d = c [ i * 3 ] - c [ ( i + 1 ) * 3 ] ; for ( int j = 0 ; j < 3 ; + + j ) { if ( c [ i * 3 + j ] - c [ ( i + 1 ) * 3 + j ] ! = d ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 , max = 0 , ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { cnt = 0 ; int num = i ; while ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } if ( max < cnt ) { ans = i ; max = cnt ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Integer > set = new TreeSet < > ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { set . add ( sc . nextInt ( ) ) ; } if ( set . contains ( 1 ) & & set . contains ( 9 ) & & set . contains ( 7 ) & & set . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N ] ; int C [ ] = new int [ N ] ; long sum _ A = 0 ; long sum _ B = 0 ; for ( int n = 0 ; n < N ; n + + ) { A [ n ] = sc . nextInt ( ) ; sum _ A + = A [ n ] ; } for ( int n = 0 ; n < N ; n + + ) { B [ n ] = sc . nextInt ( ) ; sum _ B + = B [ n ] ; C [ n ] = A [ n ] - B [ n ] ; } Arrays . sort ( C ) ; if ( sum _ A < sum _ B ) { System . out . println ( - 1 ) ; return ; } int arg = 0 ; long sum _ minus = 0 ; for ( int c : C ) { if ( c < 0 ) { sum _ minus + = Math . abs ( c ) ; arg + + ; } else { break ; } } if ( sum _ minus = = 0 ) { System . out . println ( 0 ) ; return ; } int tmp = 0 ; for ( int n = C . length - 1 ; n > 0 ; n -- ) { sum _ minus - = C [ n ] ; tmp + + ; if ( sum _ minus < = 0 ) { break ; } } System . out . println ( tmp + arg ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 0 ; int num = 1 ; while ( num < = N ) { i + + ; num * = 2 ; } i -- ; System . out . println ( ( 1 < < i ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( f - a > k ? " : ( " : " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( A = = 5 ) { five + + ; } else if ( A = = 7 ) { seven + + ; } if ( B = = 5 ) { five + + ; } else if ( B = = 7 ) { seven + + ; } if ( C = = 5 ) { five + + ; } else if ( C = = 7 ) { seven + + ; } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; boolean solved = false ; for ( long n = 1 ; n < 3501 ; n + + ) { if ( solved ) break ; for ( long w = 1 ; w < 3501 ; w + + ) { if ( solved ) break ; long denominator = 4 * n * w - N * n - N * w ; if ( denominator = = 0 ) continue ; long numerator = N * n * w ; if ( denominator > 0 & & numerator % denominator = = 0 ) { long h = numerator / denominator ; System . out . print ( h ) ; System . out . print ( " " ) ; System . out . print ( n ) ; System . out . print ( " " ) ; System . out . print ( w ) ; System . out . println ( " " ) ; solved = true ; } } } } } import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a , b , c ; a = s . nextInt ( ) ; b = s . nextInt ( ) ; c = s . nextInt ( ) ; int fiv = 0 , sev = 0 ; if ( a = = 5 ) fiv + + ; if ( a = = 7 ) sev + + ; if ( b = = 5 ) fiv + + ; if ( b = = 7 ) sev + + ; if ( c = = 5 ) fiv + + ; if ( c = = 7 ) sev + + ; if ( fiv = = 2 & & sev = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . FileNotFoundException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { new Main ( ) . run ( ) ; } final long MODULO = 1 _ 000 _ 000 _ 000 + 7 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( int h = 1 ; h < = 3500 ; + + h ) { for ( int w = 1 ; w < = 3500 ; + + w ) { if ( 4 * h * w - N * w - N * h > 0 & & N * h * w % ( 4 * h * w - N * w - N * h ) = = 0 ) { long n = N * h * w / ( 4 * h * w - N * w - N * h ) ; System . out . println ( h + " " + w + " " + n ) ; return ; } } } } void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } public void solve ( ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int [ ] d = new int [ 11 ] ; d [ scan . nextInt ( ) ] + = 1 ; d [ scan . nextInt ( ) ] + = 1 ; d [ scan . nextInt ( ) ] + = 1 ; boolean answer = false ; if ( d [ 5 ] = = 2 & & d [ 7 ] = = 1 ) { answer = true ; } System . out . println ( answer ? " YES " : " NO " ) ; } } import java . util . Scanner ; class Main { static int breakNumber ( int n ) { if ( n % 2 = = 0 ) { int tmp = n ; int count = 0 ; while ( tmp > 0 ) { if ( tmp / 2 = = 1 ) { + + count ; break ; } tmp / = 2 ; + + count ; } return count ; } return 0 ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 2 ; i < = N ; i + + ) ans = Math . max ( ans , breakNumber ( i ) ) ; System . out . println ( ( int ) Math . pow ( 2 , ans ) ) ; } } import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String args [ ] ) { try ( Scanner sc = new Scanner ( System . in ) ) { sc . nextInt ( ) ; sc . nextLine ( ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; Set < String > set = new HashSet < > ( Arrays . asList ( s ) ) ; System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] data = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { data [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( data [ i ] - data [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } int betwen = sc . nextInt ( ) ; int max = n [ 0 ] ; int min = n [ 0 ] ; for ( int i : n ) { if ( max < i ) { max = i ; } if ( min > i ) { min = i ; } } if ( max - min < = betwen ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int min = n + 1 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int next = scan . nextInt ( ) ; if ( min > next ) { min = next ; ans + + ; } } System . out . println ( ans ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; boolean hasYellow = false ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { hasYellow = true ; break ; } } System . out . println ( hasYellow ? " Four " : " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int h = in . nextInt ( ) ; int m = in . nextInt ( ) ; double h _ ang = ( h * 30 ) + ( m * 0.5 ) ; double m _ ang = m * 6 ; double tmp = 0 ; if ( h > m ) { tmp = h _ ang - m _ ang ; } else { tmp = m _ ang - h _ ang ; } if ( tmp > 180 ) { tmp - = 360 ; } double cos = Math . cos ( Math . toRadians ( tmp ) ) ; double result = ( a * a ) + ( b * b ) - ( 2 * a * b * cos ) ; System . out . println ( Math . sqrt ( result ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - i - j & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( scanner . next ( ) ) ; } if ( set . size ( ) = = 3 ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] in = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { in [ i ] = sc . nextInt ( ) ; } Arrays . sort ( in ) ; if ( in [ 0 ] = = 5 & & in [ 1 ] = = 5 & & in [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 1 , low = arr [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i ] < low ) { sum + + ; low = arr [ i ] ; } } out . println ( sum ) ; out . close ( ) ; } 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 . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; scanner . close ( ) ; int [ ] bunsetsu = new int [ 3 ] ; bunsetsu [ 0 ] = A ; bunsetsu [ 1 ] = B ; bunsetsu [ 2 ] = C ; Arrays . sort ( bunsetsu ) ; if ( bunsetsu [ 0 ] ! = 5 | | bunsetsu [ 1 ] ! = 5 | | bunsetsu [ 2 ] ! = 7 ) { System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int a = stdin . nextInt ( ) ; int b = stdin . nextInt ( ) ; int c = stdin . nextInt ( ) ; int [ ] d = IntStream . of ( a , b , c ) . sorted ( ) . toArray ( ) ; if ( d [ 0 ] = = 5 & & d [ 1 ] = = 5 & & d [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int i = 1 ; i < = 3 ; i + + ) { for ( int j = 1 ; j < = 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int a1 = 0 ; int b1 = c [ 1 ] [ 1 ] - a1 ; int b2 = c [ 1 ] [ 2 ] - a1 ; int b3 = c [ 1 ] [ 3 ] - a1 ; boolean ans = c [ 2 ] [ 1 ] - b1 = = c [ 2 ] [ 2 ] - b2 & & c [ 2 ] [ 2 ] - b2 = = c [ 2 ] [ 3 ] - b3 & & c [ 3 ] [ 1 ] - b1 = = c [ 3 ] [ 2 ] - b2 & & c [ 3 ] [ 2 ] - b2 = = c [ 3 ] [ 3 ] - b3 ; System . out . println ( ans ? " Yes " : " No " ) ; } } import java . util . * ; import java . io . * ; class Main { void solve ( ) { int [ ] a = inintar ( 3 ) ; Arrays . sort ( a ) ; out . println ( a [ 2 ] - a [ 0 ] ) ; } public static Scanner in = new Scanner ( System . in ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } public int inint ( ) { return in . nextInt ( ) ; } public String instr ( ) { return in . next ( ) ; } public int [ ] inintar ( int num ) { int [ ] a = new int [ num ] ; for ( int i = 0 ; i < num ; i + + ) { a [ i ] = in . nextInt ( ) ; } return a ; } public char [ ] incharar ( ) { return in . next ( ) . toCharArray ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = 200000 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int current = sc . nextInt ( ) ; if ( min > = current ) { count + + ; min = current ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { new Main ( ) . exec ( sc ) ; } } public void exec ( Scanner sc ) { String s = " 575 " ; s = s . replaceFirst ( sc . next ( ) , " " ) ; s = s . replaceFirst ( sc . next ( ) , " " ) ; s = s . replaceFirst ( sc . next ( ) , " " ) ; System . out . println ( s . length ( ) = = 0 ? " YES " : " NO " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > all = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 9 ; i + + ) { all . add ( sc . nextInt ( ) ) ; } boolean takahashi = true ; Integer diff1 = all . get ( 3 ) - all . get ( 0 ) ; Integer diff2 = all . get ( 4 ) - all . get ( 1 ) ; Integer diff3 = all . get ( 5 ) - all . get ( 2 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } if ( takahashi ) { diff1 = all . get ( 6 ) - all . get ( 3 ) ; diff2 = all . get ( 7 ) - all . get ( 4 ) ; diff3 = all . get ( 8 ) - all . get ( 5 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } } if ( takahashi ) { diff1 = all . get ( 1 ) - all . get ( 0 ) ; diff2 = all . get ( 4 ) - all . get ( 3 ) ; diff3 = all . get ( 7 ) - all . get ( 6 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } } if ( takahashi ) { diff1 = all . get ( 2 ) - all . get ( 1 ) ; diff2 = all . get ( 5 ) - all . get ( 4 ) ; diff3 = all . get ( 8 ) - all . get ( 7 ) ; if ( diff1 ! = diff2 ) { takahashi = false ; } else if ( diff1 ! = diff3 ) { takahashi = false ; } } if ( takahashi ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] line = br . readLine ( ) . split ( " " ) ; Arrays . sort ( line ) ; int A = Integer . parseInt ( line [ 0 ] ) ; int B = Integer . parseInt ( line [ 1 ] ) ; int C = Integer . parseInt ( line [ 2 ] ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String s = in . nextLine ( ) ; StringTokenizer st = new StringTokenizer ( s ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; a + + ; int original = ( b + 2 ) * ( b + 1 ) / 2 ; if ( b > = a ) { original - = ( b - a + 2 ) * ( b - a + 1 ) * 3 / 2 ; } if ( b > = 2 * a ) { original + = ( b - 2 * a + 2 ) * ( b - 2 * a + 1 ) * 3 / 2 ; } System . out . println ( original ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( sc . nextInt ( ) * sc . nextInt ( ) * sc . nextInt ( ) = = 175 ? " YES " : " NO " ) ; } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { resolve ( System . in , System . out ) ; } static void resolve ( InputStream is , PrintStream pw ) { Scanner sc = new Scanner ( is ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int min = p [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int pi = p [ i ] ; if ( pi < = min ) { count + + ; } min = Math . min ( min , pi ) ; } pw . println ( count ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; list . add ( d ) ; Collections . sort ( list ) ; if ( list . get ( 0 ) = = 1 & & list . get ( 1 ) = = 4 & & list . get ( 2 ) = = 7 & & list . get ( 3 ) = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; abc168 _ c solver = new abc168 _ c ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class abc168 _ c { public void solve ( int testNumber , Scanner fin , PrintWriter fout ) { double a = fin . nextInt ( ) ; double b = fin . nextInt ( ) ; double h = fin . nextInt ( ) ; double m = fin . nextInt ( ) ; double minAng = ( m * 6.0 ) ; double hrAng = ( h * 30.0 + minAng / 12.0 ) ; double diffAngl = Math . abs ( hrAng - minAng ) ; fout . println ( Math . sqrt ( ( a * a + b * b - 2 * a * b * Math . cos ( ( Math . toRadians ( diffAngl ) ) ) ) ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int f = 0 ; int s = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int str = sc . nextInt ( ) ; if ( str = = 5 ) { f + + ; } else if ( str = = 7 ) { s + + ; } } if ( s = = 1 & & f = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import static java . lang . Math . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int result = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { int now = sc . nextInt ( ) ; if ( min > now ) { result + + ; min = now ; } } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { private static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int K = Integer . parseInt ( scan . next ( ) ) ; int S = Integer . parseInt ( scan . next ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { int XY = S - i ; if ( XY < 0 ) break ; if ( XY < = 2 * K ) { for ( int j = 0 ; j < = K ; j + + ) { int X = XY - j ; if ( X < 0 ) break ; if ( X < = K ) count + + ; } } } System . out . println ( count ) ; scan . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a , b , c , d , e , k ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; c = in . nextInt ( ) ; d = in . nextInt ( ) ; e = in . nextInt ( ) ; k = in . nextInt ( ) ; if ( e - a > k ) { out . println ( " : ( " ) ; } else { out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int tmp = 1 ; if ( n = = tmp ) { System . out . println ( " 1 " ) ; } else { while ( tmp < = n ) { tmp * = 2 ; } System . out . println ( tmp / 2 ) ; } } } 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 ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int A = in . Int ( ) ; int B = in . Int ( ) ; int H = in . Int ( ) ; int M = in . Int ( ) ; double hr = Math . toRadians ( H * 30.0 + M * 0.5 ) ; double mr = Math . toRadians ( M * 6.0 ) ; double hx = A * Math . sin ( hr ) ; double hy = A * Math . cos ( hr ) ; double mx = B * Math . sin ( mr ) ; double my = B * Math . cos ( mr ) ; double dx = hx - mx ; double dy = hy - my ; double ans = Math . sqrt ( dx * dx + dy * dy ) ; out . printf ( " % .14f " , ans ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl = = null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long t1 = sc . nextLong ( ) ; long t2 = sc . nextLong ( ) ; long a1 = sc . nextLong ( ) ; long a2 = sc . nextLong ( ) ; long b1 = sc . nextLong ( ) ; long b2 = sc . nextLong ( ) ; long c1 = a1 - b1 ; long c2 = a2 - b2 ; long total = c1 * t1 + c2 * t2 ; long mid = c1 * t1 ; if ( total = = 0 ) { System . out . println ( " infinity " ) ; } else if ( ( total > 0 & & mid > 0 ) | | ( total < 0 & & mid < 0 ) ) { System . out . println ( 0 ) ; } else if ( mid % total = = 0 ) { System . out . println ( - mid / total * 2 ) ; } else { System . out . println ( - mid / total * 2 + 1 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i ! = a + 1 ; i + + ) { for ( int j = 0 ; j ! = a + 1 ; j + + ) { if ( b - i - j > = 0 & & b - i - j < = a ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Comparator ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String str = reader . readLine ( ) ; String s [ ] = str . split ( " " ) ; int h = Integer . parseInt ( s [ 0 ] ) ; int r = Integer . parseInt ( s [ 1 ] ) ; int top = h + r ; int bottom = h - r ; if ( top < 0 ) { System . out . println ( " -1 " ) ; } else if ( top = = 0 ) { System . out . println ( " 0 " ) ; } else if ( top > 0 ) { System . out . println ( " 1 " ) ; } reader . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int count = 0 ; int x = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { x = Math . min ( x , a [ i ] ) ; if ( x = = a [ i ] ) { count + + ; } } System . out . println ( count ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double h = 360 / 12 * H + 0.5 * M ; double m = 6 * M ; double kaku = h - m ; if ( kaku > 180 ) { kaku = 360 - kaku ; } mat ( A , B , Math . abs ( kaku ) ) ; } public static void mat ( double A , double B , double shita ) { double kakudo = Math . toRadians ( shita ) ; double ans = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( kakudo ) ; double Ans = Math . sqrt ( ans ) ; System . out . println ( Ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int a = 0 , b = 0 ; if ( A = = 5 ) { a + + ; } else if ( A = = 7 ) { b + + ; } if ( B = = 5 ) { a + + ; } else if ( B = = 7 ) { b + + ; } if ( C = = 5 ) { a + + ; } else if ( C = = 7 ) { b + + ; } if ( a = = 2 & & b = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String args [ ] ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean f = false ; for ( int i = 0 ; i < a . length ; i + + ) { for ( int j = i ; j < a . length ; j + + ) { if ( Math . abs ( a [ i ] - a [ j ] ) > k ) { f = true ; } } } if ( f ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { private static BufferedReader br ; private static StringTokenizer tokenizer ; private static void solve ( ) throws IOException { int n = nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = nextInt ( ) ; } int min = arr [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , arr [ i ] ) ; if ( min > = arr [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; solve ( ) ; } public static String next ( ) throws IOException { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { String line = br . readLine ( ) ; if ( line = = null ) throw new IOException ( ) ; tokenizer = new StringTokenizer ( line ) ; } return tokenizer . nextToken ( ) ; } public static int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public static long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } public static double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } } import java . util . Arrays ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Integer > remaining = new HashSet < > ( Arrays . asList ( 1 , 9 , 7 , 4 ) ) ; for ( int i = 0 ; i < 4 ; i + + ) { int a = sc . nextInt ( ) ; if ( remaining . contains ( a ) ) { remaining . remove ( a ) ; } } System . out . println ( remaining . isEmpty ( ) ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { scanner . nextLine ( ) ; System . out . println ( scanner . nextLine ( ) . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean flag = false ; String arare [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arare [ i ] = sc . next ( ) ; } for ( int k = 0 ; k < arare . length ; k + + ) { if ( arare [ k ] . equals ( " Y " ) ) { flag = true ; } } if ( flag ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; int min = 101 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 3 ; i + + ) { int total = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { if ( i ! = j ) total + = Math . abs ( a [ i ] - a [ j ] ) ; } if ( total < min ) min = total ; } System . out . println ( min ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long point [ ] = new long [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { point [ i ] = sc . nextLong ( ) ; } System . out . println ( point [ 4 ] - point [ 0 ] > sc . nextLong ( ) ? " : ( " : " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int out = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) out + + ; } } System . out . println ( out ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; a [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) b [ i ] = c [ 0 ] [ i ] - a [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = c [ i ] [ 0 ] - b [ 0 ] ; boolean good = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) good = false ; } } System . out . println ( good ? " Yes " : " No " ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ ] ; for ( int i = 0 ; i < 3 ; i + + ) arr [ i ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) arr [ i ] [ j ] = scan . nextInt ( ) ; } int [ ] diff = new int [ 9 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) diff [ i * 3 + j ] = arr [ i ] [ j ] - arr [ i ] [ ( j + 1 ) % 3 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { if ( diff [ i ] ! = diff [ i + 3 ] | | diff [ i + 3 ] ! = diff [ i + 6 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner stdin = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ ] ; for ( int i = 0 ; i < 3 ; i + + ) { c [ i ] = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdin . nextInt ( ) ; } } String result = " No " ; int a2 = c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] ; int a3 = c [ 2 ] [ 0 ] - c [ 0 ] [ 0 ] ; if ( ( c [ 1 ] [ 1 ] = = ( a2 + c [ 0 ] [ 1 ] ) ) & & ( c [ 1 ] [ 2 ] = = ( a2 + c [ 0 ] [ 2 ] ) ) & & ( c [ 2 ] [ 1 ] = = ( a3 + c [ 0 ] [ 1 ] ) ) & & ( c [ 2 ] [ 2 ] = = ( a3 + c [ 0 ] [ 2 ] ) ) ) { result = " Yes " ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = s . nextInt ( ) ; } int c1 = 0 ; int c2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( a [ i ] = = 5 ) { c1 + = 1 ; } if ( a [ i ] = = 7 ) { c2 + = 1 ; } } if ( c1 = = 2 & & c2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . equals ( " 5 7 5 " ) | | s . equals ( " 7 5 5 " ) | | s . equals ( " 5 5 7 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { static int k , s ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; long count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { if ( x > s ) { continue ; } for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { + + count ; } } } System . out . println ( count ) ; } } import java . io . * ; import java . util . * ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int n = sc . nextInt ( ) ; if ( n = = 1 ) { pr . println ( 1 ) ; } else { int p2 = 2 ; while ( p2 * 2 < = n ) { p2 * = 2 ; } pr . println ( p2 ) ; } } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } private static class Printer extends PrintWriter { Printer ( PrintStream out ) { super ( out ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; int n = sca . nextInt ( ) ; int [ ] pi = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { pi [ i ] = sca . nextInt ( ) ; } int ans = 0 ; int min = 300000 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > pi [ i ] ) { min = pi [ i ] ; ans + + ; } else { } } System . out . println ( ans ) ; sca . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import static java . math . BigDecimal . ROUND _ HALF _ UP ; public class Main { private static int MOD = 1000000007 ; public static void main ( String [ ] args ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; int [ ] abhm = readIntegers ( br ) ; int a = abhm [ 0 ] ; int b = abhm [ 1 ] ; int h = abhm [ 2 ] ; int m = abhm [ 3 ] ; double tan = ( h * 30 ) + ( 0.5 * m ) ; double tyou = m * 6 ; double kakudo = tyou - tan ; double rad = Math . toRadians ( kakudo ) ; double a _ sq = ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( rad ) ) ; System . out . println ( Math . sqrt ( a _ sq ) ) ; } private static int readInteger ( BufferedReader br ) throws IOException { return Integer . parseInt ( br . readLine ( ) ) ; } private static int [ ] readIntegers ( BufferedReader br ) throws IOException { String [ ] s = br . readLine ( ) . split ( " " ) ; int [ ] ret = new int [ s . length ] ; for ( int i = 0 ; i < s . length ; i + + ) { ret [ i ] = Integer . parseInt ( s [ i ] ) ; } return ret ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int max = Math . max ( b - a , c - a ) ; max = Math . max ( max , d - a ) ; max = Math . max ( max , e - a ) ; max = Math . max ( max , c - b ) ; max = Math . max ( max , d - b ) ; max = Math . max ( max , e - b ) ; max = Math . max ( max , d - c ) ; max = Math . max ( max , e - c ) ; max = Math . max ( max , e - d ) ; if ( max < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; import java . io . * ; import static java . lang . System . in ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; long ans = 2 ; for ( int i = 0 ; i < X ; i + + ) { ans = 2 * ans + 2 ; } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { long t1 , t2 , a1 , a2 , b1 , b2 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; t1 = sc . nextLong ( ) ; t2 = sc . nextLong ( ) ; a1 = sc . nextLong ( ) ; a2 = sc . nextLong ( ) ; b1 = sc . nextLong ( ) ; b2 = sc . nextLong ( ) ; if ( t1 * a1 + t2 * a2 = = t1 * b1 + t2 * b2 ) { System . out . println ( " infinity " ) ; return ; } if ( t1 * a1 < t1 * b1 & & t1 * a1 + t2 * a2 < t1 * b1 + t2 * b2 ) { System . out . println ( 0 ) ; return ; } if ( t1 * b1 < t1 * a1 & & t1 * b1 + t2 * b2 < t1 * a1 + t2 * a2 ) { System . out . println ( 0 ) ; return ; } long d = Math . abs ( t1 * a1 + t2 * a2 - t1 * b1 - t2 * b2 ) ; debug ( d , t1 * a1 , t1 * b1 , t1 * a1 + t2 * a2 , t1 * b1 + t2 * b2 ) ; long d2 = Math . abs ( t2 * a2 - t2 * b2 ) ; long d1 = Math . abs ( t1 * a1 - t1 * b1 ) ; debug ( d , d1 , d2 , t1 * a1 , t1 * b1 , t1 * a1 + t2 * a2 , t1 * b1 + t2 * b2 ) ; long cnt = 2 * ( d1 / d ) + 1 ; if ( d1 % d = = 0 ) cnt -- ; System . out . println ( cnt ) ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . io . * ; public class Main { final static long MOD = 1000000007 ; public static String [ ] Ws = null ; public static int wsIndx = 0 ; public static BufferedReader in = null ; public static void main ( String [ ] args ) throws Exception { int N = nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans = ans * 2 ; } System . out . println ( ans / 2 ) ; } public static void check ( ) throws Exception { if ( in = = null ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } if ( Ws = = null | | Ws . length < = wsIndx ) { Ws = in . readLine ( ) . split ( " " ) ; wsIndx = 0 ; } } public static int nextInt ( ) throws Exception { check ( ) ; return Integer . parseInt ( Ws [ wsIndx + + ] ) ; } public static long nextLong ( ) throws Exception { check ( ) ; return Long . parseLong ( Ws [ wsIndx + + ] ) ; } public static String nextString ( ) throws Exception { check ( ) ; return Ws [ wsIndx + + ] ; } public static int [ ] nextInts ( ) throws Exception { check ( ) ; int [ ] tmp = new int [ Ws . length ] ; for ( int i = 0 ; i < tmp . length ; i + + ) { tmp [ i ] = Integer . parseInt ( Ws [ i ] ) ; } wsIndx = Ws . length ; return tmp ; } public static long [ ] nextLongs ( ) throws Exception { check ( ) ; long [ ] tmp = new long [ Ws . length ] ; for ( int i = 0 ; i < tmp . length ; i + + ) { tmp [ i ] = Long . parseLong ( Ws [ i ] ) ; } wsIndx = Ws . length ; return tmp ; } public static String [ ] nextStrings ( ) throws Exception { check ( ) ; wsIndx = Ws . length ; return Ws ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N = = 1 ) { System . out . println ( " 1 " ) ; sc . close ( ) ; return ; } int max2 = 1 ; while ( max2 < N ) { max2 * = 2 ; } max2 / = 2 ; int count = 1 ; while ( max2 < = N ) { max2 * = count ; count + + ; } max2 / = -- count ; System . out . println ( max2 ) ; sc . close ( ) ; } } import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { int c [ ] [ ] = new int [ 3 ] [ 3 ] ; boolean F = false ; for ( int i = 0 ; i < 3 ; + + i ) { for ( int j = 0 ; j < 3 ; + + j ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int a1 = 0 ; a1 < = 100 & & ! F ; a1 + + ) { for ( int a2 = 0 ; a2 < = 100 & & ! F ; a2 + + ) { for ( int a3 = 0 ; a3 < = 100 & & ! F ; a3 + + ) { int b1 = c [ 0 ] [ 0 ] - a1 , b2 = c [ 0 ] [ 1 ] - a1 , b3 = c [ 0 ] [ 2 ] - a1 ; boolean L2 , L3 ; L2 = ( c [ 1 ] [ 0 ] = = a2 + b1 & & c [ 1 ] [ 1 ] = = a2 + b2 & & c [ 1 ] [ 2 ] = = a2 + b3 ) ; L3 = ( c [ 2 ] [ 0 ] = = a3 + b1 & & c [ 2 ] [ 1 ] = = a3 + b2 & & c [ 2 ] [ 2 ] = = a3 + b3 ) ; F = L2 & & L3 ; } } } System . out . println ( F ? " Yes " : " No " ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long N = input . nextLong ( ) ; boolean found = false ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long Num = N * h * w ; long Den = 4 * h * w - N * w - N * h ; if ( Den > 0 & & Num % Den = = 0 ) { long ans = Num / Den ; System . out . println ( h + " " + ans + " " + w ) ; found = true ; break ; } } if ( found ) break ; } } } import java . io . * ; import java . util . * ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String nyuA = sc . nextLine ( ) ; int n = Integer . parseInt ( nyuA ) ; int max = 0 ; int res = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int temp = i ; int count = 0 ; while ( true ) { if ( temp % 2 ! = 0 ) { if ( count > max ) { max = count ; res = i ; } break ; } temp / = 2 ; count + + ; } } if ( res = = 0 ) res = 1 ; System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int n4 = sc . nextInt ( ) ; List < Integer > list = new ArrayList < Integer > ( ) ; list . add ( n1 ) ; list . add ( n2 ) ; list . add ( n3 ) ; list . add ( n4 ) ; if ( list . contains ( 1 ) ) { if ( list . contains ( 9 ) ) { if ( list . contains ( 7 ) ) { if ( list . contains ( 4 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = scan . nextInt ( ) ; a [ 1 ] = scan . nextInt ( ) ; a [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; scan . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int count = 0 ; int result = 0 ; int result _ count = 0 ; for ( int i = 1 ; i < = x ; i + + ) { count = 0 ; int now = i ; while ( now % 2 = = 0 ) { now = now / 2 ; count + + ; } if ( result _ count < = count ) { result _ count = count ; result = i ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String [ ] s = new String [ n ] ; Arrays . setAll ( s , i - > sc . next ( ) ) ; sc . close ( ) ; Set < String > set = new HashSet < > ( Arrays . asList ( s ) ) ; boolean judge = set . size ( ) = = 3 ; String result = judge ? " Three " : " Four " ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int num = 1 ; while ( num * 2 < = n ) { num = num * 2 ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int result = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { boolean isMacth = k > = s - ( x + y ) & & s - ( x + y ) > = 0 ; if ( isMacth ) { result + + ; } } } System . out . println ( result ) ; scanner . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { private static int countPower ( int n ) { int count = 0 ; while ( n % 2 = = 0 ) { + + count ; n / = 2 ; } return count ; } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int max = 0 ; for ( int i = 1 ; i < = n ; + + i ) { int count = countPower ( i ) ; if ( max < count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . util . Collections ; import java . util . HashMap ; import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int h = in . nextInt ( ) ; int m = in . nextInt ( ) ; double hh = ( double ) h / 12 * 360 ; double mm = ( double ) m / 60 * 360 ; hh + = ( double ) m / 60 * 30 ; double angle = Math . abs ( mm - hh ) ; if ( angle > 180.0 ) { angle = 360.0 - angle ; } double ans ; if ( angle = = 0.0 ) { ans = Math . abs ( b - a ) ; } else if ( angle = = 180.0 ) { ans = a + b ; } else { ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = 0 , e = 0 , f = 0 ; d = Math . abs ( a - b ) ; e = Math . abs ( c - b ) ; f = Math . abs ( a - c ) ; int aa = Math . max ( d , e ) ; System . out . println ( Math . max ( aa , f ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int P = 0 ; int Q = 0 ; for ( int X = 0 ; X < K + 1 ; X + + ) { for ( int Y = 0 ; Y < K + 1 ; Y + + ) { P = S - X - Y ; if ( 0 < = P & & P < = K ) { Q + + ; } } } System . out . println ( Q ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double res = 0 ; double kaku = Math . abs ( H * 30 + ( double ) M / 2 - M * 6 ) ; double rad = Math . toRadians ( kaku ) ; res = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( rad ) ) ; System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double deg = 0 ; deg = ( 30 * h ) + ( 0.5 * m ) - ( 6 * m ) ; double ans = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( Math . toRadians ( deg ) ) ) ) ; System . out . println ( ans ) ; scan . close ( ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { 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 Scanner s = new Scanner ( System . in ) ; static int getInt ( ) { return Integer . parseInt ( s . next ( ) ) ; } static long getLong ( ) { return Long . parseLong ( s . next ( ) ) ; } public static void main ( String [ ] $ ) { long N = getLong ( ) ; for ( long h = 0 ; h < = 3500 ; + + h ) { for ( long n = 0 ; n < = 3500 ; + + n ) { long Nhn = N * h * n ; long v = 4 * h * n - N * n - N * h ; if ( v > 0 & & Nhn % v = = 0 ) { System . out . println ( h + " " + n + " " + ( Nhn / v ) ) ; return ; } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { num [ i ] = Integer . parseInt ( sc . nextLine ( ) ) ; } if ( num [ 4 ] - num [ 0 ] < num [ 5 ] + 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : " + " ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] in = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) { in [ i ] = sc . nextInt ( ) ; } int b = 0 ; int c = in [ 0 ] ; for ( int i = 0 ; i < a ; i + + ) { c = Math . min ( c , in [ i ] ) ; if ( c > = in [ i ] ) { b + + ; } } System . out . println ( b ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Set < Character > set = new HashSet < Character > ( ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( sc . next ( ) . charAt ( 0 ) ) ; } sc . close ( ) ; if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double A = scan . nextInt ( ) ; double B = scan . nextInt ( ) ; double H = scan . nextInt ( ) ; double M = scan . nextInt ( ) ; double hour = 2 * Math . PI * ( ( H * 60 + M ) / ( 12 * 60 ) ) ; double min = 2 * Math . PI * ( M / 60 ) ; double theta = Math . abs ( hour - min ) ; double length = Math . sqrt ( B * B + A * A - 2 * A * B * Math . cos ( theta ) ) ; System . out . println ( length ) ; scan . close ( ) ; } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( InputReader in = new InputReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ) { new Main ( ) . solve ( in , out ) ; out . flush ( ) ; } } private void solve ( InputReader in , PrintWriter out ) { int min = in . nextInt ( ) ; in . nextInt ( ) ; in . nextInt ( ) ; in . nextInt ( ) ; int max = in . nextInt ( ) ; int k = in . nextInt ( ) ; out . println ( ( max - min ) > k ? " : ( " : " Yay ! " ) ; } } class InputReader implements AutoCloseable { private final Scanner sc = new Scanner ( System . in ) ; String next ( ) { return this . sc . next ( ) ; } int nextInt ( ) { return Integer . parseInt ( this . sc . next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( this . sc . next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( this . sc . next ( ) ) ; } @ Override public void close ( ) { this . sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = c [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = c [ i ] [ 0 ] - y [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int N = sc . nextInt ( ) ; int d = 0 ; if ( N = = 0 ) { System . out . println ( " 0 " ) ; return ; } for ( int i = 0 ; i < 7 ; i + + ) { d = ( int ) Math . pow ( 2 , i ) ; if ( N / d = = 1 ) { break ; } } System . out . println ( d ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 | | A = = 5 & & B = = 7 & & C = = 5 | | A = = 7 & & B = = 5 & & C = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { long n = sc . nextLong ( ) ; List < Long > an = new ArrayList < > ( ) ; for ( long i = 0 ; i < n ; i + + ) { an . add ( sc . nextLong ( ) ) ; } long result = 0 ; long min = Integer . MAX _ VALUE ; for ( long l : an ) { if ( min > l ) { result + + ; min = l ; } } System . out . println ( result ) ; } } static long lcm ( long a , long b ) { long temp ; long c = a ; c * = b ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return c / b ; } static long gcd ( long a , long b ) { long temp ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return b ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int r = 0 ; r < 3 ; r + + ) { for ( int c = 0 ; c < 3 ; c + + ) { C [ r ] [ c ] = in . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] a2 = new int [ 3 ] [ 3 ] ; a [ 0 ] = 0 ; for ( int c = 0 ; c < 3 ; c + + ) { b [ c ] = C [ 0 ] [ c ] - a [ 0 ] ; } for ( int r = 0 ; r < 3 ; r + + ) { for ( int c = 0 ; c < 3 ; c + + ) { a2 [ r ] [ c ] = C [ r ] [ c ] - b [ c ] ; } } for ( int r = 0 ; r < 3 ; r + + ) { for ( int c = 1 ; c < 3 ; c + + ) { if ( a2 [ r ] [ c - 1 ] ! = a2 [ r ] [ c ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int a ; int b ; int cnt = 0 ; for ( a = 0 ; a < = K ; a + + ) { int qw = K ; if ( S - a < qw ) { qw = S - a ; } for ( b = 0 ; b < = qw ; b + + ) { if ( S - a - b < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; int z = 0 , y = 0 , fin = 0 , a1 = 0 , a2 = 0 ; while ( z < 3 ) { while ( y < 3 ) { c [ z ] [ y ] = stdIn . nextInt ( ) ; y + + ; } y = 0 ; z + + ; } z = 1 ; a1 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; a2 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; while ( z < 3 ) { if ( c [ z ] [ 0 ] - c [ z ] [ 1 ] ! = a1 ) { fin = 1 ; break ; } if ( c [ z ] [ 1 ] - c [ z ] [ 2 ] ! = a2 ) { fin = 1 ; break ; } z + + ; } if ( fin = = 1 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) throws Exception { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) a [ i ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ? " YES " : " NO " ) ; } 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 stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int max = a ; int min = a ; if ( max < b ) { max = b ; } if ( min > b ) { min = b ; } if ( max < c ) { max = c ; } if ( min > c ) { min = c ; } System . out . println ( max - min ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] argv ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( str [ 0 ] ) ; int n = Integer . parseInt ( str [ 1 ] ) ; int x , y , cnt = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( ( 0 < = n - x - y ) & & ( n - x - y < = k ) ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { private static final int MOD = 1 _ 000 _ 000 _ 007 ; private static final String YES = " Yes " ; private static final String NO = " No " ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } System . out . println ( solve ( N , P ) ) ; } private static int solve ( int N , int [ ] P ) { int count = 0 ; int min = N + 1 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < min ) { min = P [ i ] ; count + + ; } } return count ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans * = 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = n + 1 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { min = p [ i ] ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( a * b * c = = 175 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int maxDis = sc . nextInt ( ) ; String res = " Yay ! " ; for ( int i = antena . length - 1 ; i > = 0 ; i -- ) { for ( int j = antena . length - 2 ; j > = 0 ; j -- ) { if ( antena [ i ] - antena [ j ] > maxDis ) { res = " : ( " ; } } } System . out . println ( res ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; if ( H = = 0 ) H = 12 ; double H2 = ( H * 60 + M ) * 0.5 ; double M2 = M * 6 ; if ( M2 = = 0 ) M2 = 360 ; double kakudo = 0 ; if ( M2 > H2 ) { kakudo = M2 - H2 ; } else { kakudo = H2 - M2 ; } kakudo = Math . min ( kakudo , 360 - kakudo ) ; double cos = Math . cos ( Math . toRadians ( kakudo ) ) ; double ans = Math . sqrt ( ( A * A ) + ( B * B ) - ( 2 * A * B * cos ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; return ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double turnA = ( ( H * 60 ) + M ) * 0.5 ; double turnB = M * 6.0 ; double d = Math . abs ( turnA - turnB ) ; double X = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * Math . cos ( Math . toRadians ( d ) ) ) ; X = Math . sqrt ( X ) ; System . out . println ( X ) ; } } import java . util . Scanner ; class Main { int [ ] abc ; Main ( int [ ] abc ) { this . abc = abc ; } String solve ( ) { final String YES = " YES " ; final String NO = " NO " ; int n5 = 0 ; int n7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( abc [ i ] = = 5 ) { n5 + + ; } else if ( abc [ i ] = = 7 ) { n7 + + ; } } if ( n5 = = 2 & & n7 = = 1 ) { return YES ; } else { return NO ; } } public static void main ( String args [ ] ) { int [ ] abc = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { abc [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; String greeting = new Main ( abc ) . solve ( ) ; System . out . println ( greeting ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int max = 0 ; int max _ num = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int tmp = i ; int count = 0 ; while ( true ) { if ( tmp % 2 = = 0 ) { count + + ; tmp / = 2 ; } else { break ; } } if ( count > max ) { max = count ; max _ num = i ; } } System . out . println ( max _ num ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( x + y < = s & & x + y + k > = s ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; N [ 0 ] = sc . nextInt ( ) ; N [ 1 ] = sc . nextInt ( ) ; N [ 2 ] = sc . nextInt ( ) ; N [ 3 ] = sc . nextInt ( ) ; boolean ans = solve ( N ) ; System . out . println ( ans ? " YES " : " NO " ) ; } private static boolean solve ( int [ ] N ) { Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 & & N [ 1 ] = = 4 & & N [ 2 ] = = 7 & & N [ 3 ] = = 9 ) { return true ; } return false ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 ; int a2 ; int a3 ; int HUNDRED = 100 ; boolean flag = false ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( a1 = 0 ; a1 < = HUNDRED & & ! flag ; a1 + + ) { int b1 = c [ 0 ] [ 0 ] - a1 ; int b2 = c [ 0 ] [ 1 ] - a1 ; int b3 = c [ 0 ] [ 2 ] - a1 ; for ( a2 = 0 ; a2 < = HUNDRED & & ! flag ; a2 + + ) { if ( c [ 1 ] [ 0 ] = = a2 + b1 & & c [ 1 ] [ 1 ] = = a2 + b2 & & c [ 1 ] [ 2 ] = = a2 + b3 ) { for ( a3 = 0 ; a3 < = HUNDRED & & ! flag ; a3 + + ) { if ( c [ 2 ] [ 0 ] = = a3 + b1 & & c [ 2 ] [ 1 ] = = a3 + b2 & & c [ 2 ] [ 2 ] = = a3 + b3 ) { flag = true ; } } } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; int [ ] test = new int [ 5 ] ; test [ 0 ] = sc1 . nextInt ( ) ; test [ 1 ] = sc1 . nextInt ( ) ; test [ 2 ] = sc1 . nextInt ( ) ; test [ 3 ] = sc1 . nextInt ( ) ; test [ 4 ] = sc1 . nextInt ( ) ; int k = sc1 . nextInt ( ) ; Arrays . sort ( test ) ; if ( test [ 4 ] - test [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } sc1 . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String input = s . nextLine ( ) ; int n = Integer . parseInt ( input ) ; int m = n ; int pow = 0 ; do { m / = 2 ; pow + + ; } while ( m > 1 ) ; int result = 1 ; if ( m = = 1 ) { for ( int i = 0 ; i < pow ; i + + ) { result * = 2 ; } } else { result = n ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] num = new int [ 3 ] ; num [ 0 ] = scan . nextInt ( ) ; num [ 1 ] = scan . nextInt ( ) ; num [ 2 ] = scan . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; for ( int number : num ) { if ( number = = 5 ) { count5 + = 1 ; } else if ( number = = 7 ) { count7 + = 1 ; } } String result ; if ( count5 = = 2 & & count7 = = 1 ) { result = " YES " ; } else { result = " NO " ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { ArrayList < Integer > array = new ArrayList < Integer > ( ) ; Scanner scan = new Scanner ( System . in ) ; int val1 = scan . nextInt ( ) ; int val2 = scan . nextInt ( ) ; int val3 = scan . nextInt ( ) ; array . add ( val1 ) ; array . add ( val2 ) ; array . add ( val3 ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < array . size ( ) ; i + + ) { if ( array . get ( i ) = = 5 ) { five + + ; } if ( array . get ( i ) = = 7 ) { seven + + ; } else { } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int seki = a * b * c ; if ( seki = = ( 5 * 7 * 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; int K = Integer . parseInt ( line [ 0 ] ) ; int S = Integer . parseInt ( line [ 1 ] ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int target = S - x - y ; if ( target > = 0 & & target < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { private static final Scanner SCANNER = new Scanner ( System . in ) ; static int readOneInt ( ) { String line = SCANNER . nextLine ( ) ; return Integer . parseInt ( line ) ; } public static void main ( String [ ] args ) { int tc = 1 ; for ( int i = 0 ; i < tc ; + + i ) { String s = SCANNER . nextLine ( ) ; String [ ] str = s . split ( " " ) ; int [ ] ints = new int [ str . length ] ; for ( int j = 0 ; j < str . length ; + + j ) { ints [ j ] = Integer . parseInt ( str [ j ] ) ; } test ( ints [ 0 ] , ints [ 1 ] , ints [ 2 ] , ints [ 3 ] ) ; } } private static void test ( int a , int b , int h , int m ) { double full = 2 * Math . PI ; double ba = full * ( m / 60.0 ) ; double aa = full * ( h * 60 + m ) / 12.0 / 60.0 ; double ax = a * Math . sin ( aa ) ; double ay = a * Math . cos ( aa ) ; double bx = b * Math . sin ( ba ) ; double by = b * Math . cos ( ba ) ; double dx = bx - ax ; double dy = by - ay ; double d = Math . sqrt ( dx * dx + dy * dy ) ; System . out . println ( d ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int limit = 5 ; int [ ] list = new int [ limit ] ; for ( int i = 0 ; i < limit ; + + i ) { list [ i ] = Integer . parseInt ( sc . next ( ) ) ; } ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( list [ list . length - 1 ] - list [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( z > = 0 & & z < = K ) ans + + ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . * ; import java . util . * ; public class Main { static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { try { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } public String next ( ) { if ( st . hasMoreTokens ( ) ) return st . nextToken ( ) ; try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public String nextLine ( ) { String line = " " ; if ( st . hasMoreTokens ( ) ) line = st . nextToken ( ) ; else try { return br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } while ( st . hasMoreTokens ( ) ) line + = " " + st . nextToken ( ) ; return line ; } } public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ; boolean one = false , two = false , three = false , four = false ; for ( int i = 0 ; i < 4 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 1 ) one = true ; else if ( a = = 9 ) two = true ; else if ( a = = 7 ) three = true ; else if ( a = = 4 ) four = true ; } pw . println ( one & & two & & three & & four ? " YES " : " NO " ) ; pw . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int max = 0 ; int sum = 0 ; int num = 0 ; int tmp = 0 ; int N = scan . nextInt ( ) ; for ( int i = N ; i > 0 ; i -- ) { tmp = i ; while ( true ) { if ( tmp % 2 = = 0 & & tmp > 0 ) { sum + + ; tmp / = 2 ; } else { if ( max < = sum ) { max = sum ; num = i ; } sum = 0 ; break ; } } } System . out . println ( num ) ; scan . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 8 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int x = sc . nextInt ( ) ; a [ x ] + + ; } if ( a [ 5 ] = = 2 & & a [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count5 = 0 ; int count7 = 0 ; Scanner sc = new Scanner ( System . in ) ; String [ ] line = sc . nextLine ( ) . split ( " " ) ; for ( String n : line ) { if ( n . equals ( " 5 " ) ) { count5 + + ; } if ( n . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - i - j & & s - i - j < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BBreakNumber solver = new BBreakNumber ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class BBreakNumber { public void solve ( int testNumber , Scanner in , PrintWriter out ) { out . println ( ( int ) Math . pow ( 2 , Math . floor ( Math . log ( in . nextInt ( ) ) / Math . log ( 2 ) ) ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int sum = scanner . nextInt ( ) ; int count = 0 ; int i = 0 , j = 0 , k = 0 ; for ( i = 0 ; i < = n ; i + + ) { for ( j = 0 ; j < = n ; j + + ) { for ( k = 0 ; k < = n ; k + + ) { if ( i + j + k < = sum ) { k = Math . min ( n , sum - i - j ) ; if ( i + j + k < = sum - n ) { j = Math . min ( n , sum - i - k ) ; if ( i + j + k < = sum - n ) { i = Math . min ( n , sum - j - k ) ; } } } else { break ; } if ( ( i + j + k ) = = sum ) count + + ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; import static java . lang . System . in ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; String [ ] lo = reader . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( lo [ 0 ] ) ; int B = Integer . parseInt ( lo [ 1 ] ) ; int H = Integer . parseInt ( lo [ 2 ] ) ; int M = Integer . parseInt ( lo [ 3 ] ) ; double angle = Math . abs ( ( H + M / ( double ) 60 ) * ( Math . PI / ( double ) 6 ) - M * ( Math . PI / ( double ) 30 ) ) ; double res = Math . sqrt ( ( double ) ( A * A ) + ( double ) ( B * B ) - 2 * A * B * Math . cos ( angle ) ) ; DecimalFormat dec = new DecimalFormat ( " # 0.000000000 " ) ; System . out . println ( dec . format ( res ) ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] points = new int [ 5 ] ; int distance = 0 ; for ( int i = 0 ; i < points . length ; i + + ) { points [ i ] = sc . nextInt ( ) ; } int upper = sc . nextInt ( ) ; loop : for ( int i = 0 ; i < 5 ; i + + ) { for ( int n = 0 ; n < 5 ; n + + ) { distance = points [ n ] - points [ i ] ; if ( distance > upper ) { System . out . println ( " : ( " ) ; break loop ; } } if ( i = = 4 ) { System . out . println ( " Yay ! " ) ; } } } } 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 . 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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; String [ ] s = in . nextStringArray ( n ) ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . charAt ( 0 ) = = ' Y ' ) { out . println ( " Four " ) ; return ; } } out . println ( " Three " ) ; } } 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 String [ ] nextStringArray ( int n ) { String [ ] res = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nextString ( ) ; } return res ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int w = 0 ; int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; for ( w = 0 ; w < = 100 ; w + + ) { a [ 0 ] = w ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { if ( b [ i ] < 0 ) { System . out . println ( " No " ) ; return ; } } int aa [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 1 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { aa [ i ] [ j ] = c [ i ] [ j ] - b [ j ] ; } } if ( aa [ 1 ] [ 0 ] ! = aa [ 1 ] [ 1 ] | | aa [ 1 ] [ 0 ] ! = aa [ 1 ] [ 2 ] | | aa [ 2 ] [ 0 ] ! = aa [ 2 ] [ 1 ] | | aa [ 2 ] [ 0 ] ! = aa [ 2 ] [ 2 ] ) { continue ; } System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } if ( arr [ 0 ] [ 0 ] - arr [ 0 ] [ 1 ] = = arr [ 1 ] [ 0 ] - arr [ 1 ] [ 1 ] & & arr [ 1 ] [ 0 ] - arr [ 1 ] [ 1 ] = = arr [ 2 ] [ 0 ] - arr [ 2 ] [ 1 ] ) { if ( arr [ 0 ] [ 1 ] - arr [ 0 ] [ 2 ] = = arr [ 1 ] [ 1 ] - arr [ 1 ] [ 2 ] & & arr [ 1 ] [ 1 ] - arr [ 1 ] [ 2 ] = = arr [ 2 ] [ 1 ] - arr [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int num = 0 ; int max = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int count = 0 ; int x = i ; while ( x % 2 = = 0 ) { count + + ; x / = 2 ; } if ( num < = count ) { max = i ; num = count ; } } System . out . println ( max ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int tmp = s - i - j ; if ( tmp < = k & & tmp > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean go = true ; if ( Math . abs ( a - b ) > k ) go = false ; if ( Math . abs ( a - c ) > k ) go = false ; if ( Math . abs ( a - d ) > k ) go = false ; if ( Math . abs ( a - e ) > k ) go = false ; if ( Math . abs ( b - c ) > k ) go = false ; if ( Math . abs ( b - d ) > k ) go = false ; if ( Math . abs ( b - e ) > k ) go = false ; if ( Math . abs ( c - d ) > k ) go = false ; if ( Math . abs ( c - e ) > k ) go = false ; if ( Math . abs ( d - e ) > k ) go = false ; if ( go ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String agrs [ ] ) { Scanner in = new Scanner ( System . in ) ; double a = in . nextDouble ( ) ; double b = in . nextDouble ( ) ; double h = in . nextDouble ( ) ; double m = in . nextDouble ( ) ; h * = 30 ; m * = 6 ; h + = m / 12 ; if ( m = = 0 ) { m = 360.0 ; } if ( h = = 0 ) { h = 360.0 ; } double angle = Math . min ( Math . abs ( h - m ) , Math . abs ( m - h ) ) ; angle / = 180 ; angle * = Math . PI ; double hyp = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( angle ) ) ; hyp = Math . sqrt ( hyp ) ; System . out . println ( hyp ) ; } } 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 ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double c = Math . cos ( Math . toRadians ( 30 * h + m / 2 - 6 * m ) ) ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * c ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ai [ ] = new int [ 3 ] ; ai [ 0 ] = sc . nextInt ( ) ; ai [ 1 ] = sc . nextInt ( ) ; ai [ 2 ] = sc . nextInt ( ) ; int c5 = 0 ; int c7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { switch ( ai [ i ] ) { case 5 : c5 + + ; break ; case 7 : c7 + + ; break ; } } if ( c5 = = 2 & & c7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 N = in . nextInt ( ) ; String ans = " Three " ; String str ; for ( int i = 0 ; i < N ; i + + ) { str = in . next ( ) ; if ( str . equals ( " Y " ) ) { ans = " Four " ; } } out . println ( ans ) ; } } 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 . Scanner ; class Main { int [ ] [ ] c ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . solve ( ) ; sc . close ( ) ; } Main ( Scanner sc ) { c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } } void solve ( ) { int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int min = Math . min ( c [ 0 ] [ 0 ] , Math . min ( c [ 0 ] [ 1 ] , c [ 0 ] [ 2 ] ) ) ; for ( int i = 0 ; i < = min ; i + + ) { a [ 0 ] = i ; b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 1 ] - b [ 1 ] ; check : for ( int j = 0 ; j < 3 ; j + + ) { for ( int k = 0 ; k < 3 ; k + + ) { if ( c [ j ] [ k ] ! = a [ j ] + b [ k ] ) break check ; if ( j = = 2 & & k = = 2 ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } } } System . out . println ( " No " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . math . BigInteger ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner input = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; + + i ) arr [ i ] = input . nextInt ( ) ; int k = input . nextInt ( ) ; boolean flag = false ; for ( int i = 0 ; i < 5 ; + + i ) { for ( int j = i + 1 ; j < 5 ; + + j ) { if ( arr [ j ] - arr [ i ] > k ) { flag = true ; break ; } } } if ( flag ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { new A ( ) . doIt ( ) ; } class A { void doIt ( ) { int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . * ; import java . math . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void run ( ) { int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int e = 0 ; for ( int i = 0 ; i < 1 ; i + + ) { if ( a [ i + 4 ] - a [ i ] > k ) e = 1 ; } if ( e = = 1 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . IOException ; import java . util . InputMismatchException ; 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int [ ] a = in . nextIntArray ( 4 ) ; Arrays . sort ( a ) ; int [ ] b = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = b [ i ] ) { out . println ( " NO " ) ; return ; } } out . println ( " YES " ) ; } } static class InputReader { private BufferedReader br ; private StringTokenizer st ; public InputReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; st = new StringTokenizer ( " " ) ; } public String nextString ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) , " " ) ; } catch ( IOException e ) { throw new InputMismatchException ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextString ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] res = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nextInt ( ) ; } return res ; } } } import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double H = 5 * sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; H = H + M / 12 ; double RAD = Math . toRadians ( ( M - H ) * 6 ) ; double COS = Math . cos ( RAD ) ; double ans = ( A * A ) + ( B * B ) - ( 2 * A * B * COS ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; Double A = in . nextDouble ( ) ; Double B = in . nextDouble ( ) ; Double H = in . nextDouble ( ) ; double M = in . nextDouble ( ) ; double x = Math . abs ( 30 * H + M / 2 - 6 * M ) ; double X = Math . cos ( Math . toRadians ( x ) ) ; double C = Math . sqrt ( A * A + B * B - 2 * A * B * X ) ; System . out . println ( C ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; public class Main { static double a , b , h , m ; public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; String [ ] in = br . readLine ( ) . split ( " " ) ; a = Double . parseDouble ( in [ 0 ] ) ; b = Double . parseDouble ( in [ 1 ] ) ; h = Double . parseDouble ( in [ 2 ] ) ; m = Double . parseDouble ( in [ 3 ] ) ; br . close ( ) ; double ang = Math . PI * Math . abs ( 30.0 * h + 0.5 * m - 6.0 * m ) / 180.0 ; out . println ( Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( ang ) ) ) ; out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] antena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = Integer . parseInt ( in . next ( ) ) ; } int k = Integer . parseInt ( in . next ( ) ) ; for ( int i = 0 ; i < 5 ; i + + ) { int antena _ i = antena [ i ] ; for ( int comp = i ; comp < 5 ; comp + + ) { int dist = antena [ comp ] - antena _ i ; if ( k < dist ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < = 100 ; i + + ) { a [ 0 ] = i ; for ( int j = 0 ; j < 2 ; j + + ) { b [ j ] = c [ 0 ] [ j ] - a [ 0 ] ; } a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; if ( infomation ( a , b , c ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } public static boolean infomation ( int [ ] a , int [ ] b , int [ ] [ ] c ) { for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) { return false ; } } } return true ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; Scanner sc = new Scanner ( System . in ) ; main . solve ( sc ) ; sc . close ( ) ; } void solve ( Scanner sc ) { int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( S - x - y < = K & & S > = x + y ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; if ( K > = E - A ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { private void solve ( InputReader in , PrintWriter out ) { int [ ] arr = { 5 , 5 , 7 } ; int [ ] arr2 = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { arr2 [ i ] = in . nextInt ( ) ; } Arrays . sort ( arr2 ) ; out . println ( Arrays . equals ( arr , arr2 ) ? " YES " : " NO " ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { try ( InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ) { solve ( in , out ) ; } } static class InputReader implements AutoCloseable { private BufferedReader reader ; private StringTokenizer tokenizer ; InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } @ Override public void close ( ) { } } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double ans = 0 ; double hh = h * 30 + 0.5 * m ; double mm = 6 * m ; double hm = ( double ) Math . abs ( hh - mm ) ; double cos = ( double ) Math . cos ( Math . toRadians ( hm ) ) ; ans = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * cos ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; if ( min > = x ) { count + + ; min = x ; } } sc . close ( ) ; System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = b & & b = = 5 & & c = = 7 | | b = = c & & c = = 5 & & a = = 7 | | c = = a & & a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; if ( min > = P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int tmp = s - ( i + j ) ; if ( 0 < = tmp & & tmp < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = Integer . parseInt ( in . nextLine ( ) ) ; String [ ] params = in . nextLine ( ) . split ( " " ) ; int [ ] ps = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { ps [ i ] = Integer . parseInt ( params [ i ] ) ; } int ans = 0 ; int min = ps [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( ps [ i ] < = min ) { ans + + ; min = ps [ i ] ; } } 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 ( ) ; int [ ] p = new int [ n ] ; int [ ] m = new int [ n ] ; int ans = 0 ; for ( int i = 0 ; i < n ; + + i ) { p [ i ] = sc . nextInt ( ) ; m [ i ] = ( i = = 0 ) ? p [ i ] : Math . min ( p [ i ] , m [ i - 1 ] ) ; if ( p [ i ] = = m [ i ] ) + + ans ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double minutesHand = m * 6 ; double hourHand = h * 30 + m * 0.5 ; double longth = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( minutesHand - hourHand ) ) ) ; System . out . println ( longth ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] antenas = { a , b , c , d , e } ; boolean connect = true ; check : for ( int i = 0 ; i < antenas . length - 1 ; i + + ) { for ( int j = i + 1 ; j < antenas . length ; j + + ) { if ( antenas [ j ] - antenas [ i ] > k ) { connect = false ; break check ; } } } String output = connect ? " Yay ! " : " : ( " ; System . out . println ( output ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; } if ( Arrays . asList ( s ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] numlist = new int [ 5 ] ; int k ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; if ( ( numlist [ 4 ] - numlist [ 0 ] ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } public void solve ( ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double hour _ unit = ( double ) 360 / ( 12 * 60 ) ; double minute _ unit = 360 / 60 ; double hours = hour _ unit * ( 60 * H + M ) ; double minutes = minute _ unit * M ; double hours _ pi = Math . PI * ( 360 - hours ) / 180 ; double minute _ pi = Math . PI * ( 360 - minutes ) / 180 ; double hours _ x = A * Math . cos ( hours _ pi ) ; double hours _ y = A * Math . sin ( hours _ pi ) ; double minutes _ x = B * Math . cos ( minute _ pi ) ; double minutes _ y = B * Math . sin ( minute _ pi ) ; double ans = ( hours _ x - minutes _ x ) * ( hours _ x - minutes _ x ) + ( hours _ y - minutes _ y ) * ( hours _ y - minutes _ y ) ; System . out . printf ( " % .12f \ n " , Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; String result = ( e - a < = sc . nextInt ( ) ) ? " Yay ! " : " : ( " ; System . out . println ( result ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int maxCount = 0 ; int maxN = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int count = 0 ; int tmp = i ; while ( tmp % 2 = = 0 ) { tmp / = 2 ; count + + ; } if ( count > maxCount ) { maxCount = count ; maxN = i ; } } System . out . println ( maxN ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) , r = sc . nextInt ( ) ; if ( h + r = = 0 ) { System . out . println ( 0 ) ; } else if ( h + r < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( 1 ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { String line = Io . read ( ) ; int [ ] nums = Arrays . stream ( line . split ( " " ) ) . mapToInt ( num - > Integer . parseInt ( num ) ) . toArray ( ) ; int count5 = 0 , count7 = 0 ; for ( int num : nums ) { if ( num = = 5 ) { count5 + + ; } else if ( num = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { Io . write ( " YES " ) ; } else { Io . write ( " NO " ) ; } } } class Io { public static String read ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; return line ; } public static void write ( String line ) { System . out . println ( line ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , ans = 1 ; int a [ ] ; a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = in . nextInt ( ) ; int mmin = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < mmin ) ans + + ; mmin = Math . min ( mmin , a [ i ] ) ; } System . out . printf ( " % d \ n " , ans ) ; in . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] points = new int [ 5 ] ; for ( int i = 0 ; i < points . length ; i + + ) { points [ i ] = sc . nextInt ( ) ; } int d = sc . nextInt ( ) ; boolean check = true ; for ( int j = 0 ; j < points . length ; j + + ) { for ( int k = 0 ; k < points . length ; k + + ) { if ( j > k ) { if ( ( points [ j ] - points [ k ] ) > d ) { check = false ; } } else { if ( ( points [ k ] - points [ j ] ) > d ) { check = false ; } } } } if ( check ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . print ( " : ( " ) ; } else { System . out . print ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int h = 0 ; h < = k ; h + + ) { if ( s - i - h < = k & & s > = i + h ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A * B * C = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 ( ) ; int ans = 1 ; while ( true ) { if ( ans * 2 > N ) break ; ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int i = 0 , input , total = 0 ; while ( i < 3 ) { input = Integer . parseInt ( sc . next ( ) ) ; total + = input ; i + + ; } if ( total % 10 = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 , i , j ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( i + j < = s & & s - ( i + j ) < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double shortA = sc . nextInt ( ) ; double longB = sc . nextInt ( ) ; double time = sc . nextInt ( ) ; double minute = sc . nextInt ( ) ; double all = 360 ; double ans = 0.0 ; double timeMinute = 60.0 * time + minute ; double shortaa = ( timeMinute / 720.0 ) * 360 ; double longaa = minute * 6 ; double angle = 0.0 ; if ( shortaa < longaa ) { angle = longaa - shortaa ; } else { angle = shortaa - longaa ; } if ( angle = = 360.0 ) { angle = 0.0 ; } else if ( angle > 180.0 ) { angle = 360.0 - angle ; } double cos = Math . cos ( Math . toRadians ( angle ) ) ; ans = Math . sqrt ( Math . pow ( shortA , 2 ) + Math . pow ( longB , 2 ) - 2.0 * shortA * longB * cos ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { System . out . println ( Integer . highestOneBit ( scanner . nextInt ( ) ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] argd ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; int ar [ ] = { a , b , c , d , e } ; String flag = " Yay ! " ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( ar [ i ] - ar [ j ] ) > k ) { flag = " : ( " ; } } } System . out . println ( flag ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; int [ ] b = new int [ 4 ] ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int i = 1 ; i < = 3 ; i + + ) { for ( int j = 1 ; j < = 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } a [ 1 ] = c [ 1 ] [ 1 ] ; a [ 2 ] = c [ 2 ] [ 1 ] ; a [ 3 ] = c [ 3 ] [ 1 ] ; b [ 1 ] = 0 ; b [ 2 ] = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ; b [ 3 ] = c [ 1 ] [ 3 ] - c [ 1 ] [ 1 ] ; boolean ans = true ; int numbers [ ] = { 2 , 3 } ; for ( int i : numbers ) { for ( int j : numbers ) { if ( a [ i ] + b [ j ] = = c [ i ] [ j ] ) ; else ans = false ; } } if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; import java . io . PrintWriter ; import static java . lang . Integer . * ; import static java . lang . Long . * ; import static java . lang . Math . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; int k = parseInt ( sc . next ( ) ) ; int s = parseInt ( sc . next ( ) ) ; sc . close ( ) ; int cnt = 0 ; int z = 0 ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { z = s - ( i + j ) ; if ( 0 < = z & & z < = k ) cnt + + ; } } out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int K = s . nextInt ( ) ; int S = s . nextInt ( ) ; int Ans = 0 ; if ( S < = K ) Ans = ( S + 1 ) * ( S + 2 ) / 2 ; else if ( K < S & & S < = 2 * K ) Ans = ( K + 1 ) * ( K + 1 ) - ( 2 * K - S + 1 ) * ( 2 * K - S ) / 2 - ( S - K + 1 ) * ( S - K ) / 2 ; else if ( 2 * K < = S ) Ans = ( 3 * K - S + 1 ) * ( 3 * K - S + 2 ) / 2 ; 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 ) ; CLowElements solver = new CLowElements ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CLowElements { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] p = in . readIntArray ( n ) ; int answer = 0 ; for ( int i = 0 , min = Integer . MAX _ VALUE ; i < n ; i + + ) { if ( p [ i ] < min ) answer + + ; min = Math . min ( min , p [ i ] ) ; } out . println ( answer ) ; } } 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 ( ) ) ; } public int [ ] readIntArray ( int n ) { int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = nextInt ( ) ; } return x ; } } } import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ; public class Main { static int [ ] w = new int [ 100010 ] ; static int [ ] v = new int [ 100010 ] ; static int [ ] [ ] dp = new int [ 110 ] [ 100010 ] ; static int k ; static int chmin ( int a , int b ) { if ( a > b ) { a = b ; return a ; } return a ; } static int chmax ( int a , int b ) { if ( a < b ) { a = b ; return a ; } return a ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int a1a2 = Math . abs ( a1 - a2 ) ; int a1a3 = Math . abs ( a1 - a3 ) ; int a2a3 = Math . abs ( a2 - a3 ) ; if ( a1a2 > = a1a3 & & a1a2 > = a2a3 ) System . out . println ( a1a3 + a2a3 ) ; else if ( a1a3 > = a2a3 & & a1a3 > = a1a2 ) { System . out . println ( a2a3 + a1a2 ) ; } else System . out . println ( a1a2 + a1a3 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; double h = Double . parseDouble ( sc . next ( ) ) ; double m = Double . parseDouble ( sc . next ( ) ) ; double res = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . abs ( ( h + m / 60 ) / 12 - m / 60 ) * 2 * Math . PI ) ) ; System . out . println ( res ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String [ ] data = str . split ( " " ) ; int [ ] numdata = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { numdata [ i ] = Integer . parseInt ( data [ i ] ) ; } int a = 0 , b = 0 , c = 0 , d = 0 , e = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ! ( e = = 0 ) ) { e = 1 ; break ; } switch ( numdata [ i ] ) { case 1 : if ( a = = 0 ) { a = 1 ; } else { e = 1 ; } break ; case 9 : if ( b = = 0 ) { b = 1 ; } else { e = 1 ; } break ; case 7 : if ( c = = 0 ) { c = 1 ; } else { e = 1 ; } break ; case 4 : if ( d = = 0 ) { d = 1 ; } else { e = 1 ; } break ; default : e = 1 ; break ; } } if ( e = = 0 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = Math . max ( 0 , s - 2 * k ) ; x < = k ; x + + ) { for ( int y = Math . max ( 0 , s - k - x ) ; y < = Math . min ( k , s - x ) ; y + + ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; in . close ( ) ; int max = 1 ; int max1 = 1 ; for ( int i = n ; i > 1 ; i -- ) { int n _ i = calc ( i ) ; if ( max1 < = n _ i ) { max = i ; max1 = n _ i ; } } System . out . println ( max ) ; } public static int calc ( int n ) { if ( n % 2 = = 0 ) return 1 + calc ( n / 2 ) ; else return 0 ; } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws IOException { int n = 3 ; int s [ ] = new int [ n ] ; BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = scan . nextInt ( ) ; } int cnt5 = 0 ; int cnt7 = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] = = 5 ) { cnt5 + + ; } else if ( s [ i ] = = 7 ) { cnt7 + + ; } } if ( cnt5 = = 2 & & cnt7 = = 1 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } out . flush ( ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int n = getInput ( ) . get ( 0 ) ; ArrayList < Integer > p = getInput ( ) ; int count = 1 ; int tmin = Integer . MAX _ VALUE ; for ( int i = 1 ; i < n ; i + + ) { tmin = Math . min ( p . get ( i - 1 ) , tmin ) ; if ( p . get ( i ) < = tmin ) + + count ; } Print ( count ) ; } private static Scanner scanner = new Scanner ( System . in ) ; private static ArrayList < Integer > getInput ( ) { String in = scanner . nextLine ( ) ; ArrayList < Integer > result = new ArrayList < > ( ) ; for ( String t : in . split ( " " ) ) { result . add ( Integer . parseInt ( t ) ) ; } return result ; } private static void Print ( Object o ) { System . out . println ( o ) ; } private static void Print ( Object ... o ) { for ( Object i : o ) System . out . print ( i ) ; System . out . println ( ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . nextLine ( ) ; double t = ( double ) H * 5 + ( double ) M / 12 ; double sa = Math . abs ( t - M ) ; if ( sa > 30 ) { sa = 60 - sa ; } sa * = 6.0 ; double ans = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2.0 * A * B * Math . cos ( Math . toRadians ( sa ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; CLowElements solver = new CLowElements ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class CLowElements { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = in . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = in . nextInt ( ) ; } int min = arr [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( arr [ i ] > min ) { count + + ; } min = Math . min ( min , arr [ i ] ) ; } out . println ( n - count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( x [ 4 ] - x [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else if ( x [ 4 ] - x [ 0 ] < = k ) { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int a , b , c ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; b = input . nextInt ( ) ; c = input . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int R = sc . nextInt ( ) ; System . out . println ( judgeSun ( H , R ) ) ; sc . close ( ) ; } private static int judgeSun ( int H , int R ) { int x = 1 ; if ( Math . abs ( H ) = = R ) { if ( H < 0 ) { x = 0 ; } else { x = 1 ; } } else if ( Math . abs ( H ) > R ) { if ( H < 0 ) { x = - 1 ; } else { x = 1 ; } } return x ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count = 0 ; boolean sw = false ; int max = Integer . MIN _ VALUE ; int min = Integer . MAX _ VALUE ; double dMax = Double . MIN _ VALUE ; double dMin = Double . MAX _ VALUE ; Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( int i = 0 ; i < = k ; + + i ) { for ( int j = 0 ; j < = k ; + + j ) { int a = s - i - j ; if ( a < = k & & a > = 0 ) { + + count ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] nums = new int [ 4 ] [ 4 ] ; for ( int rIdx = 1 ; rIdx < = 3 ; rIdx + + ) { String [ ] inputs = scanner . nextLine ( ) . split ( " " ) ; for ( int cIdx = 1 ; cIdx < = 3 ; cIdx + + ) nums [ rIdx ] [ cIdx ] = Integer . parseInt ( inputs [ cIdx - 1 ] ) ; } boolean isRightInfo = true ; for ( int idx = 2 ; idx < = 3 ; idx + + ) { int diff = nums [ idx ] [ 1 ] - nums [ 1 ] [ 1 ] ; if ( diff ! = nums [ idx ] [ 2 ] - nums [ 1 ] [ 2 ] | | diff ! = nums [ idx ] [ 3 ] - nums [ 1 ] [ 3 ] ) isRightInfo = false ; diff = nums [ 1 ] [ idx ] - nums [ 1 ] [ 1 ] ; if ( diff ! = nums [ 2 ] [ idx ] - nums [ 2 ] [ 1 ] | | diff ! = nums [ 3 ] [ idx ] - nums [ 3 ] [ 1 ] ) isRightInfo = false ; } if ( isRightInfo ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 5 * 5 * 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { new Main ( ) . solve ( sc ) ; } } void solve ( Scanner sc ) { int n = sc . nextInt ( ) ; Set < String > sSet = new HashSet < > ( 4 ) ; for ( int i = 0 ; i < n ; i + + ) { sSet . add ( sc . next ( ) ) ; } System . out . println ( sSet . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( n = = Math . pow ( 2 , i ) ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } else if ( n < Math . pow ( 2 , i ) ) { System . out . println ( ( int ) Math . pow ( 2 , i - 1 ) ) ; break ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ sc . nextInt ( ) ] + + ; } if ( n [ 1 ] = = 1 & & n [ 9 ] = = 1 & & n [ 7 ] = = 1 & & n [ 4 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; int max = Integer . parseInt ( s [ 0 ] ) ; int ans = Integer . parseInt ( s [ 1 ] ) ; int result = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int k = ans - ( i + j ) ; if ( 0 < = k & & k < = max ) result + + ; } } System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int r = 1 ; for ( int i = 2 ; i < = n ; i + + ) { int current = 0 ; if ( i % 2 = = 1 ) { continue ; } int j = i ; while ( true ) { j = j / 2 ; + + current ; if ( j = = 0 | | j % 2 = = 1 ) { break ; } } if ( current > count ) { count = current ; r = i ; } } System . out . println ( r ) ; sc . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; long [ ] q = new long [ a ] ; long [ ] p = new long [ a ] ; long count = 0 ; long sum = 0 ; long h = 0 ; ArrayList < Long > list = new ArrayList < Long > ( ) ; long o = 0 ; long s = 0 ; for ( int i = 0 ; i < a ; i + + ) { long c = sc . nextLong ( ) ; q [ i ] = c ; o + = c ; } for ( int i = 0 ; i < a ; i + + ) { long b = sc . nextLong ( ) ; p [ i ] = b ; s + = b ; } if ( o > = s ) { for ( int i = 0 ; i < a ; i + + ) { if ( q [ i ] > = p [ i ] ) { if ( q [ i ] - p [ i ] < = o - s ) { list . add ( q [ i ] - p [ i ] ) ; } h + + ; } } if ( h = = a ) { System . out . println ( 0 ) ; return ; } } else { System . out . println ( - 1 ) ; return ; } Collections . sort ( list ) ; for ( long k : list ) { if ( k + sum < = o - s ) { sum + = k ; count + + ; } } System . out . println ( a - count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { new Solver ( ) . run ( ) ; } } class Solver { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int v = N ; int ans = 1 ; int cnt = 0 ; while ( v > 1 ) { v > > = 1 ; cnt + + ; ans * = 2 ; } System . out . println ( ans ) ; return ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { String result = " NO " ; List < Integer > inputList = new ArrayList < Integer > ( ) ; Scanner sc = new Scanner ( System . in ) ; inputList . add ( sc . nextInt ( ) ) ; inputList . add ( sc . nextInt ( ) ) ; inputList . add ( sc . nextInt ( ) ) ; int count7 = 0 ; int count5 = 0 ; for ( int input : inputList ) { if ( input = = 5 ) count5 + + ; if ( input = = 7 ) count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { result = " YES " ; } System . out . print ( result ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 6 ] ; int count = 0 ; for ( int i = 0 ; i < 6 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 6 - 1 ; i + + ) { for ( int j = i + 1 ; j < 6 ; j + + ) { if ( ( a [ j ] - a [ i ] ) > a [ 6 - 1 ] ) count + + ; } } if ( count > 0 ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a * b * c = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int H = scanner . nextInt ( ) ; int M = scanner . nextInt ( ) ; double S = 30 * H + 0.5 * M ; double L = 6 * M ; double angle = Math . abs ( L - S ) ; if ( angle > 180 ) { angle = Math . abs ( angle - 360 ) ; } angle = Math . toRadians ( angle ) ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( angle ) ) ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( 0 < = z & & z < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int sum = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( ( z < = k ) & & ( z > = 0 ) ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] array = str . split ( " " ) ; int a = Integer . parseInt ( array [ 0 ] ) ; int b = Integer . parseInt ( array [ 1 ] ) ; int c = Integer . parseInt ( array [ 2 ] ) ; int d = Integer . parseInt ( array [ 3 ] ) ; int [ ] list = { a , b , c , d } ; Arrays . sort ( list ) ; int [ ] diff = { 1 , 4 , 7 , 9 } ; if ( Arrays . equals ( list , diff ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < Character > set = new HashSet < Character > ( ) ; for ( int i = 0 ; i < n ; i + + ) set . add ( sc . next ( ) . charAt ( 0 ) ) ; String res = " " ; switch ( set . size ( ) ) { case 3 : res = " Three " ; break ; case 4 : res = " Four " ; } System . out . println ( res ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int cou = 1 ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = 999999999 ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , p [ i - 1 ] ) ; if ( p [ i ] < min ) { cou + + ; } } System . out . print ( cou ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; long base = ( long ) 1e9 + 7 ; long ans = 1 ; if ( Math . abs ( n - m ) = = 0 ) { ans * = 2 ; ans % = base ; } else if ( Math . abs ( n - m ) > 1 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } for ( int i = 1 ; i < = n ; i + + ) { ans * = i ; ans % = base ; } for ( int i = 1 ; i < = m ; i + + ) { ans * = i ; ans % = base ; } System . out . println ( ans ) ; } } import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { static class IO { BufferedReader br ; StringTokenizer st ; public IO ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { IO fs = new IO ( ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = fs . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int numlist [ ] = new int [ 5 ] ; int k = 0 ; boolean isOk = true ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; loop : for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ( numlist [ j ] - numlist [ i ] ) > k ) { isOk = false ; break loop ; } } } if ( isOk ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 1 ; int min = sc . nextInt ( ) ; for ( int i = 0 ; i < N - 1 ; i + + ) { int next = sc . nextInt ( ) ; if ( min > next ) { cnt + + ; } min = Math . min ( min , next ) ; } System . out . println ( cnt ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; long n = sc . nextLong ( ) ; long p = sc . nextLong ( ) ; long x = ( long ) Math . pow ( p , ( double ) 1 / n ) + 1 ; long ans = 1 ; if ( n = = 1 ) { ans = p ; } else { for ( long i = x ; i > = 1 ; i -- ) { if ( p % Math . pow ( i , n ) = = 0 ) { ans = i ; break ; } } } System . out . println ( ans ) ; } 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 . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] map = new int [ 3 ] [ 3 ] ; boolean ans = false ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { map [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { for ( int j = 0 ; j < = 100 ; j + + ) { for ( int k = 0 ; k < = 100 ; k + + ) { int ok = 0 ; int [ ] b = { map [ 0 ] [ 0 ] - i , map [ 1 ] [ 1 ] - j , map [ 2 ] [ 2 ] - k } ; if ( i + b [ 1 ] = = map [ 0 ] [ 1 ] ) ok + + ; if ( i + b [ 2 ] = = map [ 0 ] [ 2 ] ) ok + + ; if ( j + b [ 0 ] = = map [ 1 ] [ 0 ] ) ok + + ; if ( j + b [ 2 ] = = map [ 1 ] [ 2 ] ) ok + + ; if ( k + b [ 0 ] = = map [ 2 ] [ 0 ] ) ok + + ; if ( k + b [ 1 ] = = map [ 2 ] [ 1 ] ) ok + + ; if ( ok = = 6 ) ans = true ; } } } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int [ ] antenna = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antenna [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; boolean result = true ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > k ) { result = false ; break ; } } if ( result = = false ) { break ; } } if ( result ) { out . printf ( " Yay ! \ n " ) ; } else { out . printf ( " : ( \ n " ) ; } out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] values = sc . nextLine ( ) . split ( " " ) ; int countFor7 = 0 ; int countFor5 = 0 ; for ( String value : values ) { if ( " 7 " . equals ( value ) ) { countFor7 + + ; } else if ( " 5 " . equals ( value ) ) { countFor5 + + ; } } System . out . println ( ( countFor5 = = 2 & & countFor7 = = 1 ) ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; if ( min > = x ) { count + + ; min = x ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int H = s . nextInt ( ) ; int R = s . nextInt ( ) ; if ( H < 0 ) { int a = H + R ; if ( a < 0 ) { System . out . println ( " -1 " ) ; } else if ( a = = 0 ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " 1 " ) ; } } else { System . out . println ( " 1 " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int a = Integer . parseInt ( sc . nextLine ( ) ) ; int b = Integer . parseInt ( sc . nextLine ( ) ) ; int c = Integer . parseInt ( sc . nextLine ( ) ) ; int d = Integer . parseInt ( sc . nextLine ( ) ) ; int e = Integer . parseInt ( sc . nextLine ( ) ) ; int k = Integer . parseInt ( sc . nextLine ( ) ) ; if ( ( e - a ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 1 ; while ( i < = N ) { i = i * 2 ; } System . out . println ( i / 2 ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sr = new Scanner ( System . in ) ; int A = sr . nextInt ( ) ; int B = sr . nextInt ( ) ; int H = sr . nextInt ( ) ; int M = sr . nextInt ( ) ; double angleA = ( H * 60 + M ) * Math . PI / 360 ; double angleB = ( M * Math . PI ) / 30 ; double C = A * A + B * B - ( 2 * A * B * Math . cos ( Math . abs ( angleA - angleB ) ) ) ; System . out . println ( Math . sqrt ( C ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; Arrays . sort ( str ) ; sb . append ( " 557 " . equals ( str [ 0 ] + str [ 1 ] + str [ 2 ] ) ? " YES " : " NO " ) ; System . out . println ( sb ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] tmp = new int [ 6 ] ; int i = 0 ; for ( String str = br . readLine ( ) ; str ! = null ; str = br . readLine ( ) ) { tmp [ i + + ] = Integer . parseInt ( str ) ; } final int A = tmp [ 0 ] ; final int E = tmp [ 4 ] ; final int K = tmp [ 5 ] ; boolean communicationAvailable = false ; if ( E - A < = K ) { communicationAvailable = true ; } if ( communicationAvailable ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; n = ( int ) ( Math . log10 ( n ) / Math . log10 ( 2 ) ) ; System . out . println ( ( int ) Math . pow ( 2 , n ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; System . out . println ( three ( K , S ) ) ; } private static int one ( int K , int S ) { return 0 < = S & & S < = K ? 1 : 0 ; } private static int two ( int K , int S ) { int result = 0 ; for ( int i = 0 ; i < = K ; i + + ) { result + = one ( K , S - i ) ; } return result ; } private static int three ( int K , int S ) { int result = 0 ; for ( int i = 0 ; i < = K ; i + + ) { result + = two ( K , S - i ) ; } return result ; } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 0 ; int max = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( max > p ) { ans + + ; max = p ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main implements Runnable { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Thread ( null , new Main ( ) , " " , 128 * 1024 * 1024 ) . start ( ) ; } public void run ( ) { int c [ ] [ ] = new int [ 3 ] [ 3 ] ; int a1 , a2 , a3 , b1 , b2 , b3 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } a1 = Math . min ( c [ 0 ] [ 0 ] , Math . min ( c [ 0 ] [ 1 ] , c [ 0 ] [ 2 ] ) ) ; a2 = Math . min ( c [ 1 ] [ 0 ] , Math . min ( c [ 1 ] [ 1 ] , c [ 1 ] [ 2 ] ) ) ; a3 = Math . min ( c [ 2 ] [ 0 ] , Math . min ( c [ 2 ] [ 1 ] , c [ 2 ] [ 2 ] ) ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int min = i = = 0 ? a1 : i = = 1 ? a2 : a3 ; c [ i ] [ j ] - = min ; } } for ( int j = 0 ; j < 3 ; j + + ) { int tmp = c [ 0 ] [ j ] ; for ( int i = 1 ; i < 3 ; i + + ) { if ( c [ i ] [ j ] ! = tmp ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double hDegree = 360.0 * ( h + m / 60.0 ) / 12 ; double mDegree = 360.0 * m / 60 ; double theta = Math . toRadians ( Math . max ( hDegree , mDegree ) - Math . min ( hDegree , mDegree ) ) ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( theta ) ) ; System . out . printf ( " % .12f " , ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] g = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { g [ i ] [ 0 ] = sc . nextInt ( ) ; g [ i ] [ 1 ] = sc . nextInt ( ) ; g [ i ] [ 2 ] = sc . nextInt ( ) ; } boolean ans = true ; for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( g [ i ] [ j ] - g [ i + 1 ] [ j ] ! = g [ i ] [ j + 1 ] - g [ i + 1 ] [ j + 1 ] ) { ans = false ; break ; } if ( g [ i ] [ j ] - g [ i ] [ j + 1 ] ! = g [ i + 1 ] [ j ] - g [ i + 1 ] [ j + 1 ] ) { ans = false ; break ; } } } if ( ans ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } long ans = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { min = Math . min ( min , P [ i ] ) ; if ( min > = P [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = 7 ; i + + ) { if ( Math . pow ( 2 , i ) > n ) { System . out . print ( ( int ) Math . pow ( 2 , i - 1 ) ) ; break ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int maxCount = 0 ; int ans = 0 ; for ( int i = n ; i > = 1 ; i -- ) { int num = i ; int cnt = 0 ; while ( true ) { if ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } else { break ; } } if ( cnt > = maxCount ) { ans = i ; maxCount = cnt ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prod = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { prod * = sc . nextInt ( ) ; } if ( prod = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void Solver ( int A , int B , int C ) { int sevenCount = 0 ; int fiveCount = 0 ; if ( A = = 5 ) fiveCount + + ; if ( B = = 5 ) fiveCount + + ; if ( C = = 5 ) fiveCount + + ; if ( A = = 7 ) sevenCount + + ; if ( B = = 7 ) sevenCount + + ; if ( C = = 7 ) sevenCount + + ; if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; Solver ( input . nextInt ( ) , input . nextInt ( ) , input . nextInt ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int judge = 1 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) { judge -- ; } } } if ( judge = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int o = 0 ; int n = sc . nextInt ( ) ; int mini = 2000000 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < = mini ) { o + + ; mini = p ; } } System . out . println ( o ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; long n = 0 ; for ( int i = 0 ; i < = x ; i + + ) { n + + ; n * = 2 ; } System . out . println ( n ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( Math . max ( a , Math . max ( b , c ) ) - Math . min ( a , Math . min ( b , c ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int counter = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { counter + + ; } } } System . out . println ( counter ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; HashMap < String , Integer > HM = new HashMap ( ) ; int N = Input . nextInt ( ) ; for ( int I = 0 ; I < N ; I + + ) { String S = Input . next ( ) ; HM . put ( S , 0 ) ; } if ( HM . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else if ( HM . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int max = P [ 0 ] ; int min = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( max > = P [ i ] & & min > = P [ i ] ) { ans + = 1 ; } max = Math . max ( max , P [ i ] ) ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; if ( n _ customer > 1 ) { while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } } System . out . println ( sold ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { try ( Scanner sc = new Scanner ( System . in ) ) { int K = sc . nextInt ( ) , S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( 0 < = k & & k < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = Math . min ( s , k ) ; i + + ) { ans + = Math . max ( 0 , Math . min ( s - i + 1 , k + 1 ) - Math . max ( 0 , s - i - k ) ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j > = 0 & & s - i - j < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; double ans = 1 ; for ( int i = 1 ; i < = n ; i + + ) { double pwr = Math . pow ( 2 , i ) ; if ( pwr > n ) { System . out . println ( ( int ) ans ) ; return ; } ans = pwr ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int max = 0 ; int ans = 0 ; int cnt = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int j = i ; while ( j % 2 = = 0 ) { j / = 2 ; cnt + + ; } if ( cnt > = max ) { max = cnt ; ans = i ; } cnt = 0 ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int box = sc . nextInt ( ) ; int [ ] list = new int [ box ] ; for ( int i = 0 ; i < list . length ; + + i ) { list [ i ] = sc . nextInt ( ) ; } int intMin = list [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < list . length ; + + i ) { if ( intMin > list [ i ] ) { intMin = list [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; long x = scan . nextLong ( ) ; long [ ] [ ] dp = new long [ n ] [ n ] ; for ( int j = 0 ; j < n ; j + + ) { dp [ 0 ] [ j ] = scan . nextLong ( ) ; } for ( int i = 1 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { dp [ i ] [ j ] = Math . min ( dp [ i - 1 ] [ j ] , dp [ 0 ] [ ( j - i + n ) % n ] ) ; } } long result = 1L < < 60 ; for ( int i = 0 ; i < n ; i + + ) { long dummyResult = i * x ; for ( int j = 0 ; j < n ; j + + ) { dummyResult + = ( long ) dp [ i ] [ j ] ; } result = Math . min ( result , dummyResult ) ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int c = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( x + y = = s ) { c + + ; } else if ( s - ( x + y ) < = k & & x + y < s ) { c + + ; } } } System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; public class Main { static long T1 ; static long T2 ; static long A1 ; static long A2 ; static long B1 ; static long B2 ; static void swap ( long a , long b ) { long tmp = a ; a = b ; b = tmp ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; T1 = Long . parseLong ( sc . next ( ) ) ; T2 = Long . parseLong ( sc . next ( ) ) ; A1 = Long . parseLong ( sc . next ( ) ) ; A2 = Long . parseLong ( sc . next ( ) ) ; B1 = Long . parseLong ( sc . next ( ) ) ; B2 = Long . parseLong ( sc . next ( ) ) ; long ans = 0 ; long diff = 0 ; if ( ( A1 * T1 + A2 * T2 ) - ( B1 * T1 + B2 * T2 ) = = 0 ) { if ( A1 = = B1 ) System . out . println ( 0 ) ; else System . out . println ( " infinity " ) ; return ; } if ( ( A1 * T1 + A2 * T2 ) - ( B1 * T1 + B2 * T2 ) < 0 ) { long tmp _ aa = A1 ; A1 = B1 ; B1 = tmp _ aa ; long tmp _ bb = A2 ; A2 = B2 ; B2 = tmp _ bb ; } ans = 0L ; diff = ( A1 * T1 + A2 * T2 ) - ( B1 * T1 + B2 * T2 ) ; if ( A1 > = B1 ) { ans = 0 ; } else { ans = ( ( B1 * T1 ) - ( A1 * T1 ) ) / diff * 2 + 1 ; if ( ( ( B1 * T1 ) - ( A1 * T1 ) ) % diff = = 0 ) ans -- ; } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int last = s - i - j ; if ( last > = 0 & & last < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { int n ; int ans = 1 ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { in ( ) ; int mx = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int cnt = 0 , m = i ; while ( m % 2 = = 0 ) { cnt + + ; m / = 2 ; } if ( mx < cnt ) { mx = cnt ; ans = i ; } } out ( ) ; } void in ( ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; } void out ( ) { System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { long bunbo = 4 * h * n - N * n - N * h ; if ( bunbo = = 0 ) { continue ; } if ( ( N * h * n ) % bunbo = = 0 ) { long w = ( N * h * n ) / bunbo ; if ( w < = 0 ) { continue ; } System . out . println ( h + " " + n + " " + w ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { String str = sc . next ( ) ; if ( str . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final double A = Integer . parseInt ( sc . next ( ) ) ; final double B = Integer . parseInt ( sc . next ( ) ) ; final double H = Integer . parseInt ( sc . next ( ) ) ; final double M = Integer . parseInt ( sc . next ( ) ) ; final double parseH = H * 30d + ( 30d * ( M / 60d ) ) ; final double parseM = M * 6d ; double ang = Math . abs ( parseH - parseM ) ; final double ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2d * A * B * Math . cos ( Math . toRadians ( ang ) ) ) ; System . out . print ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < p . length ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = p [ 0 ] ; int count = 1 ; for ( int i = 0 ; i < p . length ; i + + ) { if ( min > p [ i ] ) { min = p [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class Solver { public void solve ( Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; int count = 0 ; int PjMin = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int Pi = in . nextInt ( ) ; if ( Pi < = PjMin ) { count + + ; } if ( PjMin > = Pi ) { PjMin = Pi ; } } out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double c2 = A * A + B * B - 2.0 * A * B * Math . cos ( ( 3.141592653589793238 * ( 300.0 * H - 55.0 * M ) ) / 1800.0 ) ; double c = Math . sqrt ( c2 ) ; System . out . printf ( " % .20f " , c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner as = new Scanner ( System . in ) ; int a = as . nextInt ( ) ; int b = as . nextInt ( ) ; int c ; int l = 0 ; if ( a < b ) { for ( int i = 0 ; i < = a ; i + + ) { c = b ; c - = i ; for ( int s = 0 ; s < = a ; s + + ) { c - = s ; if ( c < 0 ) { break ; } else { if ( c > a ) { c + = s ; } else { l + + ; c + = s ; } } } } } else { l + = ( b + 2 ) * ( b + 1 ) / 2 ; } System . out . println ( l ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { c [ i ] [ 0 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ i ] [ 1 ] = Integer . parseInt ( scanner . next ( ) ) ; c [ i ] [ 2 ] = Integer . parseInt ( scanner . next ( ) ) ; } scanner . close ( ) ; for ( int i = 0 ; i < c . length ; i + + ) { int min = Integer . MAX _ VALUE ; for ( int j = 0 ; j < c [ i ] . length ; j + + ) { int num = c [ i ] [ j ] ; if ( min > num ) { min = num ; } } for ( int j = 0 ; j < c [ i ] . length ; j + + ) { c [ i ] [ j ] - = min ; } } for ( int i = 0 ; i < c . length ; i + + ) { if ( c [ 0 ] [ i ] ! = c [ 1 ] [ i ] | | c [ 1 ] [ i ] ! = c [ 2 ] [ i ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans * = 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int num [ ] = new int [ 5 ] ; for ( int i = 0 ; i < = 4 ; i + + ) { num [ i ] = scanner . nextInt ( ) ; } int k = scanner . nextInt ( ) ; for ( int i = 0 ; i < num . length ; i + + ) { if ( num [ num . length - i - 1 ] - num [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } System . out . println ( " Yay ! " ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int N = stdIn . nextInt ( ) ; int maxcount = 0 ; int ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int a = i ; int count = 0 ; while ( a % 2 = = 0 & & i > = 1 ) { a / = 2 ; count + + ; } if ( count > maxcount ) { maxcount = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; PriorityQueue < Integer > q = new PriorityQueue < > ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int now = sc . nextInt ( ) ; q . add ( now ) ; if ( now = = q . peek ( ) ) { ans + + ; } } System . out . println ( ans ) ; } } } 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 maxNum = 1 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int targetNum = i + 1 ; int tmpCount = 0 ; while ( targetNum % 2 = = 0 ) { targetNum = targetNum / 2 ; tmpCount + + ; } if ( tmpCount > count ) { count = tmpCount ; maxNum = i + 1 ; } } System . out . println ( maxNum ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; System . out . println ( E - A < = K ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String A = scan . next ( ) ; int a = Integer . parseInt ( A ) ; String B = scan . next ( ) ; int b = Integer . parseInt ( B ) ; String H = scan . next ( ) ; int h = Integer . parseInt ( H ) ; String M = scan . next ( ) ; int m = Integer . parseInt ( M ) ; double angle = Math . abs ( ( 30 * h + 0.5 * m ) - 6 * m ) ; double cos = Math . cos ( Math . toRadians ( angle ) ) ; double ans ; if ( angle = = 0 ) { ans = Math . abs ( a - b ) ; } else { ans = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * cos ) ) ; } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { String [ ] line = new Scanner ( System . in ) . nextLine ( ) . split ( " " , 3 ) ; int num [ ] = new int [ 3 ] ; num [ 0 ] = Integer . parseInt ( line [ 0 ] ) ; num [ 1 ] = Integer . parseInt ( line [ 1 ] ) ; num [ 2 ] = Integer . parseInt ( line [ 2 ] ) ; Arrays . sort ( num ) ; if ( num [ 0 ] = = 5 & & num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . StringTokenizer ; public class Main { private static PrintWriter out ; public static void main ( String [ ] args ) { Main main = new Main ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ( ) - > out . close ( ) ) ) ; try { main . run ( args ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private void run ( String [ ] arguments ) throws Exception { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int rest = S - x - y ; if ( rest > = 0 & & rest < = K ) { count + + ; } } } out . println ( count ) ; out . close ( ) ; } private class MyScanner { BufferedReader br ; StringTokenizer st ; 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 K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sc . close ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ! ( num [ i ] = = 1 | | num [ i ] = = 4 | | num [ i ] = = 7 | | num [ i ] = = 9 ) ) { System . out . println ( " NO " ) ; return ; } } int n = 21 ; for ( int i = 0 ; i < 4 ; i + + ) { n - = num [ i ] ; } if ( n = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( i < j ) { if ( Math . abs ( a [ i ] - a [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; Integer count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - ( i + j ) ; if ( 0 < = z & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String kotei [ ] = { " P " , " W " , " G " , " Y " } ; String s [ ] = new String [ n ] ; int count = 0 ; for ( int ii = 0 ; ii < n ; ii + + ) { s [ ii ] = sc . next ( ) ; } for ( int i = 0 ; i < 4 ; i + + ) { for ( int ii = 0 ; ii < n ; ii + + ) { if ( kotei [ i ] . equals ( s [ ii ] ) ) { count + + ; break ; } } } if ( count = = 4 ) { System . out . println ( " Four " ) ; } else if ( count = = 3 ) { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; if ( 5 = = num ) { count _ 5 + + ; } else if ( 7 = = num ) { count _ 7 + + ; } } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int five = 0 ; int seven = 0 ; if ( a = = 5 ) { five + + ; } else if ( a = = 7 ) { seven + + ; } if ( b = = 5 ) { five + + ; } else if ( b = = 7 ) { seven + + ; } if ( c = = 5 ) { five + + ; } else if ( c = = 7 ) { seven + + ; } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } System . out . print ( count ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] input = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { input [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < input . length ; i + + ) { for ( int j = i + 1 ; j < input . length ; j + + ) { if ( input [ j ] - input [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double jiaoduH = h * 360 / 12 ; double jiaoduM = m * 360 / 60 ; if ( jiaoduM > 0 ) { jiaoduH + = m * 1.0 * 360 / ( 60 * 12 ) ; } double jiaodu = Math . abs ( jiaoduM - jiaoduH ) ; if ( jiaodu > 180 ) { jiaodu = 360 - jiaodu ; } Double c = a * a + b * b - 2 * a * b * Math . cos ( jiaodu * ( Math . PI ) / 180 ) ; System . out . println ( Math . sqrt ( c ) ) ; } } import java . util . * ; import java . util . stream . Stream ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String [ ] nums = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { nums [ i ] = sc . next ( ) ; } long result = Stream . of ( nums ) . distinct ( ) . count ( ) ; if ( result = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; System . out . println ( sc . nextInt ( ) - a > sc . nextInt ( ) ? " : ( " : " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; if ( k > = s ) { System . out . println ( ( s + 2 ) * ( s + 1 ) / 2 ) ; } else { int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int nums [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { nums [ i ] = sc . nextInt ( ) ; } int a = 0 , b = 0 ; for ( int i = 0 ; i < 3 ; + + i ) { if ( nums [ i ] = = 5 ) a + + ; if ( nums [ i ] = = 7 ) b + + ; } if ( a = = 2 & & b = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] task = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { task [ i ] = sc . nextInt ( ) ; } Arrays . sort ( task ) ; int sum = 0 ; for ( int i = 0 ; i < 2 ; i + + ) { sum + = task [ i + 1 ] - task [ i ] ; } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) y [ i ] = a [ 0 ] [ i ] ; x [ 1 ] = a [ 1 ] [ 0 ] - y [ 0 ] ; x [ 2 ] = a [ 2 ] [ 0 ] - y [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF _ 8 ) ; BufferedReader in = new BufferedReader ( reader ) ; List < Integer > positions = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; + + i ) { positions . add ( Integer . parseInt ( in . readLine ( ) ) ) ; } int K = Integer . parseInt ( in . readLine ( ) ) ; in . close ( ) ; int count = 0 ; for ( int i = 0 ; i < positions . size ( ) ; + + i ) { for ( int j = 0 ; j < positions . size ( ) ; + + j ) { if ( positions . get ( j ) - positions . get ( i ) > K ) { + + count ; } } } if ( count > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . Arrays ; public class Main { private static int [ ] pos = new int [ 5 ] ; private static int k ; private static String solver ( ) { int min = Arrays . stream ( pos ) . min ( ) . getAsInt ( ) ; int max = Arrays . stream ( pos ) . max ( ) . getAsInt ( ) ; if ( k > = max - min ) { return " Yay ! " ; } else { return " : ( " ; } } public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; try { for ( int i = 0 ; i < 5 ; i + + ) { String [ ] inputArray = br . readLine ( ) . split ( " " ) ; pos [ i ] = Integer . parseInt ( inputArray [ 0 ] ) ; } String [ ] inputArray = br . readLine ( ) . split ( " " ) ; k = Integer . parseInt ( inputArray [ 0 ] ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } System . out . println ( solver ( ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int first = scan . nextInt ( ) ; int second = scan . nextInt ( ) ; int third = scan . nextInt ( ) ; if ( ( first = = 5 | | first = = 7 ) & ( second = = 5 | | second = = 7 ) & ( third = = 5 | | third = = 7 ) & ( first + second + third = = 17 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( ( A = = 5 | | A = = 7 ) & & ( B = = 5 | | B = = 7 ) & & ( C = = 5 | | C = = 7 ) & & A + B + C = = 17 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( ( ( S - ( i + j ) ) < = K ) & & ( S - ( i + j ) > = 0 ) ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) System . out . println ( " YES " ) ; else if ( a = = 5 & & b = = 7 & & c = = 5 ) System . out . println ( " YES " ) ; else if ( a = = 7 & & b = = 5 & & c = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; import java . io . * ; class Main { void solve ( ) { int k = inint ( ) , s = inint ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( 0 < = z & & z < = k ) & & x + y + z = = s ) count + + ; } } out . println ( count ) ; } public static Scanner in = new Scanner ( System . in ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } public int inint ( ) { return in . nextInt ( ) ; } public long inlong ( ) { return in . nextLong ( ) ; } public String instr ( ) { return in . next ( ) ; } public char inchar ( ) { return in . next ( ) . charAt ( 0 ) ; } public int [ ] inintar ( int num ) { int [ ] a = new int [ num ] ; for ( int i = 0 ; i < num ; i + + ) { a [ i ] = in . nextInt ( ) ; } return a ; } public char [ ] incharar ( ) { return in . next ( ) . toCharArray ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int min = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ( max - min ) > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] array = new Integer [ 5 ] ; for ( int i = 0 ; i < 5 ; + + i ) { int tmp = sc . nextInt ( ) ; array [ i ] = tmp ; } int k = Integer . parseInt ( sc . next ( ) ) ; if ( array [ 4 ] - array [ 0 ] < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; switch ( a ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : break ; } switch ( b ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : break ; } switch ( c ) { case 5 : count5 + + ; break ; case 7 : count7 + + ; break ; default : break ; } if ( 2 = = count5 & & 1 = = count7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { private static final String YES = " YES " ; private static final String NO = " NO " ; public static void main ( String [ ] args ) { new Main ( ) . execute ( ) ; } public void execute ( ) { Scanner sc = new Scanner ( System . in ) ; final int N1 = sc . nextInt ( ) ; final int N2 = sc . nextInt ( ) ; final int N3 = sc . nextInt ( ) ; final int N4 = sc . nextInt ( ) ; boolean [ ] b = new boolean [ 10 ] ; b [ N1 ] = true ; b [ N2 ] = true ; b [ N3 ] = true ; b [ N4 ] = true ; if ( b [ 1 ] & & b [ 9 ] & & b [ 7 ] & & b [ 4 ] ) { System . out . println ( YES ) ; } else { System . out . println ( NO ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s [ ] = new String [ n ] ; int flag = 0 ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { flag = 1 ; } } if ( flag = = 1 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] anArray = reader . readLine ( ) . split ( " " ) ; int counterFor7 = 0 ; int counterFor5 = 0 ; for ( int i = 0 ; i < anArray . length ; i + + ) { if ( Integer . parseInt ( anArray [ i ] ) = = 7 ) { counterFor7 + + ; } else if ( Integer . parseInt ( anArray [ i ] ) = = 5 ) { counterFor5 + + ; } } if ( counterFor7 = = 1 & & counterFor5 = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; sc . next ( ) ; sc . next ( ) ; sc . next ( ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int abc = a + b + c ; if ( abc = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] [ ] a = new int [ 3 ] [ 3 ] ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = true ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = a [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = a [ i ] [ 0 ] - y [ 0 ] ; } flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( x [ i ] + y [ j ] ! = a [ i ] [ j ] ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } 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 ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , InputReader in , PrintWriter out ) { final int n = 5 ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) ar [ i ] = in . nextInt ( ) ; int k = in . nextInt ( ) ; for ( int i = 0 ; i < n - 1 ; i + + ) for ( int j = i + 1 ; j < n ; j + + ) if ( Math . abs ( ar [ i ] - ar [ j ] ) > k ) { out . println ( " : ( " ) ; return ; } out . println ( " Yay ! " ) ; } } 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 , min = n , p ; i < n ; i + + ) { p = sc . nextInt ( ) ; if ( p < = min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; boolean ans = false ; switch ( a ) { case 5 : if ( b = = 7 ) { if ( c = = 5 ) { ans = true ; } } else if ( c = = 7 ) { if ( b = = 5 ) { ans = true ; } } break ; case 7 : if ( b = = 5 & & c = = 5 ) { ans = true ; } } System . out . println ( ans ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int y = 0 ; y < 3 ; y + + ) { for ( int x = 0 ; x < 3 ; x + + ) { c [ y ] [ x ] = sc . nextInt ( ) ; if ( y = = 0 ) b [ x ] = c [ y ] [ x ] ; else a [ y ] = c [ y ] [ x ] - b [ x ] ; } } boolean isAns = true ; for ( int y = 0 ; y < 3 ; y + + ) { for ( int x = 0 ; x < 3 ; x + + ) { if ( c [ y ] [ x ] ! = a [ y ] + b [ x ] ) { isAns = false ; break ; } } } System . out . println ( isAns ? " Yes " : " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int maxCount = 0 ; int ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int count = 0 ; int n = i ; while ( n % 2 = = 0 ) { n / = 2 ; count + + ; } if ( maxCount < count ) { maxCount = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; String s = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; out . println ( s . equals ( " 575 " ) | | s . equals ( " 557 " ) | | s . equals ( " 755 " ) ? " YES " : " NO " ) ; out . flush ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double mr = Math . toRadians ( m * 6 ) ; double hr = Math . toRadians ( 30 * h + m * 0.5 ) ; double sar = Math . abs ( mr - hr ) ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( sar ) ) ; System . out . println ( ans ) ; } } import java . io . * ; import java . util . Scanner ; public class Main { private static Scanner sc ; private static Printer pr ; private static void solve ( ) { int [ ] abcde = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { abcde [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( abcde [ j ] - abcde [ i ] < = k ) { cnt + + ; } } } if ( cnt < 10 ) { pr . println ( " : ( " ) ; } else { pr . println ( " Yay ! " ) ; } } public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; pr = new Printer ( System . out ) ; solve ( ) ; pr . close ( ) ; sc . close ( ) ; } static class Printer extends PrintWriter { Printer ( OutputStream out ) { super ( out ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 4 ] ; int [ ] Ans = { 1 , 4 , 7 , 9 } ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; boolean isAns = true ; for ( int i = 0 ; i < 4 ; i + + ) { if ( n [ i ] ! = Ans [ i ] ) isAns = false ; } System . out . println ( isAns ? " YES " : " NO " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; boolean isAB5C7 = ( a = = 5 & & b = = 5 & & c = = 7 ) ; boolean isBC5A7 = ( a = = 7 & & b = = 5 & & c = = 5 ) ; boolean isCA5B7 = ( a = = 5 & & b = = 7 & & c = = 5 ) ; if ( isCA5B7 | | isBC5A7 | | isAB5C7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader reader = new InputStreamReader ( System . in , StandardCharsets . UTF _ 8 ) ; BufferedReader in = new BufferedReader ( reader ) ; Main ins = new Main ( in ) ; ins . calc ( ) ; ins . showResult ( ) ; } int [ ] [ ] c ; Main ( BufferedReader in ) throws IOException { c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { String [ ] tokens = in . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < 3 ; + + j ) { c [ i ] [ j ] = Integer . parseInt ( tokens [ j ] ) ; } } for ( int i = 0 ; i < 3 ; + + i ) { for ( int j = 1 ; j < 3 ; + + j ) { c [ j ] [ i ] - = c [ 0 ] [ i ] ; } } for ( int i = 0 ; i < 3 ; + + i ) { c [ 0 ] [ i ] = 0 ; } boolean enable = true ; for ( int i = 0 ; i < 3 ; + + i ) { boolean cond = true ; for ( int j = 1 ; j < 3 ; + + j ) { if ( c [ i ] [ j ] ! = c [ i ] [ 0 ] ) { cond = false ; } } if ( ! cond ) { enable = false ; break ; } } System . out . println ( ( enable ? " Yes " : " No " ) ) ; } void calc ( ) { } void showResult ( ) { } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; void solve ( ) throws IOException { int x = ni ( ) ; long ans = 2 ; for ( int i = 0 ; i < x ; i + + ) { ans + + ; ans * = 2 ; } out . println ( ans ) ; } String ns ( ) throws IOException { while ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) , " " ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( ns ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( ns ( ) ) ; } double nd ( ) throws IOException { return Double . parseDouble ( ns ( ) ) ; } String [ ] nsa ( int n ) throws IOException { String [ ] res = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ns ( ) ; } return res ; } int [ ] nia ( int n ) throws IOException { int [ ] res = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ni ( ) ; } return res ; } long [ ] nla ( int n ) throws IOException { long [ ] res = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nl ( ) ; } return res ; } public static void main ( String [ ] args ) throws IOException { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; tok = new StringTokenizer ( " " ) ; Main main = new Main ( ) ; main . solve ( ) ; out . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int num = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) num + + ; } } System . out . println ( num ) ; } } import java . util . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) { int x = 0 ; Scanner input = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = input . nextInt ( ) ; } for ( int j = 0 ; j < 3 ; j + + ) { x = x + a [ j ] ; } if ( x = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] ary = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) { ary [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int min = 2000000 ; int max = 0 ; for ( int i = 0 ; i < a ; i + + ) { if ( ary [ i ] < min ) { ans + + ; min = ary [ i ] ; } else if ( true ) { } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int oto [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { oto [ i ] = sc . nextInt ( ) ; } if ( oto [ 0 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 0 ] ; oto [ 0 ] = toriaezu ; } if ( oto [ 2 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 2 ] ; oto [ 2 ] = toriaezu ; } if ( oto [ 0 ] = = 5 & & oto [ 1 ] = = 7 & & oto [ 2 ] = = 5 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - i - j & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; sum = ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] level = new int [ n ] ; int count = 1 ; int min = 0 ; for ( int i = 0 ; i < n ; i + + ) { level [ i ] = input . nextInt ( ) ; if ( i = = 0 ) { min = level [ 0 ] ; } else { if ( level [ i ] < = min ) { count + + ; min = level [ i ] ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) for ( int j = 0 ; j < = k ; j + + ) if ( s - i - j > = 0 & & s - i - j < = k ) ans + + ; System . out . println ( ans ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double hk = ( ( h / 12 ) * 360 ) + ( ( m / 60 ) * 30 ) ; double mk = 360 * ( m / 60 ) ; double k = 0 ; if ( mk > = hk ) { k = mk - hk ; } else { k = hk - mk ; } if ( k > = 180 ) { k = 360 - k ; } double cosk = Math . cos ( Math . toRadians ( k ) ) ; double c = ( a * a ) + ( b * b ) - ( 2 * a * b * cosk ) ; System . out . println ( Math . sqrt ( c ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; B solver = new B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = Integer . parseInt ( in . next ( ) ) ; int [ ] [ ] ans = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i + + ) { int cnt = 0 ; int tmp = i + 1 ; while ( tmp > = 1 ) { if ( tmp % 2 = = 0 ) { cnt + + ; tmp / = 2 ; } else { break ; } } ans [ i ] [ 0 ] = i + 1 ; ans [ i ] [ 1 ] = cnt ; } Arrays . sort ( ans , ( x , y ) - > Integer . compare ( x [ 1 ] , y [ 1 ] ) ) ; out . println ( ans [ n - 1 ] [ 0 ] ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ab = Math . abs ( b - a ) ; int bc = Math . abs ( c - b ) ; int ca = Math . abs ( a - c ) ; if ( a < = b & & b < = c ) { System . out . println ( ab + bc ) ; } else if ( a < = c & & c < = b ) { System . out . println ( ca + bc ) ; } else if ( b < = a & & a < = c ) { System . out . println ( ab + ca ) ; } else if ( b < = c & & c < = a ) { System . out . println ( bc + ca ) ; } else if ( c < = a & & a < = b ) { System . out . println ( ca + ab ) ; } else if ( c < = b & & b < = a ) { System . out . println ( bc + ab ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k , s , ans = 0 ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 0 ; i < = k ; + + i ) { for ( int j = 0 ; j < = k ; + + j ) { int tmp = s - i - j ; if ( tmp > = 0 & & tmp < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i < = N ; i * = 2 ) { ans = Math . max ( ans , i ) ; } System . out . println ( ans ) ; } } 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 . math . BigDecimal ; import java . math . BigInteger ; import java . util . InputMismatchException ; import java . util . Scanner ; import java . util . StringTokenizer ; public class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws IOException { while ( in . hasNext ( ) ) { int [ ] a = new int [ 4 + 1 ] ; int [ ] vis = new int [ 11 ] ; for ( int i = 1 ; i < = 4 ; i + + ) { a [ i ] = in . nextInt ( ) ; vis [ a [ i ] ] + + ; } if ( vis [ 1 ] = = 1 & & vis [ 7 ] = = 1 & & vis [ 9 ] = = 1 & & vis [ 4 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] grid = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { grid [ i ] [ j ] = sc . nextInt ( ) ; } } boolean b = true ; for ( int i = 0 ; i < 3 ; i + + ) { int x = 0 ; int y = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { int bX = grid [ j ] [ i ] - grid [ j ] [ ( ( i + 1 ) % 3 ) ] ; int bY = grid [ i ] [ j ] - grid [ ( ( i + 1 ) % 3 ) ] [ j ] ; if ( j = = 0 ) { x = bX ; y = bY ; } else { b & = x = = bX ; b & = y = = bY ; } if ( ! b ) break ; } if ( ! b ) break ; } System . out . println ( b ? " Yes " : " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 6 ] ; for ( int i = 0 ; i < array . length ; i + + ) array [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( array [ j ] - array [ i ] > array [ array . length - 1 ] ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . Set ; import java . util . function . Consumer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { String str [ ] = br . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( str [ j ] ) ; } } for ( int i = 0 ; i < 3 ; i + + ) { int s = c [ ( i + 1 ) % 3 ] [ 0 ] - c [ i ] [ 0 ] ; int t = c [ ( i + 1 ) % 3 ] [ 1 ] - c [ i ] [ 1 ] ; int u = c [ ( i + 1 ) % 3 ] [ 2 ] - c [ i ] [ 2 ] ; if ( s ! = t | | t ! = u | | u ! = s ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double theta = ( double ) Math . abs ( ( H * 30 + 0.5 * M ) - M * 6 ) ; if ( theta > = 180 ) { theta = ( double ) 360.0 - theta ; } double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( theta ) ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int res = 0 ; for ( int i = 0 ; i < N ; i + + ) { int P = sc . nextInt ( ) ; if ( P < = min ) { res + + ; min = P ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) , r = sc . nextInt ( ) ; int a = r - h ; if ( a = = 2 * r ) { System . out . println ( 0 ) ; } else if ( a > 2 * r ) { System . out . println ( - 1 ) ; } else { System . out . println ( 1 ) ; } } } public class Main { public static void main ( String [ ] args ) { java . util . Scanner s = new java . util . Scanner ( System . in ) ; Integer c [ ] [ ] = new Integer [ 3 ] [ 3 ] ; int max = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int pos = c [ i ] [ j ] = s . nextInt ( ) ; max = Math . max ( max , pos ) ; } } System . out . println ( Main . calc ( c , max ) ? " Yes " : " No " ) ; } public static boolean calc ( Integer c [ ] [ ] , int max ) { for ( int a1 = 0 ; a1 < = max & & a1 < = 100 ; a1 + + ) { int b1 = c [ 0 ] [ 0 ] - a1 ; if ( 0 > b1 | | b1 > 100 ) { continue ; } for ( int a2 = 0 ; a2 < = max & & a2 < = 100 ; a2 + + ) { int b2 = c [ 1 ] [ 1 ] - a2 ; if ( 0 > b2 | | b2 > 100 ) { continue ; } for ( int a3 = 0 ; a3 < = max & & a3 < = 100 ; a3 + + ) { int b3 = c [ 2 ] [ 2 ] - a3 ; if ( 0 > b3 | | b3 > 100 ) { continue ; } if ( c [ 0 ] [ 1 ] = = a1 + b2 & & c [ 0 ] [ 2 ] = = a1 + b3 & & c [ 1 ] [ 0 ] = = a2 + b1 & & c [ 2 ] [ 0 ] = = a3 + b1 & & c [ 2 ] [ 1 ] = = a3 + b2 & & c [ 1 ] [ 2 ] = = a2 + b3 ) { return true ; } } } } return false ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int current = sc . nextInt ( ) ; int mini = current , maxi = current , distance = 0 ; do { int res = Math . max ( Math . abs ( current - mini ) , Math . abs ( current - maxi ) ) ; if ( res > distance ) { distance = res ; } current = sc . nextInt ( ) ; } while ( sc . hasNext ( ) ) ; if ( distance > current ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int all = 1 ; while ( all < = N ) { all * = 2 ; } if ( all > N ) { System . out . println ( all / 2 ) ; } else { System . out . println ( all ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = " " ; int p = 0 ; int w = 0 ; int g = 0 ; int y = 0 ; for ( int i = 0 ; i < n ; i + + ) { s = sc . next ( ) ; if ( s . equals ( " P " ) & & p = = 0 ) { p = 1 ; } else if ( s . equals ( " W " ) & & w = = 0 ) { w = 1 ; } else if ( s . equals ( " G " ) & & g = = 0 ) { g = 1 ; } else if ( s . equals ( " Y " ) & & y = = 0 ) { y = 1 ; } } System . out . println ( ( p + w + g + y ) = = 3 ? " Three " : " Four " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ar [ ] = new int [ 5 ] ; boolean what = true ; for ( int i = 0 ; i < 5 ; i + + ) { ar [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < ar . length - 1 ; i + + ) { for ( int j = i ; j < ar . length - 1 ; j + + ) { if ( Math . abs ( ( ar [ i ] - ar [ j + 1 ] ) ) > k ) { what = false ; break ; } } if ( what = = false ) break ; } if ( what = = false ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; + + i ) p [ i ] = sc . nextInt ( ) ; int ans = 0 ; int min = p [ 0 ] ; for ( int i = 0 ; i < n ; + + i ) { if ( p [ i ] < = min ) { min = p [ i ] ; + + ans ; } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( Math . abs ( a [ 1 ] - a [ 0 ] ) + Math . abs ( a [ 2 ] - a [ 1 ] ) ) ; } } public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; System . out . println ( e - a < = scanner . nextInt ( ) ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; x [ 0 ] = sc . nextInt ( ) ; x [ 1 ] = sc . nextInt ( ) ; x [ 2 ] = sc . nextInt ( ) ; x [ 3 ] = sc . nextInt ( ) ; x [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 - 1 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( x [ i ] - x [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( ! ( Z > = 0 & & Z < = K ) ) { continue ; } count + + ; } } System . out . println ( count ) ; } } } import java . util . * ; import java . util . stream . Collectors ; public class Main { public static void main ( String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; solve ( scanner ) ; } static void solve ( Scanner scanner ) { int N = scanner . nextInt ( ) ; long X = scanner . nextLong ( ) ; scanner . nextLine ( ) ; int [ ] a = Arrays . stream ( scanner . nextLine ( ) . split ( " " ) ) . mapToInt ( Integer : : parseInt ) . toArray ( ) ; long [ ] [ ] min = new long [ N ] [ N ] ; for ( int i = 0 ; i < N ; i + + ) { Arrays . fill ( min [ i ] , Long . MAX _ VALUE / 2 ) ; min [ i ] [ i ] = a [ i ] ; } for ( int i = 1 ; i < N ; i + + ) { for ( int l = 0 ; l < N ; l + + ) { min [ l ] [ Math . floorMod ( l + i , N ) ] = Math . min ( min [ l ] [ Math . floorMod ( l + i - 1 , N ) ] , a [ Math . floorMod ( l + i , N ) ] ) ; } } long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { long tmp = i * X ; for ( int j = 0 ; j < N ; j + + ) { tmp + = min [ Math . floorMod ( j - i , N ) ] [ j ] ; } ans = Math . min ( ans , tmp ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > colors = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { colors . add ( sc . next ( ) ) ; } if ( colors . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 9 ] ; boolean key = false ; for ( int i = 0 ; i < 9 ; i + + ) num [ i ] = sc . nextInt ( ) ; for ( int a1 = 0 ; a1 < = 100 ; a1 + + ) { int b1 = num [ 0 ] - a1 ; int b2 = num [ 1 ] - a1 ; int b3 = num [ 2 ] - a1 ; int a2 = num [ 3 ] - b1 ; int a3 = num [ 6 ] - b1 ; if ( a2 + b2 = = num [ 4 ] & & a2 + b3 = = num [ 5 ] & & a3 + b2 = = num [ 7 ] & & a3 + b3 = = num [ 8 ] ) { key = true ; break ; } } System . out . println ( key ? " Yes " : " No " ) ; } } import java . time . chrono . MinguoChronology ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int count = 0 ; count < 4 ; count + + ) { list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; list . add ( d ) ; } int mitasu = 0 ; int countAns = 0 ; boolean one = false ; boolean seven = false ; boolean nine = false ; boolean forth = false ; for ( int youso : list ) { if ( youso = = 1 & & ! one ) { one = true ; countAns + + ; } if ( youso = = 7 & & ! seven ) { seven = true ; countAns + + ; } if ( youso = = 9 & & ! nine ) { nine = true ; countAns + + ; } if ( youso = = 7 & & ! forth ) { forth = true ; countAns + + ; } } if ( countAns = = 4 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double mm = h + ( m / 60.0 ) ; double cc = Math . cos ( ( 5 * mm - m ) * Math . PI / 30.0 ) ; double z = Math . sqrt ( a * a * 1.0 + b * b - 2.0 * a * b * cc ) ; System . out . println ( z ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int v [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) v [ i ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( ( v [ 4 ] - v [ 0 ] < = k ) ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double t = h * 60 + m ; double diff = Math . abs ( t / 720 - m / 60 ) ; diff = Math . min ( diff , 1 - diff ) ; double ans = a * a + b * b ; ans - = 2 * a * b * Math . cos ( diff * 2 * Math . PI ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner stdIn = new Scanner ( System . in ) ; double A = stdIn . nextInt ( ) ; double B = stdIn . nextInt ( ) ; double H = stdIn . nextInt ( ) ; double W = stdIn . nextInt ( ) ; double a = W * 6 - ( H * 30 + W * 0.5 ) ; a = Math . abs ( a ) ; if ( a > 180 ) a = 360 - a ; System . out . println ( Math . sqrt ( ( A * A + B * B ) - 2 * A * B * Math . cos ( Math . toRadians ( a ) ) ) ) ; } } import java . lang . reflect . Array ; import java . util . * ; public class Main { static int N ; static int K ; static long Q ; static int A ; static int B ; static long C ; static double min = 9999999 ; static long ans = 0 ; public static void main ( String [ ] args ) { if ( get ( ) ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } public static boolean get ( ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; int D = scanner . nextInt ( ) ; int E = scanner . nextInt ( ) ; int K = scanner . nextInt ( ) ; if ( B - A > K ) return false ; if ( C - A > K ) return false ; if ( D - A > K ) return false ; if ( E - A > K ) return false ; if ( C - B > K ) return false ; if ( D - B > K ) return false ; if ( E - B > K ) return false ; if ( D - C > K ) return false ; if ( E - C > K ) return false ; if ( E - D > K ) return false ; return true ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputs = input . readLine ( ) . split ( " " ) ; int A = Integer . parseInt ( inputs [ 0 ] ) ; int B = Integer . parseInt ( inputs [ 1 ] ) ; int C = Integer . parseInt ( inputs [ 2 ] ) ; int [ ] syllables = new int [ ] { A , B , C } ; int numOf5 = 0 ; int numOf7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( syllables [ i ] = = 5 ) { numOf5 + = 1 ; } else if ( syllables [ i ] = = 7 ) { numOf7 + = 1 ; } } if ( numOf5 = = 2 & & numOf7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > dis = new ArrayList < Integer > ( ) ; String judge ; for ( int i = 0 ; i < 5 ; i + + ) { dis . add ( Integer . parseInt ( sc . next ( ) ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; int max = Collections . max ( dis ) ; int min = Collections . min ( dis ) ; int flag = max - min ; if ( flag > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Math . abs ( a - e ) < = k ) { System . out . println ( " Yay ! " ) ; return ; } System . out . println ( " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; int cntmax = - 1 ; int cnt , ii ; int imax = 0 ; for ( int i = 1 ; i < = n ; i + + ) { cnt = 0 ; ii = i ; while ( true ) { if ( ii % 2 = = 1 ) break ; ii = ii / 2 ; cnt + + ; } if ( cnt > cntmax ) { cntmax = cnt ; imax = i ; } } System . out . println ( imax ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; int [ ] a = new int [ ] { A , B , C , } ; Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) , S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int l = S - i - j ; if ( l > = 0 & & l < = K & & i + j + l = = S ) { count + + ; } } } System . out . println ( count ) ; } public static int sample ( int n ) { return n ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int e = Integer . parseInt ( br . readLine ( ) ) ; int k = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; } } } import java . util . Scanner ; import java . util . InputMismatchException ; class Main { public static void main ( String args [ ] ) { int x [ ] = new int [ 6 ] ; try { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 6 ; i + + ) { x [ i ] = scanner . nextInt ( ) ; } scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( " error " ) ; } if ( x [ 4 ] - x [ 0 ] > x [ 5 ] ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; int [ ] pArray = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { pArray [ i ] = sc . nextInt ( ) ; } int min = pArray [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( pArray [ i ] < min ) { count + + ; min = pArray [ i ] ; } } System . out . println ( count ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; if ( list . contains ( 5 ) ) { list . remove ( list . indexOf ( 5 ) ) ; if ( list . contains ( 5 ) ) { list . remove ( list . indexOf ( 5 ) ) ; if ( list . contains ( 7 ) ) { list . remove ( list . indexOf ( 7 ) ) ; System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long mins = h * 60 + m ; double fen = mins * 6 % 360 ; double shi = mins * 0.5 % 360 ; double diff = ( ( shi - fen + 360 ) % 360 ) ; double res = 0.0 ; if ( diff = = 0 ) { System . out . println ( Math . abs ( a - b ) ) ; return ; } else if ( diff = = 180 ) { System . out . println ( a + b ) ; return ; } else if ( diff > 180 ) { diff = 360 - diff ; } double res2 = a * a + b * b - 2.0 * a * b * Math . cos ( Math . toRadians ( diff ) ) ; System . out . println ( Math . sqrt ( res2 ) ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > plist = new ArrayList < > ( ) ; plist . add ( sc . nextInt ( ) ) ; plist . add ( sc . nextInt ( ) ) ; plist . add ( sc . nextInt ( ) ) ; plist . add ( sc . nextInt ( ) ) ; Collections . sort ( plist ) ; if ( plist . get ( 0 ) = = 1 & & plist . get ( 1 ) = = 4 & & plist . get ( 2 ) = = 7 & & plist . get ( 3 ) = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( ( 2 * ans ) < = n ) { ans * = 2 ; } else { break ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String line = in . nextLine ( ) ; in . close ( ) ; String [ ] ary = line . split ( " " ) ; boolean w7 = false ; boolean [ ] w5 = { false , false } ; for ( String w : ary ) { int intW = Integer . parseInt ( w . trim ( ) ) ; if ( intW ! = 5 & & intW ! = 7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 5 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 = = false ) { w7 = true ; } else if ( intW = = 5 ) { if ( w5 [ 0 ] = = false ) { w5 [ 0 ] = true ; } else if ( w5 [ 1 ] = = false ) { w5 [ 1 ] = true ; } } } if ( w7 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double ra = H / 12.0 ; double rb = M / 60.0 ; ra + = 1 / 12.0 * rb ; double a = ( Math . max ( ra , rb ) - Math . min ( ra , rb ) ) * 360 ; if ( a > 180 ) { a = 360 - a ; } double cosA = Math . cos ( Math . toRadians ( a ) ) ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * cosA ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int [ ] a = new int [ 3 ] ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; sum = ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( sum ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String a = " Three " ; for ( int i = 1 ; i < = n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) a = " Four " ; } System . out . println ( a ) ; } } import java . util . Scanner ; import java . util . Vector ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] sequence = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { sequence [ i ] = sc . nextInt ( ) ; } int koike = 1 ; int tanaka = 0 ; int min = sequence [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = sequence [ i ] ) { tanaka + + ; } min = Math . min ( min , sequence [ i ] ) ; } System . out . println ( tanaka ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) ; int A2 = sc . nextInt ( ) ; int A3 = sc . nextInt ( ) ; int max = Math . max ( Math . max ( A1 , A2 ) , Math . max ( A2 , A3 ) ) ; int min = Math . min ( Math . min ( A1 , A2 ) , Math . min ( A2 , A3 ) ) ; int mid = A1 + A2 + A3 - min - max ; System . out . println ( Math . abs ( min - mid ) + Math . abs ( mid - max ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] w = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; out : for ( int i = N ; i > 0 ; i -- ) { for ( int j = w . length - 1 ; j > = 0 ; j -- ) { if ( i = = w [ j ] ) { System . out . println ( w [ j ] ) ; break out ; } } } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int [ ] D = new int [ N ] ; long sumA = 0 ; long sumB = 0 ; long diff = 0 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; sumA + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; sumB + = B [ i ] ; D [ i ] = B [ i ] - A [ i ] ; if ( A [ i ] < B [ i ] ) { diff + = B [ i ] - A [ i ] ; count + + ; } } sc . close ( ) ; Arrays . sort ( D ) ; if ( sumA < sumB ) { System . out . println ( - 1 ) ; } else { int idx = 0 ; while ( diff > 0 ) { diff + = D [ idx ] ; count + + ; idx + + ; } System . out . println ( count ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) arr [ i ] = in . nextInt ( ) ; Arrays . sort ( arr ) ; if ( isHaiku ( arr ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static boolean isHaiku ( int [ ] arr ) { int [ ] haiku = { 5 , 5 , 7 } ; for ( int i = 0 ; i < 3 ; i + + ) if ( arr [ i ] ! = haiku [ i ] ) return false ; return true ; } static class InputReader { public BufferedReader br ; public StringTokenizer st ; public InputReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = null ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) counter + + ; } } System . out . println ( counter ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String abc = " " + a + b + c ; String ans = " NO " ; if ( a + b + c = = 17 ) { if ( abc . contains ( " 7 " ) & & abc . contains ( " 5 " ) ) { ans = " YES " ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double mangle = ( 360.0 / 60.0 ) * M ; double hangle = ( 30.0 * H ) + ( 30.0 / 360.0 ) * mangle ; double angle = Math . abs ( mangle - hangle ) ; if ( angle > 180 ) angle = 360 - angle ; double ans = A * A + B * B - 2 * A * B * Math . cos ( angle * ( Math . PI / 180 ) ) ; ans = Math . sqrt ( ans ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( scanner . next ( ) ) ; } int k = Integer . parseInt ( scanner . next ( ) ) ; scanner . close ( ) ; String message ; if ( Math . abs ( a [ 0 ] - a [ 4 ] ) < = k ) { message = " Yay ! " ; } else { message = " : ( " ; } System . out . println ( message ) ; System . out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double theta1 = 2 * Math . PI * ( h * 60 + m ) / 720 ; double theta2 = 2 * Math . PI * m / 60 ; double x1 = a * Math . cos ( theta1 ) ; double y1 = a * Math . sin ( theta1 ) ; double x2 = b * Math . cos ( theta2 ) ; double y2 = b * Math . sin ( theta2 ) ; System . out . println ( Math . sqrt ( Math . pow ( x1 - x2 , 2 ) + Math . pow ( y1 - y2 , 2 ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] antenna = { Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . next ( ) ) } ; int range = Integer . parseInt ( sc . next ( ) ) ; boolean result = true ; for ( int i = 0 ; i < antenna . length - 1 ; i + + ) { for ( int j = i + 1 ; j < antenna . length ; j + + ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > range ) { result = false ; } } } System . out . println ( result ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] n = new int [ 4 ] ; for ( int i = 0 ; i < N ; i + + ) { String t = sc . next ( ) ; if ( t . compareTo ( " P " ) = = 0 ) n [ 0 ] + + ; if ( t . compareTo ( " W " ) = = 0 ) n [ 1 ] + + ; if ( t . compareTo ( " G " ) = = 0 ) n [ 2 ] + + ; if ( t . compareTo ( " Y " ) = = 0 ) n [ 3 ] + + ; } int res = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( n [ i ] > 0 ) res + + ; } if ( res = = 3 ) System . out . println ( " Three " ) ; else if ( res = = 4 ) System . out . println ( " Four " ) ; } } import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Map < Character , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { map . put ( sc . next ( ) . charAt ( 0 ) , 0 ) ; } Object [ ] array = map . keySet ( ) . toArray ( ) ; if ( array . length = = 4 ) System . out . println ( " Four " ) ; else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double angleM = ( ( double ) M / 60 ) * 360 ; double tmpM = ( ( double ) M / 60 ) * 30 ; ; double angleH = ( double ) ( H * 30 + tmpM ) ; double theta = angleH - angleM ; if ( theta > 180 ) theta = angleM - angleH ; double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( theta ) ) ; double r _ ans = Math . sqrt ( ans ) ; System . out . println ( r _ ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } b [ 0 ] = c [ 0 ] [ 0 ] - a [ 0 ] ; b [ 1 ] = c [ 0 ] [ 1 ] - a [ 0 ] ; b [ 2 ] = c [ 0 ] [ 2 ] - a [ 0 ] ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; import java . util . Collections ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list ) ; System . out . println ( list . get ( 2 ) - list . get ( 0 ) ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int size = in . nextInt ( ) ; ArrayList < Long > list = new ArrayList < Long > ( ) ; for ( int x = 0 ; x < size ; x + + ) { list . add ( in . nextLong ( ) ) ; } long minimum = 2 ; long counter = list . get ( 0 ) - 1 ; for ( int x = 1 ; x < size ; x + + ) { long num = list . get ( x ) ; if ( num % minimum = = 0 ) { counter + = ( num / minimum ) - 1 ; list . set ( x , minimum ) ; } else { counter + = ( num / minimum ) ; list . set ( x , list . get ( x ) % minimum ) ; } if ( list . get ( x ) - minimum = = 0 & & num = = minimum ) { minimum + + ; } } System . out . println ( counter ) ; in . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int H = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; double x2 = A * A + B * B - 2 * A * B * ( Math . cos ( Math . toRadians ( 30 * H + ( double ) ( M / 2.0 ) - 6 * M ) ) ) ; double ans = Math . sqrt ( x2 ) ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; scan . close ( ) ; String [ ] ks = str . split ( " " ) ; int n = 0 ; int k = Integer . parseInt ( ks [ 0 ] ) ; int s = Integer . parseInt ( ks [ 1 ] ) ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { n + + ; } } } System . out . println ( n ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] anntena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { anntena [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " Yay ! " ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i ; j < 5 ; j + + ) { int distance = anntena [ j ] - anntena [ i ] ; if ( distance > k ) { ans = " : ( " ; break ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int K = keyboard . nextInt ( ) ; int S = keyboard . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( 0 < = S - ( i + j ) & & S - ( i + j ) < = K ) { ans + + ; } } } System . out . println ( ans ) ; keyboard . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; boolean hasYellow = false ; for ( int i = 0 ; i < count ; i + + ) { String color = sc . next ( ) ; if ( color . equals ( " Y " ) ) hasYellow = true ; } if ( hasYellow ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { int input = sc . nextInt ( ) ; list . add ( input ) ; } Collections . sort ( list ) ; int diff = list . get ( 4 ) - list . get ( 0 ) ; int k = sc . nextInt ( ) ; if ( diff < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } class Pair < T1 , T2 > { private T1 left ; private T2 right ; public Pair ( T1 left , T2 right ) { this . left = left ; this . right = right ; } public T1 getLeft ( ) { return this . left ; } public T2 getRight ( ) { return this . right ; } @ Override public boolean equals ( Object object ) { Pair pair = ( Pair ) object ; if ( pair . getLeft ( ) . equals ( this . getLeft ( ) ) & & pair . getRight ( ) . equals ( this . getRight ( ) ) ) { return true ; } return false ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double degree = Math . abs ( 30 * h - 5.5 * m ) ; if ( degree > 180 ) { degree = 360 - degree ; } double hudu = degree * ( Math . PI / 180 ) ; double c = Math . sqrt ( b * b + a * a - 2 * a * b * Math . cos ( hudu ) ) ; System . out . println ( c ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . sort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double cosC = 0 ; double h = ( H * 30 ) + ( M * 0.5 ) ; double s = M * 6 ; if ( h > s ) { cosC = h - s ; } else if ( h < s ) { cosC = s - h ; } double C = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( cosC ) ) ) ; System . out . println ( C ) ; } } import java . util . Scanner ; public class Main { static boolean [ ] isPrime ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; sc . close ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; System . exit ( 0 ) ; } long ans = 1 ; long t = ( long ) Math . pow ( P , ( double ) 1 / N ) ; t + = 2 ; for ( long k = 2 ; k < = t ; k + + ) { long s = ( long ) Math . pow ( k , N ) ; if ( P % s = = 0 ) { ans = k ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int max = 0 ; int highest = 1 ; for ( int i = 1 ; i < n + 1 ; i + + ) { int x = i ; int ans = 0 ; while ( x % 2 = = 0 ) { x / = 2 ; ans + = 1 ; if ( x = = 0 ) { break ; } } if ( max < ans ) { max = ans ; highest = i ; } } System . out . print ( highest ) ; } } 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 ( ) ; sc . close ( ) ; long sum _ N = 1 ; long sum _ M = 1 ; long ans = 0 ; int l = ( int ) Math . pow ( 10 , 9 ) + 7 ; if ( Math . abs ( N - M ) < 2 ) { for ( int i = 1 ; i < = N ; i + + ) { sum _ N = sum _ N * i % l ; } for ( int j = 1 ; j < = M ; j + + ) { sum _ M = sum _ M * j % l ; } if ( N = = M ) { ans = ( sum _ N * sum _ M * 2 ) % l ; } else { ans = ( sum _ N * sum _ M ) % l ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int num = 1 ; while ( num * 2 < = n ) { num = num * 2 ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( e - a > k ) flag = true ; if ( flag ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt = 0 ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; void solve ( ) throws IOException { int [ ] arr = nia ( 3 ) ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } String ns ( ) throws IOException { while ( ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) , " " ) ; } return tok . nextToken ( ) ; } int ni ( ) throws IOException { return Integer . parseInt ( ns ( ) ) ; } long nl ( ) throws IOException { return Long . parseLong ( ns ( ) ) ; } double nd ( ) throws IOException { return Double . parseDouble ( ns ( ) ) ; } String [ ] nsa ( int n ) throws IOException { String [ ] res = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ns ( ) ; } return res ; } int [ ] nia ( int n ) throws IOException { int [ ] res = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = ni ( ) ; } return res ; } long [ ] nla ( int n ) throws IOException { long [ ] res = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { res [ i ] = nl ( ) ; } return res ; } public static void main ( String [ ] args ) throws IOException { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; tok = new StringTokenizer ( " " ) ; Main main = new Main ( ) ; main . solve ( ) ; out . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 0 ; int ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int count = 0 ; int temp = i ; while ( true ) { if ( temp % 2 = = 0 ) { temp = temp / 2 ; count + + ; } else { break ; } } if ( count > max ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String n = sc . nextLine ( ) ; sc . close ( ) ; boolean judge = n . contains ( " 1 " ) & & n . contains ( " 9 " ) & & n . contains ( " 7 " ) & & n . contains ( " 4 " ) ; String result = judge ? " YES " : " NO " ; System . out . println ( result ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { num [ i ] = keyboard . nextInt ( ) ; } int K = keyboard . nextInt ( ) ; String ans = " Yay ! " ; for ( int j = 0 ; j < 4 ; j + + ) { for ( int k = 1 ; k < 5 ; k + + ) { if ( num [ k ] - num [ j ] > K ) { ans = " : ( " ; } } } System . out . println ( ans ) ; keyboard . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double ax , ay , bx , by , arad , brad ; arad = ( 1 / 2 - h / 6 - m / 360 ) * Math . PI ; brad = ( 1 / 2 - m / 30 ) * Math . PI ; ax = a * Math . cos ( arad ) ; bx = b * Math . cos ( brad ) ; ay = a * Math . sin ( arad ) ; by = b * Math . sin ( brad ) ; System . out . println ( Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int kari = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; if ( kari = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] & & kari = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) { kari = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; if ( kari = = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] & & kari = = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; boolean existsY = false ; for ( int i = 0 ; i < n ; i + + ) { if ( scanner . next ( ) . equals ( " Y " ) ) { existsY = true ; break ; } } if ( existsY ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int ans = 1 ; int count = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int divi = i ; int roop = 0 ; while ( divi % 2 = = 0 ) { divi = divi / 2 ; roop + + ; } if ( count < roop ) { count = roop ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 5 ] ; boolean t = true ; for ( int i = 0 ; i < 5 ; i + + ) { N [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int j = 0 ; j < 4 ; j + + ) { if ( Math . abs ( N [ 0 ] - N [ j + 1 ] ) > k ) { t = false ; } } for ( int j = 0 ; j < 3 ; j + + ) { if ( Math . abs ( N [ 1 ] - N [ j + 2 ] ) > k ) { t = false ; } } for ( int j = 0 ; j < 2 ; j + + ) { if ( Math . abs ( N [ 2 ] - N [ j + 3 ] ) > k ) { t = false ; } } if ( Math . abs ( N [ 3 ] - N [ 4 ] ) > k ) t = false ; if ( t = = true ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long K = sc . nextInt ( ) ; long S = sc . nextInt ( ) ; long res = 0 ; for ( long i = Math . min ( K , S ) ; i > = 0 ; i -- ) { long v = S - i ; if ( v < K ) res + = ( v + 1 ) ; else if ( v = = K ) res + = ( K + 1 ) ; else if ( v < = 2 * K ) { long a = v - K ; res + = K - a + 1 ; } } System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double o = 0 ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double x = sc . nextDouble ( ) ; double y = sc . nextDouble ( ) ; double d = 6 * y - ( 30 * x + y / 2 ) ; double cosin = Math . cos ( Math . toRadians ( d ) ) ; o = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * cosin ) ; System . out . println ( o ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 1 ; i < = N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Map . Entry ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; Scanner in = new Scanner ( System . in ) ; new Main ( ) . solve ( in , out ) ; in . close ( ) ; out . close ( ) ; } private void solve ( Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; HashMap < Integer , Integer > hash = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i < = N ; i + + ) { hash . put ( i , dividedCount ( i ) ) ; } List < Entry < Integer , Integer > > list _ entries = new ArrayList < Entry < Integer , Integer > > ( hash . entrySet ( ) ) ; Collections . sort ( list _ entries , new Comparator < Entry < Integer , Integer > > ( ) { public int compare ( Entry < Integer , Integer > obj1 , Entry < Integer , Integer > obj2 ) { return obj2 . getValue ( ) . compareTo ( obj1 . getValue ( ) ) ; } } ) ; System . out . println ( list _ entries . get ( 0 ) . getKey ( ) ) ; } private int dividedCount ( int n ) { if ( n % 2 ! = 0 | | n < = 1 ) return 0 ; return 1 + dividedCount ( n / 2 ) ; } } import static java . lang . System . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( in ) ; int n = s . nextInt ( ) ; int cur = 1 ; int max = 0 ; for ( int x = 2 ; x < = n ; x + + ) { int exp = 1 ; while ( x % Math . pow ( 2 , exp ) = = 0 & & Math . pow ( 2 , exp ) < x ) exp + + ; if ( exp > max ) { max = exp ; cur = x ; } } out . println ( cur ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Double A = sc . nextDouble ( ) ; Double B = sc . nextDouble ( ) ; Double H = sc . nextDouble ( ) ; Double M = sc . nextDouble ( ) ; Double R = Math . abs ( ( H * 30 + M * 0.5 ) - ( M * 6 ) ) ; if ( R > 180 ) { R = 360 - R ; } Double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( R ) ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { private void doit ( ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = 3 ; int [ ] [ ] data = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { data [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flg = false ; for ( int i = 0 ; i < 101 ; i + + ) { for ( int j = 0 ; j < 101 ; j + + ) { for ( int k = 0 ; k < 101 ; k + + ) { if ( data [ 0 ] [ 0 ] - i = = data [ 0 ] [ 1 ] - j & & data [ 0 ] [ 0 ] - i = = data [ 0 ] [ 2 ] - k & & data [ 0 ] [ 1 ] - j = = data [ 0 ] [ 2 ] - k ) { if ( data [ 1 ] [ 0 ] - i = = data [ 1 ] [ 1 ] - j & & data [ 1 ] [ 0 ] - i = = data [ 1 ] [ 2 ] - k & & data [ 1 ] [ 1 ] - j = = data [ 1 ] [ 2 ] - k ) { if ( data [ 2 ] [ 0 ] - i = = data [ 2 ] [ 1 ] - j & & data [ 2 ] [ 0 ] - i = = data [ 2 ] [ 2 ] - k & & data [ 2 ] [ 1 ] - j = = data [ 2 ] [ 2 ] - k ) { flg = true ; break ; } } } } if ( flg ) break ; } if ( flg ) break ; } System . out . println ( flg ? " Yes " : " No " ) ; } } private void debug ( Object ... o ) { System . out . println ( " debug = " + Arrays . deepToString ( o ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . doit ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double hr = ( ( ( h * 60 ) + m ) / 720 ) * 360 * Math . PI / 180 ; double mr = ( m / 60 ) * 360 * Math . PI / 180 ; double ax = a * Math . cos ( hr ) ; double ay = a * Math . sin ( hr ) ; double bx = b * Math . cos ( mr ) ; double by = b * Math . sin ( mr ) ; double result = Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ; System . out . println ( result ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > minus = new ArrayList < > ( ) ; long sumM = 0 ; long sumP = 0 ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; PriorityQueue < Integer > plus = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { int a1 = a [ i ] ; int b1 = b [ i ] ; if ( b1 > a1 ) { minus . add ( b1 - a1 ) ; sumM + = ( long ) ( b1 - a1 ) ; } if ( a1 > b1 ) { plus . add ( a1 - b1 ) ; sumP + = ( long ) ( a1 - b1 ) ; } } if ( sumM > sumP ) { System . out . println ( - 1 ) ; return ; } if ( sumM = = 0 ) { System . out . println ( 0 ) ; return ; } int carry = 0 ; int change = minus . size ( ) ; for ( int m : minus ) { while ( carry < m ) { carry + = plus . poll ( ) ; change + + ; } carry - = m ; } System . out . println ( change ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; if ( a = = 5 ) { count _ 5 + + ; } else if ( a = = 7 ) { count _ 7 + + ; } if ( b = = 5 ) { count _ 5 + + ; } else if ( b = = 7 ) { count _ 7 + + ; } if ( c = = 5 ) { count _ 5 + + ; } else if ( c = = 7 ) { count _ 7 + + ; } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] list = { sc . next ( ) , sc . next ( ) , sc . next ( ) } ; int five _ count = 0 ; int seven _ count = 0 ; for ( String l : list ) { if ( l . equals ( " 5 " ) ) five _ count + + ; else if ( l . equals ( " 7 " ) ) seven _ count + + ; } if ( five _ count = = 2 & & seven _ count = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; br . readLine ( ) ; br . readLine ( ) ; br . readLine ( ) ; int e = Integer . parseInt ( br . readLine ( ) ) ; int k = Integer . parseInt ( br . readLine ( ) ) ; if ( e - a < = k ) bw . write ( " Yay ! " ) ; else bw . write ( " : ( " ) ; bw . close ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private static Scanner sc = new Scanner ( System . in ) ; private void run ( ) { int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int e = Integer . parseInt ( sc . next ( ) ) ; int k = Integer . parseInt ( sc . next ( ) ) ; if ( b - a > k | | c - a > k | | d - a > k | | e - a > k | | c - b > k | | d - b > k | | e - b > k | | d - c > k | | e - c > k | | e - d > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ) ; IrohaAndHaikuABCEdition solver = new IrohaAndHaikuABCEdition ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class IrohaAndHaikuABCEdition { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int array [ ] = { a , b , c } ; Arrays . sort ( array ) ; if ( array [ 0 ] = = 5 & & array [ 1 ] = = 5 & & array [ 2 ] = = 7 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } 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 . * ; public class Main { int ni ( ) { return cin . nextInt ( ) ; } long nl ( ) { return cin . nextLong ( ) ; } String line ( ) { return cin . nextLine ( ) ; } void println ( String str ) { System . out . println ( str ) ; } void print ( String str ) { System . out . print ( str ) ; } static final int MOD = 1000000007 ; Scanner cin = new Scanner ( System . in ) ; String output ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } public void run ( ) { input ( ) ; int res = solve ( ) ; output = res + " " ; println ( output ) ; } int n , m ; long [ ] x ; long [ ] y ; void input ( ) { n = ni ( ) ; m = ni ( ) ; x = new long [ n ] ; y = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = nl ( ) ; } for ( int j = 0 ; j < m ; j + + ) { y [ j ] = nl ( ) ; } } int solve ( ) { long xsum = 0 , ysum = 0 ; for ( int i = 0 ; i < n ; i + + ) { xsum + = x [ i ] * i - x [ i ] * ( n - i - 1 ) ; xsum % = MOD ; } for ( int i = 0 ; i < m ; i + + ) { ysum + = y [ i ] * i - y [ i ] * ( m - i - 1 ) ; ysum % = MOD ; } return ( int ) ( ( xsum * ysum ) % MOD ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] arr = new int [ 19 ] ; int a = s . nextInt ( ) ; arr [ a ] + + ; a = s . nextInt ( ) ; arr [ a ] + + ; a = s . nextInt ( ) ; arr [ a ] + + ; if ( arr [ 5 ] = = 2 & & arr [ 7 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > hina = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { hina . add ( sc . next ( ) ) ; } String ans = " Three " ; if ( hina . size ( ) = = 4 ) { ans = " Four " ; } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver solver = new Solver ( ) ; solver . init ( ) ; solver . readHead ( in . readLine ( ) ) ; } } class Solver { int N ; int cnt ; public void init ( ) { N = 0 ; cnt = 0 ; } public void readHead ( String str ) { String [ ] strArr = str . split ( " " ) ; int N1 = Integer . parseInt ( strArr [ 0 ] ) ; int N2 = Integer . parseInt ( strArr [ 1 ] ) ; int N3 = Integer . parseInt ( strArr [ 2 ] ) ; int N4 = Integer . parseInt ( strArr [ 3 ] ) ; boolean ans = true ; if ( N1 ! = 1 & & N2 ! = 1 & & N3 ! = 1 & & N4 ! = 1 ) ans = false ; if ( N1 ! = 9 & & N2 ! = 9 & & N3 ! = 9 & & N4 ! = 9 ) ans = false ; if ( N1 ! = 7 & & N2 ! = 7 & & N3 ! = 7 & & N4 ! = 7 ) ans = false ; if ( N1 ! = 4 & & N2 ! = 4 & & N3 ! = 4 & & N4 ! = 4 ) ans = false ; if ( ans ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public boolean hasNext ( ) { return cnt < N ; } public void readBody ( String str ) { cnt + + ; } public void solve ( ) { } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . text . DecimalFormat ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int jisin _ nagasa = sc . nextInt ( ) ; int hunsin _ nagasa = sc . nextInt ( ) ; int jikan = sc . nextInt ( ) ; int hun = sc . nextInt ( ) ; double jisin _ kakudo = ( jikan * 60 + hun ) * 0.5 ; double hunsin _ kakudo = hun * 6 ; double kakudo _ sa = 0 ; if ( jisin _ kakudo > hunsin _ kakudo ) { kakudo _ sa = jisin _ kakudo - hunsin _ kakudo ; } else { kakudo _ sa = hunsin _ kakudo - jisin _ kakudo ; } double b = jisin _ nagasa ; double c = hunsin _ nagasa ; double e = kakudo _ sa ; double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( c , 2 ) - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int j = 0 ; j = sc . nextInt ( ) ; if ( j = = 5 ) count5 + = 1 ; if ( j = = 7 ) count7 + = 1 ; } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ( System . in ) ) ; int N = sc . nextInt ( ) ; int a = 0 , b = 0 , c = 1 ; for ( int i = 1 ; i < = N ; i + + ) { int k = i ; while ( k % 2 = = 0 ) { k = k / 2 ; a + + ; } if ( b < a ) { b = a ; c = i ; } a = 0 ; } System . out . print ( c ) ; sc . close ( ) ; } } import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; final String [ ] sl = s . split ( " " ) ; int K = Integer . parseInt ( sl [ 0 ] ) ; int S = Integer . parseInt ( sl [ 1 ] ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( x + y < = S ) { int z = S - x - y ; if ( z < = K ) cnt + + ; } } } System . out . println ( cnt ) ; } } } import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String args [ ] ) throws IOException { int n = in . nextInt ( ) ; long [ ] a = new long [ n + 1 ] ; long [ ] b = new long [ n + 1 ] ; ArrayList < Long > list = new ArrayList < Long > ( ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = in . nextLong ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = in . nextLong ( ) ; if ( a [ i ] < b [ i ] ) { sum + = b [ i ] - a [ i ] ; ans + + ; } if ( a [ i ] > b [ i ] ) list . add ( ( a [ i ] - b [ i ] ) ) ; } Collections . sort ( list ) ; int pos = list . size ( ) ; for ( int i = pos - 1 ; i > = 0 ; i -- ) { if ( sum < = 0 ) break ; ans + + ; sum - = list . get ( i ) . longValue ( ) ; } if ( sum < = 0 ) System . out . println ( ans ) ; else System . out . println ( - 1 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; double A = keyboard . nextDouble ( ) ; double B = keyboard . nextDouble ( ) ; int H = keyboard . nextInt ( ) ; int M = keyboard . nextInt ( ) ; double h = H * 30 + M * 0.5 ; double m = M * 6 ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( h - m ) ) ) ) ; keyboard . close ( ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; final int N = Integer . parseInt ( sc . next ( ) ) ; int ans ; if ( N = = 1 ) { ans = 1 ; } else if ( N < 4 ) { ans = 2 ; } else if ( N < 8 ) { ans = 4 ; } else if ( N < 16 ) { ans = 8 ; } else if ( N < 32 ) { ans = 16 ; } else if ( N < 64 ) { ans = 32 ; } else { ans = 64 ; } out . println ( ans ) ; out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; boolean OK = false ; for ( long n = 1 ; n < = 3500 ; n + + ) { for ( long h = 1 ; h < = 3500 ; h + + ) { if ( n * ( 2 * h - N ) + h * ( 2 * n - N ) < = 0 ) continue ; if ( n * h * N % ( ( long ) 4 * n * h - n * N - h * N ) = = 0 ) { System . out . println ( h + " " + n + " " + ( n * h * N / ( ( long ) 4 * n * h - n * N - h * N ) ) ) ; OK = true ; break ; } } if ( OK ) break ; } } } import com . sun . corba . se . impl . orbutil . ObjectUtility ; import java . io . * ; import java . lang . reflect . Array ; import java . util . * ; public class Main { Random rand = new Random ( ) ; public void solve ( ) throws IOException { int n = nextInt ( ) ; int cnt = 1 ; while ( cnt < = n ) { cnt * = 2 ; } out . print ( cnt > > 1 ) ; } BufferedReader br ; StringTokenizer sc ; PrintWriter out ; public static void main ( String [ ] args ) throws IOException { Locale . setDefault ( Locale . US ) ; new Main ( ) . run ( ) ; } void run ( ) throws IOException { try { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } String nextToken ( ) throws IOException { while ( sc = = null | | ! sc . hasMoreTokens ( ) ) { try { sc = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { return null ; } } return sc . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . sort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double jisin = ( double ) H / 12 + ( double ) M / 60 / 12 ; double funsin = ( double ) M / 60 ; double kakudo = Math . PI * 2 * ( jisin - funsin ) ; double C = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( kakudo ) ) ; System . out . println ( C ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int fiveCount = 0 ; int sevenCount = 0 ; int inputCount = 0 ; while ( inputCount < 3 ) { int abc = sc . nextInt ( ) ; if ( abc = = 5 ) { fiveCount + + ; } else if ( abc = = 7 ) { sevenCount + + ; } inputCount + + ; } if ( fiveCount = = 2 & & sevenCount = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } finally { sc . close ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < > ( ) ; a . add ( 2 ) ; a . add ( 4 ) ; a . add ( 8 ) ; a . add ( 16 ) ; a . add ( 32 ) ; a . add ( 64 ) ; for ( int i = scan . nextInt ( ) ; i > = 1 ; i -- ) { if ( a . contains ( i ) ) { System . out . println ( i ) ; return ; } } System . out . println ( 1 ) ; scan . close ( ) ; } } import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { System . out . println ( solve ( ) ) ; } public static int solve ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] arr = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } int sum = 0 ; Queue < Integer > q = new PriorityQueue < > ( ) ; for ( int i = 0 ; i < arr . length ; i + + ) { q . add ( arr [ i ] ) ; if ( arr [ i ] < = q . peek ( ) ) { sum + + ; } } return sum ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int flag = 0 ; for ( int i = 0 ; i < a . length - 1 ; i + + ) { for ( int j = i ; j < a . length ; j + + ) { if ( a [ i ] - a [ j ] > k | | a [ j ] - a [ i ] > k ) { flag + + ; } } } if ( flag ! = 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; Integer [ ] numbs = { a , b , c , d } ; String strBl ; if ( Arrays . asList ( numbs ) . contains ( 1 ) & & Arrays . asList ( numbs ) . contains ( 9 ) & & Arrays . asList ( numbs ) . contains ( 7 ) & & Arrays . asList ( numbs ) . contains ( 4 ) ) { strBl = " YES " ; } else { strBl = " NO " ; } System . out . println ( strBl ) ; } } import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { private static String FOUR = " Four " ; private static String THREE = " Three " ; public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { String number = sc . nextLine ( ) ; List < String > arares = Arrays . asList ( sc . nextLine ( ) . split ( " " ) ) ; for ( String mark : arares ) { if ( isYellow ( mark ) ) { System . out . println ( FOUR ) ; return ; } ; } System . out . println ( THREE ) ; } } private static boolean isYellow ( String mark ) { return mark . equals ( HinaArareKind . YELLOW . getMark ( ) ) ; } private enum HinaArareKind { PINK ( " P " ) , WHITE ( " W " ) , GREEN ( " G " ) , YELLOW ( " Y " ) ; private String mark ; private HinaArareKind ( String mark ) { this . mark = mark ; } private String getMark ( ) { return mark ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = 3 ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = scan . nextInt ( ) ; } Arrays . sort ( array ) ; System . out . println ( ( ( array [ 0 ] = = 5 & & array [ 1 ] = = 5 ) & & array [ 2 ] = = 7 ) ? " YES " : " NO " ) ; } } import java . util . * ; import java . lang . * ; import java . math . * ; public class Main { static int [ ] parent ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long x = sc . nextInt ( ) ; long ans = 2 ; for ( int i = 0 ; i < x ; i + + ) { ans = ( ans + 1 ) * 2 ; } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int Pj = P [ 0 ] ; for ( int i = 0 ; i < N ; + + i ) { if ( P [ i ] < = Pj ) { + + count ; Pj = P [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( - sc . nextInt ( ) + ( sc . nextInt ( ) + sc . nextInt ( ) + sc . nextInt ( ) ) * 0 + sc . nextInt ( ) > sc . nextInt ( ) ? " : ( " : " Yay ! " ) ; } } import java . util . * ; import java . lang . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long inu = sc . nextLong ( ) ; long saru = sc . nextLong ( ) ; long ans = 1 ; if ( inu = = saru ) { for ( int i = 1 ; i < = inu ; i + + ) { ans = ( ans * i ) % 1000000007 ; } for ( int i = 1 ; i < = saru ; i + + ) { ans = ( ans * i ) % 1000000007 ; } ans = ( ans * 2 ) % 1000000007 ; System . out . println ( ans ) ; } else { if ( Math . abs ( inu - saru ) > = 2 ) { System . out . println ( 0 ) ; } else { for ( int i = 1 ; i < = inu ; i + + ) { ans = ( ans * i ) % 1000000007 ; } for ( int i = 1 ; i < = saru ; i + + ) { ans = ( ans * i ) % 1000000007 ; } System . out . println ( ans ) ; } } sc . close ( ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c1 = sc . nextInt ( ) ; int c2 = sc . nextInt ( ) ; int c3 = sc . nextInt ( ) ; int c4 = sc . nextInt ( ) ; int c5 = sc . nextInt ( ) ; int c6 = sc . nextInt ( ) ; int c7 = sc . nextInt ( ) ; int c8 = sc . nextInt ( ) ; int c9 = sc . nextInt ( ) ; int flag = 0 ; ArrayList < Integer > Aarray = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { Aarray . add ( 0 ) ; } ArrayList < Integer > Barray = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { Barray . add ( 0 ) ; } loop : for ( int i = 0 ; i < 100 ; i + + ) { Aarray . set ( 0 , i ) ; Barray . set ( 0 , c1 - Aarray . get ( 0 ) ) ; Barray . set ( 1 , c2 - Aarray . get ( 0 ) ) ; Barray . set ( 2 , c3 - Aarray . get ( 0 ) ) ; for ( int j = 0 ; j < 2 ; j + + ) { Aarray . set ( 1 , c4 - Barray . get ( j ) ) ; for ( int k = 0 ; k < 2 ; k + + ) { Aarray . set ( 2 , c7 - Barray . get ( k ) ) ; if ( Aarray . get ( 1 ) + Barray . get ( 1 ) = = c5 & & Aarray . get ( 1 ) + Barray . get ( 2 ) = = c6 & & Aarray . get ( 2 ) + Barray . get ( 1 ) = = c8 & & Aarray . get ( 2 ) + Barray . get ( 2 ) = = c9 ) { flag + + ; break loop ; } } } } if ( flag = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int s1 = c [ 0 ] [ 1 ] + c [ 0 ] [ 2 ] + c [ 1 ] [ 2 ] ; int s2 = c [ 1 ] [ 0 ] + c [ 2 ] [ 0 ] + c [ 2 ] [ 1 ] ; int s = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; if ( s1 + s2 = = 2 * s ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int N = gi ( ) ; int [ ] P = new int [ N ] ; int min = Integer . MAX _ VALUE ; int c = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = gi ( ) ; if ( min > P [ i ] ) { min = P [ i ] ; c + + ; } } System . out . println ( c ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ; ) { List < Integer > list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { list . add ( Integer . parseInt ( scan . next ( ) ) ) ; } int k = Integer . parseInt ( scan . next ( ) ) ; List < Integer > revList = new ArrayList < Integer > ( list ) ; for ( Integer num : list ) { for ( Integer rev : revList ) { if ( rev - num > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; boolean [ ] k = new boolean [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 1 ) k [ 0 ] = true ; if ( n = = 9 ) k [ 1 ] = true ; if ( n = = 7 ) k [ 2 ] = true ; if ( n = = 4 ) k [ 3 ] = true ; } boolean ans = true ; for ( int i = 0 ; i < 4 ; i + + ) { ans & = k [ i ] ; } System . out . println ( ans ? " YES " : " NO " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] abc = { a , b , c } ; Arrays . sort ( abc ) ; boolean result = abc [ 0 ] = = 5 & & abc [ 1 ] = = 5 & & abc [ 2 ] = = 7 ; System . out . println ( result ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int m1 = Math . min ( a , Math . min ( b , c ) ) ; int m2 = Math . max ( a , Math . max ( b , c ) ) ; int n = a + b + c - m1 - m2 ; if ( m1 = = 5 & & n = = 5 & & m2 = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double ans = 0 ; for ( double i = 6 ; i > 0 ; i -- ) { if ( a > = Math . pow ( 2 , i ) ) { ans = Math . pow ( 2 , i ) ; break ; } } if ( a = = 1 ) { ans = 1 ; } System . out . println ( Math . round ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int N = scanner . nextInt ( ) ; int maxValue = 0 ; int maxIndex = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int ans = returnEvenCnt ( i , 0 ) ; if ( maxValue < = ans ) { maxIndex = i ; maxValue = ans ; } } System . out . println ( maxIndex ) ; } } private static int returnEvenCnt ( int n , int evenCnt ) { if ( n % 2 = = 1 ) { return evenCnt ; } n / = 2 ; evenCnt + + ; return returnEvenCnt ( n , evenCnt ) ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int matrix [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int j = 0 ; j < 2 ; j + + ) { for ( int i = 1 ; i < 3 ; i + + ) { if ( matrix [ i - 1 ] [ j ] - matrix [ i - 1 ] [ j + 1 ] ! = matrix [ i ] [ j ] - matrix [ i ] [ j + 1 ] ) { System . out . println ( " No " ) ; return ; } } } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 1 ; j < 3 ; j + + ) { if ( matrix [ i + 1 ] [ j - 1 ] - matrix [ i ] [ j - 1 ] ! = matrix [ i + 1 ] [ j ] - matrix [ i ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { private static final int VAL _ LIMIT = 3500 + 1 ; public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { final int N = in . nextInt ( ) ; int h0 = N / 4 + 1 ; for ( int h = h0 ; h < VAL _ LIMIT ; + + h ) { long a = ( h < < 2 ) - N ; long b = N * h ; int n0 = ( int ) ( b / a + 1 ) ; for ( int n = n0 ; n < VAL _ LIMIT ; + + n ) { long c = a * n - b ; long d = b * n ; long w = d / c ; if ( w * c = = d ) { System . out . printf ( " % d % d % d % n " , h , n , w ) ; return ; } } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int arrayMin = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { arrayMin = Math . min ( p [ i ] , arrayMin ) ; if ( arrayMin = = p [ i ] ) { count + + ; } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double radian _ H = Math . toRadians ( 30.0 * h + ( 6.0 * ( ( m ) / 15.0 ) ) ) ; double radian _ M = Math . toRadians ( 6.0 * m ) ; double hx = a * Math . cos ( Math . toRadians ( 30.0 * h + ( 6.0 * ( m / 12.0 ) ) ) ) ; double hy = a * Math . sin ( Math . toRadians ( 30.0 * h + ( 6.0 * ( m / 12.0 ) ) ) ) ; double mx = b * Math . cos ( Math . toRadians ( 6.0 * m ) ) ; double my = b * Math . sin ( Math . toRadians ( 6.0 * m ) ) ; double hsa = Math . abs ( hx - mx ) ; double msa = Math . abs ( hy - my ) ; double ans = Math . sqrt ( hsa * hsa + ( msa * msa ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int neL = scan . nextInt ( ) ; int neS = scan . nextInt ( ) ; int hour = scan . nextInt ( ) ; int minute = scan . nextInt ( ) ; System . out . println ( Math . sqrt ( Math . pow ( neL , 2 ) + Math . pow ( neS , 2 ) - 2 * neS * neL * Math . cos ( Math . toRadians ( Math . abs ( minute * 6 - ( 30 * hour + 0.5 * minute ) ) ) ) ) ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] math = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; + + i ) { math [ i ] = sc . nextInt ( ) ; } int a = math [ 1 ] - math [ 0 ] ; int b = math [ 4 ] - math [ 3 ] ; int c = math [ 7 ] - math [ 6 ] ; int d = math [ 2 ] - math [ 0 ] ; int e = math [ 5 ] - math [ 3 ] ; int f = math [ 8 ] - math [ 6 ] ; int g = math [ 3 ] - math [ 0 ] ; int h = math [ 4 ] - math [ 1 ] ; int i = math [ 5 ] - math [ 2 ] ; int j = math [ 6 ] - math [ 0 ] ; int k = math [ 7 ] - math [ 1 ] ; int l = math [ 8 ] - math [ 2 ] ; if ( ( a = = b & & b = = c & & c = = a ) & & ( d = = e & & e = = f & & f = = d ) & & ( g = = h & & h = = i & & i = = g ) & & ( j = = k & & k = = l & & l = = j ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int min = N ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { ans + + ; min = P [ i ] ; } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) , e = sc . nextInt ( ) , k = sc . nextInt ( ) ; String res = " Yay ! " ; if ( e - a > k ) { res = " : ( " ; } System . out . println ( res ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } if ( num [ 0 ] - num [ 3 ] = = num [ 1 ] - num [ 4 ] & & num [ 2 ] - num [ 5 ] = = num [ 1 ] - num [ 4 ] & & num [ 0 ] - num [ 3 ] = = num [ 2 ] - num [ 5 ] ) { if ( num [ 0 ] - num [ 6 ] = = num [ 1 ] - num [ 7 ] & & num [ 2 ] - num [ 8 ] = = num [ 1 ] - num [ 7 ] & & num [ 0 ] - num [ 6 ] = = num [ 2 ] - num [ 8 ] ) { if ( num [ 3 ] - num [ 6 ] = = num [ 4 ] - num [ 7 ] & & num [ 5 ] - num [ 8 ] = = num [ 4 ] - num [ 7 ] & & num [ 3 ] - num [ 6 ] = = num [ 5 ] - num [ 8 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] nums = { 64 , 32 , 16 , 8 , 4 , 2 , 1 } ; for ( int n : nums ) { if ( N > = n ) { System . out . println ( n ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 5 ] ; String s = " Yay ! " ; for ( int i = 0 ; i < = 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < = 4 ; i + + ) { for ( int j = 0 ; j < = 4 ; j + + ) { if ( Math . abs ( n [ i ] - n [ j ] ) > k ) { s = " : ( " ; } } } System . out . println ( s ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { int a = i ; int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; if ( c [ 1 ] [ 0 ] - b1 = = c [ 1 ] [ 1 ] - b2 & & c [ 1 ] [ 1 ] - b2 = = c [ 1 ] [ 2 ] - b3 ) { if ( c [ 2 ] [ 0 ] - b1 = = c [ 2 ] [ 1 ] - b2 & & c [ 2 ] [ 1 ] - b2 = = c [ 2 ] [ 2 ] - b3 ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int [ ] antennas = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scanner . nextInt ( ) ; } final int distance = scanner . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antennas [ j ] - antennas [ i ] > distance ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = { 0 , 0 , 0 , 0 , 0 , 0 } ; for ( int i = 0 ; i < x . length ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int judge = 0 ; for ( int i = 0 ; i < x . length - 1 ; i + + ) { for ( int j = 1 ; j < x . length ; j + + ) { if ( Math . abs ( x [ i ] - x [ j ] ) > x [ 5 ] ) { judge = 1 ; } } } if ( judge = = 1 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double kakudoTansin = 30 * H + 0.5 * M ; double kakudoTyousin = 6 * M ; double kakudo = Math . abs ( kakudoTansin - kakudoTyousin ) ; if ( kakudo > 180 ) { kakudo = 360 - kakudo ; } double cnizyou = A * A + B * B - 2 * A * B * Math . cos ( kakudo * ( Math . PI / 180 ) ) ; double c = Math . sqrt ( cnizyou ) ; System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; sc . close ( ) ; for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = 1 ; j < = 3500 ; j + + ) { long m = 4 * i * j - N * ( i + j ) ; if ( m < = 0 ) continue ; else { if ( N * i * j % m = = 0 & & N * i * j / m < = 3500 ) { System . out . println ( i + " " + j + " " + N * i * j / m ) ; return ; } } } } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; double A = s . nextDouble ( ) ; double B = s . nextDouble ( ) ; double H = s . nextDouble ( ) ; double M = s . nextDouble ( ) ; double arg = Math . abs ( 6.0 * M / 180.0 - ( 30.0 * H + ( M / 60 ) * 30 ) / 180.0 ) ; double A2 = Math . pow ( A , 2 ) ; double B2 = Math . pow ( B , 2 ) ; System . out . println ( Math . sqrt ( A2 + B2 - 2 * A * B * Math . cos ( arg * Math . PI ) ) ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { solve ( ) ; } public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long ans = 1 ; long mod = ( long ) Math . pow ( 10 , 9 ) + 7 ; if ( n = = m ) { for ( int i = n ; i > 0 ; i -- ) { ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ; } ans = ( ans * 2 ) % mod ; } else if ( ( int ) Math . abs ( n - m ) = = 1 ) { for ( int i = ( int ) Math . min ( n , m ) ; i > 0 ; i -- ) { ans = ( ( ans * ( long ) i ) % mod ) * ( long ) i % mod ; } ans = ( ans * ( long ) Math . max ( n , m ) ) % mod ; } else { ans = 0 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ant = new int [ 5 ] ; int dis = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { ant [ i ] = sc . nextInt ( ) ; } dis = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ant [ j ] - ant [ i ] > dis ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static int five = 0 ; public static int seven = 0 ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . nextLine ( ) ; check ( text . split ( " " ) [ 0 ] ) ; check ( text . split ( " " ) [ 1 ] ) ; check ( text . split ( " " ) [ 2 ] ) ; System . out . println ( five = = 2 & & seven = = 1 ? " YES " : " NO " ) ; } public static void check ( String str ) { int number = Integer . parseInt ( str ) ; if ( number = = 5 ) five + + ; if ( number = = 7 ) seven + + ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] d = new int [ 3 ] ; d [ 0 ] = a ; d [ 1 ] = b ; d [ 2 ] = c ; Arrays . sort ( d ) ; if ( ( d [ 0 ] = = 5 & & d [ 1 ] = = 5 ) & & d [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int k = in . nextInt ( ) ; int s = in . nextInt ( ) ; int res = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( z > = 0 & & z < = k ) { res + + ; } } } System . out . println ( res ) ; } static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = new StringTokenizer ( " " ) ; } public String next ( ) throws IOException { if ( ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( br . readLine ( ) ) ; return next ( ) ; } return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int max = num ; int maxCount = 0 ; for ( int i = num ; i > 0 ; i -- ) { int tmp = checkCount ( i ) ; if ( maxCount < tmp ) { max = i ; maxCount = tmp ; } } System . out . println ( max ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } public static int checkCount ( int num ) { int ret = 0 ; while ( true ) { if ( num % 2 = = 0 ) { num = num / 2 ; ret + + ; } else { break ; } } return ret ; } } import java . util . Scanner ; public class Main { static Scanner in = new Scanner ( System . in ) ; static void run ( ) { int A = in . nextInt ( ) , B = in . nextInt ( ) , H = in . nextInt ( ) , M = in . nextInt ( ) ; double m = 2.0 * Math . PI * M / 60 ; double h = 2.0 * Math . PI * ( H * 60 + M ) / ( 60 * 12 ) ; double a = Math . max ( m , h ) - Math . min ( m , h ) ; if ( a > = Math . PI ) a = 2 * Math . PI - a ; double d = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( a ) ) ; System . out . println ( d ) ; } public static void main ( String [ ] args ) { run ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scn = new Scanner ( System . in ) ; boolean [ ] n = new boolean [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int a = scn . nextInt ( ) ; switch ( a ) { case 1 : n [ 0 ] = true ; break ; case 9 : n [ 1 ] = true ; break ; case 7 : n [ 2 ] = true ; break ; case 4 : n [ 3 ] = true ; break ; default : break ; } } boolean ans = true ; for ( int i = 0 ; i < 4 ; i + + ) { ans & = n [ i ] ; } System . out . println ( ans ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i + + ) { sb . append ( sc . next ( ) ) ; } System . out . println ( sb . toString ( ) . indexOf ( ' Y ' ) > = 0 ? " Four " : " Three " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; double xr = ( x * 60 + y ) / 2.0 ; double yr = 6.0 * y ; double e = Math . max ( xr - yr , yr - xr ) ; double r = Math . sqrt ( b * b + c * c - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } import java . util . * ; public class Main { void solve ( ) { Scanner scan = new Scanner ( System . in ) ; int sum = scan . nextInt ( ) + scan . nextInt ( ) ; if ( sum < 0 ) { System . out . println ( - 1 ) ; } else if ( sum = = 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( 1 ) ; } } public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . print ( " : ( " ) ; } else { System . out . print ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int K = sc . nextInt ( ) ; final int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - ( x + y ) ; if ( 0 < = z & & z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int hm = h * 60 + m ; System . out . println ( Math . sqrt ( ( double ) a * a + ( double ) b * b - 2.0 * a * b * Math . cos ( Math . toRadians ( ( double ) hm / ( 12.0 * 60.0 ) * 360.0 - ( double ) m / 60.0 * 360.0 ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int num = 2 ; if ( n = = 1 ) { System . out . println ( 1 ) ; } else { while ( num < = n ) num * = 2 ; System . out . println ( num / 2 ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double HAngle = H * 30 + M * 0.5 ; double MAngle = M * 6 ; double angle = HAngle - MAngle ; if ( angle < - 90 | | 90 < angle ) { angle = 360 - Math . abs ( angle ) ; } double cosA = Math . cos ( Math . toRadians ( angle ) ) ; double answer = Math . sqrt ( A * A + B * B - ( 2 * A * B * cosA ) ) ; System . out . println ( answer ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double num = Math . abs ( 30 * h - 5.5 * m ) ; double cos = Math . cos ( Math . toRadians ( num ) ) ; double ans = b * b + a * a - 2 * a * b * cos ; System . out . println ( Math . sqrt ( ans ) ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solveA ( ) ; } private void solveA ( ) { Scanner sc = new Scanner ( System . in ) ; char nums [ ] = sc . nextLine ( ) . toCharArray ( ) ; int five = 0 ; int seven = 0 ; for ( char c : nums ) { if ( Character . getNumericValue ( c ) = = 5 ) { five + + ; } else if ( Character . getNumericValue ( c ) = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } private void solveB ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveC ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveD ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveE ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } private void solveF ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; boolean isA = false , isB = false , isC = false , isD = false ; int [ ] index = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { index [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < 4 ; i + + ) { int idx = index [ i ] ; if ( idx = = 1 ) { isA = true ; } else if ( idx = = 9 ) { isB = true ; } else if ( idx = = 7 ) { isC = true ; } else if ( idx = = 4 ) { isD = true ; } } System . out . println ( isA & & isB & & isC & & isD ? " YES " : " NO " ) ; } } import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) ; int H = sc . nextInt ( ) , M = sc . nextInt ( ) ; double theta = ( double ) 2 * Math . PI * ( ( double ) M / 60.0 - ( ( 60.0 * ( double ) H + M ) / 720.0 ) ) ; double sqr = Math . sqrt ( ( double ) ( A * A + B * B ) - 2 * ( double ) ( A * B ) * Math . cos ( theta ) ) ; System . out . println ( sqr ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double s = ( h * 60 + m ) * ( 0.5 ) ; double l = m * 6 ; double kaku = s - l ; if ( kaku > 180 ) { kaku = 360 - kaku ; } double cos = Math . cos ( Math . toRadians ( kaku ) ) ; double result2 = a * a + b * b - 2 * a * b * cos ; double result = Math . sqrt ( result2 ) ; System . out . println ( result ) ; } } import java . util . * ; public class Main { static boolean sort ( int [ ] n ) { int temp ; Arrays . sort ( n ) ; int [ ] s = { 5 , 5 , 7 } ; Arrays . sort ( s ) ; if ( Arrays . equals ( n , s ) ) { return true ; } return false ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } if ( sort ( n ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int t = 0 ; t < = k ; t + + ) { int z = s - i - t ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextInt ( ) ; double b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double a _ w = ( 30 * h ) + ( 0.5 * m ) ; double b _ w = 6 * m ; double w = 0 ; double ans = 0 ; if ( a _ w > = b _ w ) { w = a _ w - b _ w ; } else { w = b _ w - a _ w ; } if ( w > 180 ) { w = 360 - w ; } ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( Math . toRadians ( w ) ) ) ) ; System . out . printf ( " % .20f " , ans ) ; } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { static Scanner in ; static PrintWriter out ; static String INPUT = " " ; public static void main ( String [ ] args ) throws Exception { in = INPUT . isEmpty ( ) ? new Scanner ( System . in ) : new Scanner ( INPUT ) ; out = new PrintWriter ( System . out ) ; int N = ni ( ) ; int M = ni ( ) ; Long combi = N = = M ? 2L : 1L ; if ( N - M > 1 | | N - M < - 1 ) combi = 0L ; else { int i ; for ( i = N ; i > = 1 ; i -- ) { combi * = i ; combi = combi % 1000000007 ; } for ( i = M ; i > = 1 ; i -- ) { combi * = i ; combi = combi % 1000000007 ; } } out . println ( combi ) ; out . flush ( ) ; } static int ni ( ) { return Integer . parseInt ( in . next ( ) ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer [ ] array = new Integer [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { int tmp = sc . nextInt ( ) ; array [ i ] = tmp ; } Arrays . sort ( array ) ; int sum = Math . abs ( array [ 0 ] - array [ 1 ] ) + Math . abs ( array [ 1 ] - array [ 2 ] ) ; System . out . println ( sum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; try { int c5 = 0 ; int c7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int input = sc . nextInt ( ) ; if ( input = = 5 ) { c5 + + ; } else if ( input = = 7 ) { c7 + + ; } } if ( c5 = = 2 & & c7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } catch ( Exception e ) { System . out . println ( " 入力値が不正です " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { final Scanner scanner = new Scanner ( System . in ) ; final int a = scanner . nextInt ( ) ; final int b = scanner . nextInt ( ) ; final int c = scanner . nextInt ( ) ; final int d = scanner . nextInt ( ) ; final int e = scanner . nextInt ( ) ; final int k = scanner . nextInt ( ) ; final int min = Math . min ( Math . min ( Math . min ( Math . min ( a , b ) , c ) , d ) , e ) ; final int max = Math . max ( Math . max ( Math . max ( Math . max ( a , b ) , c ) , d ) , e ) ; System . out . println ( max - min < = k ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long [ ] c = new long [ n ] ; long sum = 0 ; int cnt = 0 ; ArrayList < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; c [ i ] = a [ i ] - b [ i ] ; if ( c [ i ] > 0 ) list . add ( ( int ) c [ i ] ) ; else if ( c [ i ] = = 0 ) { } else { sum + = ( - 1 ) * c [ i ] ; cnt + + ; } } Collections . sort ( list , Collections . reverseOrder ( ) ) ; int sb = list . size ( ) ; while ( sum > 0 & & list . size ( ) > 0 ) { long h = ( long ) list . get ( 0 ) ; list . remove ( 0 ) ; if ( h < = sum ) { sum - = h ; } else { sum = 0 ; } } int sa = list . size ( ) ; if ( sum > 0 ) System . out . println ( - 1 ) ; else System . out . println ( cnt + sb - sa ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) < = k & & 0 < = s - ( i + j ) ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( sc . nextInt ( ) * sc . nextInt ( ) * sc . nextInt ( ) = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; boolean judge = false ; list . add ( a ) ; list . add ( b ) ; list . add ( c ) ; Collections . sort ( list ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( i = = 0 ) { if ( list . get ( i ) = = 5 ) { judge = true ; } else { judge = false ; } } if ( i = = 1 ) { if ( judge & & list . get ( i ) = = 5 ) { judge = true ; } else { judge = false ; } } if ( i = = 2 ) { if ( judge & & list . get ( i ) = = 7 ) { judge = true ; } else { judge = false ; } } } if ( judge ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; } sc . close ( ) ; String result = " Three " ; for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { result = " Four " ; } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) { count5 + + ; } else if ( n = = 7 ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; KEYENCE2019 _ A solver = new KEYENCE2019 _ A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class KEYENCE2019 _ A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String [ ] c = new String [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { c [ i ] = in . next ( ) ; } Arrays . sort ( c ) ; if ( String . join ( " " , c ) . equals ( " 1479 " ) ) { out . print ( " YES " ) ; } else { out . print ( " NO " ) ; } } } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double HourLength = input . nextDouble ( ) ; double MinLength = input . nextDouble ( ) ; double H = input . nextDouble ( ) ; double M = input . nextDouble ( ) ; double Htheta = ( H / 12 ) * 360.0 ; double Mtheta = ( M / 60 ) * 360.0 ; Htheta + = 30.0 * ( Mtheta / 360.0 ) ; double ans = HourLength * HourLength + MinLength * MinLength ; double TotalAngle = Math . abs ( Htheta - Mtheta ) ; double cos = Math . cos ( Math . toRadians ( TotalAngle ) ) ; ans - = 2 * HourLength * MinLength * cos ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] [ ] c = new int [ 3 ] [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = false ; for ( int x = 0 ; x < = 100 ; x + + ) { int a1 = c [ 0 ] [ 0 ] - x ; int a2 = c [ 0 ] [ 1 ] - x ; int a3 = c [ 0 ] [ 2 ] - x ; int b1 = x ; int b2 = c [ 1 ] [ 0 ] - a1 ; int b3 = c [ 2 ] [ 0 ] - a1 ; if ( c [ 1 ] [ 1 ] = = a2 + b2 & & c [ 1 ] [ 2 ] = = a3 + b2 & & c [ 2 ] [ 1 ] = = a2 + b3 & & c [ 2 ] [ 2 ] = = a3 + b3 ) { flag = true ; break ; } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String result = ( a + b + c ) = = 17 ? " YES " : " NO " ; System . out . println ( result ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N ; N = sc . nextInt ( ) ; ArrayList < String > List = new ArrayList < String > ( ) ; for ( int a = 0 ; a < N ; a + + ) { String moji = sc . next ( ) ; List . add ( moji ) ; } if ( List . contains ( " Y " ) = = true ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { static public void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; num [ 0 ] = sc . nextInt ( ) ; num [ 1 ] = sc . nextInt ( ) ; num [ 2 ] = sc . nextInt ( ) ; int count5 = 0 , count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( num [ i ] = = 5 ) { count5 + + ; } else if ( num [ i ] = = 7 ) { count7 + + ; } else { System . out . println ( " NO " ) ; } } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = sc . nextInt ( ) ; int min = P [ 0 ] ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( min > = P [ i ] ) { cnt + + ; min = P [ i ] ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int A , B , C ; A = input . nextInt ( ) ; B = input . nextInt ( ) ; C = input . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int [ ] si = { Math . abs ( A - B ) , Math . abs ( C - B ) , Math . abs ( A - C ) } ; Arrays . sort ( si ) ; System . out . println ( si [ 0 ] + si [ 1 ] ) ; } } import java . util . Scanner ; class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; boolean hasY = false ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { hasY = true ; } } System . out . println ( hasY ? " Four " : " Three " ) ; } } import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Scanner ; class Main { static final int MOD = 1000000007 ; static final int INF = 1 < < 30 ; Main ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean ok = false ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " Y " ) ) ok = true ; } System . out . println ( ok ? " Four " : " Three " ) ; } public static void main ( String [ ] args ) { new Main ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; long [ ] b = new long [ n ] ; long [ ] d = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextLong ( ) ; d [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( d ) ; long [ ] matcher = d . clone ( ) ; int r = n - 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( d [ i ] > = 0 ) { break ; } while ( d [ i ] < 0 ) { if ( d [ r ] < = 0 ) { System . out . println ( - 1 ) ; return ; } if ( d [ r ] + d [ i ] > 0 ) { d [ r ] + = d [ i ] ; d [ i ] = 0 ; } else { d [ i ] + = d [ r ] ; d [ r ] = 0 ; r -- ; } } } int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( d [ i ] ! = matcher [ i ] ) ans + + ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; String [ ] sArray = s . split ( " " ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( sArray [ i ] . equals ( " 5 " ) ) { five + + ; } else if ( sArray [ i ] . equals ( " 7 " ) ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String colorNumber = " Three " ; for ( int i = 0 ; i < N ; i + + ) { String str = sc . next ( ) ; if ( str . equals ( " Y " ) ) { colorNumber = " Four " ; break ; } } System . out . println ( colorNumber ) ; } } import java . util . Scanner ; public class Main { public int n = 3 ; void run ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] in = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { in [ i ] = sc . nextInt ( ) ; } int cnt5 = 0 ; int cnt7 = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( in [ i ] = = 5 ) { cnt5 + + ; } else if ( in [ i ] = = 7 ) { cnt7 + + ; } } if ( cnt5 = = 2 & & cnt7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antena = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int limit = antena [ 5 ] ; boolean isJumming = false ; for ( int i = 0 ; i < 6 ; i + + ) { for ( int j = i + 1 ; j < 6 ; j + + ) { if ( ( antena [ j ] - antena [ i ] ) > limit ) { isJumming = true ; } } } System . out . println ( isJumming ? " : ( " : " Yay ! " ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double hour = H * 360 / 12.0 + M * 360 / 60.0 / 12.0 ; double min = M * 360 / 60.0 ; double diff = Math . abs ( hour - min ) ; double degree = Math . min ( diff , 360 - diff ) ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int C = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( A + B + C = = 17 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int K = sc . nextInt ( ) ; final int S = sc . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( 0 < = k & & k < = K ) { counter + + ; } } } System . out . println ( counter ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . * ; import java . util . stream . * ; public class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; long x = s . nextInt ( ) ; long [ ] [ ] a = new long [ n ] [ n ] ; Arrays . setAll ( a [ 0 ] , i - > s . nextLong ( ) ) ; for ( int j = 0 ; j < n ; + + j ) { for ( int i = 1 ; i < n ; + + i ) { a [ i ] [ j ] = Math . min ( a [ i - 1 ] [ j ] , a [ 0 ] [ ( j - i + n ) % n ] ) ; } } System . out . println ( IntStream . range ( 0 , n ) . mapToLong ( i - > i * x + Arrays . stream ( a [ i ] ) . sum ( ) ) . min ( ) . getAsLong ( ) ) ; } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = p [ 0 ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = p [ i ] ) { ans + + ; } min = Math . min ( min , p [ i ] ) ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; boolean s = false ; if ( a = = 5 ) { if ( ( b = = 5 & & c = = 7 ) | | ( b = = 7 & & c = = 5 ) ) { s = true ; } } else if ( a = = 7 ) { if ( b = = 5 & & c = = 5 ) { s = true ; } } if ( s = = true ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] [ ] c = new int [ N ] [ N ] ; IntStream . range ( 0 , N ) . forEach ( i - > IntStream . range ( 0 , N ) . forEach ( j - > c [ i ] [ j ] = scanner . nextInt ( ) ) ) ; boolean result = true ; for ( int i = 0 ; i < N - 1 ; i + + ) { int diff1 = c [ i + 1 ] [ 0 ] - c [ i ] [ 0 ] ; int diff2 = c [ 0 ] [ i + 1 ] - c [ 0 ] [ i ] ; for ( int j = 1 ; j < N ; j + + ) { if ( ( c [ i + 1 ] [ j ] - c [ i ] [ j ] ) ! = diff1 ) { result = false ; break ; } if ( ( c [ j ] [ i + 1 ] - c [ j ] [ i ] ) ! = diff2 ) { result = false ; break ; } } } System . out . println ( result ? " Yes " : " No " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; int count = 0 ; int min = 99999999 ; while ( n -- > 0 ) { int num = sc . nextInt ( ) ; if ( num < min ) { count + + ; min = num ; } } System . out . println ( count ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angH = 30 * h + 0.5 * m ; double angM = 6 * m ; double disAng = Math . abs ( angH - angM ) ; if ( disAng = = 0 ) { System . out . println ( Math . abs ( a - b ) ) ; return ; } double angC = disAng ; if ( disAng > 180 ) angC = 360 - disAng ; double cosC = Math . cos ( Math . toRadians ( angC ) ) ; double c = a * a + b * b - 2 * a * b * cosC ; System . out . println ( Math . sqrt ( c ) ) ; } static class MyScanner { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) , 1 < < 15 ) ; StringTokenizer tokenizer ; String next ( ) { try { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } } catch ( IOException ignored ) { } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Reader r = new Reader ( ) ; int [ ] [ ] c = new int [ 3 ] [ ] ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) c [ i ] = r . ii ( ) ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) sum + = c [ i ] [ j ] ; boolean flag = true ; loop : for ( int i = 0 ; i < 3 ; i + + ) { for ( int d = 1 ; d < 3 ; d + + ) { int j = ( i + d ) % 3 ; int k = 3 - i - j ; int s = c [ 0 ] [ i ] + c [ 1 ] [ j ] + c [ 2 ] [ k ] ; if ( 3 * s ! = sum ) { flag = false ; break loop ; } } } println ( flag ? " Yes " : " No " ) ; } static void print ( Object o ) { System . out . print ( o . toString ( ) ) ; } static void println ( Object o ) { System . out . println ( o . toString ( ) ) ; } static class Reader extends BufferedReader { Reader ( ) { super ( new InputStreamReader ( System . in ) ) ; } String s ( ) throws IOException { return readLine ( ) ; } String [ ] ss ( ) throws IOException { return s ( ) . split ( " " ) ; } int Int ( String s ) { return Integer . parseInt ( s ) ; } int i ( ) throws IOException { return Int ( s ( ) ) ; } int [ ] ii ( ) throws IOException { String [ ] ss = ss ( ) ; int size = ss . length ; int [ ] ii = new int [ size ] ; for ( int j = 0 ; j < size ; j + + ) ii [ j ] = Int ( ss [ j ] ) ; return ii ; } } } import java . util . Scanner ; import java . util . Set ; import java . util . HashSet ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . next ( ) ; Set < String > set = new HashSet < > ( ) ; while ( sc . hasNext ( ) ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) > 3 ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 , z ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { z = s - ( x + y ) ; if ( k > = z & & z > = 0 ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( z > = 0 & & z < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ret = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int t = s - i - j ; if ( 0 < = t & & t < = k ) ret + + ; } } System . out . println ( ret ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; int [ ] A = new int [ 2 ] ; int [ ] B = new int [ 2 ] ; Arrays . fill ( A , 101 ) ; Arrays . fill ( B , 101 ) ; String ans = " Yes " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = reader . nextInt ( ) ; } } A [ 0 ] = arr [ 0 ] [ 0 ] - arr [ 1 ] [ 0 ] ; A [ 1 ] = arr [ 1 ] [ 0 ] - arr [ 2 ] [ 0 ] ; B [ 0 ] = arr [ 0 ] [ 0 ] - arr [ 0 ] [ 1 ] ; B [ 1 ] = arr [ 0 ] [ 1 ] - arr [ 0 ] [ 2 ] ; for ( int i = 1 ; i < 3 ; i + + ) { for ( int j = 1 ; j < 3 ; j + + ) { if ( arr [ i - 1 ] [ j ] - A [ i - 1 ] ! = arr [ i ] [ j ] | | arr [ i ] [ j - 1 ] - B [ j - 1 ] ! = arr [ i ] [ j ] ) { ans = " No " ; } } } System . out . print ( ans ) ; reader . close ( ) ; } } import java . util . * ; import java . util . function . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; int H = s . nextInt ( ) ; int M = s . nextInt ( ) ; BigDecimal lenax = BigDecimal . valueOf ( A * Math . cos ( ( Math . PI / 6 ) * H + ( Math . PI / 360 ) * M ) ) ; BigDecimal lenay = BigDecimal . valueOf ( A * Math . sin ( ( Math . PI / 6 ) * H + ( Math . PI / 360 ) * M ) ) ; BigDecimal lenbx = BigDecimal . valueOf ( B * Math . cos ( ( Math . PI / 30 ) * M ) ) ; BigDecimal lenby = BigDecimal . valueOf ( B * Math . sin ( ( Math . PI / 30 ) * M ) ) ; BigDecimal x = lenax . subtract ( lenbx ) . pow ( 2 ) ; BigDecimal y = lenay . subtract ( lenby ) . pow ( 2 ) ; System . out . println ( x . add ( y ) . sqrt ( MathContext . DECIMAL128 ) ) ; } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int tmp = 0 ; int count = 0 ; int maxCount = 0 ; int result = 0 ; for ( int i = 1 ; i < = N ; i + + ) { tmp = i ; while ( tmp > 0 ) { tmp = tmp / 2 ; count + + ; } if ( count > maxCount ) { maxCount = count ; result = i ; } tmp = 0 ; count = 0 ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( result ) ; out . flush ( ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; if ( num = = 5 ) { five + + ; } else if ( num = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] list = { a , b , c } ; Arrays . sort ( list ) ; System . out . println ( list [ 2 ] - list [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; scanner . nextLine ( ) ; String [ ] c = scanner . nextLine ( ) . split ( " " ) ; for ( int i = 0 ; i < N ; i + + ) { if ( c [ i ] . charAt ( 0 ) = = ' Y ' ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int [ ] min = new int [ n ] ; min [ 0 ] = p [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { min [ i ] = Math . min ( min [ i - 1 ] , p [ i ] ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < = min [ i ] ) ans + + ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = c [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = c [ i ] [ 0 ] - y [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = x [ i ] + y [ j ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } boolean ans = true ; for ( int i = 0 ; i < 2 ; i + + ) { int left = c [ i + 1 ] [ 0 ] - c [ i ] [ 0 ] ; int center = c [ i + 1 ] [ 1 ] - c [ i ] [ 1 ] ; int right = c [ i + 1 ] [ 2 ] - c [ i ] [ 2 ] ; if ( left ! = center | | center ! = right | | right ! = left ) { ans = false ; } } for ( int j = 0 ; j < 2 ; j + + ) { int up = c [ 0 ] [ j + 1 ] - c [ 0 ] [ j ] ; int center = c [ 1 ] [ j + 1 ] - c [ 1 ] [ j ] ; int down = c [ 2 ] [ j + 1 ] - c [ 2 ] [ j ] ; if ( up ! = down | | up ! = center | | down ! = center ) { ans = false ; } } if ( ans ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < arr . length ; i + + ) arr [ i ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; System . out . println ( ( arr [ 2 ] - arr [ 1 ] ) + ( arr [ 1 ] - arr [ 0 ] ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; int H = s . nextInt ( ) ; int M = s . nextInt ( ) ; double Hx = A * Math . cos ( Math . toRadians ( 90 - 30 * H - ( double ) M / 2 ) ) ; double Hy = A * Math . sin ( Math . toRadians ( 90 - 30 * H - ( double ) M / 2 ) ) ; double Mx = B * Math . cos ( Math . toRadians ( 90 - 6 * M ) ) ; double My = B * Math . sin ( Math . toRadians ( 90 - 6 * M ) ) ; double d = Math . sqrt ( ( Hx - Mx ) * ( Hx - Mx ) + ( Hy - My ) * ( Hy - My ) ) ; System . out . print ( d ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double rads = 2.0 * Math . PI * ( ( double ) m / 60.0 ) ; double radl = ( Math . PI / 6 ) * h + ( Math . PI / 6.0 ) * ( ( double ) m / 60.0 ) ; double rad = 0.0 ; if ( Math . abs ( rads - radl ) < Math . PI ) rad = Math . abs ( rads - radl ) ; else rad = 2.0 * Math . PI - Math . abs ( rads - radl ) ; double c = Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( rad ) ) ; System . out . println ( c ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j < = k & & s - j - i > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = Integer . parseInt ( sc . next ( ) ) ; int a2 = Integer . parseInt ( sc . next ( ) ) ; int a3 = Integer . parseInt ( sc . next ( ) ) ; int b1 = Integer . parseInt ( sc . next ( ) ) ; int b2 = Integer . parseInt ( sc . next ( ) ) ; int b3 = Integer . parseInt ( sc . next ( ) ) ; int c1 = Integer . parseInt ( sc . next ( ) ) ; int c2 = Integer . parseInt ( sc . next ( ) ) ; int c3 = Integer . parseInt ( sc . next ( ) ) ; boolean flg = true ; if ( a1 - a2 ! = b1 - b2 | | a1 - a3 ! = b1 - b3 | | a1 - a2 ! = c1 - c2 | | a1 - a3 ! = c1 - c3 | | a1 - b1 ! = a2 - b2 | | a1 - b1 ! = a3 - b3 | | a1 - c1 ! = a2 - c2 | | a1 - c1 ! = a3 - c3 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } import java . math . BigDecimal ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > arr = new ArrayList < > ( Arrays . asList ( sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) ) ) ; if ( arr . contains ( 5 ) ) { arr . remove ( arr . indexOf ( 5 ) ) ; if ( arr . contains ( 5 ) ) { arr . remove ( arr . indexOf ( 5 ) ) ; if ( arr . contains ( 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int n = scan . nextInt ( ) ; if ( n = = 1 ) { System . out . println ( 1 ) ; return ; } int answer = 0 ; while ( n ! = 1 ) { answer + = 1 ; n / = 2 ; } System . out . println ( ( int ) Math . pow ( 2 , answer ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int first = scan . nextInt ( ) ; int second = scan . nextInt ( ) ; int therd = scan . nextInt ( ) ; if ( ( first = = 5 | | first = = 7 ) & ( second = = 5 | | second = = 7 ) & ( therd = = 5 | | therd = = 7 ) & ( first + second + therd = = 17 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 1 & & a [ 1 ] = = 4 & & a [ 2 ] = = 7 & & a [ 3 ] = = 9 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) , a = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) a + + ; } } System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n = = 5 ) count5 + + ; if ( n = = 7 ) count7 + + ; } sc . close ( ) ; if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S [ ] = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; char c [ ] = S [ i ] . toCharArray ( ) ; if ( c [ 0 ] = = ' Y ' ) { System . out . println ( " Four " ) ; sc . close ( ) ; return ; } } sc . close ( ) ; System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) ; int n = 1 ; for ( int i = 0 ; i > = 0 ; i + + ) { n = n * 2 ; if ( n > s ) { int nn = n / 2 ; System . out . println ( nn ) ; return ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] count = new int [ N ] ; for ( int i = 1 ; i < = N ; i + + ) { int x = i ; while ( i ! = 0 ) { if ( x % 2 = = 0 ) { count [ i - 1 ] + + ; x = x / 2 ; } else { break ; } } } int max = count [ 0 ] ; int soeji = 0 ; for ( int i = 1 ; i < N ; i + + ) { if ( count [ i ] > max ) { max = count [ i ] ; soeji = i ; } } System . out . println ( soeji + 1 ) ; } } import java . util . * ; public class Main { static int [ ] a ; static boolean res ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) a [ i ] = sc . nextInt ( ) ; dfs ( " " ) ; System . out . println ( res ? " YES " : " NO " ) ; } public static void dfs ( String current ) { if ( res ) { return ; } if ( current . length ( ) = = 4 ) { if ( current . equals ( " 1974 " ) ) { res = true ; } return ; } dfs ( current + a [ 0 ] ) ; dfs ( current + a [ 1 ] ) ; dfs ( current + a [ 2 ] ) ; dfs ( current + a [ 3 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int leftTop = sc . nextInt ( ) ; int middleTop = sc . nextInt ( ) ; int rightTop = sc . nextInt ( ) ; int leftMiddle = sc . nextInt ( ) ; int middleMiddle = sc . nextInt ( ) ; int rightMiddle = sc . nextInt ( ) ; int leftDown = sc . nextInt ( ) ; int middleDown = sc . nextInt ( ) ; int rightDown = sc . nextInt ( ) ; String ans = " Yes " ; int [ ] aTop = { 0 , leftTop - middleTop , leftTop - rightTop } ; int [ ] aMiddle = { 0 , leftMiddle - middleMiddle , leftMiddle - rightMiddle } ; int [ ] aDown = { 0 , leftDown - middleDown , leftDown - rightDown } ; int [ ] bLeft = { 0 , leftTop - leftMiddle , leftTop - leftDown } ; int [ ] bMiddle = { 0 , middleTop - middleMiddle , middleTop - middleDown } ; int [ ] bRight = { 0 , rightTop - rightMiddle , rightTop - rightDown } ; if ( ! Arrays . equals ( aTop , aMiddle ) | | ! Arrays . equals ( aTop , aDown ) ) { ans = " No " ; } if ( ! Arrays . equals ( bLeft , bMiddle ) | | ! Arrays . equals ( bLeft , bRight ) ) { ans = " No " ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; double hh = 2 * Math . PI * h / 12.0 ; hh + = 2 * Math . PI * m / 720.0 ; double mm = 2 * Math . PI * m / 60.0 ; double hm = Math . abs ( hh - mm ) ; if ( hm > Math . PI ) { hm = 2 * Math . PI - hm ; } double ans = Math . sqrt ( a * a + b * b - 2.0 * a * b * Math . cos ( hm ) ) ; System . out . println ( ans ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double l = m * 6 ; double s = h * 30 + m * 0.5 ; double cos ; if ( Math . abs ( l - s ) > 180 ) { cos = 360 - Math . abs ( l - s ) ; } else { cos = Math . abs ( l - s ) ; } double c2 = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( cos ) ) ; double c = Math . sqrt ( c2 ) ; System . out . println ( c ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) , s = scan . nextInt ( ) , a = 0 , i , j ; scan . close ( ) ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( i + j > s ) break ; if ( k > = s - i - j ) a + + ; } } System . out . print ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String [ ] s = new String [ n ] ; boolean hanbetsu = false ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { hanbetsu = true ; break ; } } if ( hanbetsu ) System . out . print ( " Four " ) ; else System . out . print ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int A = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; int sum = A + B + C ; if ( sum = = 17 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " NO " ; int [ ] setu = new int [ 3 ] ; for ( int i = 0 ; i < setu . length ; i + + ) { setu [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < setu . length ; i + + ) { for ( int j = i ; j < setu . length ; j + + ) { if ( setu [ i ] > setu [ j ] ) { int hoge = setu [ i ] ; setu [ i ] = setu [ j ] ; setu [ j ] = hoge ; } } } if ( setu [ 0 ] = = 5 & & setu [ 1 ] = = 5 & & setu [ 2 ] = = 7 ) { ans = " YES " ; } System . out . println ( ans ) ; if ( ! ( sc = = null ) ) sc . close ( ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; + + i ) a [ i ] = sc . nextLong ( ) ; long ans = 0 ; long c = 1 ; for ( int i = 0 ; i < n ; + + i ) { long q = ( a [ i ] - 1 ) / c ; ans + = q ; if ( q > 0 ) a [ i ] = 1 ; c = Math . max ( c , a [ i ] + 1 ) ; } out . println ( ans ) ; out . close ( ) ; } 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 . Scanner ; public class Main { private static double LONG _ ANGLE = 0.5 ; private static double SHORT _ ANGLE = 6.0 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angleH = LONG _ ANGLE * ( h * 60 + m ) ; double angleM = SHORT _ ANGLE * m ; double angle = 0 ; if ( angleH > angleM ) { angle = angleH - angleM ; } else { angle = angleM - angleH ; } System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double wm = 360 / 60 ; double wh1 = 360 / 12 ; double wh2 = 30.0 / 60.0 ; double m _ angle = ( double ) M * wm ; double h _ angle = ( double ) H * wh1 + ( double ) M * wh2 ; double angle _ a = m _ angle > h _ angle ? m _ angle - h _ angle : h _ angle - m _ angle ; if ( angle _ a > 180 ) angle _ a = 360 - angle _ a ; double b = Math . pow ( A , 2 ) ; double c = Math . pow ( B , 2 ) ; double a = Math . sqrt ( b + c - 2 * A * B * Math . cos ( Math . toRadians ( angle _ a ) ) ) ; System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; break ; } if ( i = = N - 1 ) { System . out . println ( " Three " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ! ( e - a > k ) ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String s = " " ; if ( b - a > k ) { s = " : ( " ; } else if ( c - a > k ) { s = " : ( " ; } else if ( d - a > k ) { s = " : ( " ; } else if ( e - a > k ) { s = " : ( " ; } else if ( c - b > k ) { s = " : ( " ; } else if ( d - b > k ) { s = " : ( " ; } else if ( e - b > k ) { s = " : ( " ; } else if ( d - c > k ) { s = " : ( " ; } else if ( e - c > k ) { s = " : ( " ; } else if ( e - d > k ) { s = " : ( " ; } else { s = " Yay ! " ; } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = sc . nextLong ( ) ; int min = Integer . MAX _ VALUE ; int minpos = 0 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] < min ) { min = a [ i ] ; minpos = i ; } } sc . close ( ) ; long ans = 0 ; int [ ] [ ] b = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { ans + = b [ 0 ] [ i ] = a [ i ] ; } for ( int i = 1 ; i < n ; i + + ) { long mans = i * x + min ; b [ i ] [ minpos ] = min ; for ( int j = 1 ; j < n ; j + + ) { int mpos = minpos + j ; if ( mpos > = n ) mpos - = n ; { int npos = mpos - i ; if ( npos < 0 ) npos + = n ; mans + = b [ i ] [ mpos ] = Math . min ( b [ i - 1 ] [ mpos ] , a [ npos ] ) ; } } if ( mans < ans ) ans = mans ; } System . out . println ( ans ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] in = br . readLine ( ) . split ( " " ) ; long n = Long . parseLong ( in [ 0 ] ) ; long p = Long . parseLong ( in [ 1 ] ) ; br . close ( ) ; Map < Long , Integer > prime = new HashMap < > ( ) ; for ( long i = 2 ; i * i < = p ; i + + ) { int cnt = 0 ; while ( p % i = = 0 ) { p / = i ; cnt + + ; } if ( cnt > 0 ) { prime . put ( i , cnt ) ; } } if ( p > 1 ) prime . put ( p , 1 ) ; long ans = 1 ; for ( Map . Entry < Long , Integer > e : prime . entrySet ( ) ) { int t = e . getValue ( ) ; while ( t > = n ) { ans * = e . getKey ( ) ; t - = n ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int count = 0 ; while ( N ! = 1 ) { N = N / 2 ; count = count + 1 ; } System . out . println ( ( int ) Math . pow ( 2 , count ) ) ; scanner . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & S - i - j > = 0 ) { ans + + ; } else if ( S - i - j < = 0 ) { break ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . io . PrintWriter ; import static java . lang . Integer . * ; import static java . lang . Long . * ; import static java . lang . Double . * ; import static java . lang . Math . * ; import static java . lang . System . * ; public class Main { public static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { int i , j ; Scanner sc = new Scanner ( in ) ; double a = parseDouble ( sc . next ( ) ) ; double b = parseDouble ( sc . next ( ) ) ; double h = parseDouble ( sc . next ( ) ) ; double m = parseDouble ( sc . next ( ) ) ; sc . close ( ) ; double dx = cos ( PI * ( h / 6 + m / 360 ) ) * a - cos ( PI * m / 30 ) * b ; double dy = sin ( PI * ( h / 6 + m / 360 ) ) * a - sin ( PI * m / 30 ) * b ; double ans = sqrt ( dx * dx + dy * dy ) ; out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; String result = " NO " ; if ( ( A = = 7 & & B = = 5 & & C = = 5 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 5 & & B = = 5 & & C = = 7 ) ) { result = " YES " ; } System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] antena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antena [ j ] - antena [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " G " ) ) a [ 0 ] + + ; if ( s . equals ( " W " ) ) a [ 1 ] + + ; if ( s . equals ( " Y " ) ) a [ 2 ] + + ; if ( s . equals ( " P " ) ) a [ 3 ] + + ; } int count = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( a [ i ] ! = 0 ) count + + ; } System . out . println ( count = = 4 ? " Four " : " Three " ) ; sc . close ( ) ; } void debug ( Object ... o ) { System . out . println ( Arrays . deepToString ( o ) ) ; } long combination ( int n , int r , int m ) { long [ ] [ ] Combination = new long [ n + 1 ] [ n + 1 ] ; for ( int i = 0 ; i < = n ; i + + ) { Combination [ i ] [ 0 ] = 1 ; for ( int j = 1 ; j < = i ; j + + ) { Combination [ i ] [ j ] = ( Combination [ i - 1 ] [ j - 1 ] + Combination [ i - 1 ] [ j ] ) % m ; } } return Combination [ n ] [ r ] ; } int gcd ( int a , int b ) { if ( a < b ) { int c = a ; a = b ; b = c ; } if ( b = = 0 ) return a ; else return gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - ( i + j ) < = k & & s - ( i + j ) > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; String [ ] list = { a , b , c } ; Arrays . sort ( list ) ; if ( " 5 " . equals ( list [ 0 ] ) & & " 5 " . equals ( list [ 1 ] ) & & " 7 " . equals ( list [ 2 ] ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; System . out . println ( sc . nextLine ( ) . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] list = reader . readLine ( ) . split ( " " ) ; int [ ] l = new int [ 3 ] ; int t = 0 ; for ( String p : list ) { l [ t ] = Integer . parseInt ( p ) ; t + + ; } Arrays . sort ( l ) ; if ( l [ 0 ] = = 5 & & l [ 1 ] = = 5 & & l [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String arare [ ] = new String [ N ] ; boolean answer = false ; for ( int i = 0 ; i < N ; i + + ) { arare [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( arare [ i ] . equals ( " Y " ) ) { answer = true ; } } if ( answer = = true ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { int A = 0 ; int B = 0 ; int C = 0 ; int w = 0 ; Scanner scan = new Scanner ( System . in ) ; A = scan . nextInt ( ) ; B = scan . nextInt ( ) ; C = scan . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; w + + ; } if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; w + + ; } if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; w + + ; } if ( w = = 0 ) System . out . println ( " NO " ) ; } } import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; HashSet < String > list = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { list . add ( sc . next ( ) ) ; } if ( list . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] c = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { c [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; if ( c [ 3 ] - c [ 0 ] = = c [ 4 ] - c [ 1 ] & & c [ 3 ] - c [ 0 ] = = c [ 5 ] - c [ 2 ] & & c [ 6 ] - c [ 3 ] = = c [ 7 ] - c [ 4 ] & & c [ 6 ] - c [ 3 ] = = c [ 8 ] - c [ 5 ] & & c [ 1 ] - c [ 0 ] = = c [ 4 ] - c [ 3 ] & & c [ 1 ] - c [ 0 ] = = c [ 7 ] - c [ 6 ] & & c [ 2 ] - c [ 1 ] = = c [ 5 ] - c [ 4 ] & & c [ 2 ] - c [ 1 ] = = c [ 8 ] - c [ 7 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . parallelSort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int N = in . nextInt ( ) ; int M = in . nextInt ( ) ; if ( Math . abs ( N - M ) > = 2 ) { System . out . println ( 0 ) ; return ; } long mod = ( long ) ( 1e9 + 7 ) ; if ( N < M ) { int swap = N ; N = M ; M = swap ; } long res = 1 ; if ( N = = M ) { res = 2 ; } int NM = N + M ; for ( int i = 0 ; i < NM ; i + + ) { if ( i % 2 = = 0 ) { res * = N ; res % = mod ; N -- ; } else { res * = M ; res % = mod ; M -- ; } } System . out . println ( res ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = 200000 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int P = sc . nextInt ( ) ; min = Math . min ( min , P ) ; if ( min = = P ) cnt + + ; } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N [ ] = new int [ 4 ] ; for ( int n = 0 ; n < 4 ; n + + ) { N [ n ] = sc . nextInt ( ) ; } boolean a = false ; boolean b = false ; boolean c = false ; boolean d = false ; for ( int n = 0 ; n < 4 ; n + + ) { if ( N [ n ] = = 1 ) { a = true ; } if ( N [ n ] = = 9 ) { b = true ; } if ( N [ n ] = = 7 ) { c = true ; } if ( N [ n ] = = 4 ) { d = true ; } } if ( a & & b & & c & & d ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . text . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; int MOD = ( int ) 998244353 ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } void run ( ) { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double [ ] sh = { 0 , a } ; double [ ] lo = { 0 , b } ; double mit = 60 * h + m ; double hourkaku = ( 360 - ( 360 * h / 12 + 30 * m / 60 ) ) ; double mkaku = ( ( 360 - 360 * m / 60 ) % 360 ) ; double shx = sh [ 0 ] * Math . cos ( hourkaku * Math . PI / 180 ) - sh [ 1 ] * Math . sin ( hourkaku * Math . PI / 180 ) ; double shy = sh [ 0 ] * Math . sin ( hourkaku * Math . PI / 180 ) + sh [ 1 ] * Math . cos ( hourkaku * Math . PI / 180 ) ; double lox = lo [ 0 ] * Math . cos ( mkaku * Math . PI / 180 ) - lo [ 1 ] * Math . sin ( mkaku * Math . PI / 180 ) ; double loy = lo [ 0 ] * Math . sin ( mkaku * Math . PI / 180 ) + lo [ 1 ] * Math . cos ( mkaku * Math . PI / 180 ) ; double dis = Math . sqrt ( Math . pow ( shx - lox , 2 ) + Math . pow ( shy - loy , 2 ) ) ; System . out . println ( dis ) ; } } import java . util . * ; import java . io . * ; import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int N4 = sc . nextInt ( ) ; if ( ( N1 = = 1 | | N2 = = 1 | | N3 = = 1 | | N4 = = 1 ) & & ( N1 = = 9 | | N2 = = 9 | | N3 = = 9 | | N4 = = 9 ) & & ( N1 = = 7 | | N2 = = 7 | | N3 = = 7 | | N4 = = 7 ) & & ( N1 = = 4 | | N2 = = 4 | | N3 = = 4 | | N4 = = 4 ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; Map < Integer , Integer > input = new HashMap < Integer , Integer > ( ) ; int in = 0 ; int x = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { in = scan . nextInt ( ) ; if ( input . get ( in ) ! = null ) { x = input . get ( in ) ; x = x + 1 ; input . put ( in , x ) ; } else { input . put ( in , 1 ) ; } } int number5 = 0 ; int number7 = 0 ; String ans = " NO " ; number5 = input . get ( 5 ) ; if ( number5 ! = 0 ) { if ( number5 = = 2 ) { number7 = input . get ( 7 ) ; if ( number7 ! = 0 ) { if ( number7 = = 1 ) { ans = " YES " ; } } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = 10000000 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String A = " Three " ; for ( int i = 0 ; i < N ; i + + ) { String S = sc . next ( ) ; if ( S . equals ( " Y " ) ) { A = " Four " ; break ; } } System . out . println ( A ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = 0 ; Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) for ( int y = 0 ; y < = k ; y + + ) if ( s - x - y > = 0 & & s - x - y < = k ) ans + + ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A _ 1 = sc . nextInt ( ) ; int A _ 2 = sc . nextInt ( ) ; int A _ 3 = sc . nextInt ( ) ; int [ ] S = new int [ ] { A _ 1 , A _ 2 , A _ 3 } ; Arrays . sort ( S ) ; System . out . println ( ( S [ 2 ] - S [ 1 ] ) + ( S [ 1 ] - S [ 0 ] ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . UncheckedIOException ; 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 ; LightScanner in = new LightScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C4N solver = new C4N ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C4N { public void solve ( int testNumber , LightScanner in , PrintWriter out ) { long n = in . ints ( ) ; for ( int h = 1 ; h < = 3500 ; h + + ) { for ( int w = h ; w < = 3500 ; w + + ) { long c = n * h * w ; long m = 4 * h * w - n * ( w + h ) ; if ( m > 0 & & c % m = = 0 ) { out . print ( h ) ; out . print ( ' ' ) ; out . print ( c / m ) ; out . print ( ' ' ) ; out . println ( w ) ; return ; } } } } } static class LightScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public LightScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } public String string ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } public int ints ( ) { return Integer . parseInt ( string ( ) ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int s = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s > = i + j & & s - ( i + j ) < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int K = scanner . nextInt ( ) ; int S = scanner . nextInt ( ) ; scanner . close ( ) ; int combination = 0 ; int k ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { k = S - i - j ; if ( i + j + k = = S & & i > = 0 & & j > = 0 & & k > = 0 & & k < = K ) { combination + + ; } } } System . out . println ( combination ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String [ ] strlist = str . split ( " " ) ; int k = Integer . parseInt ( strlist [ 0 ] ) ; int s = Integer . parseInt ( strlist [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) { count = count + 1 ; continue ; } } } System . out . println ( count ) ; } } import java . io . BufferedInputStream ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( new BufferedInputStream ( System . in ) ) ; int a = sc . nextInt ( ) ; int m [ ] = new int [ a ] ; int min = a ; int count = 0 ; for ( int i = 0 ; i < a ; i + + ) { m [ i ] = sc . nextInt ( ) ; if ( m [ i ] < min ) min = m [ i ] ; if ( m [ i ] < = min ) count + + ; } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int A = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; final int H = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; sc . close ( ) ; double omega _ h = 2 * Math . PI / 12 ; double omega _ m = 2 * Math . PI / 60 ; double dig _ h = omega _ h * H + M * Math . PI / 360 ; double dig _ m = omega _ m * M ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . abs ( dig _ h - dig _ m ) ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int answer = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( 0 < = z ) & & ( z < = k ) ) { answer + = 1 ; } } } System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 1 ; i < = 7 ; i + + ) { if ( Math . pow ( 2 , i ) > n ) { System . out . print ( ( int ) Math . pow ( 2 , i - 1 ) ) ; break ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Math . abs ( a - b ) < = k & & Math . abs ( a - c ) < = k & & Math . abs ( a - d ) < = k & & Math . abs ( a - e ) < = k & & Math . abs ( b - c ) < = k & & Math . abs ( b - d ) < = k & & Math . abs ( b - e ) < = k & & Math . abs ( c - d ) < = k & & Math . abs ( c - e ) < = k & & Math . abs ( d - e ) < = k ) { System . out . println ( " Yay ! " ) ; return ; } System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] temp = scanner . nextLine ( ) . split ( " " ) ; int [ ] list = new int [ temp . length ] ; for ( int i = 0 ; i < 3 ; i + + ) { list [ i ] = Integer . parseInt ( temp [ i ] ) ; if ( list [ 0 ] > list [ i ] ) { int te = list [ 0 ] ; list [ 0 ] = list [ i ] ; list [ i ] = te ; } } int ans = 0 ; if ( list [ 2 ] > list [ 1 ] ) { ans = ( list [ 1 ] - list [ 0 ] ) + ( list [ 2 ] - list [ 1 ] ) ; } else { ans = ( list [ 2 ] - list [ 0 ] ) + ( list [ 1 ] - list [ 2 ] ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String [ ] temp = scanner . nextLine ( ) . split ( " " ) ; int tmp = 0 ; int count = 0 ; int min = Integer . parseInt ( temp [ 0 ] ) ; for ( int i = 1 ; i < n ; i + + ) { tmp = Integer . parseInt ( temp [ i ] ) ; if ( tmp = = Math . min ( min , tmp ) ) { count + + ; min = tmp ; } } System . out . println ( count + 1 ) ; } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; int s = Integer . parseInt ( st . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { if ( i > s ) break ; for ( int j = 0 ; j < = k ; j + + ) { if ( i + j > s ) break ; if ( ( s - ( i + j ) ) < = k ) count + = 1 ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] line = new int [ 4 ] ; line [ 0 ] = sc . nextInt ( ) ; line [ 1 ] = sc . nextInt ( ) ; line [ 2 ] = sc . nextInt ( ) ; line [ 3 ] = sc . nextInt ( ) ; String ans ; if ( ! isIn ( line , 1 ) ) { ans = " NO " ; } else if ( ! isIn ( line , 9 ) ) { ans = " NO " ; } else if ( ! isIn ( line , 7 ) ) { ans = " NO " ; } else if ( ! isIn ( line , 4 ) ) { ans = " NO " ; } else { ans = " YES " ; } System . out . println ( ans ) ; } public static boolean isIn ( int [ ] line , int x ) { for ( int n = 0 ; n < 4 ; n + + ) { if ( line [ n ] = = x ) { line [ n ] = 0 ; return true ; } } return false ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int P [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = scanner . nextInt ( ) ; } int min = N + 1 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = min ) { count + + ; min = P [ i ] ; } } System . out . println ( count ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { InputStream in = System . in ; Scanner sc = new Scanner ( in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int num = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int z = S - i - j ; if ( z > = 0 & & z < = K ) { num + + ; } } } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] n = new int [ 4 ] ; n [ 0 ] = 0 ; n [ 1 ] = 0 ; n [ 2 ] = 0 ; n [ 3 ] = 0 ; String StringLine = sc . nextLine ( ) ; StringLine = StringLine . replace ( " " , " " ) ; char [ ] array = StringLine . toCharArray ( ) ; for ( int i = 0 ; i < num ; i + + ) { switch ( array [ i ] ) { case ' P ' : n [ 0 ] + + ; break ; case ' W ' : n [ 1 ] + + ; break ; case ' G ' : n [ 2 ] + + ; break ; case ' Y ' : n [ 3 ] + + ; break ; } } int rc = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( n [ i ] = = 0 ) { rc + + ; } } switch ( rc ) { case 0 : System . out . println ( " Four " ) ; break ; case 1 : System . out . println ( " Three " ) ; break ; case 2 : System . out . println ( " Two " ) ; break ; case 3 : System . out . println ( " One " ) ; break ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int bn = 1 ; while ( bn < = n ) bn * = 2 ; System . out . println ( bn / 2 ) ; } } import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static PrintWriter out ; public static void main ( String [ ] args ) { Main . run ( ) ; } private static void run ( ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; Scanner sc = new Scanner ( System . in ) ; out . println ( count ( Integer . parseInt ( sc . next ( ) ) ) ) ; out . close ( ) ; sc . close ( ) ; } private static int count ( int pnum ) { int result = 0 ; for ( int i = 0 ; ( int ) Math . pow ( 2 , i ) < = pnum ; i + + ) { result = ( int ) Math . pow ( 2 , i ) ; } return result ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( scanner . nextInt ( ) ) ; } scanner . close ( ) ; int count = 0 ; int min = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( list . get ( i ) . compareTo ( min ) = = 1 ) { continue ; } count + = 1 ; min = list . get ( i ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = Integer . parseInt ( sc . next ( ) ) ; int B = Integer . parseInt ( sc . next ( ) ) ; int H = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; double Hdeg = H * 30 + M * 0.5 ; double Mdeg = M * 6 ; double deg = Hdeg - Mdeg ; if ( deg > 180 ) { deg = 360 - deg ; } deg = Math . abs ( deg ) ; double cSquare = A * A + B * B - ( 2 * A * B * Math . cos ( deg * Math . PI / 180 ) ) ; System . out . println ( Math . sqrt ( cSquare ) ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int tmp = sc . nextInt ( ) ; if ( tmp < min ) { min = Math . min ( min , tmp ) ; cnt + + ; } } System . out . print ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( z > = 0 & & z < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( k > = e - a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] str = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( str [ 0 ] ) ; int s = Integer . parseInt ( str [ 1 ] ) ; int cnt = 0 ; int x = 0 ; int y = 0 ; int z = 0 ; for ( x = k ; x > - 1 ; -- x ) { int rest = s - x ; if ( rest > 2 * k | | rest < 0 ) continue ; if ( rest > k ) { cnt + = - ( rest - 2 * k ) + 1 ; } else { cnt + = rest + 1 ; } } sb . append ( cnt ) ; System . out . println ( sb ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; sc . close ( ) ; double perMinRad = 360.0000 / 60.0000 ; double perHourRad = 360.0000 / ( 12.0000 * 60.0000 ) ; double minRad = perMinRad * M ; double hourRad = ( H * 60 * perHourRad ) + ( M * perHourRad ) ; double rad = hourRad - minRad ; if ( rad > 180 ) { rad = 360.0000 - rad ; } if ( rad = = 180.0 ) { System . out . println ( A + B ) ; } else { rad = Math . toRadians ( rad ) ; double cosRad = Math . cos ( rad ) ; double res = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * cosRad ) ) ; System . out . println ( res ) ; } } } import java . util . * ; public class Main { static Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = s . nextInt ( ) , SUM = s . nextInt ( ) , sum = 0 ; for ( int a = 0 ; a < = k ; a + + ) if ( a < = SUM ) for ( int b = 0 ; b < = k ; b + + ) if ( SUM - a - b > = 0 & & SUM - a - b < = k ) sum + + ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int tmp = 1 ; if ( n = = tmp ) { System . out . println ( " 1 " ) ; } else { while ( tmp < = n ) { tmp * = 2 ; } System . out . println ( tmp / 2 ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; if ( Arrays . stream ( s ) . filter ( e - > e . equals ( " Y " ) ) . count ( ) > 0L ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } sc . close ( ) ; } } import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int ans = 0 ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( 0 < = z & & z < = k ) ans + + ; } } out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = Integer . parseInt ( sc . next ( ) ) ; if ( n = = 5 ) five + + ; else if ( n = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { private static final int ANTENNA _ COUNT = 5 ; public static void main ( String [ ] args ) throws Exception { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { int [ ] antennas = new int [ ANTENNA _ COUNT ] ; for ( int i = 0 ; i < ANTENNA _ COUNT ; + + i ) { antennas [ i ] = Integer . parseInt ( reader . readLine ( ) ) ; } int maxDistance = Integer . parseInt ( reader . readLine ( ) ) ; test ( antennas , maxDistance ) ; } } public static void test ( int [ ] antennas , int maxDistance ) { int offset = 0 ; for ( int a = 0 ; a < ANTENNA _ COUNT ; + + a ) { + + offset ; for ( int b = offset ; b < ANTENNA _ COUNT ; + + b ) { int distance = antennas [ b ] - antennas [ a ] ; if ( distance > maxDistance ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { new Thread ( null , new Runnable ( ) { public void run ( ) { solve ( ) ; } } , " 1 " , 1 < < 26 ) . start ( ) ; } static void solve ( ) { FastReader fr = new FastReader ( ) ; PrintWriter op = new PrintWriter ( System . out ) ; int i = fr . nextInt ( ) , j = fr . nextInt ( ) ; double a = i * i , b = j * j ; int h = fr . nextInt ( ) , m = fr . nextInt ( ) ; double H = h * 30.0 + ( m * 30.0 ) / 60.0 , M = m * 6.0 , ang = Math . abs ( H - M ) ; ang = Math . min ( ang , 360.0 - ang ) ; double rad = Math . PI / 180.0 ; rad * = ang ; double c = a + b - ( 2.0 * i * j * Math . cos ( rad ) ) ; c = Math . sqrt ( c ) ; op . println ( c ) ; op . flush ( ) ; op . close ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ( ! st . hasMoreElements ( ) ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; import java . math . BigInteger ; public class Main { public static final int MOD = ( int ) 1e9 + 7 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; double h = Integer . parseInt ( sc . next ( ) ) ; double m = Integer . parseInt ( sc . next ( ) ) ; double hs = h / 12 + m / 60 / 12 ; double ms = m / 60 ; double e = Math . abs ( hs - ms ) * 360 ; double c = a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( e ) ) ; System . out . println ( Math . sqrt ( c ) ) ; } } import java . util . Arrays ; import java . util . List ; 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 ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( Math . abs ( n - m ) > = 2 ) { System . out . println ( 0 ) ; return ; } long ans = ( m = = n ) ? 2 : 1 ; for ( int i = 1 ; i < = n ; i + + ) { ans = ( ans * i ) % ( 1 _ 000 _ 000 _ 000 + 7 ) ; } for ( int i = 1 ; i < = m ; i + + ) { ans = ( ans * i ) % ( 1 _ 000 _ 000 _ 000 + 7 ) ; } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s - i - j < 0 | | s - i - j > k ) { continue ; } cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String color [ ] = new String [ N ] ; boolean or = false ; for ( int i = 0 ; i < N ; i + + ) { color [ i ] = sc . next ( ) ; if ( color [ i ] . equals ( " Y " ) ) or = true ; } if ( ! or ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; sc . close ( ) ; } } import java . util . * ; import java . io . * ; public class Main { BufferedReader br ; PrintWriter out ; StringTokenizer stok ; String nextToken ( ) throws IOException { while ( stok = = null | | ! stok . hasMoreTokens ( ) ) { String s = br . readLine ( ) ; if ( s = = null ) { return null ; } stok = new StringTokenizer ( s ) ; } return stok . nextToken ( ) ; } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; } char nextChar ( ) throws IOException { return ( char ) ( br . read ( ) ) ; } String nextLine ( ) throws IOException { return br . readLine ( ) ; } final double EPS = 1e-10 ; void solve ( ) throws IOException { double N = nextInt ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { double w = N * h * n / ( 4 * h * n - N * ( n + h ) ) ; if ( w > 0.1 & & Math . abs ( w - Math . round ( w ) ) < EPS ) { out . println ( h + " " + n + " " + ( ( long ) Math . round ( w ) ) ) ; return ; } } } } void run ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; br . close ( ) ; out . close ( ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } } import java . io . * ; import java . util . * ; public class Main { void submit ( ) { int N = nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = nextInt ( ) ; } int count = 1 ; if ( N = = 1 ) { out . println ( count ) ; return ; } int min = P [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( min > = P [ i ] ) { min = P [ i ] ; count + + ; } } out . println ( count ) ; } void preCalc ( ) { } void stress ( ) { } void test ( ) { } Main ( ) throws IOException { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; preCalc ( ) ; submit ( ) ; out . close ( ) ; } static final Random rng = new Random ( ) ; static int rand ( int l , int r ) { return l + rng . nextInt ( r - l + 1 ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) ; } BufferedReader br ; PrintWriter out ; StringTokenizer st ; String nextToken ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } String nextString ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } int nextInt ( ) { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( nextToken ( ) ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Integer x = 5 ; Integer y = 7 ; boolean b = false ; Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > inputs = new ArrayList < Integer > ( ) { { add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; } } ; if ( inputs . remove ( x ) & & inputs . size ( ) = = 2 ) { if ( inputs . remove ( x ) & & inputs . size ( ) = = 1 ) { if ( inputs . remove ( y ) & & inputs . size ( ) = = 0 ) { b = true ; } } } if ( b ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int H _ degree = 30 * H ; int M _ degree = 6 * M ; double radian = Math . PI * 2 * ( H / 12.0 + ( M / 60.0 ) / 12.0 - M / 60.0 ) ; double cos = Math . cos ( radian ) ; double ans = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B * cos ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c5 = 0 ; int c7 = 0 ; int a = sc . nextInt ( ) ; if ( a = = 7 ) c7 + + ; else if ( a = = 5 ) c5 + + ; int b = sc . nextInt ( ) ; if ( b = = 7 ) c7 + + ; else if ( b = = 5 ) c5 + + ; int c = sc . nextInt ( ) ; if ( c = = 7 ) c7 + + ; else if ( c = = 5 ) c5 + + ; if ( c5 = = 2 & & c7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer n = sc . nextInt ( ) ; Integer x = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n + 1 ] ; Integer [ ] [ ] b = new Integer [ n + 1 ] [ n ] ; Long result ; Long cost = 0L ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = sc . nextInt ( ) ; b [ i ] [ 0 ] = a [ i ] ; cost + = b [ i ] [ 0 ] ; } result = cost ; for ( int k = 1 ; k < n ; k + + ) { cost = ( long ) k * x ; for ( int i = 1 ; i < = n ; i + + ) { if ( i > k ) { b [ i ] [ k ] = Math . min ( b [ i ] [ k - 1 ] , a [ i - k ] ) ; } else { b [ i ] [ k ] = Math . min ( b [ i ] [ k - 1 ] , a [ i - k + n ] ) ; } cost + = b [ i ] [ k ] ; } if ( cost < result ) { result = cost ; } } System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; double radian = Math . PI * 2 * ( C / 12.0 + ( D / 60.0 ) / 12.0 - D / 60.0 ) ; System . out . println ( Math . sqrt ( ( double ) ( ( A * A ) + ( B * B ) - ( 2 * A * B * Math . cos ( radian ) ) ) ) ) ; } } 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 i = 0 ; while ( true ) { if ( ( 1 < < ( i + 1 ) ) < = N ) i + + ; else break ; } System . out . println ( 1 < < i ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( ) ; System . out . println ( ( a * b * c ) % 175 = = 0 ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] p = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; sc . close ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( p [ j ] - p [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . util . Comparator ; import java . util . Map ; import java . util . HashMap ; public class Main { int k , s ; public static void main ( String args [ ] ) { new Main ( ) . solve ( ) ; } void solve ( ) { in ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int n = s - i - j ; if ( n > = 0 & & n < = k ) cnt + + ; } } out ( cnt ) ; } void in ( ) { Scanner sc = new Scanner ( System . in ) ; k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; } void out ( ) { } void out ( int n ) { System . out . println ( n ) ; } void out ( char c ) { System . out . print ( c ) ; } void out ( String s ) { System . out . println ( s ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int cnt = 0 ; while ( N ! = 1 ) { N = N > > 1 ; cnt + + ; } System . out . println ( N < < cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) x [ i ] = sc . nextInt ( ) ; sc . close ( ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; + + i ) if ( x [ i ] = = 5 ) + + count5 ; else if ( x [ i ] = = 7 ) + + count7 ; if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int number1 = 0 ; int number2 = 0 ; int number3 = 0 ; String anser = " NO " ; Scanner scan = new Scanner ( System . in ) ; number1 = scan . nextInt ( ) ; number2 = scan . nextInt ( ) ; number3 = scan . nextInt ( ) ; if ( checkFiveOrSeven ( number1 ) ) { if ( checkFiveOrSeven ( number2 ) ) { if ( checkFiveOrSeven ( number3 ) ) { if ( number1 + number2 + number3 = = 17 ) { anser = " YES " ; } } } } System . out . println ( anser ) ; } private static boolean checkFiveOrSeven ( int number ) { if ( number = = 5 | | number = = 7 ) { return true ; } return false ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; boolean flag = false ; for ( int i = 0 ; i < N ; i + + ) { String a = scanner . next ( ) ; if ( a . equals ( " Y " ) ) { flag = true ; } } if ( flag = = true ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { long n = sc . nextLong ( ) ; long p = sc . nextLong ( ) ; long max = ( long ) Math . pow ( p , 1.0 / n ) + 1 ; System . out . println ( getAns ( n , p , max ) ) ; } long getAns ( long n , long p , long max ) { for ( long i = max ; i > = 1 ; i -- ) { if ( p % ( long ) Math . pow ( i , n ) = = 0 ) return i ; } return 1 ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } import java . util . * ; class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { String s [ ] = new String [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { s [ i ] = sc . next ( ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; int antn [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antn [ i ] = Integer . parseInt ( s [ i ] ) ; } for ( int r = 0 ; r < 5 ; r + + ) { for ( int t = 0 ; t < 4 ; t + + ) { if ( Math . abs ( antn [ r ] - antn [ t ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final long MOD = 1000000007 ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; if ( Math . abs ( N - M ) > 1 ) { System . out . println ( 0 ) ; } else { long ans = 1 ; for ( int i = 2 ; i < = N ; i + + ) ans = ( ans * i ) % MOD ; for ( int i = 2 ; i < = M ; i + + ) ans = ( ans * i ) % MOD ; if ( N = = M ) ans = ( ans * 2 ) % MOD ; System . out . println ( ans ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner teclado = new Scanner ( System . in ) ; int A , B , C , D , E ; A = teclado . nextInt ( ) ; B = teclado . nextInt ( ) ; C = teclado . nextInt ( ) ; D = teclado . nextInt ( ) ; E = teclado . nextInt ( ) ; int k = teclado . nextInt ( ) ; if ( B - A < = k & & C - A < = k & & D - A < = k & & E - A < = k & & C - B < = k & & D - B < = k & & E - B < = k & & D - C < = k & & E - C < = k & & E - D < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) a [ i ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int c = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ( a [ j ] - a [ i ] ) > k ) { c + + ; System . out . println ( " : ( " ) ; break ; } } if ( c > 0 ) break ; } if ( c = = 0 ) System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] arg ) { int [ ] count = new int [ 10 + 1 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int len = sc . nextInt ( ) ; count [ len ] + + ; } System . out . println ( count [ 5 ] = = 2 & & count [ 7 ] = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String s2 = sc . next ( ) ; String s3 = sc . next ( ) ; String s4 = sc . next ( ) ; String t = s + s2 + s3 + s4 ; if ( t . contains ( " 1 " ) & & t . contains ( " 9 " ) & & t . contains ( " 7 " ) & & t . contains ( " 4 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } System . out . println ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < array . length ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean flag = true ; for ( int i = 0 ; i < array . length ; i + + ) { for ( int j = i + 1 ; j < array . length ; j + + ) { if ( array [ j ] - array [ i ] > k ) { System . out . println ( " : ( " ) ; flag = false ; break ; } } if ( ! flag ) { break ; } } if ( flag ) { System . out . println ( " Yay ! " ) ; } } } import java . io . PrintWriter ; import java . util . Scanner ; public class Main { static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { final int [ ] a = new int [ 3 ] ; try ( Scanner scan = new Scanner ( System . in ) ) { a [ 0 ] = scan . nextInt ( ) ; a [ 1 ] = scan . nextInt ( ) ; a [ 2 ] = scan . nextInt ( ) ; } int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( a [ i ] = = 5 ) { count5 + + ; } else if ( a [ i ] = = 7 ) { count7 + + ; } } final boolean result = count5 = = 2 & & count7 = = 1 ; out . println ( result ? " YES " : " NO " ) ; out . flush ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 4 ; j > = 0 + ( i + 1 ) ; j -- ) { if ( Math . max ( a [ i ] , a [ j ] ) - Math . min ( a [ i ] , a [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { nums [ i ] = scanner . nextInt ( ) ; } int sum = 0 ; int count = 0 ; for ( int i = 0 ; i < nums . length ; i + + ) { if ( nums [ i ] = = 5 ) { sum + + ; } else if ( nums [ i ] = = 7 ) { count + + ; } else { sum + = 0 ; count + = 0 ; } } if ( sum = = 2 & & count = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] antenas = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int dist = sc . nextInt ( ) ; boolean res = true ; for ( int i = 0 ; i < antenas . length - 1 ; i + + ) { for ( int j = i ; j + i < antenas . length - 1 ; j + + ) { if ( antenas [ j + 1 ] - antenas [ i ] > dist ) { res = false ; break ; } } if ( ! res ) break ; } System . out . println ( res ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = 0 ; if ( a = = b ) { if ( a < c ) { d = 1 ; } } else if ( a = = c ) { if ( a < b ) { d = 1 ; } } else if ( c = = b ) { if ( c < a ) { d = 1 ; } } if ( d = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) , e = sc . nextInt ( ) , k = sc . nextInt ( ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; } } import java . util . * ; import java . io . * ; public class Main { static long mod = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long a = 0 ; for ( int i = 0 ; i < n ; i + + ) { long x = sc . nextLong ( ) ; a = ( a + x * i ) % mod ; a = ( a - x * ( n - 1 - i ) ) % mod ; if ( a < 0 ) a + = mod ; } long b = 0 ; for ( int i = 0 ; i < m ; i + + ) { long x = sc . nextLong ( ) ; b = ( b + x * i ) % mod ; b = ( b - x * ( m - 1 - i ) ) % mod ; if ( b < 0 ) b + = mod ; } out . println ( ( a * b ) % mod ) ; out . close ( ) ; } 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 N = sc . nextInt ( ) ; int [ ] p = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; int pj = p [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( p [ i ] < = pj ) { + + count ; pj = p [ i ] ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A , B , H , M ; A = Integer . parseInt ( in . next ( ) ) ; B = Integer . parseInt ( in . next ( ) ) ; H = Integer . parseInt ( in . next ( ) ) ; M = Integer . parseInt ( in . next ( ) ) ; double pi = Math . PI ; double alpha = 2 * pi * H / 12 + 2 * pi * M / 720 ; double beta = 2 * pi * M / 60 ; double ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( alpha - beta ) ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static Long gcd ( Long num1 , Long num2 ) { if ( num2 = = 0 ) return num1 ; else return gcd ( num2 , num1 % num2 ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int ans = a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 0 ; for ( int i = N ; i > 0 ; i -- ) { if ( Check ( i ) ) { result = i ; break ; } } System . out . println ( result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static boolean Check ( int n ) { while ( n % 2 = = 0 ) { n = n / 2 ; } if ( n = = 1 ) return true ; return false ; } } import java . io . * ; import java . util . * ; class Main { static Scanner scanner = new Scanner ( ) ; static long mod = 1000000007 ; public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scanner . nextInt ( ) ; if ( i > 0 ) { x [ i ] - = sum ; } sum + = x [ i ] ; } sum = 0 ; for ( int i = 0 ; i < m ; i + + ) { y [ i ] = scanner . nextInt ( ) ; if ( i > 0 ) { y [ i ] - = sum ; } sum + = y [ i ] ; } long c = 0 ; for ( int i = 1 ; i < m ; i + + ) { c = ( c + y [ i ] * i % mod * ( m - i ) % mod ) % mod ; } long ans = 0 ; for ( int i = 1 ; i < n ; i + + ) { ans = ( ans + c * x [ i ] % mod * i % mod * ( n - i ) % mod ) % mod ; } System . out . println ( ans ) ; } static class Scanner { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) , 32768 ) ; StringTokenizer tokenizer ; String next ( ) { try { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str ; while ( ( str = br . readLine ( ) ) ! = null ) { String [ ] sp = str . split ( " " ) ; int h = Integer . parseInt ( sp [ 0 ] ) ; int r = Integer . parseInt ( sp [ 1 ] ) ; if ( h + r = = 0 ) { System . out . println ( 0 ) ; } else if ( h + r > 0 ) { System . out . println ( 1 ) ; } else { System . out . println ( - 1 ) ; } } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int c = scn . nextInt ( ) ; int [ ] arr = { a , b , c } ; Arrays . parallelSort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long t1 = sc . nextLong ( ) ; long t2 = sc . nextLong ( ) ; long a1 = sc . nextLong ( ) ; long a2 = sc . nextLong ( ) ; long b1 = sc . nextLong ( ) ; long b2 = sc . nextLong ( ) ; long sub1 = ( a1 - b1 ) * t1 ; long sub2 = ( a2 - b2 ) * t2 ; if ( sub1 + sub2 = = 0 ) { System . out . println ( " infinity " ) ; return ; } else if ( sub1 > 0 & & sub2 > 0 ) { System . out . println ( 0 ) ; return ; } else if ( sub1 < 0 & & sub2 < 0 ) { System . out . println ( 0 ) ; return ; } if ( sub1 < 0 ) { sub1 = - sub1 ; sub2 = - sub2 ; } long dist = sub1 + sub2 ; if ( dist < 0 ) { if ( ( sub1 % ( - dist ) = = 0 ) ) { System . out . println ( ( sub1 / ( - dist ) ) * 2 ) ; return ; } System . out . println ( ( sub1 / ( - dist ) ) * 2 + 1 ) ; return ; } System . out . println ( 0 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int bucket [ ] = new int [ 15 ] ; for ( int i = 0 ; i < 3 ; i + + ) { bucket [ sc . nextInt ( ) ] + + ; } System . out . println ( bucket [ 5 ] = = 2 & & bucket [ 7 ] = = 1 ? " YES " : " NO " ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > A = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { A . add ( Integer . parseInt ( sc . next ( ) ) ) ; } Collections . sort ( A ) ; System . out . println ( A . get ( 2 ) - A . get ( 0 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] [ ] dx = new int [ 3 ] [ 2 ] ; int [ ] [ ] dy = new int [ 2 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { dx [ i ] [ 0 ] = ( c [ i ] [ 0 ] - c [ i ] [ 1 ] ) ; dx [ i ] [ 1 ] = ( c [ i ] [ 1 ] - c [ i ] [ 2 ] ) ; } for ( int j = 0 ; j < 3 ; j + + ) { dy [ 0 ] [ j ] = Math . abs ( c [ 0 ] [ j ] - c [ 1 ] [ j ] ) ; dy [ 1 ] [ j ] = Math . abs ( c [ 1 ] [ j ] - c [ 2 ] [ j ] ) ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( dy [ i ] [ 0 ] ! = dy [ i ] [ 1 ] | | dy [ i ] [ 0 ] ! = dy [ i ] [ 2 ] ) { System . out . println ( " No " ) ; return ; } } for ( int j = 0 ; j < 2 ; j + + ) { if ( dx [ 0 ] [ j ] ! = dx [ 1 ] [ j ] | | dx [ 0 ] [ j ] ! = dx [ 2 ] [ j ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static int [ ] N = new int [ 10 ] ; public static void main ( String [ ] args ) { for ( int i = 0 ; i < 4 ; i + + ) { N [ sc . nextInt ( ) ] = 1 ; } if ( N [ 1 ] = = 1 & & N [ 7 ] = = 1 & & N [ 4 ] = = 1 & & N [ 9 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Comparator ; import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; PriorityQueue < Integer > surplus = new PriorityQueue < > ( Comparator . reverseOrder ( ) ) ; int count = 0 ; long shortage = 0L ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] = = b [ i ] ) continue ; if ( a [ i ] > b [ i ] ) { surplus . add ( a [ i ] - b [ i ] ) ; } else { shortage + = b [ i ] - a [ i ] ; count + + ; } } while ( shortage > 0 ) { Integer i = surplus . poll ( ) ; if ( i = = null ) { System . out . println ( - 1 ) ; return ; } shortage - = i ; count + + ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int max = 0 ; for ( int i = 0 ; i < = N ; i + + ) { int count = 0 ; for ( int j = 0 ; j < N ; j + + ) { if ( Math . pow ( 2 , j ) = = i ) { count = j ; } } max = ( max < count ) ? count : max ; } System . out . println ( ( int ) Math . pow ( 2 , max ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k > = e - a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int k = S - i - j ; if ( k > = 0 & & k < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int a , b , c ; int count = 0 ; for ( a = 0 ; a < = k ; a + + ) { for ( b = 0 ; b < = k ; b + + ) { c = s - a - b ; if ( c > = 0 & & c < = k ) count + + ; } } System . out . println ( count ) ; } } import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner in = new Scanner ( System . in ) ) { int N = in . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = in . next ( ) ; } HashSet < String > set = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( S [ i ] ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = std . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = std . nextInt ( ) ; } int max = p [ 0 ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int value = p [ i ] ; if ( value < = max ) { count + + ; } max = Math . min ( max , value ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int value = a + b + c ; int product = a * b * c ; if ( value = = 5 + 5 + 7 & product = = 5 * 5 * 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] nums = sc . nextLine ( ) . split ( " " ) ; int cont = 1 ; int bump = Integer . parseInt ( nums [ 0 ] ) ; for ( int i = 1 ; i < nums . length ; i + + ) { if ( Integer . parseInt ( nums [ i ] ) < bump ) { bump = Integer . parseInt ( nums [ i ] ) ; cont + + ; } } System . out . println ( cont ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { static String [ ] ANS = { " Three " , " Four " } ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . nextLine ( ) ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( ANS [ set . size ( ) - 3 ] ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] a = IntStream . range ( 0 , N ) . map ( i - > scanner . nextInt ( ) ) . toArray ( ) ; System . out . println ( permutation ( a ) ) ; } } private static int permutation ( int [ ] seed ) { int [ ] perm = new int [ seed . length ] ; boolean [ ] used = new boolean [ seed . length ] ; return buildPerm ( seed , perm , used , 0 ) ; } private static int buildPerm ( int [ ] seed , int [ ] perm , boolean [ ] used , int index ) { if ( seed . length = = index ) { return procPerm ( perm ) ; } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < seed . length ; + + i ) { if ( ! used [ i ] ) { perm [ index ] = seed [ i ] ; used [ i ] = true ; min = Math . min ( min , buildPerm ( seed , perm , used , index + 1 ) ) ; used [ i ] = false ; } } return min ; } private static int procPerm ( int [ ] perm ) { return IntStream . range ( 1 , perm . length ) . map ( i - > Math . abs ( perm [ i ] - perm [ i - 1 ] ) ) . sum ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 3 ] ; n [ 0 ] = sc . nextInt ( ) ; n [ 1 ] = sc . nextInt ( ) ; n [ 2 ] = sc . nextInt ( ) ; if ( n [ 0 ] * n [ 1 ] * n [ 2 ] = = 25 * 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = p [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( p [ i ] < min ) { ans + + ; min = p [ i ] ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . io . * ; class Main { void solve ( ) { int n = inint ( ) ; int [ ] a = inintar ( n ) ; int count = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( min , a [ i ] ) ; if ( min > = a [ i ] ) count + + ; } out . println ( count ) ; } public static Scanner in = new Scanner ( System . in ) ; public static PrintWriter out = new PrintWriter ( System . out ) ; public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; out . flush ( ) ; } public int inint ( ) { return in . nextInt ( ) ; } public long inlong ( ) { return in . nextLong ( ) ; } public double indouble ( ) { return in . nextDouble ( ) ; } public String instr ( ) { return in . next ( ) ; } public char inchar ( ) { return in . next ( ) . charAt ( 0 ) ; } public int [ ] inintar ( int num ) { int [ ] a = new int [ num ] ; for ( int i = 0 ; i < num ; i + + ) { a [ i ] = in . nextInt ( ) ; } return a ; } public char [ ] incharar ( ) { return in . next ( ) . toCharArray ( ) ; } public char [ ] [ ] incharmap ( int h , int w ) { char [ ] [ ] a = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { String temp = in . next ( ) ; for ( int j = 0 ; j < w ; j + + ) { a [ i ] [ j ] = temp . charAt ( j ) ; } } return a ; } } import java . util . HashSet ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; HashSet < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } if ( set . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { String line = " " ; try { line = readLine ( ) ; StringTokenizer st = new StringTokenizer ( line , " " ) ; String k = st . nextToken ( ) ; String s = st . nextToken ( ) ; int k1Value = Integer . parseInt ( k ) ; int sValue = Integer . parseInt ( s ) ; int cnt = 0 ; int x = 0 ; for ( int i = 0 ; i < sValue + 1 ; i + + ) { if ( i > k1Value ) { continue ; } for ( int j = 0 ; j < sValue + 1 ; j + + ) { if ( j > k1Value ) { continue ; } else if ( sValue - i - j > k1Value ) { continue ; } if ( i + j < = sValue ) { cnt + + ; } } } System . out . println ( cnt ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static String readLine ( ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return br . readLine ( ) ; } } import java . util . Scanner ; public class Main { static int ans = 1 ; static int min ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } min = a [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { check ( n , a , i ) ; } System . out . println ( ans ) ; } public static void check ( int n , int [ ] a , int i ) { if ( a [ i ] < min ) { min = a [ i ] ; ans + + ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] [ ] c2 = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; c2 [ i ] [ j ] = c [ i ] [ j ] ; } } for ( int i = 0 ; i < 3 ; i + + ) { c [ i ] [ 2 ] - = c [ i ] [ 0 ] ; c [ i ] [ 1 ] - = c [ i ] [ 0 ] ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( c [ 0 ] [ i + 1 ] ! = c [ 1 ] [ i + 1 ] | | c [ 2 ] [ i + 1 ] ! = c [ 1 ] [ i + 1 ] ) { System . out . println ( " No " ) ; return ; } } for ( int i = 0 ; i < 3 ; i + + ) { c2 [ 2 ] [ i ] - = c2 [ 0 ] [ i ] ; c2 [ 1 ] [ i ] - = c2 [ 0 ] [ i ] ; } for ( int i = 0 ; i < 2 ; i + + ) { if ( c2 [ i + 1 ] [ 0 ] ! = c2 [ i + 1 ] [ 1 ] | | c2 [ i + 1 ] [ 2 ] ! = c2 [ i + 1 ] [ 1 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; int k = 0 ; for ( int i = 0 ; i < 6 & & s . hasNextLine ( ) ; i + + ) { if ( i < 5 ) { antennas [ i ] = Integer . parseInt ( s . nextLine ( ) ) ; } else if ( i = = 5 ) { k = Integer . parseInt ( s . nextLine ( ) ) ; } else { System . exit ( - 1 ) ; } } if ( available ( antennas , k ) ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } public static boolean available ( int [ ] antennas , int k ) { for ( int i = 0 ; i < antennas . length ; i + + ) { for ( int j = i + 1 ; j < antennas . length ; j + + ) { int distance = Math . abs ( antennas [ i ] - antennas [ j ] ) ; if ( distance > k ) { return false ; } } } return true ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { try ( Scanner in = new Scanner ( System . in ) ) { int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = in . nextInt ( ) ; } int k = in . nextInt ( ) ; for ( int i = 0 ; i < a . length ; i + + ) { for ( int j = i + 1 ; j < a . length ; j + + ) { if ( a [ j ] - a [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; try { while ( ( line = br . readLine ( ) ) ! = null ) { StringTokenizer token = new StringTokenizer ( line ) ; while ( token . hasMoreElements ( ) ) { if ( Integer . parseInt ( token . nextElement ( ) . toString ( ) ) = = 7 ) sevenCounter + + ; else fiveCounter + + ; } } } catch ( Exception ex ) { } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 1 ] [ 1 ] = = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] & & c [ 1 ] [ 2 ] = = c [ 1 ] [ 0 ] + c [ 0 ] [ 2 ] - c [ 0 ] [ 0 ] & & c [ 2 ] [ 1 ] = = c [ 2 ] [ 0 ] + c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] & & c [ 2 ] [ 2 ] = = c [ 2 ] [ 0 ] + c [ 0 ] [ 2 ] - c [ 0 ] [ 0 ] ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static int lcm ( int x , int y ) { return x * y / gcd ( x , y ) ; } public static int gcd ( int x , int y ) { if ( x < y ) return gcd ( y , x ) ; if ( y = = 0 ) return x ; return gcd ( y , x % y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean [ ] b = new boolean [ 4 ] ; for ( int i = 0 ; i < n ; i + + ) { char a = sc . next ( ) . charAt ( 0 ) ; switch ( a ) { case ' P ' : b [ 0 ] = true ; break ; case ' W ' : b [ 1 ] = true ; break ; case ' G ' : b [ 2 ] = true ; break ; case ' Y ' : b [ 3 ] = true ; break ; } } int cnt = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { if ( b [ i ] ) { cnt + + ; } } if ( cnt = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int day , numberOfTypes , bestShowy = 0 ; day = sc . nextInt ( ) ; numberOfTypes = sc . nextInt ( ) ; int temperature [ ] = new int [ day ] ; int clothesInfo [ ] [ ] = new int [ numberOfTypes ] [ 3 ] ; for ( int i = 0 ; i < day ; i + + ) { temperature [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < numberOfTypes ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { clothesInfo [ i ] [ j ] = sc . nextInt ( ) ; } } int showy [ ] [ ] = new int [ day ] [ numberOfTypes ] ; for ( int i = 0 ; i < day ; i + + ) { for ( int j = 0 ; j < numberOfTypes ; j + + ) { if ( clothesInfo [ j ] [ 0 ] < = temperature [ i ] & & clothesInfo [ j ] [ 1 ] > = temperature [ i ] ) { showy [ i ] [ j ] = 0 ; } else { showy [ i ] [ j ] = - 1 ; } } } for ( int i = 1 ; i < day ; i + + ) { for ( int j = 0 ; j < numberOfTypes ; j + + ) { if ( showy [ i ] [ j ] = = 0 ) { for ( int k = 0 ; k < numberOfTypes ; k + + ) { if ( showy [ i - 1 ] [ k ] ! = - 1 ) { showy [ i ] [ j ] = Math . max ( showy [ i ] [ j ] , showy [ i - 1 ] [ k ] + Math . abs ( clothesInfo [ k ] [ 2 ] - clothesInfo [ j ] [ 2 ] ) ) ; } } } } } for ( int p = 0 ; p < numberOfTypes ; p + + ) { bestShowy = Math . max ( bestShowy , showy [ day - 1 ] [ p ] ) ; } System . out . println ( bestShowy ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) , temp = t , counter = 0 ; for ( int count = 0 ; count < t ; count + + ) { int x = scan . nextInt ( ) ; if ( x < = temp ) { temp = x ; counter + + ; } } System . out . println ( counter ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int z = s - i - j ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int q = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( q > p ) { count + + ; q = p ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double t = ( double ) ( h * 30 + ( double ) ( m / 2 ) ) ; double ak = Math . toRadians ( t ) ; double bk = Math . toRadians ( m * 6 ) ; double ax = a * Math . sin ( ak ) ; double ay = a * Math . cos ( ak ) ; double bx = b * Math . sin ( bk ) ; double by = b * Math . cos ( bk ) ; System . out . println ( Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; } public void solve ( ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int N = scan . nextInt ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long x = 4 * h * w - N * w - N * h ; if ( x < = 0 ) { continue ; } long y = N * h * w ; if ( y % x = = 0 ) { System . out . printf ( " % d % d % d \ n " , h , w , y / x ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int antenas [ ] = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { antenas [ i ] = Integer . parseInt ( sc . nextLine ( ) ) ; } sc . close ( ) ; boolean isConnect = true ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = 1 ; j < 5 ; j + + ) { if ( antenas [ j ] - antenas [ i ] > antenas [ 5 ] ) { isConnect = false ; } } } if ( isConnect ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner s = new Scanner ( System . in ) ) { final int A = s . nextInt ( ) , B = s . nextInt ( ) , H = s . nextInt ( ) , M = s . nextInt ( ) ; double hAngle = 2 * Math . PI * ( H * 60 + M ) / ( 60 * 12 ) ; double mAngle = 2 * Math . PI * M / 60 ; double theta = Math . abs ( hAngle - mAngle ) ; System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( theta ) ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = 3 ; Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { list . add ( sc . nextInt ( ) ) ; } Collections . sort ( list ) ; if ( ( list . get ( 0 ) = = 5 ) & & ( list . get ( 1 ) = = 5 ) & & ( list . get ( 2 ) = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { private Scanner sc ; public static void main ( String [ ] args ) { new Main ( ) ; } public Main ( ) { sc = new Scanner ( System . in ) ; int num = Integer . parseInt ( sc . nextLine ( ) ) ; int ans = 1 ; while ( ans < = num ) { ans = ans * 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String [ ] arsg ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = { a , b , c , d , e } ; String ans = " Yay ! " ; out : for ( int i = 0 ; i < l . length - 1 ; i + + ) { for ( int x = 1 ; x < l . length ; x + + ) { if ( Math . abs ( l [ i ] - l [ x ] ) > k ) { ans = " : ( " ; break out ; } } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String yellow = " Y " ; String [ ] color = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { color [ i ] = scan . next ( ) ; if ( color [ i ] . contains ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { static boolean [ ] isPrime ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; sc . close ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; System . exit ( 0 ) ; } long ans = 1 ; long t = ( long ) Math . pow ( P , ( double ) 1 / N ) + 1 ; for ( long k = 2 ; k < = t ; k + + ) { long s = ( long ) Math . pow ( k , N ) ; if ( P % s = = 0 ) { ans = k ; } } System . out . println ( ans ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; List < String > ss = new ArrayList < String > ( ) ; try { ss . add ( sc . next ( ) ) ; ss . add ( sc . next ( ) ) ; ss . add ( sc . next ( ) ) ; Collections . sort ( ss ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( ( i = = 0 | | i = = 1 ) & & ! " 5 " . equals ( ss . get ( i ) ) ) { System . out . println ( " NO " ) ; throw new Exception ( ) ; } else if ( i = = 3 & & ! " 7 " . equals ( ss . get ( i ) ) ) { System . out . println ( " NO " ) ; throw new Exception ( ) ; } } System . out . println ( " YES " ) ; } catch ( Exception e ) { } finally { sc . close ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 9 ; i + + ) c [ i / 3 ] [ i % 3 ] = sc . nextInt ( ) ; System . out . println ( c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] = = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] & & c [ 0 ] [ 2 ] + c [ 2 ] [ 0 ] = = c [ 0 ] [ 0 ] + c [ 2 ] [ 2 ] & & c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] = = c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ? " Yes " : " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int th = sc . nextInt ( ) ; int diff = a [ 4 ] - a [ 0 ] ; if ( diff > th ) { System . out . println ( " : ( " ) ; sc . close ( ) ; } else { System . out . println ( " Yay ! " ) ; sc . close ( ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int antennaAmounts = 5 ; int [ ] antennas = new int [ antennaAmounts ] ; for ( int i = 0 ; i < antennaAmounts ; i + + ) { antennas [ i ] = sc . nextInt ( ) ; } int inputK = sc . nextInt ( ) ; sc . close ( ) ; if ( antennas [ antennaAmounts - 1 ] - antennas [ 0 ] < = inputK ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; String result = " " ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { result = " YES " ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { result = " YES " ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { result = " YES " ; } else { result = " NO " ; } System . out . println ( result ) ; } } import java . math . BigDecimal ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; BigDecimal hourY = new BigDecimal ( a * Math . sin ( Math . toRadians ( ( double ) ( ( 60 * h ) + m ) * 0.5 ) ) ) ; BigDecimal hourX = new BigDecimal ( a * Math . cos ( Math . toRadians ( ( double ) ( ( 60 * h ) + m ) * 0.5 ) ) ) ; BigDecimal minuteY = new BigDecimal ( b * Math . sin ( Math . toRadians ( 6 * m ) ) ) ; BigDecimal minuteX = new BigDecimal ( b * Math . cos ( Math . toRadians ( 6 * m ) ) ) ; BigDecimal x = hourX . subtract ( minuteX ) ; BigDecimal y = hourY . subtract ( minuteY ) ; BigDecimal xx = x . multiply ( x ) ; BigDecimal yy = y . multiply ( y ) ; BigDecimal preResult = xx . add ( yy ) ; System . out . println ( Math . sqrt ( preResult . doubleValue ( ) ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] ag ) { Scanner sc = new Scanner ( System . in ) ; int lastN = 0 ; int a = sc . nextInt ( ) ; for ( int i = 0 ; i < 32 ; i + + ) { if ( a % 2 = = 1 ) { lastN = i ; } a / = 2 ; } int res = 1 ; for ( int i = 0 ; i < lastN ; i + + ) { res * = 2 ; } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputs = sc . nextInt ( ) ; int num ; int count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < inputs ; i + + ) { num = sc . nextInt ( ) ; if ( min > num ) { min = num ; } if ( min = = num ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; String [ ] s = new String [ N ] ; int truefalse = 0 ; for ( int i = 0 ; i < N ; i + + ) { s [ i ] = scanner . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { System . out . println ( " Four " ) ; truefalse + + ; break ; } } if ( truefalse = = 0 ) { System . out . println ( " Three " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; boolean yellow = false ; int N = s . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( s . next ( ) . charAt ( 0 ) = = ' Y ' ) yellow = true ; } if ( yellow ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . close ( ) ; double shortHand = m * 6 ; double longHand = h * 30 + m * 0.5 ; double angle = Math . max ( longHand , shortHand ) - Math . min ( longHand , shortHand ) ; double distance = Math . sqrt ( b * b + a * a - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( distance ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int grid [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { grid [ i ] [ j ] = sc . nextInt ( ) ; } } String ans = " No " ; for ( int i = 0 ; i < = grid [ 0 ] [ 0 ] ; i + + ) { int a0 = i ; int b0 = grid [ 0 ] [ 0 ] - a0 ; int a1 = grid [ 1 ] [ 0 ] - b0 ; int a2 = grid [ 2 ] [ 0 ] - b0 ; boolean isOK = true ; for ( int y = 1 ; y < 3 ; y + + ) { int by1 = grid [ 0 ] [ y ] - a0 ; int by2 = grid [ 1 ] [ y ] - a1 ; int by3 = grid [ 2 ] [ y ] - a2 ; if ( by1 < 0 | | by2 < 0 | | by3 < 0 ) { isOK = false ; break ; } if ( by1 ! = by2 | | by2 ! = by3 ) { isOK = false ; break ; } } if ( isOK ) { ans = " Yes " ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { static int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) , s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < k + 1 ; i + + ) for ( int j = 0 ; j < k + 1 ; j + + ) { if ( i + j < = s & & i + j + k > = s ) ans + + ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static int p [ ] ; public static int min = 2 * 10 * 10 * 10 * 10 * 10 + 1 ; private static boolean judge ( int i ) { if ( min > p [ i - 1 ] ) { min = p [ i - 1 ] ; return true ; } else { return false ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( judge ( i ) ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int max = 0 ; int ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int count = 0 ; for ( int j = i ; j % 2 = = 0 ; j / = 2 ) { count + + ; } if ( max < = count ) { max = count ; ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { final Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( min > p ) ans + + ; min = Math . min ( p , min ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { for ( java . util . Scanner scan : new java . util . Scanner [ ] { new java . util . Scanner ( System . in ) } ) { for ( int a : new int [ ] { scan . nextInt ( ) } ) { for ( int b : new int [ ] { scan . nextInt ( ) } ) { for ( int c : new int [ ] { scan . nextInt ( ) } ) { if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) { if ( System . out . printf ( " % s " , " YES " ) = = null ) { } } else { if ( System . out . printf ( " % s " , " NO " ) = = null ) { } } } } } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - X - Y ; if ( Z > = 0 & & Z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int k = stdIn . nextInt ( ) ; int s = stdIn . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - ( i + j ) & & s - ( i + j ) < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { private int N ; private char [ ] S ; public void inputData ( ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; S = new char [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) . charAt ( 0 ) ; } } public void printAnswer ( ) { for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] = = ' Y ' ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } public void run ( ) { inputData ( ) ; printAnswer ( ) ; } public static void main ( String [ ] args ) { ( new Main ( ) ) . run ( ) ; } } 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 [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int r = n ; int max = p [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( max < p [ i ] ) { r -- ; } else { max = p [ i ] ; } } System . out . println ( r ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = 3 ; int [ ] [ ] t = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { t [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int dif0 = t [ i ] [ 0 ] - t [ i + 1 ] [ 0 ] ; for ( int j = 1 ; j < n ; j + + ) { int difj = t [ i ] [ j ] - t [ i + 1 ] [ j ] ; if ( dif0 ! = difj ) { System . out . println ( " No " ) ; return ; } } } for ( int j = 0 ; j < n - 1 ; j + + ) { int dif0 = t [ 0 ] [ j ] - t [ 0 ] [ j + 1 ] ; for ( int i = 1 ; i < n ; i + + ) { int difi = t [ i ] [ j ] - t [ i ] [ j + 1 ] ; if ( dif0 ! = difi ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 64 ; while ( N < ans ) { ans / = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; double h = scan . nextDouble ( ) ; double m = scan . nextDouble ( ) ; double ah = 0 ; double am = 0 ; am = m * 6 ; ah = h * 30 + m / 2 ; double angle = Math . abs ( am - ah ) ; if ( angle > 180 ) { angle = 360 - angle ; } double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( a , 2 ) - 2 * b * a * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( r ) ; } } import java . util . Scanner ; public class Main { static int c [ ] [ ] = new int [ 3 ] [ 3 ] ; @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < = 100 ; i + + ) { if ( judge ( i ) ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } private static boolean judge ( int i ) { int b1 = c [ 0 ] [ 0 ] - i ; int b2 = c [ 0 ] [ 1 ] - i ; int b3 = c [ 0 ] [ 2 ] - i ; boolean jua2 = false ; boolean jua3 = false ; for ( int j = 0 ; j < = 100 ; j + + ) { if ( c [ 1 ] [ 0 ] - b1 = = j & & c [ 1 ] [ 1 ] - b2 = = j & & c [ 1 ] [ 2 ] - b3 = = j ) jua2 = true ; } for ( int j = 0 ; j < = 100 ; j + + ) { if ( c [ 2 ] [ 0 ] - b1 = = j & & c [ 2 ] [ 1 ] - b2 = = j & & c [ 2 ] [ 2 ] - b3 = = j ) jua3 = true ; } if ( 0 < = b1 & & b1 < = 100 & & 0 < = b2 & & b2 < = 100 & & 0 < = b3 & & b3 < = 100 & & jua2 & & jua3 ) return true ; else return false ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K & & x < = S ; x + + ) { for ( int y = 0 ; y < = K & & y < = S ; y + + ) { if ( S - x - y > = 0 & & S - x - y < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } a [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) b [ i ] = arr [ 0 ] [ i ] - a [ 0 ] ; for ( int i = 0 ; i < 3 ; i + + ) a [ i ] = arr [ i ] [ 0 ] - b [ 0 ] ; boolean isGood = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( arr [ i ] [ j ] ! = a [ i ] + b [ j ] ) { isGood = false ; } } } System . out . println ( isGood ? " Yes " : " No " ) ; } } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { resolve ( System . in , System . out ) ; } static void resolve ( InputStream is , PrintStream pw ) { Scanner sc = new Scanner ( is ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int h = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; double hRad = ( double ) 90 - 360 * ( double ) h / 12 - 30 * ( ( double ) m % 60 ) / 60 ; double hX = ( double ) a * Math . cos ( Math . toRadians ( hRad ) ) ; double hY = ( double ) a * Math . sin ( Math . toRadians ( hRad ) ) ; double mRad = ( double ) 90 - 360 * ( ( double ) m % 60 ) / 60 ; double mX = ( double ) b * Math . cos ( Math . toRadians ( mRad ) ) ; double mY = ( double ) b * Math . sin ( Math . toRadians ( mRad ) ) ; double diffX = hX - mX ; double diffY = hY - mY ; pw . println ( Math . sqrt ( diffX * diffX + diffY * diffY ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String A [ ] = new String [ N ] ; int a = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . next ( ) ; if ( A [ i ] . equals ( " Y " ) ) { a = 1 ; } } if ( a = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int number = 5 ; int max = 0 , min = 123 ; while ( number -- > 0 ) { int k = in . nextInt ( ) ; max = Math . max ( k , max ) ; min = Math . min ( k , min ) ; } int j = in . nextInt ( ) ; if ( max - min > j ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] strs = br . readLine ( ) . split ( " " ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < strs . length ; i + + ) { nums [ i ] = Integer . parseInt ( strs [ i ] ) ; } Arrays . sort ( nums ) ; System . out . println ( ( nums [ 2 ] - nums [ 1 ] ) + ( nums [ 1 ] - nums [ 0 ] ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( Scanner sc = new Scanner ( System . in ) ) { int T1 = sc . nextInt ( ) ; int T2 = sc . nextInt ( ) ; long A1 = sc . nextLong ( ) ; long A2 = sc . nextLong ( ) ; long B1 = sc . nextLong ( ) ; long B2 = sc . nextLong ( ) ; if ( ( A1 * T1 + A2 * T2 ) = = ( B1 * T1 + B2 * T2 ) ) { System . out . println ( " infinity " ) ; return ; } if ( A1 > B1 ) { A1 = A1 - B1 ; B2 = B2 - A2 ; } else { A1 = B1 - A1 ; B2 = A2 - B2 ; } long d1 = A1 * T1 ; long d2 = B2 * T2 ; if ( d1 - d2 > 0 ) { System . out . println ( 0 ) ; return ; } long ans = ( d1 / ( d2 - d1 ) ) * 2 ; if ( d1 % ( d2 - d1 ) ! = 0 ) { ans + + ; } System . out . println ( ans ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws Exception { try ( final var stdin = new InputStreamReader ( System . in ) ; final var br = new BufferedReader ( stdin ) ) { final var line = Arrays . stream ( br . readLine ( ) . split ( " " ) ) . mapToInt ( Integer : : parseInt ) . sorted ( ) . toArray ( ) ; System . out . println ( line [ 0 ] = = 5 & & line [ 1 ] = = 5 & & line [ 2 ] = = 7 ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; for ( int i = 0 ; i < 10 ; i + + ) { if ( Math . pow ( 2 , i ) > N ) { System . out . println ( ( int ) Math . pow ( 2 , i - 1 ) ) ; return ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double tan = 0 ; tan = ( H * 30 ) + ( M * 0.5 ) ; double tyo = 0 ; tyo = ( M * 6 ) ; double kaku = 0 ; kaku = ( tan - tyo ) ; double radi = Math . toRadians ( kaku ) ; double C = 0 ; C = Math . cos ( radi ) ; C = Math . sqrt ( ( ( A * A ) + ( B * B ) ) - ( ( 2 * A * B ) * C ) ) ; System . out . println ( C ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = k ; + + y ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; bw . flush ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskATCG004B solver = new TaskATCG004B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskATCG004B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; int x = in . nextInt ( ) ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = in . nextInt ( ) ; } long minSum = 0 ; int m [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { m [ i ] = a [ i ] ; minSum + = m [ i ] ; } for ( int k = 1 ; k < = N - 1 ; k + + ) { long sum = ( long ) k * x ; for ( int i = 0 ; i < N ; i + + ) { int p = ( i - k ) % N ; if ( p < 0 ) p + = N ; m [ i ] = Math . min ( m [ i ] , a [ p ] ) ; sum + = m [ i ] ; } minSum = Math . min ( sum , minSum ) ; } out . println ( minSum ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int a = 0 ; while ( ans < = n ) { ans = ans * 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = n ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = c [ 0 ] [ i ] ; } a [ 0 ] = 0 ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; boolean wronganswer = false ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { wronganswer = true ; } ; } } if ( wronganswer ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 1 ; while ( result < = N ) { result = result * 2 ; } System . out . println ( result / 2 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; s = r . readLine ( ) ; String sl [ ] = s . split ( " " ) ; System . out . println ( s . contains ( " Y " ) ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A _ 1 = sc . nextInt ( ) ; int A _ 2 = sc . nextInt ( ) ; int A _ 3 = sc . nextInt ( ) ; int [ ] S = new int [ ] { A _ 1 , A _ 2 , A _ 3 } ; Arrays . sort ( S ) ; System . out . println ( S [ 2 ] - S [ 0 ] ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int a = Integer . parseInt ( in . next ( ) ) ; int b = Integer . parseInt ( in . next ( ) ) ; int h = Integer . parseInt ( in . next ( ) ) ; int m = Integer . parseInt ( in . next ( ) ) ; double rect _ l = m * 360.0 / 60.0 ; double rect _ s = h * 30.0 + m * 0.5 ; double diff = rect _ s - rect _ l ; if ( diff > 180 ) diff = 360 - diff ; double ans = Math . sqrt ( ( a * a ) + ( b * b ) - 2 * a * b * Math . cos ( Math . toRadians ( diff ) ) ) ; out . printf ( " % .13f \ n " , ans ) ; } } } import java . io . * ; import java . util . * ; import java . lang . * ; import java . text . DecimalFormat ; public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { DecimalFormat df = new DecimalFormat ( " 0.000000000 " ) ; String lines = br . readLine ( ) ; String [ ] strs = lines . trim ( ) . split ( " \ \ s + " ) ; int [ ] a = new int [ 4 ] ; for ( int i = 0 ; i < strs . length ; i + + ) { a [ i ] = Integer . parseInt ( strs [ i ] ) ; } double radian = Math . PI * 2 * ( ( double ) a [ 2 ] / 12.0 + ( ( double ) a [ 3 ] / 60.0 ) / 12.0 - ( double ) a [ 3 ] / 60.0 ) ; double ans = ( double ) ( a [ 0 ] * a [ 0 ] + a [ 1 ] * a [ 1 ] ) - ( double ) ( 2 * a [ 0 ] * a [ 1 ] ) * Math . cos ( radian ) ; System . out . println ( df . format ( Math . sqrt ( ans ) ) ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final double pi = 3.14159265358979323846 ; Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double dist = A * A + B * B - A * B * Math . cos ( 2 * pi * ( M / 60 - ( H * 60 + M ) / 720 ) ) * 2 ; System . out . println ( Math . sqrt ( dist ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int ans = 0 ; Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean f = false ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int tmp = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( i = = 0 ) { tmp = a [ i ] ; continue ; } if ( tmp > = a [ i ] ) { tmp = a [ i ] ; ans + + ; } } ans + + ; System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n [ ] [ ] = new int [ 3 ] [ 3 ] ; int total = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int a = sc . nextInt ( ) ; total + = a ; n [ i ] [ j ] = a ; } } String ans = " Yes " ; for ( int i = 0 ; i < 1 ; i + + ) { if ( total % 3 ! = 0 ) { ans = " No " ; break ; } total / = 3 ; if ( ( n [ 0 ] [ 0 ] + n [ 1 ] [ 1 ] + n [ 2 ] [ 2 ] ) ! = total | | ( n [ 0 ] [ 2 ] + n [ 1 ] [ 1 ] + n [ 2 ] [ 0 ] ) ! = total ) { ans = " No " ; break ; } } 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 [ ] args ) { Scanner sc = new Scanner ( in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; int temp = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( temp < = Integer . numberOfTrailingZeros ( i ) ) { ans = i ; temp = Integer . numberOfTrailingZeros ( i ) ; } } out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int i = 0 ; for ( i = 1 ; i < = n ; i = i * 2 ) { } i = i / 2 ; System . out . println ( i ) ; } } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double t1 = ( h + m / 60.0 ) / 12.0 ; double t2 = m / 60.0 ; double r = Math . toRadians ( Math . abs ( t2 - t1 ) * 360.0 ) ; double ans = a * a + b * b - 2 * a * b * Math . cos ( r ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( N > = 64 ) { System . out . println ( 64 ) ; } else if ( N > = 32 ) { System . out . println ( 32 ) ; } else if ( N > = 16 ) { System . out . println ( 16 ) ; } else if ( N > = 8 ) { System . out . println ( 8 ) ; } else if ( N > = 4 ) { System . out . println ( 4 ) ; } else if ( N > = 2 ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; e = sc . nextInt ( ) ; e = sc . nextInt ( ) ; e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a * b * c = = 175 ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int p [ ] = new int [ n ] ; int num = 1 ; int min = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = scan . nextInt ( ) ; if ( i = = 0 ) { min = p [ i ] ; continue ; } if ( p [ i ] < min ) { num + + ; min = p [ i ] ; } } System . out . println ( num ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double X = ( M * 11 / 360 - H / 6 ) * Math . PI ; System . out . println ( Math . pow ( A * A + B * B - 2 * A * B * Math . cos ( X ) , 0.5 ) ) ; } } import java . io . * ; import java . util . * ; public class Main { void run ( ) { int [ ] need = new int [ ] { 1 , 4 , 7 , 9 } ; int [ ] a = new int [ need . length ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = in . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( Arrays . equals ( a , need ) ? " YES " : " NO " ) ; } static MyScanner in ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { boolean stdStreams = true ; String fileName = Main . class . getSimpleName ( ) . replaceFirst ( " _ . * " , " " ) . toLowerCase ( ) ; String inputFileName = fileName + " .in " ; String outputFileName = fileName + " .out " ; Locale . setDefault ( Locale . US ) ; BufferedReader br ; if ( stdStreams ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; } else { br = new BufferedReader ( new FileReader ( inputFileName ) ) ; out = new PrintWriter ( outputFileName ) ; } in = new MyScanner ( br ) ; int tests = 1 ; for ( int test = 0 ; test < tests ; test + + ) { new Main ( ) . run ( ) ; } br . close ( ) ; out . close ( ) ; } static class MyScanner { BufferedReader br ; StringTokenizer st ; MyScanner ( BufferedReader br ) { this . br = br ; } void findToken ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } } String next ( ) { findToken ( ) ; return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } if ( set . contains ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( num [ 4 ] - num [ 0 ] > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter out = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer tokenizer = new StringTokenizer ( input . readLine ( ) ) ; int k = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int s = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( s > = i + j & & s - ( i + j ) < = k ) { count + + ; } if ( s < i + j ) break ; } if ( s < i ) break ; } out . write ( String . valueOf ( count ) ) ; out . write ( " \ n " ) ; out . close ( ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] values = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { values [ i ] = Integer . parseInt ( input . readLine ( ) ) ; } int k = Integer . parseInt ( input . readLine ( ) ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( values [ i ] - values [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 2 ; i < = N ; i * = 2 ) { ans = i ; } 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 ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( sc . next ( ) . contains ( " Y " ) ) { System . out . println ( " Four " ) ; System . exit ( 0 ) ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < = 100 ; i + + ) { for ( int j = 0 ; j < = 100 ; j + + ) { for ( int k = 0 ; k < = 100 ; k + + ) { a [ 0 ] = i ; a [ 1 ] = j ; a [ 2 ] = k ; b [ 0 ] = c [ 0 ] [ 0 ] - i ; b [ 1 ] = c [ 0 ] [ 1 ] - i ; b [ 2 ] = c [ 0 ] [ 2 ] - i ; if ( check ( a , b , c ) ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } static boolean check ( int a [ ] , int b [ ] , int c [ ] [ ] ) { for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = c [ i ] [ j ] ) { return false ; } } } return true ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int min = 0 ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } min = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( min > = P [ i ] ) { min = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] list = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; String ans = " Yay ! " ; for ( int i = 0 ; i < 5 ; i + + ) { int value = list [ i ] ; for ( int index = i + 1 ; index < 5 ; index + + ) { if ( Math . abs ( value - list [ index ] ) > k ) { ans = " : ( " ; break ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a , b , h , m ; a = sc . nextDouble ( ) ; b = sc . nextDouble ( ) ; h = sc . nextDouble ( ) ; m = sc . nextDouble ( ) ; double angle = Math . min ( Math . abs ( h * 30 + m * 0.5 - m * 6 ) , 360 - Math . abs ( h * 30 + m * 0.5 - m * 6 ) ) ; double pi = angle / 180 * Math . PI ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( pi ) ) ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > c1 = new ArrayList < > ( ) ; List < Integer > c2 = new ArrayList < > ( ) ; List < Integer > c3 = new ArrayList < > ( ) ; IntStream . range ( 0 , 3 ) . forEach ( i - > c1 . add ( sc . nextInt ( ) ) ) ; IntStream . range ( 0 , 3 ) . forEach ( i - > c2 . add ( sc . nextInt ( ) ) ) ; IntStream . range ( 0 , 3 ) . forEach ( i - > c3 . add ( sc . nextInt ( ) ) ) ; int a1 = 0 ; int b1 = c1 . get ( 0 ) - a1 ; int a2 = c2 . get ( 0 ) - b1 ; int b2 = c2 . get ( 1 ) - a2 ; int a3 = c3 . get ( 0 ) - b1 ; int b3 = c3 . get ( 2 ) - a3 ; if ( c1 . get ( 0 ) = = a1 + b1 & & c1 . get ( 1 ) = = a1 + b2 & & c1 . get ( 2 ) = = a1 + b3 & & c2 . get ( 0 ) = = a2 + b1 & & c2 . get ( 1 ) = = a2 + b2 & & c2 . get ( 2 ) = = a2 + b3 & & c3 . get ( 0 ) = = a3 + b1 & & c3 . get ( 1 ) = = a3 + b2 & & c3 . get ( 2 ) = = a3 + b3 ) { System . out . println ( " Yes " ) ; return ; } System . out . println ( " No " ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( scanner . nextInt ( ) ) ; } scanner . close ( ) ; int count = 0 ; int min = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( list . get ( i ) . compareTo ( min ) = = 1 ) { continue ; } count + = 1 ; min = list . get ( i ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = Math . min ( k , s ) ; x + + ) { for ( int y = Math . max ( 0 , s - x - k ) ; y < = Math . min ( k , s - x ) ; y + + ) { int z = s - x - y ; if ( ( z > = 0 ) & & ( z < = k ) ) { count + + ; } } } System . out . println ( count ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( 1 < n & & n < 4 ) { System . out . println ( 2 ) ; } else if ( 4 < = n & & n < 8 ) { System . out . println ( 4 ) ; } else if ( 8 < = n & & n < 16 ) { System . out . println ( 8 ) ; } else if ( 16 < = n & & n < 32 ) { System . out . println ( 16 ) ; } else if ( 32 < = n & & n < 64 ) { System . out . println ( 32 ) ; } else if ( n = = 1 ) { System . out . println ( 1 ) ; } else { System . out . println ( 64 ) ; } } } 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 N = in . nextInt ( ) ; int ans = 0 ; for ( int i = 1 ; i < = N ; i + + ) { if ( i = = 1 | | i = = 2 | | i = = 4 | | i = = 8 | | i = = 16 | | i = = 32 | | i = = 64 ) { ans = i ; } } out . println ( ans ) ; } } 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 char nextChar ( ) { return next ( ) . charAt ( 0 ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int X , Y = 0 , Z ; int sum = 0 ; for ( Z = 0 ; Z < = K ; Z + + ) { S - = Z ; for ( X = 0 ; X < = K & & X < = S ; X + + ) { Y = S - X ; if ( Y > K ) continue ; sum + + ; } S + = Z ; } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String arare [ ] = new String [ 100 ] ; for ( int i = 0 ; i < n ; i + + ) { arare [ i ] = sc . next ( ) ; if ( arare [ i ] . equals ( " Y " ) ) { System . out . println ( " Four " ) ; break ; } else if ( i = = n - 1 ) { System . out . println ( " Three " ) ; break ; } } } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; int number = 1 ; while ( number * 2 < = n ) { number * = 2 ; } System . out . println ( number ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { list [ i ] = sc . nextInt ( ) ; } int ans = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( list [ i ] , min ) ; if ( min < list [ i ] ) { continue ; } ans + + ; } 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 ( ) ; HashSet < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; set . add ( s ) ; } if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String arge [ ] ) { Scanner scan = new Scanner ( System . in ) ; int i = scan . nextInt ( ) ; String [ ] a ; a = new String [ i ] ; String ans = " Three " ; for ( int j = 0 ; j < i ; j + + ) { a [ j ] = scan . next ( ) ; if ( a [ j ] . equals ( " Y " ) ) { ans = " Four " ; } } System . out . print ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int [ ] [ ] a = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { int now = 0 ; for ( int k = 0 ; k < h ; k + + ) { for ( int l = 0 ; l < w ; l + + ) { now + = Math . min ( Math . abs ( i - k ) , Math . abs ( j - l ) ) * a [ k ] [ l ] ; } } ans = Math . min ( ans , now ) ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Math . abs ( a - e ) < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int min = sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; int max = sc . nextInt ( ) ; int limit = sc . nextInt ( ) ; if ( max - min < = limit ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; return ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; Set < String > list = new HashSet < String > ( ) ; int num = sc . nextInt ( ) ; for ( int i = 0 ; i < num ; i + + ) { list . add ( sc . next ( ) ) ; } if ( list . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else if ( list . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int x [ ] = new int [ 10 ] ; x [ 0 ] = Math . abs ( a - b ) ; x [ 1 ] = Math . abs ( a - c ) ; x [ 2 ] = Math . abs ( a - d ) ; x [ 3 ] = Math . abs ( a - e ) ; x [ 4 ] = Math . abs ( b - c ) ; x [ 5 ] = Math . abs ( b - d ) ; x [ 6 ] = Math . abs ( b - e ) ; x [ 7 ] = Math . abs ( c - d ) ; x [ 8 ] = Math . abs ( c - e ) ; x [ 9 ] = Math . abs ( d - e ) ; for ( int i = 0 ; i < x . length ; i + + ) { if ( x [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; import java . awt . * ; import static java . lang . System . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { out . println ( " YES " ) ; } else { out . println ( " NO " ) ; } } static long power ( long x , int n ) { long mod = 1000000007 ; long ans = 1 ; while ( n > 0 ) { if ( ( n & 1 ) = = 1 ) { ans = ( ans * x ) % mod ; } x = ( x * x ) % mod ; n > > = 1 ; } return ans ; } static int gcd ( int a , int b ) { int temp ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return b ; } static class UF { static int size = 51 ; static int [ ] par = new int [ size ] ; static void init ( ) { for ( int i = 1 ; i < size ; i + + ) { par [ i ] = i ; } } static int root ( int x ) { if ( par [ x ] = = x ) { return x ; } else { return par [ x ] = root ( par [ x ] ) ; } } static boolean same ( int x , int y ) { return root ( x ) = = root ( y ) ; } static void unite ( int x , int y ) { x = root ( x ) ; y = root ( y ) ; if ( x = = y ) return ; par [ x ] = y ; } } } import java . util . * ; class Main { public static void main ( String [ ] arg ) { Scanner stdIn = new Scanner ( System . in ) ; int A = stdIn . nextInt ( ) ; int B = stdIn . nextInt ( ) ; int C = stdIn . nextInt ( ) ; int max = Math . max ( A , Math . max ( B , C ) ) ; int min = Math . min ( A , Math . min ( B , C ) ) ; if ( A + B + C = = 17 & & max = = 7 & & min = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner Input = new Scanner ( System . in ) ; int K = Input . nextInt ( ) ; int S = Input . nextInt ( ) ; int Counter = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( 0 < = S - ( X + Y ) & & S - ( X + Y ) < = K ) { Counter + + ; } } } System . out . println ( Counter ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double num1 = 0.5 * m + 30 * h ; double num2 = 6 * m ; double num3 = 0 ; if ( num1 > num2 ) { num3 = num1 - num2 ; } else if ( num2 > num1 ) { num3 = num2 - num1 ; } if ( num3 > 180 ) { num3 = 360 - num3 ; } double cos = Math . cos ( Math . toRadians ( num3 ) ) ; double c = ( a * a + b * b ) - ( 2 * a * b * cos ) ; double ans = Math . sqrt ( c ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a > k | | c - a > k | | d - a > k | | e - a > k | | c - b > k | | d - b > k | | e - b > k | | d - c > k | | e - c > k | | e - d > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { static long inf = ( long ) 1e17 ; public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n = Integer . parseInt ( in . next ( ) ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( in . next ( ) ) ; } long min = inf ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { min = p [ i ] ; ans + + ; } } out . println ( ans ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long sumA = 0 ; long sumB = 0 ; Pair [ ] pairs = new Pair [ n ] ; int [ ] aa = new int [ n ] ; int [ ] ba = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { aa [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { ba [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { int a = aa [ i ] ; int b = ba [ i ] ; int dif = a - b ; sumA + = a ; sumB + = b ; Pair pair = new Pair ( ) ; pair . a = a ; pair . b = b ; pair . dif = dif ; pairs [ i ] = pair ; } if ( sumA < sumB ) { System . out . println ( - 1 ) ; return ; } Arrays . sort ( pairs ) ; long difTotal = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( pairs [ i ] . dif < 0 ) { difTotal + = pairs [ i ] . dif ; count + + ; } } for ( int i = n - 1 ; i > = 0 ; i -- ) { if ( difTotal < 0 ) { difTotal + = pairs [ i ] . dif ; count + + ; } else { System . out . println ( count ) ; return ; } } System . out . println ( count ) ; } } class Pair implements Comparable < Object > { int a ; int b ; int dif ; @ Override public int compareTo ( Object other ) { Pair otherpair = ( Pair ) other ; return dif - otherpair . dif ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( ( e - a ) < = k ) { System . out . println ( " Yay ! " ) ; return ; } System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . nio . file . * ; import java . nio . charset . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set s = new HashSet ( ) ; for ( int i = 0 ; i < n ; i + + ) { s . add ( sc . next ( ) ) ; } if ( s . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { final String PINK = " P " ; final String WHITE = " W " ; final String GREEN = " G " ; final String YELLOW = " Y " ; boolean hasFourColors = false ; Scanner sc = new Scanner ( System . in ) ; int arareNum = sc . nextInt ( ) ; while ( sc . hasNext ( ) ) { String color = sc . next ( ) ; if ( color . equals ( YELLOW ) ) { hasFourColors = true ; break ; } } String result = null ; if ( hasFourColors ) { result = " Four " ; } else { result = " Three " ; } System . out . println ( result ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; public class Main { static int n ; static ArrayList < ArrayList < Integer > > edge ; static boolean used [ ] ; static boolean flag = false ; static int ans ; public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; n = Integer . parseInt ( br . readLine ( ) ) ; String str [ ] = br . readLine ( ) . split ( " " ) ; int a [ ] = new int [ n ] ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( str [ i ] ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( a [ i ] , min ) ; if ( min < a [ i ] ) { } else { ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int two [ ] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; int max = 0 ; for ( int i = 0 ; i < 7 ; i + + ) { if ( two [ i ] > N ) break ; max = i ; } System . out . println ( two [ max ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int num [ ] = new int [ 5 ] ; for ( int i = 0 ; i < n ; i + + ) num [ i ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean po = true ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( Math . abs ( num [ i ] - num [ j ] ) > k ) po = false ; } } System . out . println ( ( po ) ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count5 = 0 ; int count7 = 0 ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 ) { count5 + + ; } if ( a = = 7 ) { count7 + + ; } if ( b = = 5 ) { count5 + + ; } if ( b = = 7 ) { count7 + + ; } if ( c = = 5 ) { count5 + + ; } if ( c = = 7 ) { count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { MyScanner sc = new MyScanner ( System . in ) ; int n ; long x ; n = sc . nextInt ( ) ; x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; long [ ] b = a . clone ( ) ; long ans = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long acc = 0 ; long xk = ( ( long ) x ) * k ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i - k + n ) % n ] ) ; acc + = b [ i ] ; } ans = Math . min ( ans , acc + xk ) ; } System . out . println ( ans ) ; } static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int temp = 0 ; for ( int i = 0 ; i < ( t - 1 ) ; i + + ) { int k = sc . nextInt ( ) ; if ( k < min ) { min = k ; temp + + ; } } System . out . println ( temp + 1 ) ; } } import java . math . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String [ ] np = scanner . nextLine ( ) . split ( " " , 2 ) ; long n = Long . parseLong ( np [ 0 ] ) ; long p = Long . parseLong ( np [ 1 ] ) ; long remP = p ; long limit = ( long ) Math . sqrt ( p ) + 1 ; if ( n = = 1 ) { System . out . println ( p ) ; return ; } long answer = 1 ; for ( long i = 2 ; i < = limit ; i + + ) { long cnt = 0 ; while ( remP % i = = 0 ) { remP / = i ; cnt + + ; } for ( long j = 0 ; j < cnt / n ; j + + ) { answer * = i ; } if ( remP = = 1 ) { break ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double A = scan . nextDouble ( ) ; double B = scan . nextDouble ( ) ; double H = scan . nextDouble ( ) ; double M = scan . nextDouble ( ) ; double hour , minute , c , co , ans ; hour = H * 30 + M * 0.5 ; minute = M * 6 ; c = hour - minute ; if ( c > 180 ) { c = 360 - c ; } else if ( c < 0 ) { c = 360 + c ; } co = Math . cos ( Math . toRadians ( c ) ) ; ans = A * A + B * B - 2 * A * B * co ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String ans = " Yes " ; for ( int i = 0 ; i < 2 ; i + + ) { if ( ! ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] = = c [ 1 ] [ i ] - c [ 1 ] [ i + 1 ] & & c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] = = c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] ) ) { ans = " No " ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t1 = sc . nextInt ( ) ; int t2 = sc . nextInt ( ) ; long a1 = sc . nextLong ( ) ; long a2 = sc . nextLong ( ) ; long b1 = sc . nextLong ( ) ; long b2 = sc . nextLong ( ) ; if ( a1 * t1 + a2 * t2 = = b1 * t1 + b2 * t2 ) { System . out . println ( " infinity " ) ; System . exit ( 0 ) ; } long dif1 = a1 * t1 - b1 * t1 ; long dif2 = a2 * t2 - b2 * t2 ; long ans ; if ( ( dif1 > 0 & & dif1 + dif2 < 0 ) | | ( dif1 < 0 & & dif1 + dif2 > 0 ) ) { if ( - dif1 % ( dif1 + dif2 ) = = 0 ) { ans = - dif1 / ( dif1 + dif2 ) * 2 ; } else { ans = - dif1 / ( dif1 + dif2 ) * 2 + 1 ; } } else { ans = 0 ; } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int A = sc . nextInt ( ) ; final int B = sc . nextInt ( ) ; final int H = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; sc . close ( ) ; double rad = Math . toRadians ( ( 60 * H + M ) * 0.5 - M * 6 ) ; double ans = Math . sqrt ( Math . pow ( A , 2.0 ) + Math . pow ( B , 2.0 ) - 2 * A * B * Math . cos ( rad ) ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; switch ( A ) { case 5 : if ( B = = 5 & & C = = 7 | | B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; return ; case 7 : if ( B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; return ; default : System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int ans = 1 ; while ( true ) { ans * = 2 ; if ( ans > n ) { break ; } } System . out . println ( ans / 2 ) ; } } import java . util . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] > k ) { out . println ( " : ( " ) ; return ; } out . println ( " Yay ! " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int [ ] sMinusZ = new int [ K + 1 ] ; for ( int i = 0 ; i < = K ; i + + ) { sMinusZ [ i ] = S - i ; } Arrays . sort ( sMinusZ ) ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( Arrays . binarySearch ( sMinusZ , i + j ) > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; String [ ] cmd = s . split ( " " ) ; double a = Double . valueOf ( cmd [ 0 ] ) ; double b = Double . valueOf ( cmd [ 1 ] ) ; double c = Double . valueOf ( cmd [ 2 ] ) ; double d = Double . valueOf ( cmd [ 3 ] ) ; double x = ( ( c * 60 + d ) * 6 ) % 360 ; double y = c * 30 + ( d * 1.0 ) / 2 ; double an = Math . abs ( x - y ) ; if ( an > 180 ) an = 360 - an ; double a1 = a * a + b * b ; double a2 = 2 * a * b ; double a3 = a1 - a2 * Math . cos ( ( an * Math . PI ) / 180 ) ; System . out . println ( Math . sqrt ( a3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int check = 0 ; int [ ] a = new int [ 9 ] ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = scn . nextInt ( ) ; } int x1 = a [ 3 ] - a [ 0 ] ; int x2 = a [ 6 ] - a [ 3 ] ; if ( a [ 4 ] ! = a [ 1 ] + x1 ) { check = 1 ; } if ( a [ 5 ] ! = a [ 2 ] + x1 ) { check = 1 ; } if ( a [ 7 ] ! = a [ 4 ] + x2 ) { check = 1 ; } if ( a [ 8 ] ! = a [ 5 ] + x2 ) { check = 1 ; } if ( check = = 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = sc . nextInt ( ) ; int cnt = 1 ; for ( int i = 1 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < = min ) { cnt + + ; } if ( p < min ) min = p ; } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int wa = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = x ; i + + ) { for ( int j = 0 ; j < = x ; j + + ) { if ( 0 < = wa - i - j & & wa - i - j < = x ) { ans + + ; } } } System . out . println ( ans ) ; sc . close ( ) ; } public static void saiki ( int a , String b ) { if ( a = = 0 ) { System . out . println ( b ) ; } else { for ( char ch = ' a ' ; ch < = ' c ' ; ch + + ) { saiki ( a - 1 , b + ch ) ; } } } public static int gcd ( int a , int b ) { if ( a < b ) { int tmp = a ; a = b ; b = tmp ; } int r = - 1 ; while ( r ! = 0 ) { r = a % b ; a = b ; b = r ; } return a ; } } import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ; import java . util . List ; import java . util . NoSuchElementException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] S = new int [ N ] ; boolean flg = false ; for ( int i = 0 ; i < N ; i + + ) { flg | = s . next ( ) . equals ( " Y " ) ; } System . out . println ( flg ? " Four " : " Three " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { int Z = S - ( X + Y ) ; if ( Z < = K & & Z > = 0 ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int count = 0 ; int p = 1 ; while ( p < = n ) { p * = 2 ; } System . out . println ( p / 2 ) ; } } import java . util . * ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import java . util . Arrays ; import java . util . Collections ; import java . lang . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) , s = scanner . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k ; i + + ) { int sum = 0 ; for ( int j = 0 ; j < = k ; j + + ) { sum = i + j ; if ( ( s - sum ) > = 0 & & ( s - sum ) < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . TreeMap ; import java . util . ArrayDeque ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double tan = 360.0 * H / 12 + 0.5 * M ; double tyo = 360.0 * M / 60 ; double c = Math . abs ( tan - tyo ) ; if ( c > 180 ) { c = 360 - c ; } double C = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( c ) ) ; System . out . println ( Math . sqrt ( C ) ) ; } } import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int cnt = 1 ; ; for ( int i = 0 ; i < n ; i + + ) p [ i ] = sc . nextInt ( ) ; int tmp = p [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( tmp > p [ i ] ) cnt + + ; if ( p [ i ] < tmp ) tmp = p [ i ] ; } System . out . println ( cnt ) ; } } import java . io . * ; import java . util . * ; class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader bu = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s [ ] = bu . readLine ( ) . split ( " " ) ; int a = Integer . parseInt ( s [ 0 ] ) , b = Integer . parseInt ( s [ 1 ] ) , h = Integer . parseInt ( s [ 2 ] ) , m = Integer . parseInt ( s [ 3 ] ) ; double hr = 0.5 * ( h * 60 + m ) , min = 6 * m , angle = Math . abs ( hr - min ) ; angle = Math . min ( 360 - angle , angle ) ; double d = Math . cos ( Math . toRadians ( angle ) ) ; double ans = Math . sqrt ( - 2.0 * a * b * d + a * a + b * b ) ; System . out . print ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int a = 128 ; for ( ; a > n ; a / = 2 ) ; System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - d > k | | e - c > k | | e - b > k | | e - a > k | | d - c > k | | d - b > k | | d - a > k | | c - b > k | | c - a > k | | b - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; boolean s [ ] = { false , false , false , false } ; String c ; for ( int i = 0 ; i < N ; i + + ) { c = sc . next ( ) ; if ( " P " . equals ( c ) ) s [ 0 ] = true ; else if ( " W " . equals ( c ) ) s [ 1 ] = true ; else if ( " G " . equals ( c ) ) s [ 2 ] = true ; else if ( " Y " . equals ( c ) ) s [ 3 ] = true ; if ( s [ 0 ] & & s [ 1 ] & & s [ 2 ] & & s [ 3 ] ) { sc . close ( ) ; System . out . println ( " Four " ) ; return ; } } sc . close ( ) ; System . out . println ( " Three " ) ; } } import java . util . Scanner ; public class Main { private static final int IROHA = 17 ; public static void main ( String [ ] args ) { try ( Scanner scan = new Scanner ( System . in ) ) { String input = scan . nextLine ( ) ; String [ ] arr = input . split ( " \ \ s " ) ; String result = " YES " ; try { int sum = 0 ; for ( String s : arr ) { if ( s . matches ( " ^ [ 57 ] $ " ) ) { sum + = Integer . parseInt ( s ) ; } else { result = " NO " ; } } if ( sum ! = IROHA ) { result = " NO " ; } } catch ( NumberFormatException e ) { result = " NO " ; throw e ; } System . out . println ( result ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = 0 ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 7 ) { i + + ; } if ( b = = 7 ) { i + + ; } if ( c = = 7 ) { i + + ; } if ( i = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int g = 0 ; int na = 0 ; if ( A = = 5 ) { g + + ; } else if ( A = = 7 ) { na + + ; } if ( B = = 5 ) { g + + ; } else if ( B = = 7 ) { na + + ; } if ( C = = 5 ) { g + + ; } else if ( C = = 7 ) { na + + ; } if ( g = = 2 & & na = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; long d [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; d [ i ] = b [ i ] - a [ i ] ; } Arrays . sort ( d ) ; long sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) if ( d [ i ] > 0 ) { sum + = d [ i ] ; ans + + ; } long sum2 = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( sum2 > = sum ) { System . out . println ( ans + i ) ; return ; } sum2 - = d [ i ] ; } System . out . println ( - 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = n ; int cnt = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; min = Math . min ( min , p ) ; if ( p < = min ) cnt + + ; } System . out . println ( cnt ) ; sc . close ( ) ; } } import java . util . * ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double s ; double sA = 30 * H + 0.5 * M ; double sB = 6 * M ; if ( sA < = sB ) { s = sB - sA ; } else { s = sA - sB ; } double ans2 = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( s ) ) ; System . out . println ( Math . sqrt ( ans2 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean isAns = true ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) isAns = false ; } } System . out . println ( isAns ? " Yay ! " : " : ( " ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; long count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int z = S - i - j ; if ( z > = 0 & & z < = K ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int sum = a + b + c ; if ( sum = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; public class Main { void solve ( InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int ans = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; + + i ) { int x = in . nextInt ( ) ; if ( x < min ) { + + ans ; } min = Math . min ( min , x ) ; } out . println ( ans ) ; } public static void main ( String [ ] args ) throws Exception { InputReader in = new InputReader ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; Main solver = new Main ( ) ; solver . solve ( in , out ) ; out . close ( ) ; } static class InputReader { BufferedReader in ; StringTokenizer st ; public InputReader ( InputStream is ) { in = new BufferedReader ( new InputStreamReader ( is ) ) ; } public String next ( ) { try { while ( st = = null | | ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; while ( ans * 2 < = n ) { ans * = 2 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; boolean b = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = s . nextInt ( ) ; } } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( b ) { b = c [ i ] [ j ] - c [ i ] [ j + 1 ] = = c [ i + 1 ] [ j ] - c [ i + 1 ] [ j + 1 ] ; } } } String str = b ? " Yes " : " No " ; System . out . println ( str ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int minDistance = Integer . MAX _ VALUE ; int resident [ ] [ ] = new int [ h ] [ w ] ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { resident [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { minDistance = Math . min ( minDistance , calcDistance ( i , j , resident ) ) ; } } System . out . println ( minDistance ) ; } public static int calcDistance ( int a , int b , int [ ] [ ] c ) { int total = 0 ; for ( int i = 0 ; i < c . length ; i + + ) { for ( int j = 0 ; j < c [ 0 ] . length ; j + + ) { total + = c [ i ] [ j ] * Math . min ( Math . abs ( a - i ) , Math . abs ( b - j ) ) ; } } return total ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = Integer . parseInt ( scanner . next ( ) ) ; int p = Integer . MAX _ VALUE ; int r = 0 ; for ( int i = 0 ; i < n ; i + + ) { int pp = Integer . parseInt ( scanner . next ( ) ) ; if ( pp < = p ) r + + ; p = Integer . min ( p , pp ) ; } System . out . println ( r ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int read ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { read = sc . nextInt ( ) ; if ( read = = 5 ) { five + + ; } else if ( read = = 7 ) { seven + + ; } } String ans = " NO " ; if ( five = = 2 | | seven = = 1 ) { ans = " YES " ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxCnt = 0 ; int cntNum = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int cnt = 0 ; int num = i ; while ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } if ( cnt > = maxCnt ) { maxCnt = cnt ; cntNum = i ; } } System . out . println ( cntNum ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; String data [ ] = str . split ( " " , 0 ) ; int a [ ] = new int [ 3 ] ; int sum = 0 ; int s = 0 ; for ( int i = 0 ; i < data . length ; i + + ) { sum + = Integer . parseInt ( data [ i ] ) ; a [ i ] = Integer . parseInt ( data [ i ] ) ; } if ( sum ! = 17 ) { } else { if ( a [ 0 ] = = 5 | | a [ 0 ] = = 7 ) { if ( a [ 1 ] = = 5 | | a [ 1 ] = = 7 ) { if ( a [ 2 ] = = 5 | | a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; s + + ; } } } } if ( s = = 0 ) { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = scan . nextInt ( ) ; } int max = Integer . MIN _ VALUE ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = i + 1 ; j < 3 ; j + + ) { max = Math . max ( max , Math . abs ( a [ j ] - a [ i ] ) ) ; } } System . out . println ( max ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) ; int A2 = sc . nextInt ( ) ; int A3 = sc . nextInt ( ) ; int ans = Math . max ( A1 , Math . max ( A2 , A3 ) ) - Math . min ( A1 , Math . min ( A2 , A3 ) ) ; System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; String [ ] s = in . readLine ( ) . split ( " " ) ; boolean yellow _ flg = false ; for ( int i = 0 ; i < n ; i + + ) { if ( s [ i ] . charAt ( 0 ) = = ' Y ' ) yellow _ flg = true ; } System . out . println ( yellow _ flg = = true ? " Four " : " Three " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int K = s . nextInt ( ) ; int S = s . nextInt ( ) ; int count = 0 ; int i = 0 , j = 0 ; for ( i = 0 ; i < = K ; i + + ) { for ( j = 0 ; j < = K ; j + + ) { if ( S - i - j < = K & & S - i - j > = 0 ) count + + ; } } System . out . print ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; scan . close ( ) ; int x [ ] = { a , b , c } ; int cnt [ ] = { 0 , 0 } ; for ( int i = 0 ; i < 3 ; i + + ) { if ( x [ i ] = = 5 ) cnt [ 0 ] + = 1 ; if ( x [ i ] = = 7 ) cnt [ 1 ] + = 1 ; } if ( cnt [ 0 ] = = 2 & & cnt [ 1 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; A solver = new A ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class A { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int n1 = Integer . parseInt ( in . next ( ) ) ; int n2 = Integer . parseInt ( in . next ( ) ) ; int n3 = Integer . parseInt ( in . next ( ) ) ; int n4 = Integer . parseInt ( in . next ( ) ) ; boolean ok = false ; String tmp = new String ( Integer . toString ( n1 ) + Integer . toString ( n2 ) + Integer . toString ( n3 ) + Integer . toString ( n4 ) ) ; if ( tmp . contains ( " 1 " ) & & tmp . contains ( " 9 " ) & & tmp . contains ( " 7 " ) & & tmp . contains ( " 4 " ) ) ok = true ; out . println ( ok ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] pos = new int [ 5 ] ; int max = Integer . MIN _ VALUE ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int tmp = scanner . nextInt ( ) ; max = Math . max ( max , tmp ) ; min = Math . min ( min , tmp ) ; } int k = scanner . nextInt ( ) ; if ( max - min > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . ArrayDeque ; import java . util . Arrays ; import java . util . Queue ; import java . util . Random ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; static long mod = 1000000007 ; public static void main ( String [ ] args ) { double A = sc . nextInt ( ) ; double B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double t2 = H * 30 + M / 2 ; double t1 = 6 * M ; double cos = Math . min ( 360 - Math . abs ( t2 - t1 ) , Math . abs ( t2 - t1 ) ) ; double ans = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( cos ) ) ; ans = Math . pow ( ans , 0.5 ) ; p ( ans ) ; } public static long lcm ( long a , long b ) { return a / gcd ( a , b ) * b ; } public static long gcd ( long a , long b ) { return b = = 0 ? a : gcd ( b , a % b ) ; } static void p ( String ans ) { System . out . println ( ans ) ; } ; static void p ( int ans ) { System . out . println ( ans ) ; } ; static void p ( ) { System . out . println ( ) ; } ; static void p ( long ans ) { System . out . println ( ans ) ; } ; static void p ( double ans ) { 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 ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String message = " " ; if ( ( a * b * c ) = = ( 5 * 7 * 5 ) ) { message = " YES " ; } else { message = " NO " ; } System . out . println ( message ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int result = 0 ; int A [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; result + = Math . abs ( A [ 1 ] - A [ 0 ] ) ; result + = Math . abs ( A [ 1 ] - A [ 2 ] ) ; System . out . println ( result ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( A = = 7 & & B = = 5 & & C = = 5 | | A = = 5 & & B = = 7 & & C = = 5 | | A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int A [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int cnt = 1 ; int min = A [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { if ( min > = A [ i ] ) { cnt + + ; min = A [ i ] ; } } System . out . println ( cnt ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " , 0 ) ; int K = Integer . parseInt ( s [ 0 ] ) ; int S = Integer . parseInt ( s [ 1 ] ) ; int X , Y , Z ; int count = 0 ; for ( X = 0 ; X < = K ; X + + ) { for ( Y = 0 ; Y < = K ; Y + + ) { Z = S - X - Y ; if ( 0 < = Z & & Z < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskA { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] cnt = new int [ 11 ] ; for ( int i = 0 ; i < 3 ; + + i ) cnt [ in . nextInt ( ) ] + + ; if ( cnt [ 5 ] = = 2 & & cnt [ 7 ] = = 1 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . execute ( ) ; } private void execute ( ) { Scanner sc = new Scanner ( System . in ) ; final long N = sc . nextLong ( ) ; final long P = sc . nextLong ( ) ; long maxGcd = 0 ; if ( N = = 1 ) { maxGcd = P ; } else { for ( int i = 1 ; ; i + + ) { long g = ( long ) Math . pow ( i , N ) ; if ( g > P ) { break ; } if ( P % g = = 0 ) { maxGcd = i ; } } } System . out . println ( maxGcd ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int dif = array [ 4 ] - array [ 0 ] ; if ( dif < = array [ 5 ] ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int count = 0 ; int n = sc . nextInt ( ) ; int mini = 200001 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( mini > = p ) count + + ; mini = ( int ) Math . min ( p , mini ) ; } System . out . println ( count ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 3 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] a = new int [ N ] ; IntStream . range ( 0 , N ) . forEach ( i - > a [ i ] = scanner . nextInt ( ) ) ; System . out . println ( permutation ( a ) ) ; } } private static int permutation ( int [ ] seed ) { int [ ] perm = new int [ seed . length ] ; boolean [ ] used = new boolean [ seed . length ] ; return buildPerm ( seed , perm , used , 0 ) ; } private static int buildPerm ( int [ ] seed , int [ ] perm , boolean [ ] used , int index ) { if ( seed . length = = index ) { return procPerm ( perm ) ; } int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < seed . length ; + + i ) { if ( ! used [ i ] ) { perm [ index ] = seed [ i ] ; used [ i ] = true ; min = Math . min ( min , buildPerm ( seed , perm , used , index + 1 ) ) ; used [ i ] = false ; } } return min ; } private static int procPerm ( int [ ] perm ) { return IntStream . range ( 1 , perm . length ) . map ( i - > Math . abs ( perm [ i ] - perm [ i - 1 ] ) ) . sum ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 1 ; while ( ans < = N ) { ans * = 2 ; } System . out . println ( ans / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( s - x - y > = 0 & & s - x - y < = k ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int j = 0 ; a = Math . abs ( a ) ; b = Math . abs ( b ) ; c = Math . abs ( c ) ; d = Math . abs ( d ) ; e = Math . abs ( e ) ; if ( Math . max ( a , b ) - Math . min ( a , b ) > k ) { j + = 1 ; } if ( Math . max ( a , c ) - Math . min ( c , a ) > k ) { j + = 1 ; } if ( Math . max ( a , d ) - Math . min ( d , a ) > k ) { j + = 1 ; } if ( Math . max ( a , e ) - Math . min ( e , a ) > k ) { j + = 1 ; } if ( Math . max ( b , c ) - Math . min ( c , b ) > k ) { j + = 1 ; } if ( Math . max ( b , d ) - Math . min ( d , b ) > k ) { j + = 1 ; } if ( Math . max ( b , e ) - Math . min ( e , b ) > k ) { j + = 1 ; } if ( Math . max ( c , d ) - Math . min ( d , c ) > k ) { j + = 1 ; } if ( Math . max ( d , e ) - Math . min ( d , e ) > k ) { j + = 1 ; } if ( j > 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( e - a > k ? " : ( " : " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double tmp1 = sc . nextDouble ( ) ; double tmp2 = sc . nextDouble ( ) ; double h = tmp1 / 6 . * Math . PI + tmp2 / 30 . * Math . PI / 12 . ; double m = tmp2 / 30 . * Math . PI + tmp1 / 6 . * Math . PI * 12 . ; double rad = h - m ; double res = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 . * a * b * Math . cos ( rad ) ) ) ; System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a < = k & & c - a < = k & & d - a < = k & & e - a < = k & & c - b < = k & & d - b < = k & & e - b < = k & & d - c < = k & & e - c < = k & & e - d < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ABC051 _ B solver = new ABC051 _ B ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABC051 _ B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int k = in . nextInt ( ) ; int s = in . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = k ; + + i ) { for ( int j = 0 ; j < = k ; + + j ) { int l = s - ( i + j ) ; if ( l > = 0 & & l < = k ) + + counter ; else continue ; ; } } out . println ( counter ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int cnt = 0 ; int max = - 1 ; int val = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int element = i ; boolean ok = true ; while ( ok ) { if ( element % 2 = = 0 ) { cnt + + ; element = element / 2 ; } else { ok = false ; } } if ( max < cnt ) { max = cnt ; val = i ; } cnt = 0 ; } System . out . println ( val ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 0 ] [ 1 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] & & c [ 1 ] [ 1 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 2 ] [ 0 ] ) { if ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) { if ( c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] & & c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] ) { if ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) { System . out . println ( " Yes " ) ; return ; } } } } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] grid = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) grid [ i ] [ j ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 2 ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( grid [ i ] [ j ] + grid [ i + 1 ] [ j + 1 ] ! = grid [ i ] [ j + 1 ] + grid [ i + 1 ] [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int N = input . nextInt ( ) ; int lo = Integer . MAX _ VALUE ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int x = input . nextInt ( ) ; if ( x < lo ) { cnt + + ; lo = x ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > li = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { li . add ( sc . nextInt ( ) ) ; } Collections . sort ( li ) ; System . out . println ( li . get ( 2 ) - li . get ( 0 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; int b = Integer . parseInt ( scan . next ( ) ) ; int h = Integer . parseInt ( scan . next ( ) ) ; int m = Integer . parseInt ( scan . next ( ) ) ; double theta _ short = h * 30 + m * 0.5 ; double theta _ long = m * 6 ; double theta = Math . min ( Math . abs ( theta _ long - theta _ short ) , 360 - Math . abs ( theta _ long - theta _ short ) ) ; System . out . print ( Math . pow ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( theta ) ) , 0.5 ) ) ; } } import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int max = Math . max ( a , Math . max ( b , Math . max ( c , Math . max ( d , e ) ) ) ) ; int min = Math . min ( a , Math . min ( b , Math . min ( c , Math . min ( d , e ) ) ) ) ; if ( max - min < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . List ; import java . util . StringTokenizer ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; public class Main { public static void main ( final String [ ] args ) { final FastScanner scanner = new FastScanner ( System . in ) ; final int n = scanner . nextInt ( ) ; final List < Integer > list = IntStream . range ( 0 , n ) . mapToObj ( i - > scanner . nextInt ( ) ) . collect ( Collectors . toList ( ) ) ; long sum = list . get ( 0 ) - 1 ; long min = 2 ; for ( int i = 1 ; i < n ; i + + ) { final int value = list . get ( i ) ; if ( value < min ) { continue ; } else if ( value = = min ) { min + + ; continue ; } sum + = ( value - 1 ) / min ; } System . out . println ( sum ) ; } private static class FastScanner { private final BufferedReader reader ; private StringTokenizer tokenizer ; FastScanner ( final InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; } String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( final IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) | | ( a = = 5 & & b = = 5 & & c = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . math . BigInteger ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; for ( int i = 6 ; i > = 0 ; i -- ) { if ( Math . pow ( 2 , i ) < = x ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } } } } import java . io . * ; import java . util . * ; import java . math . * ; public class Main { FastReader sc ; void solve ( ) throws IOException { int n = sc . ni ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . ni ( ) ; } int min = a [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; i + + ) { if ( a [ i ] < = min ) ans + + ; min = Math . min ( min , a [ i ] ) ; } System . out . println ( ans ) ; } Main ( ) { try { sc = new FastReader ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static void main ( String [ ] args ) throws IOException { new Main ( ) . solve ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } FastReader ( String s ) { try { br = new BufferedReader ( new FileReader ( s ) ) ; st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } String ns ( ) { if ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } return st . nextToken ( ) ; } int ni ( ) { return Integer . parseInt ( ns ( ) ) ; } long nl ( ) { return Long . parseLong ( ns ( ) ) ; } double nd ( ) { return Double . parseDouble ( ns ( ) ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int n = 0 ; n = sc . nextInt ( ) ; String ans = " Three " ; char [ ] letters = new char [ n ] ; String [ ] sLetters = new String [ n ] ; String string = sc . nextLine ( ) ; sLetters = string . split ( " " ) ; for ( int l = 0 ; l < letters . length ; l + + ) { if ( sLetters [ l ] . equals ( " Y " ) ) { ans = " Four " ; } } out . println ( ans ) ; out . close ( ) ; } 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 ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int pass _ time = H * 60 + M ; double a = ( ( double ) 360 / 60 / 12 * ( double ) pass _ time ) % 360 ; double b = ( 360 / 60 * pass _ time ) % 360 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Math . abs ( a - b ) ) ) ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a > = 5 & & b > = 5 & & c > = 5 ) { int total = a + b + c ; if ( ( a > = 7 | | b > = 7 | | c > = 7 ) & & total = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { static final Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = s . nextInt ( ) , r = 1 ; while ( r * 2 < = n ) r * = 2 ; System . out . println ( r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < = K ; + + i ) { for ( int j = 0 ; j < = K ; + + j ) { if ( S - i - j > = 0 & & S - i - j < = K ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . * ; import java . util . StringTokenizer ; public class Main { FastScanner in ; PrintWriter out ; class FastScanner { BufferedReader br ; StringTokenizer st ; private FastScanner ( File f ) { try { br = new BufferedReader ( new FileReader ( f ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } private FastScanner ( InputStream f ) { br = new BufferedReader ( new InputStreamReader ( f ) ) ; } 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 ( ) ) ; } } private void solve ( ) { int num , l = 0 , r = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { num = in . nextInt ( ) ; if ( num = = 5 ) { l + = 1 ; } else if ( num = = 7 ) { r + = 1 ; } } if ( l = = 2 & & r = = 1 ) { out . print ( " YES " ) ; } else { out . print ( " NO " ) ; } } private void run ( ) { in = new FastScanner ( System . in ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final String [ ] NUMBERS = { " " , " One " , " Two " , " Three " , " Four " } ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int n = scanner . nextInt ( ) ; System . out . println ( NUMBERS [ ( int ) IntStream . range ( 0 , n ) . mapToObj ( i - > scanner . next ( ) ) . distinct ( ) . count ( ) ] ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; } } int [ ] total = new int [ 6 ] ; total [ 0 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ; total [ 1 ] = c [ 0 ] [ 0 ] + c [ 1 ] [ 2 ] + c [ 2 ] [ 1 ] ; total [ 2 ] = c [ 0 ] [ 1 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 2 ] ; total [ 3 ] = c [ 0 ] [ 1 ] + c [ 2 ] [ 0 ] + c [ 1 ] [ 2 ] ; total [ 4 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 0 ] ; total [ 5 ] = c [ 0 ] [ 2 ] + c [ 1 ] [ 0 ] + c [ 2 ] [ 1 ] ; if ( total [ 0 ] = = total [ 1 ] & & total [ 1 ] = = total [ 2 ] & & total [ 2 ] = = total [ 3 ] & & total [ 3 ] = = total [ 4 ] & & total [ 4 ] = = total [ 5 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int max = 0 ; int maxNum = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int num = i ; int count = 0 ; while ( true ) { if ( num % 2 = = 0 ) { num = num / 2 ; count + + ; } else { if ( count > max ) { max = count ; maxNum = i ; } break ; } } } System . out . println ( maxNum ) ; } } 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double degree = getDegree ( H , M ) ; double result = cosFormula ( A , B , degree ) ; System . out . println ( result ) ; } public static double getDegree ( int H , int M ) { double degH = 30 * H + 0.5 * M ; double degM = 6 * M ; double degHM = 0 ; if ( degH < = degM ) { degHM = degM - degH ; } else { degHM = degH - degM ; } if ( degHM > 180 ) { degHM = 360 - degHM ; } return degHM ; } public static double cosFormula ( int A , int B , double degree ) { double hen = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( degree ) ) ) ; return hen ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int sum = 0 , max = 5 , min = 7 ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = sc . nextInt ( ) ; sum + = num [ i ] ; max = Math . max ( max , num [ i ] ) ; min = Math . min ( min , num [ i ] ) ; } if ( ( sum = = 17 ) & & ( max = = 7 ) & & ( min = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] [ ] arr = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) for ( int j = 0 ; j < 3 ; j + + ) arr [ i ] [ j ] = in . nextInt ( ) ; for ( int i = 0 ; i < = 100 ; i + + ) { int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; boolean ok = true ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = arr [ j ] [ 0 ] - i ; for ( int j = 0 ; j < 3 ; j + + ) b [ j ] = arr [ 0 ] [ j ] - a [ 0 ] ; for ( int k = 0 ; k < 3 ; k + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( arr [ k ] [ j ] ! = a [ k ] + b [ j ] ) ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } if ( c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 2 ] - c [ 0 ] [ 1 ] = = c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) { ans + = 1 ; } if ( c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ) { ans + = 1 ; } if ( c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 2 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) { ans + = 1 ; } if ( c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ) { ans + = 1 ; } if ( ans = = 4 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int X , Y , Z ; int count = 0 ; for ( X = 0 ; X < = K ; X + + ) { for ( Y = 0 ; Y < = K ; Y + + ) { if ( X + Y < = S & & S - ( X + Y ) < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int [ ] antenna = new int [ 5 ] ; for ( int i = 0 ; i < antenna . length ; + + i ) { antenna [ i ] = in . nextInt ( ) ; } int k = in . nextInt ( ) ; boolean canDirect = true ; for ( int i = 0 ; i < antenna . length & & canDirect ; + + i ) { for ( int j = i + 1 ; j < antenna . length ; + + j ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > k ) { canDirect = false ; break ; } } } if ( canDirect ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String result = " NO " ; int [ ] a = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int count1 = 0 ; int count2 = 0 ; for ( int i : a ) { if ( i = = 5 ) { count1 + + ; } else if ( i = = 7 ) { count2 + + ; } } if ( count1 = = 2 & & count2 = = 1 ) result = " YES " ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int count = 0 ; for ( int i = n ; i > 0 ; i -- ) { int countA = 0 ; int a = two ( i ) ; while ( a ! = - 1 ) { countA + + ; a = two ( a ) ; } if ( countA > count ) { ans = i ; count = countA ; } } System . out . println ( ans ) ; } static int two ( int n ) { if ( n % 2 = = 0 ) { return n / 2 ; } else { return - 1 ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = stdIn . nextInt ( ) ; } } int s1 = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] ; int s2 = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] ; int s3 = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ; int s4 = c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] ; int s5 = c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] ; int s6 = c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] ; int s7 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] ; int s8 = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] ; int s9 = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ; int s10 = c [ 0 ] [ 1 ] - c [ 0 ] [ 2 ] ; int s11 = c [ 1 ] [ 1 ] - c [ 1 ] [ 2 ] ; int s12 = c [ 2 ] [ 1 ] - c [ 2 ] [ 2 ] ; if ( s1 = = s2 & & s2 = = s3 & & s4 = = s5 & & s5 = = s6 & & s7 = = s8 & & s8 = = s9 & & s10 = = s11 & & s11 = = s12 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( 0 < = z & & z < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " Yes " ; int list [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { int num = sc . nextInt ( ) ; list [ i ] [ j ] = num ; } } int tmpListA [ ] = new int [ 3 ] ; int tmpListB [ ] = new int [ 3 ] ; tmpListA [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { tmpListB [ i ] = list [ 0 ] [ i ] - tmpListA [ 0 ] ; tmpListA [ i ] = list [ i ] [ 0 ] - tmpListB [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( list [ i ] [ j ] = = ( tmpListA [ i ] + tmpListB [ j ] ) ) { continue ; } else { ans = " No " ; break ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . Random ; import java . util . Arrays ; import java . util . Comparator ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . HashMap ; import java . time . format . DateTimeFormatter ; import java . time . temporal . ChronoUnit ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] s = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { s [ i ] = sc . nextInt ( ) ; } if ( s [ 0 ] + s [ 4 ] + s [ 8 ] = = s [ 1 ] + s [ 5 ] + s [ 6 ] & & s [ 1 ] + s [ 5 ] + s [ 6 ] = = s [ 2 ] + s [ 3 ] + s [ 7 ] ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 9 ] ; int ans = 0 ; for ( int i = 0 ; i < 9 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int b11 = a [ 0 ] - a [ 1 ] ; int b12 = a [ 3 ] - a [ 4 ] ; int b13 = a [ 6 ] - a [ 7 ] ; int b21 = a [ 1 ] - a [ 2 ] ; int b22 = a [ 4 ] - a [ 5 ] ; int b23 = a [ 7 ] - a [ 8 ] ; int b31 = a [ 2 ] - a [ 0 ] ; int b32 = a [ 5 ] - a [ 3 ] ; int b33 = a [ 8 ] - a [ 6 ] ; if ( b11 = = b12 ) { if ( b12 = = b13 ) { if ( b21 = = b22 ) { if ( b22 = = b23 ) { if ( b31 = = b32 ) { if ( b32 = = b33 ) { ans + + ; } } } } } } if ( ans = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; if ( A = = 5 ) { if ( B = = 5 & & C = = 7 ) { System . out . println ( " YES " ) ; } else if ( B = = 7 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) p [ i ] = scan . nextInt ( ) ; int out = 1 ; int min = Integer . MAX _ VALUE ; for ( int i = 1 ; i < n ; i + + ) { min = Math . min ( min , Math . min ( p [ i ] , p [ i - 1 ] ) ) ; if ( min > = p [ i ] ) out + + ; } System . out . println ( out ) ; scan . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] point = new int [ 5 ] ; int k ; String ans = " Yay ! " ; for ( int i = 0 ; i < point . length ; i + + ) { point [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; cmp : for ( int i = 0 ; i < point . length ; i + + ) { for ( int j = i + 1 ; j < point . length ; j + + ) { int p = point [ i ] ; int q = point [ j ] ; if ( ( q - p ) > k ) { ans = " : ( " ; break cmp ; } } } System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; System . out . println ( search ( N ) ) ; } public static int search ( int N ) { int work _ n ; int ans = 1 ; int count = 0 ; int max _ count = 0 ; for ( int n = 1 ; n < = N ; n + + ) { count = 0 ; work _ n = n ; while ( ( work _ n % 2 = = 0 ) & & ( work _ n > 0 ) ) { work _ n / = 2 ; count + + ; } if ( max _ count < count ) { ans = n ; max _ count = count ; } } return ans ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = 2 ; int c = 2 ; if ( a = = 1 ) { c = 1 ; } while ( b < a ) { b * = 2 ; if ( b < = a ) { c = b ; } } System . out . println ( c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] s = new int [ 5 ] ; s [ 0 ] = sc . nextInt ( ) ; s [ 1 ] = sc . nextInt ( ) ; s [ 2 ] = sc . nextInt ( ) ; s [ 3 ] = sc . nextInt ( ) ; s [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flg = true ; for ( int n = 0 ; n < 4 & & flg ; n + + ) { for ( int m = n + 1 ; m < 5 & & flg ; m + + ) { if ( s [ m ] - s [ n ] > k ) flg = false ; } } System . out . println ( flg ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ans = " Three " ; String Y = " Y " ; int N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { String S = sc . next ( ) ; if ( S . equals ( Y ) ) { ans = " Four " ; } } System . out . println ( ans ) ; } } import java . util . * ; public final class Main { private static int solution ( int [ ] array ) { int current = 1 ; int score = 1 ; int minimum = array [ 0 ] ; while ( current < array . length ) { if ( array [ current ] < minimum ) { minimum = array [ current ] ; score + + ; } current + + ; } return score ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] array = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } System . out . println ( solution ( array ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; long ans = 0 ; if ( Math . abs ( N - M ) = = 0 ) { long a = 2 ; for ( long i = 1 ; i < = ( long ) N ; i + + ) { a = ( a * i ) % MOD ; } for ( long i = 1 ; i < = ( long ) M ; i + + ) { a = ( a * i ) % MOD ; } ans = a ; } else if ( Math . abs ( N - M ) = = 1 ) { long a = 1 ; for ( long i = 1 ; i < = ( long ) N ; i + + ) { a = ( a * i ) % MOD ; } for ( long i = 1 ; i < = ( long ) M ; i + + ) { a = ( a * i ) % MOD ; } ans = a ; } 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 ( ) ; int ans = 0 ; int m = 1000000 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; m = Math . min ( m , p ) ; if ( p = = m ) ans + + ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | ( a = = 5 & & b = = 7 & & c = = 5 ) | | ( a = = 7 & & b = = 5 & & c = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Integer . parseInt ; public class Main { static int [ ] nums ; static boolean [ ] used ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; String [ ] words ; words = br . readLine ( ) . split ( " " ) ; nums = new int [ 9 ] ; used = new boolean [ 10 ] ; for ( int i = 0 ; i < words . length ; i + + ) { nums [ i ] = parseInt ( words [ i ] ) ; if ( nums [ i ] ! = - 1 ) used [ nums [ i ] ] = true ; } System . out . println ( solve ( 0 ) ) ; } static int solve ( int idx ) { if ( idx = = nums . length ) { if ( check ( ) ) return 1 ; else return 0 ; } int ret = 0 ; if ( nums [ idx ] = = - 1 ) { for ( int k = 1 ; k < = 9 ; k + + ) { if ( ! used [ k ] ) { nums [ idx ] = k ; used [ k ] = true ; ret + = solve ( idx + 1 ) ; nums [ idx ] = - 1 ; used [ k ] = false ; } } } else { ret = solve ( idx + 1 ) ; } return ret ; } static boolean check ( ) { return nums [ 0 ] + nums [ 1 ] * 10 + nums [ 2 ] + nums [ 3 ] * 100 + nums [ 4 ] * 10 + nums [ 5 ] = = nums [ 6 ] * 100 + nums [ 7 ] * 10 + nums [ 8 ] ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; while ( input . hasNext ( ) ) { String [ ] numberStr = input . nextLine ( ) . split ( " " ) ; int count5 = 0 , count7 = 0 ; for ( int i = 0 ; i < numberStr . length ; + + i ) { if ( Integer . valueOf ( numberStr [ i ] ) = = 5 ) { + + count5 ; } if ( Integer . valueOf ( numberStr [ i ] ) = = 7 ) { + + count7 ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double kakudo = Math . toRadians ( Math . abs ( ( h * 30 + m * 0.5 ) - ( m * 6 ) ) ) ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( kakudo ) ) ; 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 ( ) ; int mini = 1000000 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int a = sc . nextInt ( ) ; if ( a < = mini ) { mini = a ; ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String agr [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . math . BigInteger ; import java . util . * ; public class Main implements Runnable { private void solve ( ) throws IOException { int [ ] arr = new int [ ] { nextInt ( ) , nextInt ( ) , nextInt ( ) } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { writer . println ( " YES " ) ; } else writer . println ( " NO " ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter writer ; public void run ( ) { try { reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; tokenizer = null ; writer = new PrintWriter ( System . out ) ; solve ( ) ; reader . close ( ) ; writer . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; } String nextToken ( ) throws IOException { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] inputs = input . readLine ( ) . split ( " " ) ; int K = Integer . parseInt ( inputs [ 0 ] ) ; int S = Integer . parseInt ( inputs [ 1 ] ) ; int [ ] xPlusY = new int [ 2 * K + 1 ] ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { xPlusY [ x + y ] + = 1 ; } } int count = 0 ; for ( int z = 0 ; z < = K ; z + + ) { int sMinusZ = S - z ; if ( sMinusZ < = 2 * K & & sMinusZ > = 0 ) { count + = xPlusY [ sMinusZ ] ; } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; Arrays . sort ( str ) ; System . out . println ( str [ 0 ] . equals ( " 5 " ) & & str [ 1 ] . equals ( " 5 " ) & & str [ 2 ] . equals ( " 7 " ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int A , B , C ; A = input . nextInt ( ) ; B = input . nextInt ( ) ; C = input . nextInt ( ) ; if ( A = = 5 & B = = 5 & C = = 7 ) System . out . println ( " YES " ) ; else if ( A = = 7 & B = = 5 & C = = 5 ) System . out . println ( " YES " ) ; else if ( A = = 5 & B = = 7 & C = = 5 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = K ; i + + ) { if ( i > S ) { break ; } for ( int j = i ; j < = K ; j + + ) { if ( i + j > S ) { break ; } for ( int l = j ; l < = K ; l + + ) { if ( i + j + l = = S ) { if ( i < j & & j < l ) { answer = answer + 6 ; } else if ( ( i = = j & & j < l ) | | ( i < j & & j = = l ) ) { answer = answer + 3 ; } else { answer + + ; } break ; } } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; if ( s . equals ( " 5 5 7 " ) | | s . equals ( " 5 7 5 " ) | | s . equals ( " 7 5 5 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . OutputStream ; import java . util . StringTokenizer ; import java . io . Writer ; 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 ) ; OutputWriter out = new OutputWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , InputReader in , OutputWriter out ) { int n = in . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { String s = in . next ( ) ; if ( s . charAt ( 0 ) = = ' Y ' ) { out . println ( " Four " ) ; return ; } } out . println ( " Three " ) ; } } static class OutputWriter extends PrintWriter { public OutputWriter ( OutputStream out ) { super ( out ) ; } public OutputWriter ( Writer out ) { super ( out ) ; } public void close ( ) { super . close ( ) ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int l ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { l = s - i - j ; if ( ! ( l < 0 | | k < l ) & & i + j + l = = s ) { count + + ; } } } System . out . println ( count ) ; } } 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 ) ; AFiveAntennas solver = new AFiveAntennas ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class AFiveAntennas { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int min = Integer . MAX _ VALUE ; int max = Integer . MIN _ VALUE ; for ( int i = 0 ; i < 5 ; i + + ) { int x = in . nextInt ( ) ; min = Math . min ( min , x ) ; max = Math . max ( max , x ) ; } int k = in . nextInt ( ) ; String answer = ( max - min ) > k ? " : ( " : " Yay ! " ; out . println ( answer ) ; } } 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int x = Math . abs ( a [ 1 ] - a [ 0 ] ) ; int y = Math . abs ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( x + y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; if ( Math . abs ( M - N ) > = 2 ) { System . out . println ( 0 ) ; return ; } long MOD = 1000 _ 000 _ 007 ; long ans = 1 ; for ( int i = 1 ; i < = N ; i + + ) { ans = ( ans * i ) % MOD ; } for ( int i = 1 ; i < = M ; i + + ) { ans = ( ans * i ) % MOD ; } if ( N = = M ) { ans = ( 2 * ans ) % MOD ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] org = new int [ ] { 1 , 4 , 7 , 9 } ; int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( arr [ i ] ! = org [ i ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long count = 1 ; long l = 0 , x = 0 ; long [ ] array = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . nextInt ( ) ; } x = array [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( array [ i ] < = x ) { count + + ; x = array [ i ] ; } } if ( count = = 0 ) { System . out . println ( 1 ) ; } else { System . out . println ( count ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( a = = 5 | | a = = 7 | | b = = 5 | | b = = 7 | | c = = 5 | | c = = 7 ) if ( a + b + c = = 17 ) System . out . printf ( " YES " ) ; else System . out . printf ( " NO " ) ; else System . out . printf ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int cnt = 1 ; for ( int i = 1 ; i < n ; i + + ) { int temp = Integer . parseInt ( sc . next ( ) ) ; if ( a > = temp ) { a = temp ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; String [ ] s = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = stdIn . next ( ) ; } Arrays . sort ( s ) ; int cnt = 1 ; for ( int i = 0 ; i < n - 1 ; i + + ) { if ( ! s [ i ] . equals ( s [ i + 1 ] ) ) { cnt + + ; } } if ( cnt = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = 0 ; int b = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int value = input . nextInt ( ) ; if ( value = = 5 ) a + + ; else if ( value = = 7 ) b + + ; } if ( a = = 2 & & b = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int [ ] array = new int [ ] { in . nextInt ( ) , in . nextInt ( ) , in . nextInt ( ) } ; Arrays . parallelSort ( array ) ; out . append ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; solve ( s ) ; s . close ( ) ; } public static void solve ( Scanner s ) { int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; if ( a = = 5 ) { count5 + + ; } else if ( a = = 7 ) { count7 + + ; } if ( b = = 5 ) { count5 + + ; } else if ( b = = 7 ) { count7 + + ; } if ( c = = 5 ) { count5 + + ; } else if ( c = = 7 ) { count7 + + ; } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { ans + = sc . nextInt ( ) ; } System . out . println ( ans = = 17 ? " YES " : " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] [ ] C = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { C [ i ] [ j ] = scan . nextInt ( ) ; } } int min = C [ 0 ] [ 0 ] ; for ( int i = 0 ; i < 2 ; i + + ) { if ( C [ 0 ] [ i ] < min ) min = C [ 0 ] [ i ] ; } int check ; for ( int a1 = 0 ; a1 < = min ; a1 + + ) { int c11 = C [ 0 ] [ 0 ] - a1 ; int a2 = C [ 1 ] [ 0 ] - c11 ; int a3 = C [ 2 ] [ 0 ] - c11 ; boolean flag = true ; for ( int i = 1 ; i < 3 ; i + + ) { check = C [ 0 ] [ i ] - a1 ; if ( C [ 1 ] [ i ] - a2 ! = check | | C [ 2 ] [ i ] - a3 ! = check ) { flag = false ; break ; } } if ( flag = = true ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } System . out . println ( " No " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . parallelSort ( A ) ; if ( A [ 0 ] = = A [ 1 ] & & A [ 1 ] = = 5 & & A [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { static int words [ ] = new int [ 3 ] ; private static int COUNT _ 5 , COUNT _ 7 ; public static void main ( String [ ] args ) { setData ( ) ; calc ( ) ; System . out . println ( COUNT _ 5 = = 2 & & COUNT _ 7 = = 1 ? " YES " : " NO " ) ; } private static void setData ( ) { Scanner sc = new Scanner ( System . in ) ; words [ 0 ] = sc . nextInt ( ) ; words [ 1 ] = sc . nextInt ( ) ; words [ 2 ] = sc . nextInt ( ) ; } private static void calc ( ) { for ( int word : words ) { if ( word = = 5 ) { COUNT _ 5 + + ; } else if ( word = = 7 ) { COUNT _ 7 + + ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( Ne - Na < = k ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double minAngle = ( double ) M * 6 ; double onlyHour = ( double ) H * 30 ; double hourAngle = onlyHour + ( double ) M * 0.5 ; double angle = Math . abs ( minAngle - hourAngle ) ; if ( angle > 180 ) angle = 360 - angle ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( ans ) ; } } import java . io . BufferedInputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { int [ ] antena = new int [ 5 ] ; int k = 0 ; try ( BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { antena [ 0 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 1 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 2 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 3 ] = Integer . parseInt ( br . readLine ( ) ) ; antena [ 4 ] = Integer . parseInt ( br . readLine ( ) ) ; k = Integer . parseInt ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } boolean result = true ; parent : for ( int i = 0 ; i < antena . length - 1 ; i + + ) { for ( int j = i + 1 ; j < = antena . length - 1 ; j + + ) { if ( k < antena [ j ] - antena [ i ] ) { result = false ; break parent ; } } } if ( result ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( e - a > k ) { flag = true ; } if ( flag ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; System . out . println ( arr [ 4 ] - arr [ 0 ] > k ? " : ( " : " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int array [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( array [ 4 ] - array [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 , ans = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int cnt = 0 ; int ii = i ; while ( ii % 2 = = 0 ) { ii / = 2 ; cnt + + ; if ( cnt > count ) { count = cnt ; ans = i ; } } } if ( N = = 1 ) System . out . println ( 1 ) ; else System . out . println ( ans ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int max = a ; if ( max < b ) max = b ; if ( max < c ) max = c ; int min = a ; if ( min > b ) min = b ; if ( min > c ) min = c ; System . out . println ( max - min ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; import java . util . Set ; import java . util . HashSet ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; Set s = new HashSet < String > ( ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; for ( int i = 0 ; i < n ; i + + ) { s . add ( str [ i ] ) ; } System . out . println ( s . size ( ) = = 4 ? " Four " : " Three " ) ; } } import java . util . Arrays ; import java . util . LinkedList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; int b [ ] = new int [ n ] ; int d [ ] = new int [ n ] ; int count = 0 ; long wa = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; d [ i ] = a [ i ] - b [ i ] ; if ( d [ i ] < 0 ) { wa + = d [ i ] ; count + + ; } } Arrays . sort ( d ) ; int ans = 0 ; for ( int i = n - 1 ; i > = 0 ; i -- ) { if ( wa > = 0 ) { break ; } wa + = d [ i ] ; ans + + ; } if ( wa < 0 ) { System . out . println ( - 1 ) ; } else { System . out . println ( ans + count ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double angle = 0 ; double h = ( H * 30 ) + ( M * 0.5 ) ; double s = M * 6 ; if ( h > s ) { angle = h - s ; } else if ( h < s ) { angle = s - h ; } double side = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( side ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; Long [ ] a = new Long [ n ] ; Long [ ] b = new Long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Long . parseLong ( sc . next ( ) ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Long . parseLong ( sc . next ( ) ) ; } sc . close ( ) ; long sumA = Arrays . stream ( a ) . mapToLong ( i - > i ) . sum ( ) ; long sumB = Arrays . stream ( b ) . mapToLong ( i - > i ) . sum ( ) ; int result = 0 ; if ( sumA < sumB ) { result = - 1 ; } else { PriorityQueue < Long > overNumberQueue = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; PriorityQueue < Long > lackNumberQueue = new PriorityQueue < > ( Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < n ; i + + ) { long diff = a [ i ] - b [ i ] ; if ( 0 < diff ) { overNumberQueue . add ( diff ) ; } else if ( diff < 0 ) { lackNumberQueue . add ( diff * - 1 ) ; } } long over = 0 ; while ( ! lackNumberQueue . isEmpty ( ) ) { long lack = lackNumberQueue . poll ( ) ; over - = lack ; result + + ; while ( over < 0 ) { over + = overNumberQueue . poll ( ) ; result + + ; } } } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String ans = " Yay ! " ; if ( ( e - a ) > k ) ans = " : ( " ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; int cnt = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int tmp = i ; int tmpCnt = 0 ; while ( true ) { if ( tmp % 2 = = 0 ) { tmp = tmp / 2 ; tmpCnt + + ; } else { break ; } } if ( Math . max ( cnt , tmpCnt ) = = tmpCnt ) { ans = i ; cnt = tmpCnt ; } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 3 ] ; n [ 0 ] = sc . nextInt ( ) ; n [ 1 ] = sc . nextInt ( ) ; n [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( n ) ; if ( n [ 0 ] = = 5 & & n [ 1 ] = = 5 & & n [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( solve ( N ) ) ; sc . close ( ) ; } static int solve ( int N ) { return Integer . highestOneBit ( N ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double radius = ( h / 12 + m / ( 60 * 12 ) - m / 60 ) * Math . PI * 2.0 ; double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( radius ) ) ; 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 ( ) ; int m = sc . nextInt ( ) ; long mod = 1 _ 000 _ 000 _ 007L ; long x [ ] = new long [ n ] ; long y [ ] = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < m ; i + + ) { y [ i ] = sc . nextInt ( ) ; } long X = 0 ; for ( int i = 0 ; i < n - 1 ; i + + ) { X = add ( X , mult ( mult ( i + 1 , n - i - 1 , mod ) , x [ i + 1 ] - x [ i ] , mod ) , mod ) ; } long ans = 0 ; for ( int i = 0 ; i < m - 1 ; i + + ) { ans = add ( ans , mult ( mult ( mult ( i + 1 , m - i - 1 , mod ) , y [ i + 1 ] - y [ i ] , mod ) , X , mod ) , mod ) ; } System . out . println ( ans ) ; } static long add ( long x , long y , long mod ) { return ( x + y ) % mod ; } static long mult ( long x , long y , long mod ) { return ( x * y ) % mod ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) throws Exception { int antenna [ ] = new int [ 5 ] ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i < antenna . length ; i + + ) { antenna [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } int k = Integer . parseInt ( br . readLine ( ) ) ; if ( antenna [ 4 ] - antenna [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < k + 1 ; x + + ) { for ( int y = 0 ; y < k + 1 ; y + + ) { if ( s - x - y < k + 1 & & s - x - y > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int fiveNum = ( a = = 5 ? 1 : 0 ) + ( b = = 5 ? 1 : 0 ) + ( c = = 5 ? 1 : 0 ) ; int sevenNum = ( a = = 7 ? 1 : 0 ) + ( b = = 7 ? 1 : 0 ) + ( c = = 7 ? 1 : 0 ) ; System . out . println ( ( fiveNum = = 2 & & sevenNum = = 1 ) ? " YES " : " NO " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import static java . lang . Integer . parseInt ; import static java . lang . Long . parseLong ; import static java . lang . System . exit ; class Main { static void solve ( ) throws Exception { int fc = 0 , sc = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int f = scanInt ( ) ; if ( f = = 5 ) fc + + ; else if ( f = = 7 ) sc + + ; } out . println ( fc = = 2 & & sc = = 1 ? " YES " : " NO " ) ; } static int scanInt ( ) throws IOException { return parseInt ( scanString ( ) ) ; } static long scanLong ( ) throws IOException { return parseLong ( scanString ( ) ) ; } static String scanString ( ) throws IOException { while ( tok = = null | | ! tok . hasMoreTokens ( ) ) { tok = new StringTokenizer ( in . readLine ( ) ) ; } return tok . nextToken ( ) ; } static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; public static void main ( String [ ] args ) { try { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; in . close ( ) ; out . close ( ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; exit ( 1 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int squ = 1 ; while ( n / 2 > = squ ) { squ * = 2 ; } System . out . println ( squ ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static final MyScanner in = new MyScanner ( ) ; public static void main ( String [ ] args ) { double A = in . nextInt ( ) ; double B = in . nextInt ( ) ; double H = in . nextInt ( ) ; double M = in . nextInt ( ) ; double mS = 360.0 / 60 * M ; double hS = ( 360.0 / 12 * H ) + ( 360.0 / 12 / 60 * M ) ; hS = s ( hS ) ; mS = s ( mS ) ; hS = Math . toRadians ( hS ) ; mS = Math . toRadians ( mS ) ; double answer = Math . sqrt ( Math . pow ( B * Math . cos ( mS ) - A * Math . cos ( hS ) , 2 ) + Math . pow ( B * Math . sin ( mS ) - A * Math . sin ( hS ) , 2 ) ) ; System . out . println ( answer ) ; } public static double s ( double d ) { if ( d < = 90 ) { return 90 - d ; } else { return 90 + 360 - d ; } } public static class MyScanner { Scanner sc = new Scanner ( System . in ) ; String next ( ) { return sc . next ( ) ; } int nextInt ( ) { return Integer . valueOf ( sc . next ( ) ) ; } long nextLong ( ) { return Long . valueOf ( sc . next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = k & & x < = s ; x + + ) { for ( int y = 0 ; y < = k & & x + y < = s ; y + + ) { if ( s - x - y < = k ) cnt + + ; } } System . out . println ( cnt ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; if ( a [ i ] = = 5 ) { count + + ; } } if ( count = = 1 | | count = = 3 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double dig1 = ( ( h + m / 60 ) / 12.0 ) * 2 * Math . PI ; double dig2 = m / 60.0 * 2 * Math . PI ; double cos = Math . cos ( Math . abs ( dig1 - dig2 ) ) ; System . out . println ( Math . sqrt ( a * a + b * b - 2 * a * b * cos ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; String [ ] S = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = in . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . equals ( " Y " ) ) { out . println ( " Four " ) ; return ; } } out . println ( " Three " ) ; } } } public class Main { public static void main ( String [ ] args ) { java . util . Scanner sc = new java . util . Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ n ] ; int sum = 1 ; p [ 0 ] = sc . nextInt ( ) ; int min = p [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; if ( p [ i ] < min ) { min = p [ i ] ; sum + + ; } } System . out . println ( sum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int cont1 = 0 , cont2 = 0 ; int n1 = scn . nextInt ( ) ; if ( n1 = = 5 ) cont1 + + ; else if ( n1 = = 7 ) cont2 + + ; n1 = scn . nextInt ( ) ; if ( n1 = = 5 ) cont1 + + ; else if ( n1 = = 7 ) cont2 + + ; n1 = scn . nextInt ( ) ; if ( n1 = = 5 ) cont1 + + ; else if ( n1 = = 7 ) cont2 + + ; if ( cont1 = = 2 & cont2 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; scn . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < n ; i + + ) { list . add ( sc . next ( ) ) ; } List < String > list2 = new ArrayList < String > ( new HashSet < > ( list ) ) ; if ( list2 . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Set < String > set1 = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { set1 . add ( sc . next ( ) ) ; } int ans = set1 . size ( ) ; if ( ans = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; int [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean flg = true ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) { flg = false ; break ; } } if ( ! flg ) break ; } if ( flg ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = 0 ; ArrayList < Integer > List = new ArrayList < > ( ) ; for ( int a = 0 ; a < 4 ; a + + ) List . add ( sc . nextInt ( ) ) ; if ( List . contains ( 1 ) = = true ) num + + ; if ( List . contains ( 9 ) = = true ) num + + ; if ( List . contains ( 7 ) = = true ) num + + ; if ( List . contains ( 4 ) = = true ) num + + ; if ( num = = 4 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int P [ ] = new int [ N ] ; int min = 0 ; int answer = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } min = P [ 0 ] ; answer = answer + 1 ; for ( int i = 1 ; i < N ; i + + ) { if ( P [ i ] < min ) { answer = answer + 1 ; min = P [ i ] ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] e = new int [ 10 ] ; e [ 1 ] = 0 ; e [ 9 ] = 0 ; e [ 4 ] = 0 ; e [ 7 ] = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { int a = sc . nextInt ( ) ; if ( a = = 1 | | a = = 9 | | a = = 7 | | a = = 4 ) { e [ a ] + + ; } } if ( e [ 1 ] > = 1 & & e [ 9 ] > = 1 & & e [ 7 ] > = 1 & & e [ 4 ] > = 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } 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 . 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 ) { long n = in . nextLong ( ) ; long m = in . nextLong ( ) ; if ( Math . abs ( n - m ) > = 2 ) { out . println ( 0 ) ; return ; } long ans = 1 ; long MOD = 1 _ 000 _ 000 _ 007 ; for ( int i = 1 ; i < = n ; i + + ) { ans = ( ans * i ) % MOD ; } for ( int i = 1 ; i < = m ; i + + ) { ans = ( ans * i ) % MOD ; } if ( n = = m ) ans = ( ans * 2 ) % MOD ; out . println ( ans ) ; } } 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 long nextLong ( ) { return Long . parseLong ( nextString ( ) ) ; } public InputReader ( InputStream inputStream ) { in = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; tok = new StringTokenizer ( " " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; double a = input . nextDouble ( ) ; double b = input . nextDouble ( ) ; double h = input . nextDouble ( ) ; double m = input . nextDouble ( ) ; double radian = Math . PI * 2 * ( h / 12.0 + ( m / 60.0 ) / 12.0 - m / 60.0 ) ; double rsq = ( a * a + b * b ) - ( 2 * a * b ) * Math . cos ( radian ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int i = 1 ; while ( i < = n ) { ans = i ; i * = 2 ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 4 ] [ 4 ] ; for ( int i = 1 ; i < = 3 ; i + + ) { for ( int j = 1 ; j < = 3 ; j + + ) c [ i ] [ j ] = sc . nextInt ( ) ; } if ( ( ( c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 2 ] - c [ 2 ] [ 1 ] ) ) & & ( ( c [ 1 ] [ 2 ] - c [ 1 ] [ 1 ] ) = = ( c [ 3 ] [ 2 ] - c [ 3 ] [ 1 ] ) ) & & ( ( c [ 1 ] [ 3 ] - c [ 1 ] [ 2 ] ) = = ( c [ 2 ] [ 3 ] - c [ 2 ] [ 2 ] ) ) & & ( ( c [ 1 ] [ 3 ] - c [ 1 ] [ 2 ] ) = = ( c [ 3 ] [ 3 ] - c [ 3 ] [ 2 ] ) ) & & ( ( c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 2 ] - c [ 1 ] [ 2 ] ) ) & & ( ( c [ 2 ] [ 1 ] - c [ 1 ] [ 1 ] ) = = ( c [ 2 ] [ 3 ] - c [ 1 ] [ 3 ] ) ) & & ( ( c [ 3 ] [ 1 ] - c [ 2 ] [ 1 ] ) = = ( c [ 3 ] [ 2 ] - c [ 2 ] [ 2 ] ) ) & & ( ( c [ 3 ] [ 1 ] - c [ 2 ] [ 1 ] ) = = ( c [ 3 ] [ 3 ] - c [ 2 ] [ 3 ] ) ) ) { System . out . println ( " Yes " ) ; } else System . out . println ( " No " ) ; return ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; aLoop : for ( int a = 0 ; a < = k ; a + + ) { bLoop : for ( int b = 0 ; b < = k ; b + + ) { int abSum = a + b ; if ( abSum > s ) { continue aLoop ; } else if ( s - abSum < = k ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; int F = sc . nextInt ( ) ; int G = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int I = sc . nextInt ( ) ; int sum = A + E + I ; Main main = new Main ( ) ; if ( main . checkSum ( sum , A , H , F ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , D , B , I ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , D , H , C ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , G , E , C ) = = false ) { System . out . println ( " No " ) ; return ; } if ( main . checkSum ( sum , G , B , F ) = = false ) { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } public boolean checkSum ( int sum , int A , int B , int C ) { if ( A + B + C = = sum ) return true ; return false ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( S - X - Y > = 0 & & S - X - Y < = K ) { count + + ; } } } System . out . print ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) a [ i ] = scan . nextInt ( ) ; scan . close ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ) ; } } import java . util . Scanner ; import java . util . stream . IntStream ; public class Main { private static final int N = 5 ; public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] n = IntStream . range ( 0 , 5 ) . map ( i - > scanner . nextInt ( ) ) . sorted ( ) . toArray ( ) ; int k = scanner . nextInt ( ) ; System . out . println ( ( n [ N - 1 ] - n [ 0 ] > k ) ? " : ( " : " Yay ! " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a < = k & & e - a > 0 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; import java . util . * ; public class Main { private static boolean debug = false ; private static boolean elapsed = false ; private static PrintWriter _ out = new PrintWriter ( System . out ) ; private static PrintWriter _ err = new PrintWriter ( System . err ) ; private void solve ( Scanner sc ) { int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { + + cnt ; } } } _ out . println ( cnt ) ; } private long C ( long n , long r ) { long res = 1 ; for ( long i = n ; i > n - r ; -- i ) { res * = i ; } for ( long i = r ; i > 1 ; -- i ) { res / = i ; } return res ; } private long P ( long n , long r ) { long res = 1 ; for ( long i = n ; i > n - r ; -- i ) { res * = i ; } return res ; } public static void main ( String [ ] args ) { long S = System . currentTimeMillis ( ) ; Scanner sc = new Scanner ( System . in ) ; new Main ( ) . solve ( sc ) ; _ out . flush ( ) ; long G = System . currentTimeMillis ( ) ; if ( elapsed ) { _ err . println ( ( G - S ) + " ms " ) ; } _ err . flush ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a = = 5 & & b = = 5 & & c = = 7 ) | | a = = 5 & & b = = 7 & & c = = 5 | | a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { private static final int MOD = 1000000007 ; public static long sum ( long [ ] x , int n ) { long s = 0 ; for ( int i = 0 ; i < n ; i + + ) { s + = i * x [ i ] % MOD ; s - = ( n - 1 - i ) * x [ i ] % MOD ; s = ( s + MOD ) % MOD ; } return s ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long [ ] x = new long [ n ] ; long [ ] y = new long [ m ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextLong ( ) ; } for ( int j = 0 ; j < m ; j + + ) { y [ j ] = sc . nextLong ( ) ; } Arrays . sort ( x ) ; Arrays . sort ( y ) ; System . out . println ( sum ( x , n ) * sum ( y , m ) % MOD ) ; } } import java . util . * ; final class Solver { static final Solver INSTANCE = new Solver ( ) ; void solve ( Iterator < String > sc ) { int K = Integer . parseInt ( sc . next ( ) ) ; int S = Integer . parseInt ( sc . next ( ) ) ; int sum = 0 ; for ( int x = 0 ; x < = K & & x < = S ; x + + ) { int remaining = S - x ; sum + = Math . max ( Math . min ( remaining , K ) - Math . max ( remaining - K , 0 ) + 1 , 0 ) ; } System . out . println ( sum ) ; } } class Main { public static void main ( String ... args ) { Solver . INSTANCE . solve ( new Scanner ( System . in ) ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { private static Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = Integer . parseInt ( scan . next ( ) ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ? " YES " : " NO " ) ; scan . close ( ) ; } } import java . io . IOException ; import java . util . NoSuchElementException ; import java . io . BufferedReader ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final String s = reader . readLine ( ) ; int N = Integer . parseInt ( s ) ; int mx = 0 ; int x = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int t = i ; int c = 0 ; while ( 0 < t ) { if ( ( t & 1 ) = = 1 ) break ; t = t > > 1 ; c + + ; } if ( mx < = c ) { mx = c ; x = i ; } } System . out . println ( x ) ; } } } import java . util . * ; import static java . lang . Integer . * ; import static java . lang . System . * ; public class Main { public static void main ( String [ ] args ) { int i ; Scanner sc = new Scanner ( in ) ; int [ ] a = new int [ 3 ] ; for ( i = 0 ; i < a . length ; i + + ) { a [ i ] = parseInt ( sc . next ( ) ) ; } sc . close ( ) ; Arrays . sort ( a ) ; out . println ( ( a [ 1 ] - a [ 0 ] ) + ( a [ 2 ] - a [ 1 ] ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = Integer . parseInt ( scanner . next ( ) ) ; int s = Integer . parseInt ( scanner . next ( ) ) ; int res = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - ( x + y ) ; if ( 0 < = z & & z < = k ) res + + ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void debug ( String str ) { System . out . println ( str ) ; } public static void main ( String [ ] args ) { int A ; int B ; int C ; try ( Scanner sc = new Scanner ( System . in ) ) { A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; } if ( A ! = 5 & & A ! = 7 ) { System . out . println ( " NO " ) ; return ; } if ( B ! = 5 & & B ! = 7 ) { System . out . println ( " NO " ) ; return ; } if ( C ! = 5 & & C ! = 7 ) { System . out . println ( " NO " ) ; return ; } if ( A + B + C ! = 17 ) { System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int day = sc . nextInt ( ) , n = sc . nextInt ( ) ; int [ ] high = new int [ day ] ; for ( int i = 0 ; i < day ; i + + ) { high [ i ] = sc . nextInt ( ) ; } int [ ] ht = new int [ n ] ; int [ ] lt = new int [ n ] ; int [ ] loud = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { lt [ i ] = sc . nextInt ( ) ; ht [ i ] = sc . nextInt ( ) ; loud [ i ] = sc . nextInt ( ) ; } int [ ] [ ] dp = new int [ day ] [ n ] ; for ( int i = 0 ; i < day ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { dp [ i ] [ j ] = 0 ; } } int ans = 0 ; for ( int i = 1 ; i < day ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( lt [ j ] < = high [ i ] & & high [ i ] < = ht [ j ] ) ; else continue ; for ( int k = 0 ; k < n ; k + + ) { if ( lt [ k ] < = high [ i - 1 ] & & high [ i - 1 ] < = ht [ k ] ) ; else continue ; dp [ i ] [ j ] = Math . max ( dp [ i ] [ j ] , Math . abs ( loud [ j ] - loud [ k ] ) + dp [ i - 1 ] [ k ] ) ; ans = Math . max ( ans , dp [ i ] [ j ] ) ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double hx = A * Math . sin ( Math . toRadians ( H * 30 + M * 0.5 ) ) ; double hy = A * Math . cos ( Math . toRadians ( H * 30 + M * 0.5 ) ) ; double mx = B * Math . sin ( Math . toRadians ( M * 6 ) ) ; double my = B * Math . cos ( Math . toRadians ( M * 6 ) ) ; double dist = Math . sqrt ( ( hx - mx ) * ( hx - mx ) + ( hy - my ) * ( hy - my ) ) ; System . out . println ( dist ) ; } } import java . io . File ; import java . io . IOException ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( z > = 0 & & z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long Count = 0l ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int ch = sc . nextInt ( ) ; if ( ch < = min ) { Count + + ; min = ch ; } } System . out . println ( Count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; System . out . println ( e - a < = k ? " Yay ! " : " : ( " ) ; scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int five _ count = 0 ; int seven _ count = 0 ; int a = - 1 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { a = sc . nextInt ( ) ; if ( a = = 5 ) { five _ count + + ; } else if ( a = = 7 ) { seven _ count + + ; } else { System . out . println ( " NO " ) ; break ; } } if ( five _ count = = 2 & & seven _ count = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] [ ] b = new int [ 3 ] [ 3 ] ; for ( int x = 0 ; x < 3 ; x + + ) { String [ ] foo = br . readLine ( ) . split ( " " ) ; for ( int y = 0 ; y < 3 ; y + + ) { b [ x ] [ y ] = Integer . parseInt ( foo [ y ] ) ; } } int a2 = 0 ; int a3 = 0 ; int b1 = 0 ; int b2 = 0 ; int b3 = 0 ; for ( int a1 = 0 ; a1 < 100 ; a1 + + ) { b1 = b [ 0 ] [ 0 ] - a1 ; b2 = b [ 0 ] [ 1 ] - a1 ; b3 = b [ 0 ] [ 2 ] - a1 ; int [ ] bls = { b1 , b2 , b3 } ; for ( int x = 0 ; x < 3 ; x + + ) { if ( x = = 0 ) { a2 = b [ 1 ] [ x ] - bls [ x ] ; a3 = b [ 2 ] [ x ] - bls [ x ] ; } else { if ( a2 ! = b [ 1 ] [ x ] - bls [ x ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } if ( a3 ! = b [ 2 ] [ x ] - bls [ x ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } a2 = b [ 1 ] [ x ] - bls [ x ] ; a3 = b [ 2 ] [ x ] - bls [ x ] ; } } } System . out . println ( " Yes " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int ans = 0 ; for ( ; n > 0 ; n -- ) { int x = sc . nextInt ( ) ; if ( x < min ) { ans + + ; min = x ; } } System . out . println ( ans ) ; } static class FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public String nextLine ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \ n " ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) , m = Integer . parseInt ( st . nextToken ( ) ) ; if ( Math . abs ( n - m ) > 1 ) { System . out . println ( 0 ) ; return ; } long a = 1 , b = 1 ; int mod = 1000000007 ; for ( int i = 2 ; i < = n ; i + + ) { a * = i ; a = a % mod ; } for ( int i = 2 ; i < = m ; i + + ) { b * = i ; b = b % mod ; } if ( Math . abs ( n - m ) = = 1 ) { System . out . println ( ( a * b ) % mod ) ; return ; } System . out . println ( 2 * ( ( a * b ) % mod ) % mod ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int b1 = a [ 0 ] ; int b2 = a [ 1 ] ; int b3 = a [ 2 ] ; int a1 = 0 ; int a2 = a [ 3 ] - b1 ; int a3 = a [ 6 ] - b1 ; int check = 0 ; if ( a [ 4 ] ! = a2 + b2 | | a [ 5 ] ! = a2 + b3 | | a [ 7 ] ! = a3 + b2 | | a [ 8 ] ! = a3 + b3 ) { check + + ; } if ( check = = 0 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] array = new int [ ] { s . nextInt ( ) , s . nextInt ( ) , s . nextInt ( ) } ; Arrays . sort ( array ) ; System . out . println ( Arrays . equals ( array , new int [ ] { 5 , 5 , 7 } ) ? " YES " : " NO " ) ; } } 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 ; MyScanner in = new MyScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; C solver = new C ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class C { public void solve ( int testNumber , MyScanner in , PrintWriter out ) { int A = in . Int ( ) ; int B = in . Int ( ) ; int H = in . Int ( ) ; int M = in . Int ( ) ; double hp = H * 30 + M * 0.5 ; double mp = M * 6 ; double rad = Math . toRadians ( hp - mp ) ; double ans = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2L * A * B * Math . cos ( rad ) ) ; out . println ( ans ) ; } } static class MyScanner { private BufferedReader in ; private StringTokenizer st ; public MyScanner ( InputStream stream ) { in = new BufferedReader ( new InputStreamReader ( stream ) ) ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { String rl = in . readLine ( ) ; if ( rl = = null ) { return null ; } st = new StringTokenizer ( rl ) ; } catch ( IOException e ) { return null ; } } return st . nextToken ( ) ; } public int Int ( ) { return Integer . parseInt ( next ( ) ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int [ ] ns = new int [ 4 ] ; for ( int i = 0 ; i < ns . length ; i + + ) { int n = std . nextInt ( ) ; ns [ i ] = n ; } Arrays . sort ( ns ) ; boolean requiredCondition = ns [ 0 ] = = 1 & & ns [ 1 ] = = 4 & & ns [ 2 ] = = 7 & & ns [ 3 ] = = 9 ; if ( requiredCondition ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } Arrays . sort ( nums ) ; if ( nums [ 0 ] = = 5 & & nums [ 1 ] = = 5 & & nums [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; s + = sc . next ( ) ; if ( s . contains ( " 1 " ) & & s . contains ( " 9 " ) & & s . contains ( " 4 " ) & & s . contains ( " 7 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int PjMin = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { int Pi = sc . nextInt ( ) ; if ( Pi < = PjMin ) { count + + ; } if ( PjMin > = Pi ) { PjMin = Pi ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] haiku = { a , b , c } ; int temp = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( haiku [ i ] < haiku [ j ] ) { temp = haiku [ i ] ; haiku [ i ] = haiku [ j ] ; haiku [ j ] = temp ; } } } if ( haiku [ 0 ] = = 5 & & haiku [ 1 ] = = 5 & & haiku [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . io . * ; import java . math . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long N = input . nextLong ( ) ; boolean found = false ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long w = 1 ; w < = 3500 ; w + + ) { long Num = N * h * w ; long Den = 4 * h * w - N * w - N * h ; if ( Den > 0 & & Num % Den = = 0 ) { long ans = Num / Den ; System . out . println ( h + " " + ans + " " + w ) ; found = true ; break ; } } if ( found ) break ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import static java . lang . Integer . parseInt ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; String [ ] words ; line = br . readLine ( ) ; int H , R ; H = parseInt ( line . substring ( 0 , line . indexOf ( ' ' ) ) ) ; R = parseInt ( line . substring ( line . indexOf ( ' ' ) + 1 ) ) ; if ( H > - R ) { System . out . println ( 1 ) ; } else if ( H = = - R ) { System . out . println ( 0 ) ; } else { System . out . println ( - 1 ) ; } } } import java . io . * ; import java . util . * ; public class Main { private static FastReader in = new FastReader ( System . in ) ; private static PrintWriter out = new PrintWriter ( System . out ) ; private static final long MOD = ( long ) 1e9 + 7 ; public static void main ( String [ ] args ) { solve ( ) ; out . flush ( ) ; } private static void solve ( ) { int n = in . nextInt ( ) ; int [ ] p = in . nextIntArray ( n ) ; int ans = 0 ; int min = p [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { min = Math . min ( min , p [ i ] ) ; if ( p [ i ] < = min ) { ans + + ; } } out . println ( ans ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; FastReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] num1 = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( num1 [ i ] = = 5 ) { count + + ; } else if ( num1 [ i ] = = 7 ) { count + = 2 ; } else { System . out . println ( " NO " ) ; return ; } } System . out . println ( count = = 4 ? " YES " : " NO " ) ; } } import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ; import java . io . OutputStream ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . Map ; import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; import java . math . BigDecimal ; 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 N = in . nextInt ( ) ; int a [ ] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 } ; int res = 0 ; for ( int i = 0 ; i < 7 ; i + + ) { if ( N > = a [ i ] ) { res = a [ i ] ; } } out . println ( res ) ; } } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int Z = S - x - y ; if ( Z > = 0 & & Z < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long n = 0 , h = 0 , w = 0 ; for ( int i = 1 ; i < 3501 ; i + + ) { for ( int j = 1 ; j < 3501 ; j + + ) { long a = N * i * j ; long b = 4 * i * j - N * i - N * j ; if ( 0 < b & & b < a & & a % b = = 0 ) { h = i ; w = j ; n = a / b ; break ; } } } System . out . println ( n + " " + h + " " + w ) ; sc . close ( ) ; } } import java . util . * ; import java . util . stream . Collectors ; public class Main implements Runnable { private static int MOD = 1 _ 000 _ 000 _ 007 ; public static void main ( String [ ] args ) { Thread thread = new Thread ( null , new Main ( ) , " " , 16 * 1024 * 1024 ) ; thread . start ( ) ; } @ Override public void run ( ) { final Scanner scanner = new Scanner ( System . in ) ; solve ( scanner ) ; } static void solve ( Scanner scanner ) { int a = Integer . parseInt ( scanner . nextLine ( ) ) ; scanner . nextLine ( ) ; scanner . nextLine ( ) ; scanner . nextLine ( ) ; int e = Integer . parseInt ( scanner . nextLine ( ) ) ; int k = Integer . parseInt ( scanner . nextLine ( ) ) ; System . out . println ( e - a < = k ? " Yay ! " : " : ( " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { static Scanner sc = new Scanner ( System . in ) ; static int N = sc . nextInt ( ) ; static long [ ] A = new long [ N ] ; static long [ ] B = new long [ N ] ; static long [ ] D = new long [ N ] ; static { Arrays . setAll ( A , i - > sc . nextLong ( ) ) ; Arrays . setAll ( B , i - > sc . nextLong ( ) ) ; Arrays . setAll ( D , i - > A [ i ] - B [ i ] ) ; } public static void main ( String [ ] args ) { long [ ] remains = Arrays . stream ( D ) . filter ( i - > i > 0 ) . sorted ( ) . toArray ( ) ; long [ ] shortages = Arrays . stream ( D ) . filter ( i - > i < 0 ) . toArray ( ) ; long shortage = Arrays . stream ( shortages ) . sum ( ) ; int ans = shortages . length ; for ( int j = remains . length - 1 ; j > - 1 ; j -- ) { if ( shortage > = 0 ) { break ; } shortage + = remains [ j ] ; ans + + ; } if ( shortage < 0 ) { ans = - 1 ; } System . out . println ( ans ) ; } } import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . Map . Entry ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n = = 1 ) { System . out . println ( 1 ) ; System . exit ( 0 ) ; } Map < Integer , Integer > an = new HashMap < Integer , Integer > ( ) ; for ( int i = 1 ; i < = n ; i + + ) { int j = i ; int c = 0 ; while ( j % 2 = = 0 ) { c + = 1 ; j / = 2 ; } an . put ( i , c ) ; } int ans = 0 ; int max = 0 ; for ( Entry < Integer , Integer > e : an . entrySet ( ) ) { if ( e . getValue ( ) > max ) { max = e . getValue ( ) ; ans = e . getKey ( ) ; } } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] a = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 2 ] - a [ 0 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; array [ 0 ] = sc . nextInt ( ) ; array [ 1 ] = sc . nextInt ( ) ; array [ 2 ] = sc . nextInt ( ) ; array [ 3 ] = sc . nextInt ( ) ; array [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( array [ i ] - array [ j ] ) > k ) { count = 1 ; break ; } } if ( count = = 1 ) break ; } if ( count = = 1 ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class Main { int a , b , c ; public static void main ( String args [ ] ) { new Main ( ) . run ( ) ; } void run ( ) { FastReader sc = new FastReader ( ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; solve ( ) ; } void solve ( ) { if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { var scaner = new Scanner ( System . in ) ; var a = scaner . nextInt ( ) ; var b = scaner . nextInt ( ) ; var h = scaner . nextInt ( ) ; var m = scaner . nextInt ( ) ; var x = 30 * h + 0.5 * m ; var y = 6 * m ; var r = Math . max ( x , y ) - Math . min ( x , y ) ; var ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b ) * Math . cos ( Math . toRadians ( r ) ) ) ; System . out . println ( ans ) ; scaner . close ( ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Map ; import java . util . Scanner ; import java . util . HashMap ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskD solver = new TaskD ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskD { public void solve ( int testNumber , Scanner in , PrintWriter out ) { double a = in . nextDouble ( ) ; double b = in . nextDouble ( ) ; double H = in . nextDouble ( ) ; double M = in . nextDouble ( ) ; double HH = H * 30 + M / 2 ; double MM = M * 6 ; double ang = Math . abs ( HH - MM ) ; ang = Math . min ( 360 - ang , ang ) ; double result = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( Math . toRadians ( ang ) ) ) ) ; out . println ( String . format ( " % .10f " , result ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int h = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; double c = angle ( h % 12 , m ) ; c = Math . toRadians ( c ) ; double ss = Math . sqrt ( ( double ) Math . pow ( a , 2 ) + ( double ) Math . pow ( b , 2 ) - ( ( double ) 2 * ( double ) a * ( double ) b * ( double ) Math . cos ( c ) ) ) ; System . out . println ( ss ) ; } public static double angle ( int hour , int minute ) { if ( hour < 0 | | minute < 0 ) { return - 1 ; } if ( hour = = 12 ) { hour = 0 ; } if ( minute = = 60 ) { minute = 0 ; hour + = 1 ; } double hourAngle = ( hour * 60 + minute ) * 0.5 ; double minAngle = minute * 6 ; double bwAngle = Math . abs ( hourAngle - minAngle ) ; return Math . min ( 360 - bwAngle , bwAngle ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner inp = new Scanner ( System . in ) ; int a = inp . nextInt ( ) ; int b = inp . nextInt ( ) ; int c = inp . nextInt ( ) ; boolean flag = false ; if ( a = = 5 & & b = = 5 & & c = = 7 ) flag = true ; if ( a = = 5 & & b = = 7 & & c = = 5 ) flag = true ; if ( a = = 7 & & b = = 5 & & c = = 5 ) flag = true ; if ( flag ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . ArrayDeque ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int book [ ] = new int [ 4 ] ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { book [ i ] = 0 ; } for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " P " ) ) { book [ 0 ] = 1 ; } else if ( s . equals ( " W " ) ) { book [ 1 ] = 1 ; } else if ( s . equals ( " G " ) ) { book [ 2 ] = 1 ; } else { book [ 3 ] = 1 ; } } int sum = book [ 0 ] + book [ 1 ] + book [ 2 ] + book [ 3 ] ; if ( sum = = 3 ) System . out . println ( " Three " ) ; else { System . out . println ( " Four " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { private static class FastScanner { private BufferedReader reader = null ; private StringTokenizer tokenizer = null ; public FastScanner ( InputStream in ) { reader = new BufferedReader ( new InputStreamReader ( in ) ) ; tokenizer = null ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; } public String nextLine ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { return reader . readLine ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( " \ n " ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } public int [ ] nextIntArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextInt ( ) ; return a ; } public long [ ] nextLongArray ( int n ) { long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = nextLong ( ) ; return a ; } } public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( System . in ) ; int [ ] a = sc . nextIntArray ( 3 ) ; Arrays . sort ( a ) ; int result = 0 ; for ( int i = 1 ; i < 3 ; i + + ) { result + = a [ i ] - a [ i - 1 ] ; } System . out . println ( result ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Sample { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num1 = Integer . parseInt ( str ) ; double num2 = Math . pow ( num1 , 2 ) ; int num3 = ( int ) num2 ; System . out . println ( num3 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; System . out . println ( getCubed ( line ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private static long getCubed ( String line ) { long x = Long . parseLong ( line ) ; return ( short ) Math . pow ( x , 3 ) ; } } public class Main { public static void main ( String [ ] args ) { if ( args . length = = 1 ) { int num = Integer . parseInt ( args [ 0 ] ) ; Cube cube = new Cube ( num ) ; } else { System . out . println ( " 引数が不正です 。 " ) ; } } } public c l s u e { Cu e ( int num ) yste m .ou .pr i n ln ( num * num * num ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int result ; x = Integer . parseInt ( br . readLine ( ) ) ; result = x * x * x ; System . out . println ( result ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io , * class Main { public static void main ( String [ ] args ) throws IOException { Buffered reader br = new Bufferedreader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int a = parseInt ( str ) ; System . out . print ( a * a * a ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) { int x ; InputStreamReader sir = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String but = br . readLine ( ) ; x = Integer . parseInt ( but ) ; if ( x > = 0 & & x < = 100 ) { x = x * x * x ; } } } package internship ; import java . util . Scanner ; public class test1 { public static void main ( String [ ] args ) { int x = 0 , temp , tot ; Scanner sc = new Scanner ( System . in ) ; while ( x ! = 0 ) { temp = sc . nextInt ( ) ; if ( 1 > = temp | | 100 < = temp ) { x = temp ; } tot = x * x * x ; System . out . println ( tot ) ; System . out . println ( ) ; } } } public class HelloWorld { public static void main ( String [ ] args ) { int line ; double mass ; try { line = Integer . parseInt ( args [ 0 ] ) ; if ( line > = 1 & line < = 100 ) { mass = Math . pow ( ( double ) line , ( double ) 3 ) ; System . out . println ( 1 ) ; } } catch ( Exception e ) { System . out . println ( " Exception : " + e ) ; } } } package DATE20200311 ; import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int flg = 0 ; for ( int j = 0 ; j < i ; j + + ) { if ( P [ i ] > P [ j ] ) { flg = 1 ; } } if ( flg = = 0 ) { count = count + 1 ; } } System . out . println ( count ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . println ( args [ 0 ] * args [ 0 ] * args [ 0 ] ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * * 2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int sum ; String x ; do { x = scan . nextLine ( ) ; if ( x . equals ( " 0 " ) ) break ; sum = 0 ; for ( int i = 0 ; i < x . length ( ) ; i + + ) { char c = x . charAt ( i ) ; sum + = ( int ) c - 48 ; } System . out . println ( sum ) ; } while ( true ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Xcubic { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BufferedReader br = new BufferedReader ( isr ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String buf = br . readLine ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int ? ? ? = Integer . parseInt ? ? ? buf ? ? ? ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( x * x * x ) : } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( SYSTEM > IN ) ; String str = sc . next ( ) ; String result = str . replace ( " ? " , " D " ) ; System . out . println ( result ) ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; system . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Set ; import java . util . StringTokenizer ; class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; Set < Character > set = new HashSet < > ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { char [ ] ch = sc . next ( ) . toCharArray ( ) ; set . add ( ch [ 0 ] ) ; } System . out . println ( set . size ( ) = = 3 ? " Three " : " Four " ) ; } import java . io . * ; import java . util . Scanner ; class Main { public static void mian ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . print ( x * x * x ) } } public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int A = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; int sum = A + B + C ; if ( sum = = 17 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class B { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { StringBuffer sb = new StringBuffer ( sc . next ( ) ) ; for ( int i = 0 ; i < sb . length ( ) - 1 ; i + + ) { char c = sb . charAt ( i ) ; if ( c = = ' ? ' ) { if ( sb . charAt ( i + 1 ) = = ' ? ' ) { sb . setCharAt ( i , ' P ' ) ; sb . setCharAt ( i + 1 , ' D ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' D ' ) { sb . setCharAt ( i , ' P ' ) ; } else { sb . setCharAt ( i , ' D ' ) ; } } else { sb . setCharAt ( i , c ) ; } } if ( sb . charAt ( sb . length ( ) - 1 ) = = ' ? ' ) { sb . setCharAt ( sb . length ( ) - 1 , ' D ' ) ; } System . out . println ( sb . toString ( ) ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String s = sc . next ( ) ; int x = 0 ; int max = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( s . charAt ( i ) . equals ( ' I ' ) ) { x + + ; } else { x -- ; } if ( max < x ) { max = x ; } } System . out . println ( max ) ; } } 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 k ; if ( a > 13 ) { k = b ; } else if ( a < = 6 ) { k = b / 2 ; } else if ( a > 6 ) { k = 0 ; } System . out . println ( k ) ; } } class aoj1 { public static void main ( String [ ] args ) throws IOException { int n ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; n = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( n , 3 ) ) ; } } import java . util . Scanner ; public class team _ formation1 _ b { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( ( n + m ) > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] a ) { Scanner x = new Scanner ( System . in ) ; a = x . nextInt ( ) ; double b = 3 ; int c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } import java . lang . Object ; class Test { public static void main ( String [ ] args ) throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . * ; public static void main ( String [ ] args ) throws ParseException { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; SimpleDateFormat s = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date date1 = s . parse ( S ) ; Date date = s . parse ( " 2019 / 04 / 30 " ) ; if ( date1 . before ( date ) ) { System . out . print ( " Heisei " ) ; } else if ( date1 . after ( date ) ) { System . out . print ( " TBD " ) ; } } import java . util , * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; if ( 1 < = A > = 5 & & 1 < = B > = 7 & & 1 < = C > = 5 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long H = sc . nextLong ( ) ; long W = sc . nextLong ( ) ; long h = sc . nextLong ( ) ; long w = sc . nextLong ( ) ; long x = ( - 10000000 ) * ( h * w - 1 ) - 1 ; String [ ] ans = new String [ H ] ; for ( int i = 0 ; i < H ; + + i ) { ans [ i ] = " " ; } long sum = 0 ; for ( int i = 1 ; i < = H ; + + i ) { StringBuilder sb = new StringBuilder ( ) ; for ( int j = 1 ; j < = W ; j + + ) { if ( i % h = = 0 & & j % w = = 0 ) { sb . append ( x ) ; sb . append ( " " ) ; sum + = x ; } else { sb . append ( 10000000 ) ; sb . append ( " " ) ; sum + = 10000000 ; } } sb . deleteCharAt ( sb . length ( ) - 1 ) ; ans [ i - 1 ] = sb . toString ( ) ; } if ( sum < = 0 ) System . out . println ( " No " ) ; else { System . out . println ( " Yes " ) ; for ( int i = 0 ; i < H ; i + + ) { System . out . println ( ans [ i ] ) ; } } return ; } } class main1 { public void Main ( ) { int i = Integer . parseInt ( S ) ; if ( i < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } package test ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = new String ( in . readLine ( ) ) ; int a = Integer . parseInt ( str ) ; System . out . println ( Math . pow ( a , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; if ( a < = 0 ) { a = a * - 1 ; } if ( ( V - W ) * T > = a | | a = = 0 ) { System . out . println ( " YES " ) ; } else ( a < 0 ) { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { if ( ( x - 500 * i - 100 * j ) % 50 = = 0 ) cnt + + ; } } System , out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; for ( int i = 0 ; i < a . length ; i + + ) { x [ i ] = scn . nextInt ( ) ; y [ i ] = scn . nextInt ( ) ; } double nnn = 1 ; for ( int i = 1 ; i < = n ; i + + ) { nnn * = i ; } double way = 0 ; for ( int i = 1 ; i < n ; i + + ) { way + = i ; } double count = nnn * ( n - 1 ) / way ; double ave = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { ave + = ( Math . sqrt ( Math . pow ( Math . abs ( x [ i ] - x [ j ] ) , 2 ) + Math . pow ( Math . abs ( y [ i ] - y [ j ] ) , 2 ) ) ) / nnn ; } } ave * = count ; System . out . println ( ave ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . nio . charset . StandardCharsets ; import java . util . * ; public class Main { int [ ] inputArray ; public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int input = sc . nextInt ( ) ; int n = 1 ; while ( true ) { if ( n > = input ) { n / = 2 ; break ; } n * = 2 ; } S stem.o u t.p r intln ( n ) ; } } import java . util . Scanner ; public class AOJ { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * x * x ) ; } } public class Hello { public static void Main ( ) { string [ ] input = System . Console . ReadLine ( ) . Split ( ' ' ) ; int A = int . Parse ( input [ 0 ] ) ; int B = int . Parse ( input [ 1 ] ) ; int C = int . Parse ( input [ 2 ] ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . Console . WriteLine ( " YES " ) ; } else { System . Console . WriteLine ( " NO " ) ; } } } import java . util . Scanner ; public class MainA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int haikuarray [ ] = new int [ 3 ] ; for ( int i = 0 ; haikuarray . length > i ; i + + ) { haikuarray [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; boolean j = retHaiku ( haikuarray ) ; if ( j = = true ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } public static boolean retHaiku ( int harray [ ] ) { int sevencnt = 0 ; int fivecnt = 0 ; for ( int i = 0 ; harray . length > i ; i + + ) { if ( harray [ i ] = = 7 & & sevencnt = = 0 ) { sevencnt + + ; } else if ( harray [ i ] = = 5 & & fivecnt < 2 ) { fivecnt + + ; } else { return false ; } } return true ; } } package syokora _ p ; import java . util . Scanner ; public class P { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } 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 k ; if ( a > 13 ) { k = b ; } else if ( a < = 6 ) { k = b / 2 ; } else if ( a > 6 ) { k = 0 } System . out . println ( k ) ; } } import java . util . Scanner ; class main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; System . out . println ( x * x * x \ n ) ; } } import java . util . Scanner ; public class Restaurant { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . close ( ) ; int x = ( n - ( n % 15 ) ) / 15 ; int amount = 800 * n - 200 * x ; System . out . println ( amount ) ; } } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( ) ; String str = " " ; str = sc . next ( ) ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; } String [ ] str2 = str . split ( " " ) ; int num1 = Integer . parseInt ( str2 [ 0 ] ) ; int num2 = Integer . parseInt ( str2 [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( String . valueOf ( num2 ) ) ; } else if ( num1 > = 6 ) { System . out . println ( String . valueOf ( num2 / 2 ) ) ; } else { System . out . println ( String . valueOf ( 0 ) ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } boolean [ ] list = new boolean [ N ] ; Arrays . fill ( list , true ) ; for ( int i = 0 ; i < N - 1 ; i + + ) { flg = true ; for ( int j = 1 ; j < N ; j + + ) { if ( P [ j ] > P [ i ] ) { flg = false ; } else { list [ j ] = false ; } } if ( flg ) { list [ i ] = ( true & & list [ i ] ) ; } } System . out . println ( ans ) ; } } import java . awt . Point ; import java . io . IOException ; import java . util . HashMap ; import java . util . Scanner ; import java . util . TreeMap ; public class Solution { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; sc . nextInt ( ) ; int M = sc . nextInt ( ) ; HashMap < Integer , TreeMap < Integer , Integer > > order = new HashMap < > ( ) ; Point [ ] data = new Point [ M ] ; for ( int i = 0 ; i < M ; i + + ) { int pref = sc . nextInt ( ) ; int year = sc . nextInt ( ) ; TreeMap < Integer , Integer > pData = order . get ( pref ) ; if ( pData = = null ) { pData = new TreeMap < Integer , Integer > ( ) ; } pData . put ( year , i ) ; order . put ( pref , pData ) ; data [ i ] = new Point ( pref , year ) ; } for ( int i = 0 ; i < M ; i + + ) { int pref = data [ i ] . x ; int year = data [ i ] . y ; int yRank = 1 ; for ( int j : order . keySet ( ) ) { if ( j = = pref ) { TreeMap < Integer , Integer > pData = order . get ( j ) ; for ( int k : pData . keySet ( ) ) { if ( k = = year ) { break ; } yRank + + ; } break ; } } String result = String . format ( " % 06d " , pref ) + String . format ( " % 06d " , yRank ) ; System . out . println ( result ) ; } sc . close ( ) ; } } public class exe { public static int main ( int i ) { int j = i * i * i ; return j ; } } public class Main { public static void main ( String [ ] args ) { int x = x * x * x System . out . println ( 1 < x < 100 ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader kbd = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int A = kdb . readLine ( ) ; int B = kbd . readLine ( ) ; int C = kbd . readLine ( ) ; int X = kbd . readLine ( ) ; int count = 0 ; int a ; int b ; int c ; int total ; for ( a = 0 ; a < = A ; a + + ) { for ( b = 0 ; b < = B ; b + + ) { for ( c = 0 ; c < = c ; c + + ) { total = 500 * a + 100 * b + 50 * c ; if ( total = = X ) count + + ; } } } System . out . println ( count ) ; } } import java . until . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io ; class Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamreader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( a * a * a ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . io . IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String hoge = input . readLine ( ) ; int x = Integer . parseInt ( hoge ) ; system . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { char arr [ ] = new Scanner ( System . in ) . next ( ) . toCharArray ( ) ; int sum = 0 ; int counter = 0 ; for ( int i = 0 ; i < arr . length ; i + + ) { if ( Integer . parseInt ( String . valueOf ( arr [ i ] ) ) > = 1 & & Integer . parseInt ( String . valueOf ( arr [ i ] ) ) < = 10 ) counter + + ; } if ( counter = = arr . length ) { for ( int i = 0 ; i < arr . length ; i + + ) { sum + = Integer . parseInt ( String . valueOf ( arr [ i ] ) ) ; } if ( sum = = 17 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class atcoder103 _ 1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 3 ] ; int t = 0 ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < 2 ; j + + ) { for ( int i = 0 ; i < 2 - j ; i + + ) { if ( n [ i + 1 ] - n [ i ] < 0 ) { t = n [ i ] ; n [ i ] = n [ i + 1 ] ; n [ i + 1 ] = t ; } } } for ( int i = 0 ; i < 2 ; i + + ) { ans + = n [ i + 1 ] - n [ i ] ; } System . out . println ( ans ) ; } } public class Main { ? ? public static void main ( String [ ] args ) { ? ? int x = new java . util . Scannner ( System . in ) . nextInt ( ) ; ? ? int i = x * x * x ; ? ? System . out . println ( i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int c = 0 ; int ans = 0 ; for ( int a = 0 ; a < = k ; a + + ) { for ( int b = 0 ; b < = k ; b + + ) { c = s - a - b ; if ( z > = 0 & & z < = k ) { ans + + ; } } } System . out . println ( ans ) ; return ; } } import java . util . Scanner ; class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( r , 2 ) ) ; sc . close ( ) ; } } import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = 0 ; if ( a > = 13 ) { ans = b ; } else if ( a > = 6 ) { ans = b / 2 ; } else { } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . prinln ( " x * x * x " ) ; } } import java . util . Scanner ; 2 . 3. public class Main { 4. public static void main ( String [ ] args ) { 5 . Scanner sc = new Scanner ( System . in ) ; 6. int n = sc . nextInt ( ) ; 7. int x = 800 * n ; 8. int y = 200 * ( n / 15 ) ; 9 . System . out . oriintin ( x - y ) ; 10 . } 11 . } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; if ( V > W ) { if ( sp * T > = def ) { System . out . println ( " YES " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class MainC { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double theta = Math . abs ( h * 30 - m * 6 ) ; double c = a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( theta ) ) ; System . out . println ( Math . sqrt ( c ) ) ; sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { int i = 2 ; cul ( i ) ; i = 3 ; cul ( i ) ; } public static void cul ( int x ) { System . out . println ( x * x * x ) ; } } e import java . io . * ; class StillTBD { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String S = br . readLine ( ) ; String [ ] ymd = S . split ( " / " ) ; int [ ] ymd _ num = new int [ ymd . length ] ; int cont = 0 ; for ( String t : ymd ) { ymd _ num [ cont ] = Integer . parseInt ( t ) ; cont = cont + 1 ; } if ( ymd _ num [ 0 ] < = 2018 ) { System . out . println ( " heisei " ) ; } else if ( ymd _ num [ 0 ] = = 2019 & & ymd _ num [ 1 ] < = 4 ) { System . out . println ( " heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . Scanner . * class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; a = sc . NextInt ( ) ; b = sc . NextInt ( ) ; c = sc . NextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long V = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long W = sc . nextLong ( ) ; long T = sc . nextLong ( ) ; boolean catched = false ; long dist = Math . abs ( A - B ) ; long dv = V - W ; if ( dv < = 0 ) { catched = false ; } else if ( dv > = dist / T ) { catched = true ; } if ( catched ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int A = 0 ; int B = 0 ; for ( int i = 0 ; i < X ; i + + ) { for ( int j = j < X ; i + + ) { if ( ( i * i * i * i * i ) - ( j * j * j * j * j ) = = 33 ) { A = i ; B = j ; } } } System . out . println ( A + " " + B ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer \ n ) ; } } } public class XCubic { } public class Main { public static void main ( String [ ] args ) { run ( ) ; } static void run ( ) { int xc = readInput ( ) ; printCubic ( xc ) ; } static int readInput ( ) { Scanner sc = new Scanner ( System . in ) ; return sc . nextInt ( ) ; } static void printCubic ( int x ) { System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextLine ( ) ; int num = x * x * x ; System . out . println ( num ) ; } } import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int K = sc . nextInt ( ) ; System . out . println ( solve ( s , K ) ) ; } public static String solve ( String s , int K ) { char [ ] chars = s . toCharArray ( ) ; int lastIndex = - 1 ; int length = chars . length ; for ( char i = 0 ; i < length ; i + + ) { char c = chars [ i ] ; int count = ( ' z ' - c ) + 1 ; if ( K > = count ) { chars [ i ] = ' a ' ; K - = count ; } else { lastIndex = i ; } if ( K < = 0 ) break ; } if ( K > 0 & & lastIndex > = 0 ) { if ( K > 26 ) K = K % 26 ; char c = ( char ) ( builder . charAt ( lastIndex ) + K ) ; chars [ i ] = c ; } return String . valueOf ( chars ) ; } } public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) : String input = br . readLine ( ) ; int x = Integer . parseInt ( input ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; System . out . println ( p * p * p ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long A = sc . nextLong ( ) ; long V = sc . nextLong ( ) ; long B = sc . nextLong ( ) ; long W = sc . nextLong ( ) ; long T = sc . nextLong ( ) ; long chati = ( V - W ) * T if ( ( B - A ) < chati ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) } } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { List < String > list = new ArrayList < String > ( ) ; while ( scan . hasNext ( ) ) { x1 = scan . nextDouble ( ) ; y1 = scan . nextDouble ( ) ; x2 = scan . nextDouble ( ) ; y2 = scan . nextDouble ( ) ; x3 = scan . nextDouble ( ) ; y3 = scan . nextDouble ( ) ; xp = scan . nextDouble ( ) ; yp = scan . nextDouble ( ) ; double S _ pab = Math . abs ( ( x1 - xp ) * ( y2 - yp ) - ( x2 - xp ) * ( y1 - yp ) ) ; double S _ pac = Math . abs ( ( x1 - xp ) * ( y3 - yp ) - ( x3 - xp ) * ( y1 - yp ) ) ; double S _ pbc = Math . abs ( ( x2 - xp ) * ( y3 - yp ) - ( x3 - xp ) * ( y2 - yp ) ) ; double S _ abc = Math . abs ( ( x3 - x1 ) * ( y2 - y1 ) - ( x2 - x1 ) * ( y3 - y1 ) ) ; if ( S _ abc = = S _ pab + S _ pac + S _ pbc ) { list . add ( " YES " ) ; } else { list . add ( " NO " ) ; } } for ( String s : list ) { System . out . printf ( " % s \ n " , s ) ; } } } public class Multi { public static void main ( String [ ] args ) { double x ; x = xclubic ( 2 ) ; System . out . println ( x ) ; } public static double xclubic ( double x ) { double y ; y = 3 ; return Math . pow ( x , y ) ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; double sum = 0 ; sum = Math . pow ( x , 3 ) ; System . out . println ( sum ) ; } import java . util . * ; import java . lang . * ; class atcoder145a { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int number = input . nextInt ( ) ; int output = number * number ; System . out . println ( output ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sn = new Scanner ( System . in ) ; int x = sn . nextInt ( ) ; if ( x > 0 | | x < 100 ) { System . out . println ( x * x * x ) ; } } } class main { public static void ( String [ ] args ) { ver x = math . pow ( 2 , 3 ) ; System . out . println ( x ) ; } } package accoder ; import java . util . Scanner ; public class test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int input1 = scanner . nextInt ( ) ; int input2 = scanner . nextInt ( ) ; if ( input1 = = input2 ) { System . out . println ( " Draw " ) ; } else if ( input1 = = 1 & & input2 ! = 1 ) { System . out . println ( " Alice " ) ; } else if ( input2 = = 1 & & input1 ! = 1 ) { System . out . println ( " Bob " ) ; } else if ( input1 > input2 ) { System . out . println ( " Alice " ) ; } else if ( input1 < input2 ) { System . out . println ( " Alice " ) ; } scanner . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; import java . util . List ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; long b [ ] = new long [ n ] ; long suma = 0 ; long sumb = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; suma + = a [ i ] ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; sumb + = b [ i ] ; } if ( suma < sumb ) { System . out . println ( - 1 ) ; return ; } int count = 0 ; long husoku = 0 ; int kajo _ count = 0 ; List < Integer > kajo _ list = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] < b [ i ] ) { count + + ; husoku + = b [ i ] - a [ i ] ; } else if ( a [ i ] > b [ i ] ) { kajo _ count + + ; kajo _ list . add ( a [ i ] - b [ i ] ) ; } } if ( count = = 0 ) { System . out . println ( count ) ; return ; } Collections . sort ( kajo _ list , Collections . reverseOrder ( ) ) ; long kajo _ sum = 0 ; for ( int i = 0 ; i < kajo _ list . size ( ) ; i + + ) { kajo _ sum + = kajo _ list . get ( i ) ; count + + ; if ( husoku < = kajo _ sum ) { break ; } } System . out . println ( count ) ; } } } import java . util . Scanner ; public class second { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } ソースコード Copy Copy i port java util.S anne r ; pu b lic cla s Main publ c st t c void main ( S ring ] ar g s ) thr o w Exc e tion { Scanner s new Sc nn r Sys em.in ) ; final i nt A V , B , W T ; A = s c . n e t n ( ; V = sc.n e x t n ( ; B = sc.n e x t n ( ; W = sc.n e x t n ( ; T = sc.n e x t n ( ; s c.close ( ) ; in t diff = ath abs ( B ) ; if ( d i f = = ) { S yste .o t . p rintln ( " YE S " ) ; } el s e if ( M a h.ab ( V - W ) * T > = d f f & - W > & ) { y t m o t . p rintln ( " YE S " ) ; } el s e { S y s t e .out p rintln ( " NO " ) ; } } } import java . utl . Scanner ; public class Main { public static void main ( string [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x ^ 3 System . out . println ( answer ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { int x = new Scanner ( System . in ) . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; public class Main2 { int n ; int max = 1 < < 15 ; void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int [ ] cnt = new int [ max + 1 ] ; for ( int i = 1 ; i * i < = max ; i + + ) { cnt [ i * i ] + + ; for ( int j = i ; j * j + i * i < = max ; j + + ) { cnt [ i * i + j * j ] + + ; for ( int k = j ; k * k + j * j + i * i < = max ; k + + ) { cnt [ i * i + j * j + k * k ] + + ; for ( int l = k ; l * l + k * k + j * j + i * i < = max ; l + + ) { cnt [ i * i + j * j + k * k + l * l ] + + ; } } } } while ( true ) { n = sc . nextInt ( ) ; if ( n = = 0 ) break ; System . out . println ( cnt [ n ] ) ; } } public static void main ( String [ ] args ) { new Main2 ( ) . solve ( ) ; } } public class Hello { public static void Main ( ) { int A = int . Parse ( System . Console . ReadLine ( ) ) ; int B = int . Parse ( System . Console . ReadLine ( ) ) ; int C = int . Parse ( System . Console . ReadLine ( ) ) ; int X = int . Parse ( System . Console . ReadLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = A ; i + + ) { for ( int j = 0 ; j < = B ; j + + ) { for ( int k = 0 ; k < = C ; k + + ) { int ans = X - i * 500 - j * 100 - k * 50 ; if ( ans = = 0 ) count + + ; } } } System . Console . WriteLine ( count ) ; } } import java . util . * ; public class Main { public static void main ( Sting [ ] args ) { Scannner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { static int n ; static int m ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; n = Integer . parseInt ( st . nextToken ( ) ) ; m = Integer . parseInt ( st . nextToken ( ) ) ; boolean [ ] [ ] n _ map = new boolean [ n ] [ n ] ; boolean [ ] [ ] m _ map = new boolean [ m ] [ m ] ; String str ; for ( int i = 0 ; i < n ; i + + ) { str = br . readLine ( ) ; for ( int j = 0 ; j < n ; j + + ) { n _ map [ i ] [ j ] = ( str . charAt ( j ) = = ' # ' ) ; } } for ( int i = 0 ; i < m ; i + + ) { str = br . readLine ( ) ; for ( int j = 0 ; j < m ; j + + ) { m _ map [ i ] [ j ] = ( str . charAt ( j ) = = ' # ' ) ; } } for ( int i = 0 ; i < = n - m ; i + + ) { for ( int j = 0 ; j < = n - m ; j + + ) { if ( check ( n _ map , m _ map , i , j ) ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; } } } System . out . println ( " No " ) ; } static boolean check ( boolean [ ] [ ] a , boolean [ ] [ ] b , int start1 , int start2 ) { for ( int i = 0 ; i < m ; i + + ) { for ( int j = 0 ; j < m ; j + + ) { if ( a [ i + start1 ] [ j + start2 ] ! = b [ i ] [ j ] ) { return false ; } } } System . out . println ( start1 + " " + start2 ) ; return true ; } } public class Main { public static void main ( String [ ] args ) throws IOException { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final int num = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( num * num * num ) ; } } } import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int input = scan . nextInt ( ) ; int ans = input * input * input ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A1 = sc . nextInt ( ) int A2 = sc . nextInt ( ) int A3 = sc . nextInt ( ) ; int mic = Math . abs ( Math . max ( Math . max ( A1 , A2 ) , A3 ) - Math . min ( Math . min ( A1 , A2 ) , A3 ) ) ; System . out . println ( mic ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long a = sc . nextInt ( ) ; Long v = sc . nextInt ( ) ; Long b = sc . nextInt ( ) ; Long w = sc . nextInt ( ) ; Long t = sc . nextInt ( ) ; a = a + ( v * t ) ; b = b + ( w * t ) ; if ( a > = b ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class StillTBD { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String date = scanner . next ( ) ; int year = Integer . parseInt ( date . substring ( 0 , 4 ) ) ; int month = Integer . parseInt ( date . substring ( 5 , 7 ) ) ; int day = Integer . parseInt ( date . substring ( 8 , 10 ) ) ; if ( year < = 2019 & & month < = 04 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class abc145 _ a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ( int ) Math . pow ( sc . nextInt ( ) , 2 ) ) ; } } import java . util . Scanner ; class testIni1 { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int val = scan . nextInt ( ) ; while ( val ! = nul ) { val = val * val * val ; System . out . println ( val ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int y = sc . nextInt ( ) ; int answer = y * y * y ; System . out . println ( answer ) ; } package practice ; import java . util . * ; public class ABC042A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int first = scan . nextInt ( ) ; int second = scan . nextInt ( ) ; int therd = scan . nextInt ( ) ; int FIVE = 0 ; int SEVEN = 0 ; if ( ( first = = 5 | first = = 7 ) & ( second = = 5 | second = = 7 ) & ( therd = = 5 | therd = = 7 ) & ( first + second + therd = = 17 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( problem145a ( r ) ) ; } private static int problem145a ( int r ) { return r * r ; } import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class xorsum4 { static long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; long a [ ] = new long [ 60 ] ; long b [ ] = new long [ 60 ] ; for ( int i = 0 ; i < N ; i + + ) { long val = in . nextLong ( ) ; for ( int j = 0 ; j < 60 ; j + + ) { if ( val % 2 = = 0 ) { a [ j ] + + ; } else { b [ j ] + + ; } val / = 2 ; } } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long t = ( long ) Math . pow ( 2 , i ) % MOD ; t = ( t * a [ i ] ) % MOD ; t = ( t * b [ i ] ) % MOD ; ans = ( ans + t ) % MOD ; } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; double a = ( oub e x double kotae = M at h .pow ( a , 3 ) ; S stem.o t p i ntln ( x + " を 乗した値は " kotae " す " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { int i = ( int ) Math . pow ( Integer . parseInt ( scan . next ( ) ) , 3 ) ; System . out . print ( i ) ; } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int a = 0 , b = 0 ; if ( A = = 5 ) a + + ; else if ( A = = 7 ) b + + ; if ( B = = 5 ) a + + ; else if ( B = = 7 ) b + + ; if ( C = = 5 ) a + + ; else if ( C = = 7 ) b + + ; if ( a = = 2 & & b = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class ITP1 _ 1 _ B { int calc ( int x ) { int y = x * x * x ; return y ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int n ; n = cin . nextInt ( ) ; ArrayList < Integer > x = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { x . add ( cin . nextInt ( ) ) ; } for ( int i = 0 ; i < 101 ; i + + ) { int sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { sum + = ( x . get ( j ) - i ) * ( x . get ( j ) - i ) ; } if ( sum < xSquareMin ) { xSquareMin = sum ; } } System . out . println ( xSquareMin ) ; } } public class Main { public static void main ( String [ ] args ) { double base = 3d ; double exponent = 3d ; double num = Math . pow ( base , exponent ) ; System . out . printf ( num ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String value = br . readLine ( ) ; int inputValue = Integer . valueOf ( value ) ; System . out . println ( inputValue * inputValue * inputValue ) ; } catch ( IOException e ) { } } } import java . util . Scanner ; public class Kadai1 _ 2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < = x ) { if ( x < = 100 ) { System . out . println ( ( x * x ) * x ) ; } } } } import java . util . * ; import java . util . stream . * ; class Main { public static void main ( String [ ] args ) { var scanner = new Scanner ( System . in ) ; var x = scanner . nextLong ( ) ; var amax = ( long ) Math . pow ( x + 0.9 , 0.2 ) ; for ( long a = 1 ; a < = amax ; a + + ) { var b = fact ( x - a * a * a * a * a , 5 ) ; if ( b > = 0 ) { System . out . println ( a + " " + ( - b ) ) ; System . exit ( 0 ) ; } } var bmax = ( long ) Math . pow ( ( x / 5 ) + 0.9 , 0.25 ) ; for ( long b = 0 ; b < = bmax ; b + + ) { var a = fact ( x + b * b * b * b * b , 5 ) ; if ( a > 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } } static int fact ( long x , int p ) { assert x > = 0 ; var f = ( long ) Math . exp ( x + 0.9 , ( double ) p ) ; if ( f * f * f * f * f ! = x ) f = - 1L ; return ( int ) f ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ab = a * b ; int cd = c * d ; if ( ad = cd ) { System . out . println ( ab ) ; } else if ( ad > cd ) { System . out . println ( ab ) ; } else if ( cd > ad ) { System . out . println ( cd ) ; } } } class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferdReader ( new InputStreamReader ( System . in ) ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " + ( x * x * x ) + " ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = System . in . read ( ) ; int a = x * x * x ; System . out . println ( a ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int kekka ; kekka = x * x ; System . out . println ( kekka ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String value = br . readLine ( ) ; int inputValue = Integer . valueOf ( value ) ; System . out . println ( inputValue * inputValue * inputValue ) ; } catch ( IOException e ) { } } } import java . util . Scanner ; import math ; class Main { public static void main ( String [ ] arsg ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = { a , b , c , d , e } ; String ans = " Yay ! " ; for ( int i = 0 ; i < l ; i + + ) { for ( int x = 1 ; x < l - 1 ; x + + ) { if ( math . abs ( l [ i ] - l [ x ] ) > k ) { ans = " : ( " ; break out ; } } } out : System . out . println ( ans ) ; } } class Main { public int x ; public static void main ( String [ ] args ) { x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( " x * x * x " ) ; } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int i = Integer . parseInt ( str ) ; int j = i * i ; System . out . println ( " + j + " ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double x = readDouble ( in ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; public class colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String n = scan . next ( ) ; String [ ] data = n . split ( " , " ) ; System . out . println ( data [ 0 ] + " " + data [ 1 ] ) ; double a = Double . parseDouble ( data [ 0 ] ) ; double b = Double . parseDouble ( data [ 1 ] ) ; double h = Double . parseDouble ( data [ 2 ] ) ; double m = Double . parseDouble ( data [ 3 ] ) ; double tyou = h * 30 ; double tan = m * 6 ; double kaku ; if ( tyou > = 180 ) { tyou = tyou - 180 ; } if ( tan > = 180 ) { tan = tan - 180 ; } if ( tyou > = tan ) { kaku = tyou - tan ; } else { kaku = tan - tyou ; } double cosa = Math . cos ( Math . toRadians ( kaku ) ) ; double an = a * a + b * b - 2 * a * b * cosa ; double ans = Math . sqrt ( an ) ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; int challengeSum ; for ( int k = min ; k < max ; k + + ) { for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( k - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; boolean switch = false ; long amari = 0 long a = 0 , b = 0 , swap = 0 , r = 0 , x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; if ( i = = 0 ) amari = A [ i ] % 2 ; else { if ( A [ i ] % 2 ! = amari ) { switch = true ; break ; } } } long max = A [ 0 ] ; if ( switch = = false ) { for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } } if ( max > M * 2 | | switch = = true ) System . out . println ( 0 ) ; else { long ans = ( M - ( max / 2 ) ) / max + ( long ) 1 ; System . out . println ( ans ) ; } } } import java . util . * ; public class rect { int ar [ ] = new int [ 4 ] ; public void input ( ) { int i ; Scanner read = new Scanner ( System . in ) ; System . out . println ( " enter " ) ; for ( i = 0 ; i < 4 ; i + + ) { ar [ i ] = read . nextInt ( ) ; } } public int recto ( ) { int a = ( ar [ 0 ] * ar [ 1 ] ) ; int b = ( ar [ 2 ] * ar [ 3 ] ) ; if ( a > b ) return a ; else if ( a < b ) return b ; else return a ; } public static void main ( String [ ] args ) { rect obj = new rect ( ) ; obj . input ( ) ; obj . recto ( ) ; } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int distance [ ] = new int [ 10 ] ; distance [ 0 ] = b - a ; distance [ 1 ] = c - a ; distance [ 2 ] = d - a ; distance [ 3 ] = e - a ; distance [ 4 ] = c - b ; distance [ 5 ] = d - b ; distance [ 6 ] = e - b ; distance [ 7 ] = d - c ; distance [ 8 ] = e - c ; distance [ 9 ] = e - d ; int flag = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( k < distance [ i ] ) { flag = 0 ; break ; } } if ( flag = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = s . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main { String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } } public class B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; double pow = Math . pow ( num , 3 ) ; int answer = ( int ) pow ; System . out . println ( answer ) ; } } import numpy as np A = int ( input ( ) ) B = int ( input ( ) ) C = int ( input ( ) ) D = int ( input ( ) ) E = int ( input ( ) ) X = np . asarray ( [ A , B , C , D , E ] ) X _ div = X % 10 X _ sort = np . sort ( X _ div ) min = 0 for i in range ( 5 ) : if X _ sort [ i ] ! = 0 : min = X _ sort [ i ] break if min = = 0 : min = 10 X = 10 * ( ( X - 1 ) sum = 0 for i in range ( 5 ) : sum + = X [ i ] print ( sum - 10 + min ) import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( String . valueOf ( i + 1 ) , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } map . entrySet ( ) . stream ( ) . sorted ( java . util . Map . Entry . comparingByValue ( ) ) ; for ( String key : map . keySet ( ) ) { for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int X = Math . abs ( B - A ) ; int sp = V - W ; int Z = sp * T - X ; int z = sp * ( T - 1 ) - X ; if ( Z = = 0 | | z = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } public class StillTBD { public static void main ( String [ ] args ) { String s ; String k = " 2019 / 04 / 30 " ; Scanner input = new Scanner ( System . in ) ; s = input . nextLine ( ) ; if ( s = = null ? k = = null : s . equals ( k ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } class Util { public static int count ( int [ ] S , int N ) { if ( N = = 0 ) { return 1 ; } if ( N < 0 ) { return 0 ; } int res = 0 ; for ( int i = 0 ; i < S . length ; i + + ) { res + = count ( S , N - S [ i ] ) ; } return res ; } public static void main ( String [ ] args ) { int [ ] S = { 1 , 2 , 3 } ; int N = 4 ; System . out . println ( " Total number of ways to get desired change is " + count ( S , N ) ) ; } } import java . util . * ; import java . text . * ; class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { char [ ] cs = sc . nextLine ( ) . toCharArray ( ) ; if ( n = = 0 ) break ; int s = 0 ; for ( int i = 0 ; i < sc . length ; i + + ) { s + = cs [ i ] - ' 0' ; } System . out . println ( s ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Map < Integer , Integer > seen = new HashMap < > ( ) ; for ( int ix = 0 ; ix < 3 ; ix + + ) { int value = scanner . nextInt ( ) ; seen . put ( value , seen . getOrDefault ( value , 0 ) + 1 ) ; } bool result = seen . containsKey ( 5 ) & & seen . containsKey ( 7 ) & & seen . get ( 5 ) = = 2 & & seen . get ( 7 ) = = 1 ; System . out . println ( result ? " YES " : " NO " ) ; } } import java . util * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = ( a + b ) / 2 ; if ( ( ( float ) a + ( float ) b ) / 2 - c < 0.5 ) { System . out . println ( c ) ; } else { System . out . println ( c + 1 ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( x * x * x ) } } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; ] String str [ 2 ] = str . split ( " " ) ; int num1 = Integer . parseInt ( str [ 0 ] ) ; int num2 = integer . parseInt ( str [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( num2 ) ; else if ( num1 > = 6 ) { System . out . println ( num2 / 2 ) ; else { System . out . println ( 0 ) ; } } } } import java . io . * ; public class Power { public static void main ( String args [ ] ) { int x = 0 ; do { System . out . println ( " Form your number : " ) ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; } catch ( Exception e ) { x = 0 ; } } while ( x < 0 | | 100 < x ) ; System . out . println ( " The number powed by 3 is ? ? ? " ) ; System . out . println ( " ? ? ? " + Math . pow ( x , 3 ) + " ? ? ? " ) ; } } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; } String [ 2 ] str = str . split ( " " ) ; int num1 = Integer . parseInt ( str [ 0 ] ) ; int num2 = integer . parseInt ( str [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( num2 ) ; else if ( num1 > = 6 ) { System . out . println ( num2 / 2 ) ; else { System . out . println ( 0 ) ; } } } public class Main { public static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { System . out . println ( ( int ) Math . pow ( input ( ) , 3 ) ) ; close ( ) ; } public static int input ( ) { return scanner . nextInt ( ) ; } public static void close ( ) { if ( scanner ! = null ) { scanner . close ( ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class A _ OneCardPoker { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a = = 1 ) { a = a + 13 ; } if ( b = = 1 ) { b = b + 13 ; } if ( a = = b ) { System . out . println ( " Draw " ) ; } else if ( a > b ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } # include < iostream > # include < algorithm > # include < string > # include < math . h > # define rep ( i , n ) for ( int i = 0 ; i < n ; i + + ) using namespace std ; int main ( ) { int a , b ; cin > > a > > b ; cout < < ( a % b = = 0 ? a / b : a / b + 1 ) < < endl ; return 0 ; } class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( num * num * num ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b + c ! = 17 ) { System . out . println ( " NO " ) ; } else { if ( ( a = = 5 | | a = = 7 ) & & ( b = = 5 | | b = = 7 ) ) { System . out . println ( " YES " ) ; } } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class HinaArare { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String output = " Tree " ; int num = sc . nextInt ( ) ; String [ ] color = new String [ num ] ; for ( int i = 0 ; i < num ; i + + ) { color [ i ] = sc . next ( ) ; } sc . close ( ) ; for ( int i = 0 ; i < num ; i + + ) { if ( color [ i ] . equals ( " Y " ) ) { output = " Four " ; break ; } } System . out . println ( output ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] permutations = new int [ n + 1 ] ; int min = n ; int [ ] mins = new int [ n + 1 ] ; for ( int i = 1 ; i < = n ; i + + ) { permutations [ i ] = sc . nextInt ( ) ; if ( i = = 1 ) { min = permutation [ 1 ] ; } min = Math . min ( min , permutations [ i ] ) ; mins [ i ] = min ; } int ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( permutations [ i ] = = mins [ i ] ) { ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; class Test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < 13 & & a > = 6 ) b / = 2 ; else if ( a < 6 ) b = 0 ; System . out . println ( b ) ; } } import java . util . Scanner ; public class ABC166D { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = Integer . parseInt ( sc . next ( ) ) ; for ( int i = - 118 ; i < = 199 ; i + + ) { for ( int j = - 119 ; j < = 118 ; j + + ) { if ( X = = Math . pow ( i , 5 ) - Math . pow ( j , 5 ) ) { System . out . println ( i + " " + j ) ; return ; } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = scan . nextInt ( ) ; long frac [ ] = new long [ 100020 ] ; int a = 1000000007 ; if ( Math . abs ( x - y ) > 1 ) { System . out . println ( ' 0' ) ; return ; } frac [ 0 ] = 1 ; for ( int i = 1 ; i < = 100000 ; i + + ) frac [ i ] = frac [ i - 1 ] * i % a ; long ans = frac [ x ] * frac [ y ] % a ; if ( x = = y ) ans = ans * 2 % a ; System . out . println ( ans ) ; return ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = in . readLine ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . util . * ; public class BC91 _ A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b ) > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } int r ; float s1 ; float s2 ; s1 = 1 ^ 2 * 3.14 ; s2 = r ^ 2 * 3.14 ; println = ( s2 / s1 ) ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int a [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ N - 1 ] - a [ 0 ] ) ; } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int i = Integer . parseInt ( str ) ; int j = i * i ; System . out . println ( " " + j ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int kekka = x * x ; System . out . println ( kekka ) ; } } class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } public class Main { static int N , M ; static int [ ] [ ] arr ; static boolean [ ] visited ; static int count ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; arr = new int [ N + 1 ] [ 100 ] ; visited = new boolean [ N + 1 ] ; int [ ] orginal = new int [ M ] ; Map < Integer , String > result = new LinkedHashMap < Integer , String > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; orginal [ i ] = y ; arr [ x ] [ y ] = 1 ; } for ( int i = 1 ; i < = N ; i + + ) { visited [ i ] = true ; count = 1 ; for ( int j = 1 ; j < 100 ; j + + ) { if ( arr [ i ] [ j ] = = 1 ) { String xiaquid = String . format ( " % 06d " , Integer . valueOf ( i ) ) ; String cityorder = String . format ( " % 06d " , Integer . valueOf ( count ) ) ; String cityid = xiaquid + cityorder ; result . put ( j , cityid ) ; count + + ; } } } for ( int i = 0 ; i < M ; i + + ) { System . out . println ( result . get ( orginal [ i ] ) ) ; } } } import java . io . * ; import java . util . * ; public class ACBeg42 { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( in . readLine ( ) ) ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int x = Integer . parseInt ( st . nextToken ( ) ) ; if ( x = = 5 ) fiveCount + + ; if ( x = = 7 ) sevenCount + + ; } if ( fiveCount = = 2 & & sevenCount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; double a = ( double ) x ; double kotae = Math . pow ( a , 3 ) ; System . out . println ( kotae ) ; } } import java . util . * ; public class Xcubic { public static void main ( String [ ] args ) { Scanner Sc = new Scanner ( System . in ) ; int x = Sc . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } mport java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; sc . close ( ) ; int min = Math . min ( Math . min ( a1 , a2 ) , a3 ) ; int max = Math . max ( Math . max ( a1 , a2 ) , a3 ) ; System . out . println ( max - min ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = ( V - W ) * T ; int b = B - A ; if ( ( V - W ) * T > = B - A ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; a = sc . NextInt ( ) ; b = sc . NextInt ( ) ; c = sc . NextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; int count = sc . nextInt ( ) ; char [ ] ca = s . toCharArray ( ) ; char [ ] ca _ n = new char [ ca . length ] ; for ( int i = 0 ; i < ca _ n . length ; i + + ) { ca _ n [ i ] = ( char ) ( ca [ i ] - 96 ) ; } if ( ca _ n . length = = 1 ) { ca _ n [ 0 ] = ( char ) ( ( ca _ n [ 0 ] + count ) % 26 ) ; if ( ca _ n [ 0 ] = = 0 ) { ca _ n [ 0 ] = 26 ; } } else { for ( int i = 0 ; i < ca _ n . length ; i + + ) { if ( ca _ n [ i ] = = 1 ) { continue ; } else if ( i = = ( ca _ n . length - 1 ) & & count > 0 ) { ca _ n [ i ] = ( char ) ( ( ca _ n [ i ] + count ) % 26 ) ; if ( ca _ n [ i ] = = 0 ) { ca _ n [ i ] = 26 ; } } else { if ( count > 0 & & 27 - ca _ n [ i ] < = count ) { count - = ( 27 - ca _ n [ i ] ) ; ca _ n [ i ] = 1 ; } } } } for ( int i = 0 ; i < ca _ n . length ; i + + ) { ca _ n [ i ] + = 96 ; } String s1 = new String ( ca _ n ) ; System . out . print ( s1 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; line = br . readLine ( ) ; int num = Integer . parseInt ( line ) ; int ans = num * 3 ; System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( string args [ ] ) { int coinVal ; int coinVal2 ; int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } } } import java . util . * ; class B { public static void main ( String [ ] args ) throws Exception { String T ; try ( Scanner scanner = new Scanner ( System . in ) ) { T = scanner . next ( ) ; } catch ( Exception e ) { throw e ; } class State { int index ; char currentChar ; State previousState ; int count ; } int score = 0 ; State result = new State ( ) { { index = - 1 ; currentChar = 0 ; previousState = null ; count = 0 ; } } ; final ArrayDeque < State > states = new ArrayDeque < > ( ) ; states . push ( result ) ; while ( ! states . isEmpty ( ) ) { final State state = states . pop ( ) ; if ( state . index + 1 > = T . length ( ) ) continue ; char [ ] charCandidates ; if ( T . charAt ( state . index + 1 ) = = ' ? ' ) { charCandidates = new char [ ] { ' P ' , ' D ' } ; } else { charCandidates = new char [ ] { T . charAt ( state . index + 1 ) } ; } for ( char c : charCandidates ) { State newState = new State ( ) { { index = state . index + 1 ; currentChar = c ; previousState = state ; count = state . count ; if ( c = = ' D ' ) { count + + ; } if ( index > = 1 & & state . currentChar = = ' P ' & & c = = ' D ' ) { count + + ; } } } ; if ( newState . count > = score & & newState . index = = T . length ( ) - 1 ) { result = newState ; score = newState . count ; } states . push ( newState ) ; } } State current = result ; List < Character > characters = new ArrayList < > ( ) ; while ( current . previousState ! = null ) { characters . add ( current . currentChar ) ; current = current . previousState ; } for ( int i = characters . size ( ) - 1 ; i > = 0 ; i -- ) { System . out . write ( characters . get ( i ) ) ; } System . out . println ( ) ; } } import java . util . * ; class Main { public static void main ( String s [ ] ) { Scanner sc = new Scanner ( System . in ) ; int arr [ ] = new int [ 3 ] ; int arr [ 0 ] = sc . nextInt ( ) ; int arr [ 1 ] = sc . nextInt ( ) ; int arr [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; System . out . println ( arr [ 0 ] + arr [ 1 ] ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( system . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; system . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( 9 ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) e . printStackTrace ( ) ; } } } } public class Main { public static void main ( String [ ] args ) { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { final int num = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( num * num * num ) ; } } } main ( c , d ) for ( ; scanf ( " % d % d " , & c , & d ) + 1 ; ) printf ( " % d \ n " , c + d ) ; import java . util . * public class Main { public static void main ( String [ ] args ) { int a ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { int searchNumber = P [ i ] ; boolean hantei = true ; for ( j = 0 ; j < i ; j + + ) { if ( searchNumber > P [ j ] ) hantei = false ; break ; } if ( hantei = = true ) count + + ; } System . out . println ( count ) ; } } public class Xcubic { public static void main ( String [ ] args ) { int X = 2 ; System . out . println ( X * X * X ) ; int Y = 3 ; System . out . println ( Y * Y * Y ) ; } } public class Main { public static void main ( String [ ] args ) { int result = 0 ; System . out . println ( " Enter Number : " ) ; Scanner stdin = new Scanner ( System . in ) ; int number = stdin . nextInt ( ) ; if ( number > = 1 | | number < = 100 ) { result = number * number * number ; System . out . println ( result ) ; } else { System . out . println ( " Please enter 1 to 100 " ) ; } } } import java . io . * public class Main { public static void main ( String args [ ] ) { System . out . println ( " 数字を入力してください " ) ; BufferedReader rea d e r = new Buffered eader ( e In utStreamReader ( Sys em.in ) ) ; String l i ne = r e ad e r . eadLin ( ) ; n x = I n teger.pa r a s Int l n ) ; int a ns = x * x * x ; S ste .ou . r n l n a n ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int sum = 0 ; int count = 0 ; for ( int i = 0 ; i < = A ; i + + ) { sum = 500 * i ; if ( sum = = X ) { count + + ; } else if ( sum < X ) { for ( int j = 0 ; j < = B ; j + + ) { int sum2 = sum ; sum2 = sum2 + ( 100 * j ) ; if ( sum2 = = X ) { count + + ; } else if ( sum2 < X ) { for ( int h = 0 ; h < = C ; h + + ) { int sum3 = sum2 ; sum3 = sum3 + ( 50 * h ) ; if ( sum3 = = X ) { count + + ; } } } } } } System . out . println ( count ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int age = scan . nextInt ( ) ; int price = scan . nextInt ( ) ; int payment = 0 ; if ( price % 2 = = 0 ) { if ( age > = 13 ) { payment = price ; } else if ( age > = 12 | | age < = 6 ) { payment = price / 2 ; } else if ( age < = 5 ) { payment = 0 ; } System . out . println ( payment ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int index = new Integer ( scan . nextLine ( ) ) ; String [ ] scanLine = scan . nextLine ( ) . split ( " " ) ; int range = 0 ; for ( int i = 0 ; i < scanLine . lengh ( ) ; i + + ) { range + = ( index - new Integer ( scanLine [ i ] ) ) * ( index - new Integer ( scanLine [ i ] ) ) ; } System . out . println ( range ) ; } } import java . util . Scanner ; class ABC145 _ A { public static final double PI = 3.14159 ; public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int r = stdIn . nextInt ( ) ; final double one = 1 * 1 * PI ; final double s = r * r * PI ; System . out . println ( ( int ) ( s / one ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cardA = Integer . parseInt ( sc . next ( ) ) ; int CardB = Integer . parseInt ( sc . next ( ) ) ; String s ; if ( CardA > CardB ) { s = " Alice " ; } else if ( CardB > CardA ) { s = " Bob " ; } else { s = " Draw " ; } System . out . println ( s ) ; sc . close ( ) ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( Math . Pow ( x , 3 ) ) ; } } import java . util . * ; class Circle { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int result = ( int ) ( Math . pow ( r , 2 ) ) ; System . out . println ( result ) ; } } public class ITP1 _ 1 _ B { public static void main [ String [ ] args ] { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; ans = x * x * x ; 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 ( ) ; if ( N = = 1 ) { System . out . println ( 1 ) ; } else if ( N = = 2 ) { int T = sc . nextInt ( ) ; if ( T = = 1 ) { System . out . println ( 1 ) ; } else { System . out . println ( 2 ) ; } ; } else { int M [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { M [ i ] = sc . nextInt ( ) ; if ( ( M [ i ] = = 2 ) | | ( M [ i ] = = 1 ) ) { break ; } } for ( int r = 0 ; r < i ; r + + ) { if ( M [ r ] = = 2 ) { s = r ; } else { s = s ; } } int l = s ; for ( int q = 0 ; q < s ; q + + ) { if ( M [ q ] = = 2 ) { l = q ; } else { l = l ; } } int x = 0 ; int L = M [ 0 ] ; for ( int j = 0 ; j < l ; j + + ) { for ( int k = 1 ; k < = j ; k + + ) { L = Math . min ( L , M [ k ] ) ; } if ( L = = M [ j ] ) { x = x + 1 ; } else { x = x ; } ; } if ( v = = s ) { if ( s = = l ) { System . out . println ( x + 1 ) ; } else { System . out . println ( x + 2 ) ; } } else if ( s = = l ) { System . out . println ( x + 2 ) ; } else { System . out . println ( x + 3 ) ; } } } } import java . util . Scanner ; public class abc145 _ a { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; final int n = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( n * n ) ; sc . close ( ) ; } } public class maple { public static void main ( String [ ] args ) { int x = 6 ; if ( x > = 1 | | x < = 100 ) System . out . print ( x * x * x ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = Integer . parseInt ( sc . next ( ) ) ; int cityNum = Integer . parseInt ( sc . next ( ) ) ; Map < String , List < Integer > > map = new HashMap < String , List < Integer > > ( ) ; String [ ] [ ] array = new String [ cityNum ] [ 2 ] ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( String . valueOf ( i + 1 ) , new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { array [ i ] [ 0 ] = sc . next ( ) ; array [ i ] [ 1 ] = sc . next ( ) ; map . get ( array [ i ] [ 0 ] ) . add ( Integer . parseInt ( array [ i ] [ 1 ] ) ) ; } for ( String key : map . keySet ( ) ) { Collections . sort ( map . get ( key ) ) ; for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { for ( int j = 0 ; j < array . length ; j + + ) { if ( array [ j ] [ 0 ] . equals ( key ) & & Integer . parseInt ( array [ j ] [ 1 ] ) = = ( map . get ( key ) . get ( i ) ) ) { StringBuilder sb = new StringBuilder ( ) ; while ( key . length ( ) < 6 ) { sb . append ( " 0 " ) ; } sb . append ( key ) ; while ( ( map . get ( key ) . get ( i ) ) . size < 6 ) { sb . append ( " 0 " ) ; } array [ j ] [ 0 ] = sb . append ( map . get ( key ) . get ( i ) ) . toString ( ) ; } } } } for ( String [ ] ary2 : array ) { System . out . println ( ary2 [ 0 ] ) ; } } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date date1 = null ; Date date2 = null ; try { date1 = sdf . parse ( S ) ; date2 = sdf . parse ( " 2019 / 04 / 30 " ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } if ( date1 . before ( date2 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . printlin ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; solve ( N ) ; } public void solve ( int N ) { for ( int i = - 120 ; i < 120 ; i + + ) { for ( int j = - 120 ; j < 120 ; j + + ) { long ans = i * i * i * i * i - j * j * j * j * j ; if ( ans = = N ) { System . out . println ( i + " " + j ) ; return ; } } } return ; } } import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; class xorsum4 { static long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; long a [ ] = new long [ 60 ] ; long b [ ] = new long [ 60 ] ; for ( int i = 0 ; i < N ; i + + ) { long val = in . nextLong ( ) ; for ( int j = 0 ; j < 60 ; j + + ) { if ( val % 2 = = 0 ) { a [ j ] + + ; } else { b [ j ] + + ; } val / = 2 ; } } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long t = ( long ) Math . pow ( 2 , i ) % MOD ; t = ( t * a [ i ] ) % MOD ; t = ( t * b [ i ] ) % MOD ; ans = ( ans + t ) % MOD ; } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = sc . nextLong ( ) ; for ( int a = - 120 ; a < 120 ; a + + ) { for ( int b = - 120 ; b < 120 ; b + + ) { if ( gojyou ( a ) - gojyou ( b ) = = X ) { System . out . println ( a + " " + b ) ; return ; } } } System . out . println ( fa + " " + fb ) ; } static long gojyou ( int a ) { long a2 = ( long ) a ; return Math . pow ( a2 , 5l ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x ) ; } } public class main { public static void main ( int x ) { System . out . println ( x * x * x ) ; } } import java . util . * ; public class a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > 12 ) { a = 0 ; } if ( b > 12 ) { b = 0 ; } if ( a > b ) { System . out . println ( " Alice " ) ; } else { if ( b > a ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } System . out . println ( ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class Main { public static void swap ( long a [ ] , int b , int e , int t ) { for ( int i = 0 ; i < e - b ; i + + ) { long tmp = a [ b + i ] ; a [ b + i ] = a [ k + i ] ; a [ k + i ] = tmp ; } } public static void main ( Stirng [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; swap ( a , b , e , t ) ; } for ( int i = 0 ; i < n - 1 ; i + + ) System . out . print ( a [ i ] + " " ) ; System . out . println ( a [ n - 1 ] ) ; } } class Main { public static void main ( String [ ] args ) BufferedReader reader = new BufferdReader ( new InputStreamReader ( System . in ) ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " + ( x * x * x ) + " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int Min ; int Max ; for ( int i = 1 ; i < N ; i + + ) { if ( Min > a ) Min = a ; if ( Max < a ) Max = a ; System . out . println ( Max - Min ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA ; String [ ] imgB ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x * ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int base = sc . nextInt ( ) ; long cube = ( long ) base * base * base ; System . out . println ( cube ) ; sc . close ( ) ; } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String s = input . readLine ( ) ; int x = Interger . parseInt ( s ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } catch ( IOExceptin e ) { } } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; int i = x ^ 3 ; System . out . println ( i ) ; } } class Main { public static void main ( String args [ ] ) { Scanner str = new Scanner ( System . in ) ; int num = str . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . util . * ; public class AOJ1000 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; System . out . println ( a + b ) ; } } } import java . io . * ; import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . read ( ) ) ; int b = Integer . parseInt ( br . read ( ) ) ; int c = Integer . parseInt ( br . read ( ) ) ; int d = Integer . parseInt ( br . read ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int N = Integer . parseInt ( str ) ; str = scan . next ( ) ; int L = Integer . parseInt ( str ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { String input = scan . next ( ) ; list . add ( input ) ; } Collections . sort ( list ) ; String ans ; for ( int i = 0 ; i < 3 ; i + + ) { String input = list . get ( i ) ; ans = ans + input ; } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . InputMismatchException ; public class main { public static void main ( String args [ ] ) { int distance [ ] = new int [ 5 ] ; int limit = 0 ; try { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < distance . length ; i + + ) { distance [ i ] = scanner . nextInt ( ) ; } limit = scanner . nextInt ( ) ; scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( e ) ; } for ( int i = distance . length - 1 ; i > = 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) { if ( distance [ i ] - distance [ j ] > limit ) { System . out . println ( " : ( " ) ; System . exit ( 1 ) ; } } } System . out . println ( " Yay ! " ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; import java . math . * ; public class a { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double c = sc . nextInt ( ) ; double d = sc . nextInt ( ) ; double e = Math . toRadians ( 90 ) ; e = Math . cos ( e ) ; System . out . printf ( " % .19f " , Math . sqrt ( a * a + b * b - a * b * 2 * e ) ) ; } } } import java . io . * ; public class X { public static void main ( String [ ] args ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? . " ) ; tring tr r. r eadLine ( ) ; nt = nteger. p arseInt ( s tr ) ; ystem. o ut. p rintln ( x * x * x ) ; import java . util . Scanner ; public static Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c , d ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = ( a + b ) / 2 ; d = ( a + b ) % 2 ; if ( d = = 0 ) { System . out . println ( c ) ; } else { System . out . println ( c + 0.5 ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " x * x * x " ) ; } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] = N [ 4 ] ; N [ 0 ] = sc nextInt ( ) ; N [ 1 ] = sc nextInt ( ) ; N [ 2 ] = sc nextInt ( ) ; N [ 3 ] = sc nextInt ( ) ; Arrays . sort ( N [ ] ) ; if ( N [ 0 ] = = 1 ) { if ( N [ 1 ] = = 4 ) { if ( N [ 2 ] = = 7 ) { if ( N [ 3 ] = = 9 ) { System . println ( " YES " ) ; } } } } else { System . println ( " NO " ) ; } } } import java . io * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; public class Reconciled { private final static int MOD = 1 _ 000 _ 000 _ 000 + 7 ; private final static BigDecimal B _ MOD = BigDecimal . valueOf ( MOD ) ; public static void main ( String ... args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] vals = reader . readLine ( ) . split ( " " ) ; final int N = Integer . parseInt ( vals [ 0 ] ) ; final int M = Integer . parseInt ( vals [ 1 ] ) ; if ( Math . abs ( N - M ) > 1 ) { System . out . print ( 0 ) ; return ; } BigDecimal result ; if ( N = = M ) { result = BigDecimal . valueOf ( 2 ) . multiply ( getPermutation ( N ) ) . multiply ( getPermutation ( N ) ) ; } else { result = getPermutation ( N ) . multiply ( getPermutation ( M ) ) ; } System . out . print ( result . remainder ( B _ MOD ) ) ; } private static BigDecimal getPermutation ( final int n ) { BigDecimal result = BigDecimal . ONE ; for ( int i = 1 ; i < = n ; i + + ) { result = result . multiply ( BigDecimal . valueOf ( i ) ) ; if ( result . compareTo ( B _ MOD ) = = 1 ) result = result . remainder ( B _ MOD ) ; } return result ; } } class Main { BufferReader br = new BufferReader ; int x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int x [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scanner . nextInt ( ) ; } System . out . println ( stamina ( x ) ) ; } private static int stamina ( int [ ] x ) { int count = Arrays . stream ( x ) . sum ( ) ; int p = count / x . length ; if ( count % x . length = = 0 ) { return Arrays . stream ( x ) . map ( i - > ( i - p ) * ( i - p ) ) . sum ( ) ; } else { return IntStream . of ( p , p + 1 ) . map ( t - > Arrays . stream ( x ) . map ( i - > ( i - t ) * ( i - t ) ) . sum ( ) ) . min ( ) . getAsInt ( ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( ( x * x * x ) ) ; } } hewjhqrke import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] menu = new int [ 5 ] ; for ( int i = 0 ; i < menu . length ; i + + ) { menu [ i ] = sc . nextInt ( ) ; } int max = 0 ; int flag = 0 ; for ( int i = 0 ; i < menu . length ; i + + ) { int tmp = Math . ceil ( ( double ) menu [ i ] / 10 ) * 10 ; if ( max < tmp - menu [ i ] ) { flag = i ; max = tmp - menu [ i ] ; } } for ( int i = 0 ; i < menu . length ; i + + ) { if ( i = = flag ) continue ; time + = Math . ceil ( ( double ) menu [ i ] / 10 ) * 10 ; } time + = menu [ flag ] ; System . out . println ( time ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { while ( scanner . hasNext ( ) ) { String [ ] s = scanner . nextLine ( ) . split ( " , " ) ; Student student = new Student ( s [ 0 ] , Double . parseDouble ( s [ 1 ] ) , Double . parseDouble ( s [ 2 ] ) ) ; if ( student . bmi . isDebu ( ) ) { System . out . println ( student . studentId ) ; } } } } } class Student { final String studentId ; final Bmi bmi ; Student ( String studentId , double ? ? ? ? ? ? kg , double ? ? ? ? ? ? m ) { this . studentId = studentId ; this . bmi = new BmiImpl ( ? ? ? ? ? ? kg , ? ? ? ? ? ? m ) ; } } interface Bmi { int debu = 25 ; boolean isDebu ( ) ; } class BmiImpl implements Bmi { private final double ? ? ? ? ? ? kg ; private final double ? ? ? ? ? ? m ; BmiImpl ( double ? ? ? ? ? ? kg , double ? ? ? ? ? ? m ) { this . ? ? ? ? ? ? kg = ? ? ? ? ? ? kg ; this . ? ? ? ? ? ? m = ? ? ? ? ? ? m ; } public double calc ( ) { return ? ? ? ? ? ? kg / Math . pow ( ? ? ? ? ? ? m , 2 ) ; } @ Override public boolean isDebu ( ) { return calc ( ) > = debu ; } } import java . util . Scanner ; public class Kadai1 _ 2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < x ) { if ( x < 100 ) { System . out . println ( ( x * x ) * x ) ; } } } } import java . util . * ; class ABC091A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , C = 0 ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; if ( A + B > = C ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . math . BigDecimal ; import java . math . MathContext ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; BigDecimal x [ ] , y [ ] ; x = new BigDecimal [ N ] ; y = new BigDecimal [ N ] ; for ( int i = 0 ; i < N ; i + + ) { int x1 , y1 ; x1 = sc . nextInt ( ) ; y1 = sc . nextInt ( ) ; x [ i ] = new BigDecimal ( x1 ) ; y [ i ] = new BigDecimal ( y1 ) ; } int c = 2 ; for ( int i = 2 ; i < = N ; i + + ) { c * = i ; } c = c / N ; int C = 1 ; for ( int i = 2 ; i < = N ; i + + ) { C * = i ; } BigDecimal sum = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { BigDecimal x1 = x [ i ] . add ( x [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; BigDecimal y1 = y [ i ] . add ( y [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; x1 = x1 . multiply ( x1 ) ; y1 = y1 . multiply ( y1 ) ; x1 = x1 . add ( y1 ) ; x1 = x1 . sqrt ( MathContext . DECIMAL64 ) ; sum = sum . add ( x1 ) ; } } sum = sum . multiply ( new BigDecimal ( c ) ) ; sum = sum . divide ( new BigDecimal ( C ) , 10 , BigDecimal . ROUND _ HALF _ UP ) ; System . out . println ( sum . toPlainString ( ) ) ; } } import java . lang . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = std . nextInt ( ) ; System . out . println ( math . pow ( n , 3 ) ) ; } } import java . io . * ; class Xcube { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readline ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } a = int ( input ( ) ) b = int ( input ( ) ) c = int ( input ( ) ) d = int ( input ( ) ) e = int ( input ( ) ) k = int ( input ( ) ) if ( e - a < = k ) : print ( " Yay ! " ) else : print ( " : ( " ) import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . UnsupportedEncodingException ; public class Sample { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; System . out . println ( " Enter a number between 1 and 100 " ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; int cube = 0 ; if ( n > = 1 & & n < = 100 ) cube = n * n * n ; System . out . println ( cube ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int x , tot ; Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; tot = x * 3 ; System . out . Println ( tot ) ; System . out . Println ( ) ; } } import java . utl . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; int result = x - y ; System . out . println ( result ) ; } } public static void main ( String [ ] args ) { double x ; x = xclubic ( 2 ) ; System . out . println ( x ) ; } public static double xclubic ( double x ) { double y ; y = 3 ; return Math . pow ( x , y ) ; } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; System . out . println ( a + b > = c ? " Yes " : " No " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Sample { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num1 = Integer . parseInt ( str ) ; double num2 = Math . pow ( num1 , 2 ) ; int num3 = ( int ) num2 ; System . out . println ( num3 ) ; } } function Main ( input ) { input = new Date ( input ) . getTime ( ) ; var check = new Date ( " 2019 / 04 / 30 " ) . getTime ( ) ; console . log ( ( input < = check ) ? " Heisei " : " TBD " ) ; } Main ( require ( " fs " ) . readFileSync ( " / dev / stdin " , " utf8 " ) ) ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; System . out . println ( pow ( n , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { ; try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = br . readLine ( ) ; int N = Integer . valueOf ( s ) ; if ( N < 1 | | N > 100 ) System . exit ( 0 ) ; int max = 0 ; int maxNum = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int num = calc ( i ) ; if ( maxNum < num ) { max = i ; maxNum = num ; } } System . out . println ( max ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } protected static int calc ( int N ) { int i = 0 ; while ( N % 2 = = 0 ) { N = N / 2 ; i + + ; } return i ; } import java . util . Scanner ; public class abc091a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b > = c ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Study2 { p blic s atic v id m in ( S t ring [ ] a gs ) { S anner s = n w S anner ( S y stem.i n ) ; i t r = s .n e xtInt ( ) ; i t a swer = r r ; S stem.o u t.p r intln ( a n swer ) ; S stem.o u t.p r intln ( ) ; } } import java . util . * ; import java . util . stream . * ; class Main { public static void main ( String [ ] args ) { var scanner = new Scanner ( System . in ) ; var x = scanner . nextInt ( ) ; var amax = 120 ; for ( int a = 1 ; a < = amax ; a + + ) { var b5 = a * a * a * a * a - x ; if ( b5 < 0 ) { var b = - fact5 ( - b5 ) ; if ( b < 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } else { var b = fact5 ( b5 ) ; if ( b > = 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } } static int fact5 ( int x ) { assert x > = 0 ; var r = ( int ) Math . pow ( x + 0.9 , 0.2 ) ; if ( x ! = r * r * r * r * r ) r = - 1 ; return r ; } } public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int number = stdin . nextInt ( ) ; if ( number > = 1 & & number < = 100 ) { int result = number * number * number ; System . out . println ( result ) ; } } } import java . util . Scanner ; public class Pangkat { public static void main ( String [ ] args ) { int a = 0 , b = 3 ; double c = 0 ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } import java . util . Scanner ; public class Pangkat { public static void main ( String [ ] args ) { int a = 0 , b = 3 , c ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } public class Main { public static void main ( String [ ] args ) { int y = x * x ; y = y * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { run ( ) ; } public static void run ( ) { int xc = readInput ( ) ; printCubic ( xc ) ; } public static int readInput ( ) { Scanner sc = new Scanner ( System . in ) ; return sc . nextInt ( ) ; } public static void printCubic ( int x ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { XCubic . run ( ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cntdif = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList < int > bigger = new ArrayList < int > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( int dif = A [ j ] - B [ j ] < 0 ) { difsum + = dif ; cnt + + ; } else if ( dif > 0 ) { bigger . add ( dif ) ; } } int big [ ] = bigger . toArray ( new int [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < big . length ; k + + ) { for ( int l = 0 ; l < big . length - k - 1 ; l + + ) { if ( big [ l ] > big [ l + 1 ] ) { temp = big [ l ] ; big [ l ] = big [ l + 1 ] ; big [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = big [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String [ ] data = new String [ 2 ] ; data [ 0 ] = " 2019 / 04 / 30 " ; data [ 1 ] = sc . nextLine ( ) ; Arrays . sore ( data ) ; if ( data [ 1 ] . equals ( " 2019 / 04 / 30 " ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = ( new Scanner ( System . in ) ) . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class main { public static void main ( Strings arg [ ] ) { int i = 3 ; System . out . println ( i * i * i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int index = 0 ; while ( index < s . length ( ) ) { System . out . println ( c ) ; if ( c = = ' d ' ) { if ( index + 5 > s . length ( ) ) { break ; } if ( index + 7 < s . length ( ) & & ( s . charAt ( index + 7 ) ! = ' a ' ) | | index + 7 = = s . length ( ) ) { if ( s . substring ( index , index + 7 ) . equals ( " dreamer " ) ) { index + = 7 ; } else { if ( s . substring ( index , index + 5 ) . equals ( " dream " ) ) { index + = 5 ; } else { break ; } } } else { if ( s . substring ( index , index + 5 ) . equals ( " dream " ) ) { index + = 5 ; } else { break ; } } } else if ( c = = ' e ' ) { if ( index + 5 > s . length ( ) ) { break ; } if ( index + 5 = = s . length ( ) | | s . charAt ( index + 5 ) ! = ' r ' ) { if ( s . substring ( index , index + 5 ) . equals ( " erase " ) ) { index + = 5 ; } else { break ; } } else { if ( s . substring ( index , index + 6 ) . equals ( " eraser " ) ) { index + = 6 ; } else { break ; } } } else { break ; } } System . out . println ( index = = s . length ( ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . NextInt ( ) ; int b = sc . NextInt ( ) ; int c = sc . NextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = Scanner ( System . in ) ; int x ; x = in . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class aa { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) , sum , min = Integer . MAX _ VALUE ; int A [ ] = new int [ a ] ; for ( int i = 0 ; i < a ; i + + ) A [ i ] = in . nextInt ( ) ; for ( int j = 0 ; j < 101 ; j + + ) { sum = 0 ; for ( int i = 0 ; i < a ; i + + ) { sum + = ( A [ i ] - j ) * ( A [ i ] - j ) ; } min = Math . min ( sum , min ) ; } System . out . println ( min ) ; } } class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int n = a . nextInt ( ) ; int ans = n * n * n System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder data = new StringBuilder ( ) ; while ( true ) { int sum = 0 ; String str = br . readLine ( ) ; int strsize = str . length ( ) ; if ( str . equals ( " 0 " ) ) break ; else if ( strsize > = 1 ) { int i = 0 ; while ( i < strsize ) { sum + = Integer . parseInt ( String . valueOf ( str . charAt ( i ) ) ) ; i + + ; } } data . append ( sum ) . append ( " \ n " ) ; } System . out . println ( data ) ; } import java . text . DateFormat ; import java . text . ParseException ; import java . util . Date ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; Date date1 = DateFormat . getDateInstance ( ) . parse ( a ) ; Date date2 = DateFormat . getDateInstance ( ) . parse ( " 2019 / 4 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff = < 0 ) { System . out . println ( " Heisei " ) ; } else if ( diff > 0 ) { System . out . println ( " TBD " ) ; } catch ( ParseException e ) { System . out . println ( e ) ; } } } class Main { public static void main ( x ) { System . out . println ( x ^ 3 ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; System . out . println ( pow ( n , 3 ) ) ; } } import java . util . Scanner ; public class Aim { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int x = 0 ; int y = 0 ; int z = 0 ; int countS = 0 ; int countK = 0 ; countS = ( s + 2 ) * ( s + 1 ) / 2 ; for ( x = k ; x < = s ; x + + ) { for ( y = k ; y < = s ; y + + ) { for ( z = k ; z < = s ; z + + ) { if ( x + y = = s - z ) { countK + + ; } } } } int show = countS ; if ( s = = 3 * k ) { show = 1 ; } System . out . println ( show ) ; } } import java . util . Scanner ; public class MyClass { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; double n = scanner . nextDouble ( ) ; int result = ( int ) Math . pow ( n , 3d ) ; System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA [ N ] ; String [ ] imgB [ M ] ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void swap ( long a [ ] , int b , int e , int t ) { for ( int i = 0 ; i < e - b ; i + + ) { long tmp = a [ b + i ] ; a [ b + i ] = a [ k + i ] ; a [ k + i ] = tmp ; } } public static void main ( Stirng [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; swap ( a , b , e , t ) ; } for ( int i = 0 ; i < n - 1 ; i + + ) System . out . print ( a [ i ] + " " ) ; System . out . println ( a [ n - 1 ] ) ; } } import java . util . Scanner ; public class StillTBD { public static void main ( String [ ] args ) { String s ; String k = " 2019 / 04 / 30 " ; Scanner input = new Scanner ( System . in ) ; s = input . nextLine ( ) ; if ( s = = null ? k = = null : s . equals ( k ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . * ; public class AGC004B { public static void main ( String [ ] args ) throws IOException { MyScanner sc = new MyScanner ( System . in ) ; int n ; long x ; n = sc . nextInt ( ) ; x = sc . nextLong ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; long [ ] b = a . clone ( ) ; long ans = Long . MAX _ VALUE ; for ( int k = 0 ; k < n ; k + + ) { long acc = 0 ; long xk = ( ( long ) x ) * k ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = Math . min ( b [ i ] , a [ ( i - k + n ) % n ] ) ; acc + = b [ i ] ; } ans = Math . min ( ans , acc + xk ) ; } System . out . println ( ans ) ; } static class MyScanner { BufferedReader br ; StringTokenizer st ; public MyScanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; } public String nextLine ( ) throws IOException { return br . readLine ( ) ; } public String next ( ) throws IOException { while ( st = = null | | ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public double nextDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } public boolean ready ( ) throws IOException { return br . ready ( ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; int x = Integer . parseInt ( s ) ; x = x * x * x ; System . out . println ( x ) ; } } inport java . until . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; long t [ ] = new long [ n ] ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { t [ i ] = scanner . nextInt ( ) ; a [ i ] = scanner . nextInt ( ) ; } for ( int i = 1 ; i < n ; i + + ) { long p = Math . max ( brd _ t / t [ i ] , brd _ a / a [ i ] ) ; t [ i ] * = p ; a [ i ] * = p ; } System . out . println ( t [ n - 1 ] + a [ n - 1 ] ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { long a = sc . nextLong ( ) ; int v = sc . nextInt ( ) ; long b = sc . nextLong ( ) ; int w = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; for ( int cnt = 0 ; cnt < t ; cnt + + ) { a + = v ; b + = w ; if ( a = = b ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } class Main { public void main ( string [ ] args ) { Scanner in = new Scanner ( System . in ) ; String x = in . next ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ; class at1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; for ( int i = 1 ; i < = 2 ; i + + ) { int diff = a [ i ] - a [ i - 1 ] ; sum = sum + diff ; } System . out . println ( sum ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextInt ( ) ; String b = sc . nextInt ( ) ; if ( a = = b ) { System . out . println ( " Draw " ) ; } else if ( a % 13 > b % 13 ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { XCubic . run ( ) ; } public class XCubic { static void run ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } } import java . util . Scanner ; public class taskA { public void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int A = r . nextInt ( ) ; int B = r . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } else if ( A > = 6 & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } catch IOException } } import java . util . * ; import javax . swing . * ; import java . text . * ; public class test { public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; s = s . replace ( " eraser " , " " ) ; s = s . replace ( " erase " , " " ) ; s = s . replace ( " dreamer " , " " ) ; s = s . replace ( " dream " , " " ) ; if ( s . length ( ) = = 0 ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } } import java . io . * public class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . * ; public class prob _ C { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double theta _ a = 30 * ( H + M / 60 ) ; double theta _ b = 360 * ( M / 60 ) ; double theta _ ab = Math . abs ( theta _ a - theta _ b ) ; double C = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( theta _ ab / 180 * Math . PI ) ) ; System . out . println ( C ) ; } } import java . util . Scanner ; public class Solution { private static Scanner input = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int balls = input . nextInt ( ) ; int people = input . nextInt ( ) ; if ( people = = 1 ) { System . out . println ( 0 ) ; } else { System . out . println ( balls - people ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( " x " ) ; } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = 3 ; System . out . println ( " " + Math . pow ( a , b ) + " " ) ; scan . close ( ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A = = B ) { System . out . println ( " Draw " ) ; } else if ( ( A = = 1 & & B ! = 1 ) | | ( A > B ) ) { System . out . println ( " Alice " ) ; } else if ( ( A ! = 1 & & B = = 1 ) | | ( A < B ) ) { System . out . println ( " Bob " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int rem = N - k ; System . out . println ( rem ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } } } int main ( int r ) { int value = r * r ; return value ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; int a ; int b ; int x ; int cnt = 0 ; int Z ; for ( a = 0 ; a < = K ; x + + ) { if ( S - x < K ) Z = S - x ; for ( b = 0 ; b < = Z ; b + + ) { if ( S - a - b < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int k = scan . next ( ) ; System . out . println ( k * k * k ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String [ ] line = sc . nextLine ( ) . split ( " " ) ; int x = Integer . parseInt ( line [ 0 ] ) ; } System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int result = 0 ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { result = x * x * x ; System . out . println ( result ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; system . out . println ( x * x * x ) ; } catch ( Exception e ) { } import java . util . * ; public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; str = str . replace ( " eraser " , " " ) ; str = str . replace ( " erase " , " " ) ; str = str . replace ( " dreamer " , " " ) ; str = str . replace ( " dream " , " " ) ; if ( str . equals ( " " ) ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String S = sc . next ( ) ; if ( N % 2 = = 1 ) { System . out . println ( " No " ) ; return ; } if ( S . substring ( 0 , N / 2 ) . equals ( S . substring ( N / 2 , N ) ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int sum = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int x = s - ( x + y ) ; if ( ( x < = k ) & & ( x > = 0 ) ) { sum + + ; } } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( 3 ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int i = ( int ) Math . pow ( Integer . parseInt ( scan . next ( ) ) , 3 ) ; System . out . print ( i ) ; } } import java . io . * ; class Main { public void main ( String [ ] args ) throws IOException { int x ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; x = I teger.p a rseInt ( b uf ) ; S y s em.out . pri n tln ( x ) ; } } import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; class stillTBD { public static void main ( String args [ ] ) { try { Date boundaryDate = ConvertDateFromString ( " 2019 / 04 / 30 " ) ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; int result = ConvertDateFromString ( input ) . compareTo ( boundaryDate ) ; if ( ( result = = - 1 ) | | ( result = = 0 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } scanner . close ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static Date ConvertDateFromString ( String dateStr ) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date formatDate = sdf . parse ( dateStr ) ; System . out . println ( formatDate ) ; return formatDate ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) , W = sc . nextInt ( ) , h = sc . nextInt ( ) , w = sc . nextInt ( ) ; if ( H % h = = 0 & & W % w = = 0 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; for ( int i = 0 ; i < H ; + + i ) { for ( int j = 0 ; j < W ; + + j ) { System . out . print ( i % h = = h - 1 & & j % w = = w - 1 ? - 4000 * h * w + 3999 : 4000 ) ; System . out . print ( ' ' ) ; } System . out . println ( ) ; } } } } import java . util . Scanner ; public class void Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int result = 1 ; for ( int i = 1 ; i < = N ; i * = 2 ) { result = i ; } System . out . println ( result ) ; } } public class Main { public static void main ( String [ ] args ) { int a = 0 ; try ( Scanner scanner = new Scanner ( System . in ) ) { a = scanner . nextInt ( ) ; } if ( a < 100 | | a > 0 ) { a = a * a * a ; System . out . println ( a ) ; } } } public class Main { public static void main ( String [ ] args ) { int a ; Scanner scanner = new Scanner ( System . in ) ; a = scanner . nextInt ( ) ; System . out . println ( a * a * a ) ; } } package aoj ; import java . util . Scanner ; public class JOI2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x > 0 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( num * num ) ; } import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } Main kari = new Main ( ) ; if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = kari . setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; Iterator < Integer > it = setwise2 . iterator ( ) ; List < Integer > setList = new ArrayList < > ( ) ; while ( it . hasNext ( ) ) { setList . add ( it . next ( ) ) ; } for ( int i = 0 ; i < setList . size ( ) ; i + + ) { for ( int j = i ; j < setList . size ( ) ; j + + ) { setwise2 . add ( gcd ( setList . get ( i ) , setList . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwise2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise2 ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; int ans = aaa + bbb + ccc + ddd + eee - 10 + min ; System . out . println ( ans ) ; } } public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int flg = 0 ; for ( int j = 0 ; j < i ; j + + ) { if ( P [ i ] > P [ j ] ) { flg = 1 ; } } if ( flg = = 0 ) { count = count + 1 ; } } System . out . println ( count ) ; } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] * args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . format ( " % d " , n % k ) ; } } import java . util . * ; class Five _ Antennas { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Integer [ ] antennas = new Integer [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antennas [ i ] = scan . nextInt ( ) ; } Arrays . sort ( antennas , Collections . reverseOrder ( ) ) ; int k = scan . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i ; j < 5 ; j + + ) { if ( antennas [ i ] - antennas [ j ] > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } public class Main { public static cul int ( int x ) { if ( 1 < = x & & x < = 100 ) { x = x * * 3 ; } } public static void main ( String [ ] args ) { cul ( x ) ; Sytem . out . println ( x ) ; } } import java . lang . * ; import java . io . * ; class ruhani { public static void main ( String [ ] args ) throws IOException { int A , B ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedRedaer br = new BufferedReader ( isr ) ; System . out . print ( " enter your age " ) ; A = Integer . parseInt ( br . readLine ( ) ) ; System . out . print ( " enter the cost b which is an even no " ) ; B = Integer . parseInt ( br . readLine ( ) ) ; if ( A < = 5 ) System . out . println ( " free of cost " ) ; if ( A > = 13 ) System . out . println ( " Your cost is " + B ) if ( A > = 6 & & A < = 12 ) System . out . println ( " Your cost is " + B / 2 ) } } import java . util . Scanner ; import java . util . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] K = new int [ ] ; int L = 100 ; int R = 0 ; int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { K [ i ] = sc . nextInt ( ) ; L = Math . min ( L , K [ i ] ) ; R = Math . max ( R , K [ i ] ) ; } for ( int i = L ; i < = R ; i + + ) { int tmp = 0 ; for ( int i = 0 ; i < N ; i + + ) { tmp + = ( K [ i ] - i ) * ( K [ i ] - i ) ; } ans = Math . min ( ans , tmp ) ; } System . out . print ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 | | A = = 5 & & B = 7 & & C = = 5 | | A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { Sytem . out . println ( " 入出力エラーです " ) ; } } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class ITP1 _ 1 _ B { public static void main ( String args [ ] ) { String line = " " ; try { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( ( line = bufferedReader . readLine ( ) ) ! = null ) { double volume = Math . pow ( ( double ) Integer . parseInt ( line ) , 3d ) ; System . out . println ( ( int ) volume ) ; } } catch ( IOException e ) { } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextLine ( ) ; int b = sc . nextLine ( ) ; int c = sc . nextLine ( ) ; int d = sc . nextLine ( ) ; int e = a * b ; int f = c * d ; if ( e > = f ) { System . out . println ( e ) ; } else { System . out . println ( f ) ; } } } import java . util . Scanner ; public class A { public static void Main ( String [ ] args ) { short coina ; short coinb ; short toyc ; Scanner sc = new Scanner ( System . in ) ; System . out . println ( " Coin A Coin B Toy 's price " ) ; coina = sc . nextShort ( ) ; coinb = sc . nextShort ( ) ; toyc = sc . nextShort ( ) ; if ( coina + coinb < toyc | | coina < 0 | | coinb < 0 ) { System . out . println ( " no " ) ; } else { System . out . println ( " yes " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { c ( ) ; } private void c ( ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] candies = new int [ n ] ; int res = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { candies [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n - k + 1 ; i + + ) { int left = Math . abs ( candies [ i ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int right = Math . abs ( candies [ i + k - 1 ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int tmp = Math . min ( left , right ) ; res = Math . min ( res , tmp ) ; } System . out . println ( res ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { c ( ) ; } private void c ( ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] candies = new int [ n ] ; int res = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { candies [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n - k + 1 ; i + + ) { int left = Math . abs ( candies [ i ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int right = Math . abs ( candies [ i + k - 1 ] ) + ( candies [ i + k - 1 ] - candies [ i ] ) ; int tmp = Math . min ( left , right ) ; res = Math . min ( res , tmp ) ; } System . out . println ( res ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } public class XCubic { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; Integer n = Integer . parseInt ( s ) ; System . out . println ( n * n * n ) ; } } import java . util . * ; public class A _ 052 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) , C = sc . nextInt ( ) , D = sc . nextInt ( ) ; int s , n ; s = A * B ; n = C * D ; if ( s > n ) { System . out . println ( s ) ; } else if ( n > s ) { System . out . println ( n ) ; } else { System . out . println ( A * B ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = S - x + y ; if ( z < = 0 & & z < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . io . * ; class ITP1 _ 1 _ B { public static void main ( String [ ] args ) throws IOException { DataInputStream d = new DataInputStream ( System . in ) ; String s = d . readLine ( ) ; int i = Integer . parseInt ( s ) ; System . out . println ( i * i * i ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 9 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = N [ i ] ; break ; } } System . out . println ( sum - 10 * count + min ) ; } } import java . util . * ; public class AtCoder04a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int AB , CD ; AB = A * B ; CD = C * D ; if ( AB > CD ) { System . out . print ( AB ) ; } else if ( AB < CD ) { System . out . print ( CD ) ; } else { System . out . print ( AB ) ; } } } public class Main { public static void main ( string args [ ] ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = in . readLine ( ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int acoin = sc . nextInt ( ) ; int bcoin = sc . nextInt ( ) ; int ccoin = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = acoin ; i + + ) { if ( i * 500 > N ) { break ; } if ( i * 500 = = N ) { count + + ; break ; } for ( int j = 0 ; j < = bcoin ; j + + ) { if ( i * 500 + j * 100 > N ) { break ; } if ( i * 500 + j * 100 = = N ) { count + + ; break ; } for ( int k = 0 ; k < = ccoin ; k + + ) { if ( i * 500 + j * 100 + k * 50 > N ) { break ; } if ( i * 500 + j * 100 + k * 50 = = N ) { count + + ; break ; } } } } System . outprintln ( count ) ; } } XCubic < ? php $ input = trim ( fgets ( STDIN ) ) ; $ ans = pow ( $ input , 3 ) ; echo $ ans ; ? > package aoj . exam ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main02 { public static void main ( String [ ] args ) { System . out . print ( " Input > > " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x ; try { x = Integer . parseInt ( reader . readLine ( ) ) ; if ( ! ( x > = 1 & & x < = 100 ) ) { throw new IllegalArgumentException ( " Please input between 1 and 100 ! " ) ; } System . out . println ( " Output > > " + ( x * x * x ) ) ; } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } public class Main { public static void main ( String args [ ] ) { int r = read ( ) ; System . out . println ( r * r ) ; } private static int read ( ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { return Integer . valueOf ( reader . readLine ( ) . trim ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; return - 1 ; } } } public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; return ; } import java . util . * ; class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = Integer . parseInt ( sc . next ( ) ) ; if ( n = = 5 ) five + + ; else if ( n = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class one { public static void main ( String [ ] args ) { int a , b , h , m ; double result ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] temp = reader . readLine ( ) . split ( " " ) ; a = Integer . parseInt ( temp [ 0 ] ) ; b = Integer . parseInt ( temp [ 1 ] ) ; h = Integer . parseInt ( temp [ 2 ] ) ; m = Integer . parseInt ( temp [ 3 ] ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } double angle = 0 ; angle = m / 60.0 * 2 * Math . PI - H / 12.0 * 2 * Math . PI ; if ( angle > = Math . PI ) { angle = 2 * Math . PI - angle ; } result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle ) ) ; System . out . println ( result ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( Integer . parseInt ( Math . pow ( x , 3 ) ) ) ; } } import java . util . * ; public class Study _ Scheduling { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int H1 = input . nextInt ( ) ; int M1 = input . nextInt ( ) ; int H2 = input . nextInt ( ) ; int M2 = input . nextInt ( ) ; int K = input . nextInt ( ) ; int remainder = 0 ; int minutes = 0 ; int hours = 0 ; if ( M2 < M1 ) { remainder = 1 ; minutes = ( M2 + 60 ) - M1 ; } else if ( M1 < M2 ) { minutes = M2 - M1 ; } hours = H2 - remainder - H1 ; int totalMinutes = ( hours * 60 ) + minutes ; System . out . println ( totalMinutes - K ) ; } } import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import java . util . concurrent . * ; import java . util . regex . * ; public class at1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int sum = 0 ; for ( int i = 1 ; i < = 2 ; i + + ) { int diff = a [ i ] - a [ i - 1 ] ; sum = sum + diff ; } System . out . println ( sum ) ; } } import java . util . Scanner ; public class ABC068 _ B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int i = 0 ; for ( i = 1 ; i < = n ; i = i * 2 ) { } i = i / 2 ; System . out . println ( i ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int array [ ] = new int [ 3 ] ; array [ 0 ] = a ; array [ 1 ] = b ; array [ 2 ] = c ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( array [ i ] = = 5 ) five + + ; else if ( array [ i ] = = 7 ) seven + + ; } if ( five = = 2 & & seven = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; int array [ ] = new int [ 3 ] ; array [ 0 ] = a ; array [ 1 ] = b ; array [ 2 ] = c ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( array [ i ] = = 5 ) five + + ; else if ( array [ i ] = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) { int x = System . in ; void cubic ( int x ) { result = x ^ 3 ; System . out . println ( result ) ; } } } class Main { public static void main ( String args [ ] ) { int i = ( int ) Math . pow ( Integer . parseInt ( scan . next ( ) ) , 3 ) ; System . out . print ( i ) ; } } class Main { public static void main ( String [ ] args ) { x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; class abc89b { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; int n = cin . nextInt ( ) ; boolean flag [ ] = new boolean [ 1000 ] ; for ( int i = 0 ; i < 1000 ; i + + ) flag [ i ] = false ; for ( int i = 0 ; i < n ; i + + ) { String ch = cin . next ( ) ; flag [ ch . charAt ( 0 ) ] = true ; } int ans = 0 ; for ( int i = 0 ; i < 1000 ; i + + ) if ( flag [ i ] ) ans + + ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main190526 _ 2 { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; try { int age = scanner . nextInt ( ) ; int adultPrice = scanner . nextInt ( ) ; int finalPrice = - 1 ; if ( age < 5 ) finalPrice = 0 ; else if ( age < 12 ) finalPrice = adultPrice / 2 ; else finalPrice = adultPrice ; System . out . println ( finalPrice ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; } finally { scanner . close ( ) ; } } } import java . util . * ; import java . lang . * ; import java . io . * ; class pow { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; int kotae = ath p w x , 3 ) ; S y stem.out . pr i ntln ( x + " を 3 乗 し 値は " kotae " す " ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int k ; List < Integer > spot = new ArrayList < > ( ) ; Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i + + ) { spot . add ( scanner . nextInt ( ) ) ; } k = scanner . nextInt ( ) ; List < Integer > tmpSpot = new ArrayList < > ( spot ) ; for ( int i = 0 ; i < 5 ; i + + ) { tmpSpot . remove ( i ) ; for ( int l : tmpSpot ) { if ( ( l - spot . get ( i ) ) > k ) { System . out . println ( " : ( " ) ; return ; } } } scanner . close ( ) ; System . out . println ( " Yay ! " ) ; } import java . util . * ; class main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; System . out . println ( N * N ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class x3 { public static void main ( String arg [ ] ) throws IOException { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; double x = Integer . parseInt ( buf ) ; x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } import java . util . Scanner ; String tbd = " TBD " ; String heisei = " Heisei " ; Scanner inputDate = new Scanner ( System . in ) ; String [ ] splitDate = inputDate . split ( " / " , 0 ) ; int year = Integer . parseInt ( splitDate [ 0 ] ) ; int month = Integer . parseInt ( splitDate [ 1 ] ) ; int day = Integer . parseInt ( splitDate [ 2 ] ) ; if ( year < = 2018 ) return heisei ; else if ( year = = 2019 & & month < = 4 ) return heisei ; else return tbd ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextLine ( ) ; while ( true ) { if ( a . equals ( " 0 " ) ) break ; int sum = 0 ; for ( int = 1 ; i < a . lenght ( ) ; i + + ) { sum + = Character . getNumericValue ( a . charAt ( i ) ) } System . out . println ( sum ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) ; Scanner sc = new Scanner ( System . in ) ; int x = nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; ArrayList < String > array = new ArrayList < String > ( ) ; Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String s = scanner . nextString ( ) ; if ( String . valueOf ( s ) . length ( ) = = 0 ) { break ; } array . add ( s ) ; } int sz = array . size ( ) ; int n = 0 ; boolean i = false ; for ( n = 0 ; n < sz ; n + + ) { if ( " Y " = = array . get ( n ) ) i = true ; } if ( i ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; x = args [ 0 ] ; System . out . println ( " 入力した値の3乗は " + x * x * x + " です " ) ; } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( int ) Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class intro2 { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } public class TwoCoins ( ) { public static void main ( string args [ ] ) { private int coinVal ; private int coinVal2 ; private int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } import java . util . Scanner ; public class Main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str ; while ( sc . hasNext ( ) ) { str = sc . next ( ) ; } String [ ] str2 ; str2 = new String [ 2 ] ; str2 = str . split ( " " ) ; int num1 = Integer . parseInt ( str2 [ 0 ] ) ; int num2 = integer . parseInt ( str2 [ 1 ] ) ; if ( num1 > = 13 ) { System . out . println ( num2 ) ; else if ( num1 > = 6 ) { System . out . println ( num2 / 2 ) ; else { System . out . println ( 0 ) ; } } } import java . io . * ; public class Power { public static void main ( String args [ ] ) { int x = 0 ; do { System . out . println ( " 0 ? ? ? 100 ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : " ) ; I n p tStreamReader isr = n w Inp tStreamReader ( Sys t em.in ) ; B u f eredReader br n w Buf eredReader ( isr ) ; t r y St r ng buf = b . ea d Line ( ) ; x = I t ger.par s eInt ( buf ) ; } c a c h ( Exc e ption e ) { x = 0 } h l e ( x < 0 | | 1 0 0 < x ) ; S y s em.out . pri n tln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y s t m.out. p rin t ln ( " ? ? ? " + Ma t h pow ( x , 3 ) + " ? ? ? ? ? § ? ? ? " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Squared { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; System . out . println ( " 値を入力してください ( このプログラムは値を3乗するものです ) 。 " ) ; int x = Integer.parseInt ( br.readLine ( ) ) ; System.out. p r i tln x x x ) ; } } import java . io . * ; import java . util . * ; public class OneCardPoker extends Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; if ( A = = B ) { System . out . println ( " Draw " ) ; } else if ( A = = 1 ) { System . out . println ( " Alice " ) ; } else if ( B = = 1 ) { System . out . println ( " Bob " ) ; } else if ( A > B ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } mport java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int n1 = stdin . nextInt ( ) ; int n2 = stdin . nextInt ( ) ; int [ ] [ ] input = new int [ n1 + 1 ] [ n2 + 1 ] ; for ( int i = 0 ; i < n1 ; i + + ) { for ( int j = 0 ; j < n2 ; j + + ) { input [ n1 ] [ n2 ] = stdin . nextInt ( ) ; } } stdin . close ( ) ; int dis = 0 ; double tmp = 0 ; int output = 0 ; for ( int i = 0 ; i < n1 ; i + + ) { for ( int j = 0 ; j < n2 ; j + + ) { for ( int k = 1 ; k < n1 ; k + + ) { tmp = tmp + Math . pow ( input [ i ] [ j ] - input [ i + k ] [ j ] , 2 ) ; } } dis = ( int ) Math . pow ( Math . sqrt ( tmp ) , 2 ) ; if ( dis = = tmp ) { output + + ; } } System . out . println ( output ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . printIn ( ans ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; } catch ( Exception e ) { } System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int v = Integer . parseInt ( line ) ; int v2 = v ; v2 * = v * v ; System . out . println ( v2 ) ; } } import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; public class B { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( sc . next ( ) ) ; } System . out . println ( set . size ( ) ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int y ; y = x * x * x ; System . out . println ( y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int mindex = 0 ; int sum = 0 ; int [ ] alist = { a , b , c , d , e } ; int slist [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { if ( alist [ mindex ] % 10 = = 0 | | alist [ mindex ] % 10 > alist [ i ] % 10 & & alist [ i ] % 10 ! = 0 ) { mindex = i ; } } for ( int i = 0 ; i < 5 ; i + + ) { if ( i = mindex | | alist [ i ] % 10 = = 0 ) { sum + = alist [ i ] ; } else { sum + = alist [ i ] / 10 * 10 + 10 ; } } System . out . println ( sum ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public static void Main ( String [ ] args ) { short coina ; short coinb ; short toyc ; Scanner sc = new Scanner ( System . in ) ; System . out . println ( " Coin A Coin B Toy 's price " ) ; coina = sc . nextShort ( ) ; coinb = sc . nextShort ( ) ; toyc = sc . nextShort ( ) ; if ( coina + coinb < toyc | | coina < 0 | | coinb < 0 ) { System . out . println ( " no " ) ; } else { System . out . println ( " yes " ) ; } } import java . utli . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n < = 2 ) { System . out . println ( 2 ) ; } else if ( 2 < n & & n < = 4 ) { System . out . println ( 4 ) ; } else if ( 2 < n & & n < = 8 ) { System . out . println ( 8 ) ; } else if ( 2 < n & & n < = 16 ) { System . out . println ( 16 ) ; } else if ( 2 < n & & n < = 32 ) { System . out . println ( 32 ) ; } else { System . out . println ( 64 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] p = new int [ ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int ans = 0 ; boolean flag = true ; for ( int i = 0 ; i < n ; i + + ) { int tmp = p [ i ] ; for ( int j = 0 ; j < i ; j + + ) { if ( tmp > p [ j ] ) { flag = false ; break ; } } if ( flag ) ans + + ; } System . out . println ( ans ) ; } } package ABC ; import java . util . Scanner ; public class ABC055A { public static void main ( ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; System . out . println ( ( N * 800 ) - ( N / 15 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } String ans ; for ( int i = 0 ; i < 2 ; i + + ) { if ( ( ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] ) = = ( c [ 1 ] [ i ] - c [ 1 ] [ i + 1 ] ) ) & & ( ( c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] ) = = ( c [ 2 ] [ i ] - c [ 2 ] [ i + 1 ] ) ) ) { ans = " Yes " ; } else { ans = " No " ; } } System . out . println ( ans ) ; } } import java . io . * ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { int x , x _ 3 ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; x _ 3 = x * x * x ; System . out . println ( " x ^ 3 = " + x _ 3 ) ; } } package AtCoderBegineerContest087 ; import java . util . Scanner ; public class Main087A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = 6000 ; int maxA = 30 ; int maxB = 40 ; int maxC = 50 ; int count = 0 ; for ( int numA = 0 ; numA < = maxA ; numA + + ) { for ( int numB = 0 ; numB < = maxB ; numB + + ) { int numC = ( x - 500 * numA - 100 * numB ) / 50 ; if ( maxC > = numC & & numC > = 0 ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class A103 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] li = new int [ 3 ] ; li [ 0 ] = sc . nextInt ( ) ; li [ 1 ] = sc . nextInt ( ) ; li [ 2 ] = sc . nextInt ( ) ; Arrays . sort ( li ) ; int i = ( li [ 2 ] - li [ 1 ] ) + ( li [ 1 ] - li [ 0 ] ) ; System . out . println ( i ) ; } } import lib . Input ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . paseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . * ; public class Xcube { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readline ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . util . Scanner ; import java . lang . math ; class Main { public static void main ( String [ ] arsg ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] l = { a , b , c , d , e } ; String ans = " Yay ! " ; for ( int i = 0 ; i < l ; i + + ) { for ( int x = 1 ; x < l - 1 ; x + + ) { if ( math . abs ( l [ i ] - l [ x ] ) > k ) { ans = " : ( " ; break out ; } } } out : System . out . println ( ans ) ; } } import java . util . * ; public class example { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; } else { long m = 12 / N + 1 ; int n = 1 ; int mlcm = 1 ; for ( int i = 0 ; i < m ; i + + ) n * = 10 ; for ( int i = 1 ; i < n + 1 ; i + + ) { if ( P % ( Math . pow ( i , N ) ) = = 0 ) { mlcm = i ; } } System . out . println ( mlcm ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; List < Integer > sums = new ArrayList ( ) ; for ( ; ; ) { String num = scan . nextLine ( ) ; if ( num . equals ( " 0 " ) ) { break ; } int sum = 0 ; for ( int i = 0 ; i < num . length ( ) ; i + + ) { char n = num . charAt ( i ) ; sum + = Character . getNumericValue ( n ) ; } sums . add ( sum ) ; } for ( int m : sums ) { System . out . println ( m ) ; } } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( a = = b ) { if ( a = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } else if ( a = = c ) { if ( a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } else if ( b = = c ) { if ( b = = 5 & & a = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } class Main { public static void main ( String [ ] args ) { int r = ( int ) new Scanner ( System . in ) . nextLine ( ) ; int r2 = r * r ; System . out . println ( r2 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; System . out . println ( floor ( average ( x , y ) ) ) ; } private float average ( int x , int y ) { return ( x + y ) / 2 ; } private int floor ( float z ) { return Math . floor ( z ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int sum = 0 ; sum = x * x * x ; System . out . println ( sum ) ; } } public class Main ( ) { public integer cube ( int x ) { return x * x * x ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int p = scanner . next ( ) ; System . out . println ( cube ( p ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int ans = a + b + c + d + e ; int A = 10 - a % 10 ; if ( A = = 10 ) { A = = 0 ; } int B = 10 - b % 10 ; if ( B = = 10 ) { B = = 0 ; } int C = 10 - c % 10 ; if ( C = = 10 ) { C = = 0 ; } int D = 10 - d % 10 ; if ( D = = 10 ) { D = = 0 ; } int E = 10 - e % 10 ; if ( E = = 10 ) { E = = 0 ; } ans + = A + B + C + D + E ; ans - = Math . max ( A , Math . max ( b , Math . max ( c , Math . max ( d , e ) ) ) ) ; System . out . println ( ans ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( x * x * x ) if ( x > = 2 & & x < = 100 ) { System . out . println ( y ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . util . Scanner ; public class ITP11B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . nextLine ( ) ; int i = Integer . parseInt ( input ) ; System . out . println ( i * i * i ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int n [ ] = new int [ 4 ] ; String m ; int p = 0 ; for ( int i = 0 ; i < N ; i + + ) { m = sc . next ( ) ; if ( m = = " P " ) n [ 0 ] + + ; if ( m = = " G " ) n [ 1 ] + + ; if ( m = = " W " ) n [ 2 ] + + ; if ( m = = " Y " ) n [ 3 ] + + ; } for ( int k = 0 ; k < 4 ; k + + ) if ( n [ k ] > 0 ) p + + ; if ( p = = 3 ) { System . out . println ( " three " ) ; } else if ( p = = 4 ) { System . out . println ( " four " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = 1 ) { a = 14 ; } if ( b = = 1 ) { b = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( A = = B ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . util . Scanner ; public class RB91A { int a , b ; int cost ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; cost = sc . nextInt ( ) ; if ( a + b < = cost ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static void main ( String [ ] args ) { new RB91A ( ) . solve ( ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Sub { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long v = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long w = sc . nextLong ( ) ; long t = sc . nextLong ( ) ; for ( int i = 0 ; i < t ; i + + ) { a = a + v ; b = b + w ; if ( a = = b ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( x [ j ] x [ i ] - x [ i ] x [ i ] ) * ( x [ j ] x [ i ] - x [ i ] x [ i ] ) ; } if ( Math . sqrt ( sum ) = = int ( Math . sqrt ( sum ) ) ) { counter + + ; } } } } } import java . util . * ; class Main { public static void main ( Strimg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , C = sc . nextInt ( ) ; if ( A + B > = C ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class BBBBBBBBBB { public static void main ( String [ ] args ) { long x , bal1 , bal2 , bal3 , ans , kk ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 0 ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { bal1 = a [ i ] ; bal2 = 0 ; bal3 = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = ( ( i - k ) + n ) % n ; if ( pi = = 0 ) pi = n ; if ( bal1 > a [ pi ] + ( ( long ) k ) * x ) { bal1 = a [ pi ] + ( k ) * x ; bal2 = k ; bal3 = a [ pi ] ; } } if ( bal2 > kk ) kk = bal2 ; ans + = bal3 ; } System . out . println ( ans + ( kk ) * x ) ; } } import java . util . Scanner ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } package atCoder01 ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double avarage = Math . ceil ( ( a + b ) / 2 ) ; System . out . println ( avarage ) ; } import java . io * ; class Main { publi static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputSteamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . pareInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class BinaryConversion { public static long [ ] decimalToBinary ( long num ) { long [ ] a = new long [ 60 ] ; int i = a . length - 1 ; while ( num ! = 0 ) { a [ i ] = num % 2 ; num / = 2 ; i -- ; } return a ; } public static long binaryToDecimal ( long [ ] a ) { long num = 0 ; for ( int i = 0 ; i < a . length ; i + + ) { num + = ( a [ i ] * Math . pow ( 2 , a . length - 1 - i ) ) ; } return num ; } } public class XOR { public static long [ ] xor ( long num1 , long num2 ) { long [ ] a = BinaryConversion . decimalToBinary ( num1 ) ; long [ ] b = BinaryConversion . decimalToBinary ( num2 ) ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = ( a [ i ] + b [ i ] ) % 2 ; } return a ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] num = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { num [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < num . length - 1 ; i + + ) { for ( int j = i + 1 ; j < num . length ; j + + ) { long [ ] temp = XOR . xor ( num [ i ] , num [ j ] ) ; sum + = BinaryConversion . binaryToDecimal ( temp ) ; } } sum % = ( Math . pow ( 10 , 9 ) + 7 ) ; System . out . println ( sum ) ; } } public class XCubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int inputIum = scan . nextInt ( ) ; System . out . println ( calCubic ( inputIum ) ) ; } private static long calCubic ( int inputIum ) { return inputIum * inputIum * inputIum ; } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( scan . hasNext ( ) ) { double [ ] x = new double [ 3 ] ; double [ ] y = new double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = scan . nextDouble ( ) ; y [ i ] = scan . nextdouble ( ) ; } double xp = scan . nextDouble ( ) ; double yp = scan . nextDouble ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = x [ i ] - xp ; y [ i ] = y [ i ] - yp ; } double [ ] gaiseki = new double [ 3 ] ; gaiseki [ 0 ] = x [ 0 ] * y [ 1 ] - y [ 0 ] * x [ 1 ] ; gaiseki [ 1 ] = x [ 1 ] * y [ 2 ] - y [ 2 ] * x [ 1 ] ; gaiseki [ 2 ] = x [ 2 ] * y [ 0 ] - y [ 2 ] * x [ 0 ] ; int plus = 0 ; int minus = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( gaiseki [ i ] > 0 ) plus + + ; if ( gaiseki [ i ] < 0 ) minus + + ; } String ans = " NO " ; if ( plus = = 3 | | minus = = 3 ) ans = " YES " ; System . out . printf ( " % s \ n " , ans ) ; } } } import java . util . Scanner ; public class TwoRectangles { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) , b = sc . nextLong ( ) ; long c = sc . nextLong ( ) , d = sc . nextLong ( ) ; System . out . println ( Math . max ( a * b , c * d ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextint ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } public class main { public static void main ( String [ ] args ) { int x ; int kekka ; x = 2 ; kekka = x * x ; System . out . println ( kekka ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int input _ number = scanner . nextInt ( ) ; System . out . println ( input _ number * input _ number * input _ number ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; System . out . println ( k * k * k ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; long n = scan . nextLong ( ) , total = 1 ; long ar [ ] = new long [ n ] ; if ( n = = 1 ) { System . out . println ( total ) ; } else { for ( int i = 1 ; i < n ; i + + ) { if ( ar [ i - 1 ] > ar [ i ] ) { total + = 1 ; } } System . out . println ( total ) ; } } } Public class main { Public static void main { int x ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int i = s . nextInt ( ) ; System . out . println ( i * i * i ) ; } } package syokora _ p ; import java . util . Scanner ; public class MMM { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ABC087 _ B { public static void main ( String [ ] args ) { int a , b , c , x ; int output = 0 ; int i , j , k ; Scanner scan = new Scanner ( System . in ) ; a = scan . nextInt ( ) ; b = scan . nextInt ( ) ; c = scan . nextInt ( ) ; x = scan . nextInt ( ) ; for ( i = 0 ; i < = a ; i + + ) { for ( j = 0 ; j < = b ; j + + ) { for ( k = 0 ; k < = c ; k + + ) { if ( 500 * i + 100 * j + k * 50 = = x ) { output + + ; } } } } System . out . println ( output ) ; } } public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; String b = scan . next ( ) ; String c = scan . next ( ) ; int ab [ ] = new int [ 3 ] ; ab [ 0 ] = Integer . valueOf ( a ) . intValue ( ) ; ab [ 1 ] = Integer . valueOf ( b ) . intValue ( ) ; ab [ 2 ] = Integer . valueOf ( c ) . intValue ( ) ; Arrays . sort ( ab ) ; if ( ab [ 0 ] = = 5 & & ab [ 1 ] = = 5 & & ab [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) } } public class aoj _ 1B { public static void main ( String [ ] args ) { double a = 2d ; double b = 3d ; double ans = Math . pow ( a , b ) ; System . out . println ( " ans " ) ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; if ( ( a = = 5 ) & & ( b = = 5 ) & & ( c = = 7 ) ) { System . out . println ( " yes " ) ; } else if ( ( a = = 5 ) & & ( b = = 7 ) & & ( c = = 5 ) ) { System . out . println ( " yes " ) ; } else if ( ( a = = 7 ) & & ( b = = 5 ) & & ( c = = 5 ) ) { System . out . println ( " yes " ) ; } else { System . out . println ( " No " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; int ans = Math . pow ( x , 3 ) ; System . out . println ( ans ) ; } } import java . lang . Math ; class Test { public static void main ( String [ ] args ) ? ? ? throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Squared { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ABC123b { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextInt ( ) ; double b = sc . nextInt ( ) ; double c = sc . nextInt ( ) ; double d = sc . nextInt ( ) ; double e = sc . nextInt ( ) ; double min = 0 ; double a1 = a / 10 ; a1 = Math . ceil ( a1 ) ; double b1 = b / 10 ; b1 = Math . ceil ( b1 ) ; double c1 = c / 10 ; c1 = Math . ceil ( c1 ) ; double d1 = d / 10 ; d1 = Math . ceil ( d1 ) ; double e1 = e / 10 ; e1 = Math . ceil ( e1 ) ; double sum = a1 + b1 + c1 + d1 + e1 ; min = a % 10 ; if ( min > b % 10 & & b % 10 ! = 0 ) { min = b % 10 ; } if ( min > c % 10 & & c % 10 ! = 0 ) { min = c % 10 ; } if ( min > d % 10 & & d % 10 ! = 0 ) { min = d % 10 ; } if ( min > e % 10 & & e % 10 ! = 0 ) { min = e % 10 ; } sum = ( sum * 10 ) - 10 + min ; System . out . println ( ( int ) sum ) ; } } public void 1 _ 1 _ B ( ) { int x = input ( ) ; print ( x * x * ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { int a = Integer . parseInt ( args [ 0 ] ) System . out . println ( a * a * a ) ; } } import java . util . Map ; import java . util . TreeMap ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Map < Integer , int [ ] > sortup = new TreeMap < > ( ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int [ ] ans = new int [ M ] ; for ( int i = 0 ; i < M ; i + + ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int [ ] c = new int [ 2 ] ; c [ 0 ] = a ; c [ 1 ] = i ; sortup . put ( b , c ) ; } for ( int key : sortup . keySet ( ) ) { System . out . println ( key ) ; int [ ] c = sortup . get ( key ) ; ans [ c [ 1 ] ] = String . format ( " % 06d % 06d " , c [ 0 ] , + + P [ c [ 0 ] - 1 ] ) ; } for ( int i = 0 ; i < M ; i + + ) { System . out . println ( ans [ i ] ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ab = a * b ; int cd = c * d ; if ( ab > cd ) { System . out . println ( ab ) ; } else if ( ab = = cd ) { System . out . println ( ab ) ; } else if ( ab < cd ) { System . out . println ( cd ) ; } } } public class main { public static void main ( String [ ] args ) { int x ; x = 2 ; for ( int count = 0 ; count < 2 ; count + + ) { x = x * 2 ; } System . out . println ( x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = input . readLine ( ) ; System . out . println ( x ) } } import java . lang . Math ; class Test { public static void main ( String [ ] args ) throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; HashMap < Integer , int [ ] > map = new HashMap < > ( ) ; ArrayList < Pair > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { int [ ] array = new int [ Integer . MAX _ VALUE ] ; map . put ( i + 1 , array ) ; } for ( int i = 0 ; i < m ; i + + ) { int p = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; list . add ( new Pair ( p , y ) ) ; int [ ] a = map . get ( p ) ; a [ y ] + + ; map . put ( p , a ) ; } for ( int i = 0 ; i < n ; i + + ) { int num = 1 ; int [ ] a = map . get ( i + 1 ) ; for ( int j = 0 ; j < a . length ; j + + ) { if ( a [ j ] = = 1 ) { a [ j ] = num ; num + + ; } } } for ( Pair pair : list ) { int p = pair . p ; int y = pair . y ; int order = map . get ( p ) [ y ] ; System . out . println ( String . format ( " % 06d " , p ) + String . format ( " % 06d " , order ) ) ; } } static class Pair { int p ; int y ; Pair ( int p , int y ) { this . p = p ; this . y = y ; } } } public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder builder = new StringBuilder ( ) ; String line ; int count = 0 ; while ( ( line = reader . readLine ( ) ) ! = null ) { Pattern pattern = Pattern . compile ( " ( [ 0-9 ] + ) " ) ; Matcher matcher = pattern . matcher ( line ) ; while ( matcher . find ( ) ) { count + = Integer . parseInt ( matcher . group ( ) ) ; } } System . out . println ( count ) ; } } inport java . until . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x \ n ; System . out . println ( answer ) ; } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( sc . nextInt ( ) = = 7 ) { sevenCounter + + ; } else { fiveCounter + + ; } } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } class Main { public static void main ( String [ ] args ) { int x = 2 x = x ^ 3 System . out . print ( x ) } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextFloat ( ) ; long b = sc . nextInt ( ) ; long c = sc . nextFloat ( ) ; long d = sc . nextInt ( ) ; long n = sc . nextInt ( ) ; for ( long i = 0 ; i < n ; i + + ) { a + = b ; c + = d ; } if ( c > = a ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } package start ; import java . util . Scanner ; public class Input { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + a * a * a + ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String strInput r . readLine ( ) ; int intInputData strInput . parseInt ( ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner = std new Scanner ( System . in ) ; int n = std . nextInt ( ) ; System . out . println ( math . pow ( n , 3 ) ) ; } } import java . util . Scanner ; class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int inputNum = Integer . parseInt ( str ) ; int intNum = inputNum * inputNum * inputNum ; System . out . println ( intNum ) ; } import java . util . Scanner ; public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int fiv = 0 ; int sev = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int num = sc . nextInt ( ) ; switch ( num ) { case 5 : fiv + + ; break ; case 7 : sev + + ; break ; } } if ( fiv = = 2 & & sev = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " no " ) ; } } } import java . util . ArrayList ; import java . util . Scanner ; public class AA { static Scanner sc = new Scanner ( System . in ) ; static ArrayList < Integer > IntList = new ArrayList < Integer > ( ) ; static ArrayList < String > StrList = new ArrayList < String > ( ) ; public static void main ( String [ ] args ) { int ans1 = sc . nextInt ( ) ; int ans2 = sc . nextInt ( ) ; int ans3 = sc . nextInt ( ) ; int ans4 = sc . nextInt ( ) ; int ans5 = sc . nextInt ( ) ; int cont = 0 ; int a = ans3 - ans1 ; int ans = a * 60 ; int sum = ans - ans2 - ans4 - ans5 ; System . out . println ( sum ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws IOException { BufferedReader br = new BfferedReader ( new InputStreamReader ( System . in ) ) ; String line = " " ; int count = 0 ; while ( ( line = br . readLine ( ) ) ! = null ) { int a = 0 ; boolean f = false ; for ( int i = 0 ; i < line . length ( ) ; i + + ) { f = false ; if ( line . charAt ( i ) > = ' 0' & & line . charAt ( i ) < = ' 9' ) { a = a * 10 + ( int ) ( line . charAt ( i ) - ' 0' ) ; f = true ; } if ( ! f ) { count + = a ; a = 0 ; } } } System . out . println ( count ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String input _ text = scanner . nextLine ( ) ; int r = Integer . parseInt ( input _ text ) ; System . out . println ( r * r ) ; scanner . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class ITP1 _ 1 _ B { public static void main ( String args [ ] ) { String line = " " ; try { BufferedReader bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( ( line = bufferedReader . readLine ( ) ) ! = null ) { double volume = Math . pow ( ( double ) Integer . parseInt ( line ) , 3d ) ; System . out . println ( ( int ) volume ) ; } } catch ( IOException e ) { } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cntdif = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList < int > bigger = new ArrayList < int > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( A [ j ] - B [ j ] < 0 ) { difsum + = A [ j ] - B [ j ] ; cnt + + ; } else if ( A [ j ] - B [ j ] > 0 ) { bigger . add ( A [ j ] - B [ j ] ) ; } } int big [ ] = bigger . toArray ( new int [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < big . length ; k + + ) { for ( int l = 0 ; l < big . length - k - 1 ; l + + ) { if ( big [ l ] > big [ l + 1 ] ) { temp = big [ l ] ; big [ l ] = big [ l + 1 ] ; big [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = big [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; double ans = ( double ) pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ( int ) ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . printf ( answer ) ; System . out . printf ( \ n ) ; } } class Circle { public static void main ( String [ ] args ) { int r = 5 ; int ratio = r * r ; System . out . println ( ratio ) ; } } int main ( ) { Scanner sc = new Scanner ( System . in ) ; int a ; int b ; while ( true ) { if ( ! sc . hasNext ( ) ) break ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; System . out . println ( a + b ) ; } return 0 ; } # include < cstdio > # include < iostream > # include < cstring > using namespace std ; int main ( ) { string s ; while ( 1 ) { cin > > s ; if ( s = = " 0 " ) break ; int sum = 0 ; for ( char c : s ) sum + = c - ' 0' ; cout < < sum < < endl ; } return 0 ; } public class Main { public static void main ( String [ ] args ) { int x ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ) ; } } import java . util . Scanner ; public class Main { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; b = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { b * = a ; } ; System . out . println ( b ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; long [ ] B = new long [ N ] ; long [ ] C = new long [ N ] ; long sum = 0 ; long minus = 0 ; int C _ minus = 0 ; for ( int i = 0 ; i < N ; i + + ) { long Ai = sc . nextLong ( ) ; A [ i ] = Ai ; C [ i ] = Ai ; } for ( int i = 0 ; i < N ; i + + ) { long Bi = sc . nextLong ( ) ; B [ i ] = Bi ; C [ i ] = C [ i ] - Bi ; sum + = C [ i ] ; if ( C [ i ] < 0 ) { C _ minus + + ; minus + = C [ i ] ; } } if ( C _ minus = 0 ) { System . out . println ( 0 ) ; } else if ( sum < 0 ) { System . out . println ( - 1 ) ; } else { int answer = 0 ; Arrays . sort ( C ) ; for ( int i = C . length - 1 ; i > = 0 ; i -- ) { minus + = C [ i ] ; if ( minus > 0 ) { answer = C . length - 1 - i + 1 ; break ; } } answer + = C _ minus ; System . out . println ( answer ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = Integer . parseInt ( in . nextLine ( ) ) ; int mealPrice = 800 ; int discount = 200 ; int discountPoint = 15 ; int x = n * mealPrice ; int y = ( n / discountPoint ) * discount ; System . out . println ( x - y ) ; } import java . util . Scanner ; public class atcoder1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans ; if ( a < 6 ) ans = 0 ; else if ( a > = 6 & & a < = 12 ) ans = b / 2 ; else ans = b ; 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 ( ) ; boolean P = false , W = false , G = false , Y = false ; String S = sc . next ( ) ; ; for ( int i = 1 ; i < n ; i + + ) { if ( S . equals ( " P " ) ) P = true ; else if ( S . equals ( " W " ) ) W = true ; else if ( S . equals ( " G " ) ) G = true ; else if ( S . equals ( " Y " ) ) Y = true ; } if ( W & & G & & Y ) { if ( P ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; } } } public class Main { public static void main ( string [ ] args ) { int x ; x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = N1 [ i ] ; break ; } } if ( count = = 5 ) count = = 4 ; System . out . println ( sum - 10 * count + min ) ; } class Main { public static void main ( String args [ ] ) { int x = 3 ; if ( x > = 1 & & x < = 100 ) { int y = x * x * x ; } System . out . println ( y ) ; } } import java . util . * ; class Study _ Scheduling { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int H1 = input . nextInt ( ) ; int M1 = input . nextInt ( ) ; int H2 = input . nextInt ( ) ; int M2 = input . nextInt ( ) ; int K = input . nextInt ( ) ; int remainder = 0 ; int minutes = 0 ; int hours = 0 ; if ( M2 < M1 ) { remainder = 1 ; minutes = ( M2 + 60 ) - M1 ; } else if ( M1 < M2 ) { minutes = M2 - M1 ; } hours = H2 - remainder - H1 ; int totalMinutes = ( hours * 60 ) + minutes ; System . out . println ( totalMinutes - K ) ; } } class Main { public static void main ( String args [ ] ) { int x ; System . out . read ( x ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder data = new StringBuilder ( ) ; while ( true ) { int sum = 0 ; String str = br . readLine ( ) ; int strsize = str . length ( ) ; if ( str . equals ( " 0 " ) ) break ; else if ( strsize > = 1 ) { int i = 0 ; while ( i < strsize ) { sum + = Integer . parseInt ( String . valueOf ( str . charAt ( i ) ) ) ; i + + ; } } data . append ( sum ) . append ( " \ n " ) ; } System . out . println ( data ) ; } public class Main { public static void main ( String [ ] args ) { Optional < String > input = Optional . of ( args [ 0 ] ) ; long x = Integer . parseInt ( input . orElse ( " 0 " ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { String line = null ; int num = 0 ; Scanner sc = null ; try { sc = new Scanner ( System . in ) ; do { line = sc . nextLine ( ) ; char [ ] work = line . toCharArray ( ) ; for ( int i = 0 ; i < work . length ; i + + ) { num + = Character . getNumericValue ( work [ i ] ) ; } if ( num ! = 0 ) { System . out . println ( num ) ; } num = 0 ; } while ( ! line . equals ( " 0 " ) ) ; } finally { sc . close ( ) ; } } class Main { public static void main ( String [ ] a ) { int x = 0 , a = 3 ; Scanner input = new Scanner ( System . in ) : x = input . nextInt ( ) ; int c = ( int ) Math . pow ( x , b ) ; System . out . println ( c ) ; } } class Main { public static void main ( String [ ] args ) { int intInputData = System . in . read ( ) ; int intResult = intInputData ^ 3 ; System . out . println ( intResult . toString ( ) ) ; } } public class Main { public static void main ( String [ ] args ) { int x = x ^ 3 ; System . out . println ( x ) ; } } class Main { public static void main ( String [ ] args ) { int x = System . in ( ) int y = x * x * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Mofu { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int mofu [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { mofu [ i ] = scan . nextInt ( ) ; } int maxmofu = mofu [ 0 ] ; int minmofu = mofu [ 0 ] ; for ( int i = 1 ; i < 3 ; i + + ) { if ( maxmofu < mofu [ i ] ) { maxmofu = mofu [ i ] ; } if ( minmofu > mofu [ i ] ) { minmofu = mofu [ i ] ; } } System . out . println ( " 合計コストは " + ( maxmofu i nmofu ) です 。 " ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int wkInt = sc . nextInt ( ) ; System . out . println ( wkInt * wkInt * wkInt ) ; } } class main { public static void main ( Strings arg [ ] ) { int i ; Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; i = x * x * x ; System . out . println ( i ) ; } import java . util . Scanner ; public class main { static int N , M ; static int [ ] arr ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; arr = new int [ N ] ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; arr [ P - 1 ] + + ; } for ( int i = 0 ; i < arr . length ; i + + ) { for ( int j = 0 ; j < arr [ i ] ; j + + ) { String id1 = String . format ( " % 06d " , i + 1 ) ; String id2 = String . format ( " % 06d " , j + 1 ) ; System . out . println ( id1 + id2 ) ; } } } } package main . task168 ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . Scanner ; public class B { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int H = in . nextInt ( ) ; int M = in . nextInt ( ) ; double red = Math . PI * 2 * ( H / 12.0 + ( M / 60 ) / 12.0 - ( M / 60 ) ) ; double rsq = ( A * A + B * B ) - ( 2 * A * B ) * Math . cos ( red ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } import java . util . Scanner ; pubulic class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = A ; i + + ) { for ( int j = 0 ; j < = B ; j + + ) { for ( int k = 0 ; k < = C ; k + + ) { if ( 500 * i + 100 * j + 50 * k = = X ) { ans + + ; } } } } System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . printIn ( ans ) ; } } class public { public static void main ( Stirng args [ ] ) throws IOException { int a = 2 ; System . out . printlin ( math . pow ( a , 3 ) ) ; } } package app ; import java . util . * ; public class App { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { System . out . println ( i + " 文字目を入力してください " ) ; a [ i ] = sc.nextInt ( ) ; } n t f v = 0 ; int s e v n = 0 for i t = ; i < a l n g h ; i + + ) f a [ ] = = 5 ) { f i e + + ; e l s e i ( a i ] = 7 ) { s v n + + ; } } i f ( iv = = 2 & & se v n = 1 ) { Sy te . ut print n ( Y E S ) ; } e l se { System . o ut. p r i t n ( " N " ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = ndew Scanner ( System . in ) ; int x = Integer . parseInt ( in . next ( ) ) ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { int wkInt ; wkInt = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( wkInt * wkInt * wkInt ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int inputNum = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( inputNum * inputNum * inputNum ) ; } } class Main { public static void main ( String [ ] args ) { int x = new ( ) ; System . out . println ( x ^ 3 ) ; } } # include < iostream > # include < string > using namespace std ; string s ; int main ( ) { cout < < s < < endl ; while ( s ! = " 0 " ) { cin > > s ; int ans = 0 ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { ans + = s [ i ] - ' 0' ; } cout < < ans < < endl ; } } import java . util . Scanner class Main { public static void Main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int x = Integer . parseInt ( sc . nextLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; class Rp1ABC091A { public static void main ( String args [ ] ) { int A ; int B ; int C ; Scanner sc = new Scanner ( System . in ) ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; C = sc . nextInt ( ) ; if ( A + B > = C ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; + + k ) { long val + = ( arr [ j ] [ k ] - arr [ i ] [ k ] ) * ( arr [ j ] [ k ] - arr [ i ] [ k ] ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) * ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) ) ; } if ( Math . sqrt ( sum ) = = ( int ) ( Math . sqrt ( sum ) ) ) { counter + + ; } } } System . out . print ( counter ) ; } } public class Test01 { public static void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = new sc . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; } long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; i < n ; j + + ) { sum + = Math . sqrt ( 1.0 * ( x [ j ] - x [ i ] ) * ( x [ j ] - x [ i ] ) + ( y [ j ] - y [ i ] ) * ( y [ j ] - y [ i ] ) ) ; } } System . out . println ( sum * 2 / n ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; Syste . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { String strNum = null ; int x = 0 ; try { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; ufferedReader nsLine ew ufferedReader ( n ew nputStreamReader ( S ystem. i n ) ) ; trNum nsLine. r eadLine ( ) ; nteger. p arseInt ( s trNum ) ; f x = 1 & = 00 ) ystem. o ut. p rintln ( x ) ; e lse { ystem. o ut. p rintln ( " ? ? \ ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } c t ch ( I E xception e ) { y tem.ou t .pr i ntln ( e ) ; } c t ch ( N m berFormatException e2 { y tem.ou t .pr i ntln ( e2 ) ; } import java . util . Scanner ; public class EjerC { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] nums = sc . nextLine ( ) . split ( " " ) ; int cont = 1 ; int bump = Integer . parseInt ( nums [ 0 ] ) ; for ( int i = 1 ; i < nums . length ; i + + ) { if ( Integer . parseInt ( nums [ i ] ) < bump ) { bump = Integer . parseInt ( nums [ i ] ) ; cont + + ; } } System . out . println ( cont ) ; } } class Main { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int x = kb . nextInt ( ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = x * x * x System . out . println ( 1 ? ? ? x ? ? ? 100 ) ; } } # include < iostream > using namespace std ; int main ( ) { int a , b , x , y ; cin > > a > > b ; x = a * b ; y = 2 * ( a + b ) ; cout < < x < < endl ; cout < < y < < endl ; return 0 ; } public class index { public static void main ( Stirng [ ] args ) { INT A , B , C ; while ( 1 ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; A = new String ( in . readLine ( ) ) ; if ( A = = 5 & & A = = 7 ) { B = new String ( in . readLine ( ) ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } C = new String ( in . readLine ( ) ) ; if ( A + B + C = = 17 ) { System . outprintln ( " Yes ! " ) ; } else { break ; } } } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( Math . pow ( ( double ) x , 3d ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; if ( ( a - 5 ) * ( b - 5 ) * ( c - 7 ) = = 0 | | ( a - 5 ) * ( b - 7 ) * ( c - 5 ) = = 0 | | ( a - 7 ) * ( b - 5 ) * ( c - 5 ) = = 0 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int z = 0 ; for ( int i = 0 ; A = = X ; i + + ) { z = z + i ; } for ( int j = 0 ; B = = X ; j + + ) { z = z + j ; } for ( int k = 0 ; C = = X ; k + + ) { z = z + k ; } System . out . print ( z ) ; } } public class ITP1 _ 1B { public static void main ( String [ ] args ) { for ( double i = 1 ; i < = 100 ; i + + ) { Math . pow ( i , 3 ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; for ( int i = 1 ; i < = 100 ; i + + ) { i = x ; System . out . println ( i * i * i ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( ) int i = x ^ 3 ; System . out . println ( i ) ; } } import java . util . Scanner ; class team _ formation1 _ b { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( ( n + m ) > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) } } import java . util . * ; class A { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; if ( n [ 0 ] ! = 1 & & n [ 1 ] ! = 4 & & n [ 2 ] ! = 7 & & n [ 3 ] ! = 9 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . priintln ( r * r ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int stnum ; double weight , height , BMI ; String data , datap [ ] ; while ( scan . hasNext ( ) ) { data = scan . next ( ) ; datap = data . split ( " , " , 3 ) ; stnum = Integer . valueOf ( datap [ 0 ] ) ; weight = Double . valueOf ( datap [ 1 ] ) ; height = Double . valueOf ( datap [ 2 ] ) ; BMI = ( weight ) / ( height * height ) ; if ( BMI > = 25.0 ) System . out . println ( stnum ) ; } } } import java . io . * ; class Main { public static void main ( ) { int a , b , c ; String buf ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; a = Integer . parseInt ( buf ) ; buf = br . readLine ( ) ; b = Integer . parseInt ( buf ) ; buf = br . readLine ( ) ; c = Integer . parseInt ( buf ) ; String s1 = a + b + c ; if ( s = = 557 | | s = = 575 | | s = = 755 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int [ ] [ ] matrix = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { matrix [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; int a [ 0 ] = 0 ; int b [ 0 ] = matrix [ 0 ] [ 0 ] - a1 ; int b [ 1 ] = matrix [ 0 ] [ 1 ] - a1 ; int b [ 2 ] = matrix [ 0 ] [ 2 ] - a1 ; int a [ 1 ] = matrix [ 1 ] [ 0 ] - b1 ; int a [ 2 ] = matrix [ 2 ] [ 0 ] - b1 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( matrix [ i ] [ j ] ! = a [ i ] + b [ j ] ) { System . out . println ( " No " ) ; return ; } } } System . out . println ( " Yes " ) ; } } import java . util . Scanner ; public class Main { int X ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; X = sc . nextInt ( ) ; System . out . println ( X * X * X ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . nextInt ( ) ; String b = sc . nextInt ( ) ; String c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main3 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = s . nextInt ( ) ; } int c = 0 ; for ( int i = 0 ; i < n ; i + + ) { boolean f = true ; for ( int j = 0 ; j < = i ; j + + ) { if ( a [ i ] > a [ j ] ) { f = false ; break ; } } if ( f ) c + + ; } System . out . println ( c ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( args [ 0 ] ^ 3 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner snanner = new Scanner ( System . in ) ; int A = scanner . nextInt ( ) ; int B = scanner . nextInt ( ) ; int C = scanner . nextInt ( ) ; if ( A * B * C = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( Strings [ ] args ) { int x ; x = 2 ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; long sum _ N = 1 ; long sum _ M = 1 ; long ans = 0 ; int n _ m = Math . abs ( N - M ) ; if ( n _ m < 2 ) { for ( long i = N ; i < = 0 ; i -- ) { sum _ N * = i ; } for ( long j = M ; j < = 0 ; j -- ) { sum _ M * = j ; } if ( n _ m = = 0 ) { ans = sum _ N * sum _ M * 2 ; } else { ans = sum _ N * sum _ M ; } } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . next ( ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . IO . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( " 入出力エラーです " ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x * ) ; } } import java . util . Arrays ; import java . util . * ; public class main { private static Scanner sc = new Scanner ( System . in ) ; static double xp , yp ; public static void main ( String [ ] args ) { while ( sc . hasNextDouble ( ) ) { double xm [ ] = new double [ 3 ] ; double ym [ ] = new double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { xm [ i ] = sc . nextDouble ( ) ; ym [ i ] = sc . nextDouble ( ) ; } xp = sc . nextDouble ( ) ; yp = sc . nextDouble ( ) ; Arrays . sort ( xm ) ; Arrays . sort ( ym ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( xm [ i ] = = xp & & ym [ i ] = = yp ) break ; } if ( xm [ 0 ] < xp & & xm [ 2 ] > xp & & ym [ 0 ] < yp & & ym [ 2 ] > yp ) { System . out . println ( " Yes " ) ; } else { mm ( ) ; } } } private static void mm ( ) { System . out . println ( " No " ) ; } } public class Main { public static void main ( String args [ ] ) { int x > = 1 & & x < = 100 ; int y = x * x * x ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { public static void main ( String args [ ] ) { int a = 3 ; int x = 7 ; int num = Math . pow ( a , x ) ; System . out . println ( Math . pow ( a , x ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b < = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; int x , cube ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] argas ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int count = 0 ; if ( a [ 0 ] = = 1 ) count + + ; if ( a [ 1 ] = = 1 ) count + + ; if ( a [ 2 ] = = 1 ) count + + ; System . out . println ( count ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String strInput = r . readLine ( ) ; int intInputData = Integer . parseInt ( strInput ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } public class Main { public static void main ( String [ ] args ) { int = 3 ; int = x ; System . out . println ( 3 * x ) ; } } import java . util . * ; public class Main { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; HashMap < Integer , Arraylist < Integer > > h = new HashMap < Integer , Arraylist < Integer > > ( ) ; Hashmap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( ! h . containkey ( P ) ) { h . put ( P , new ArrayList < Integer > ( ) ) ; } h . get ( P ) . add ( Y ) ; hm . put ( Y , i ) ; } for ( int key : h . keyset ( ) ) { Collection . sort ( h . keyset ( ) ) ; } String [ ] ans = new String [ M ] ; for ( int key : h . keyset ( ) ) { string first = key + " " ; for ( int i = 0 ; i < 6 - ( key + " " ) . length ; i + + ) { first = " 0 " + first ; } for ( int i = 0 ; i < h . get ( key ) . size ; i + + ) { int ind = hm . get ( h . get ( key ) . get ( i ) ) ; String second = ( i + 1 ) + " " ; for ( int j = 0 ; j < 6 - ( ( i - 1 ) + " " ) . size ; j + + ) { second = " 0 " + second ; } ans [ ind ] = first + second ; } } for ( an : ans ) { System . out . println ( an ) ; } } } } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BuffreredReader br = new BufferedReader ( is ) ; int i = br . readLine ( ) ; int j = i * i ; j = j * j System . out . println ( " + j + " ) ; } } import java . util . * ; import java . text . * ; public class ABC119A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; if ( S . compareTo ( " 2019 / 04 / 30 " ) > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } try { Date date1 = DateFormat . getDateInstance ( ) . parse ( S ) ; } catch ( ParseException e ) { } } } public class Calc { public static void main ( String [ ] args ) throws IOException { int ans = 0 ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String str = null ; str = br . readLine ( ) ; int r = Integer . parseInt ( str ) ; ans = r * r ; 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 ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList < Integer > bigger = new ArrayList < Integer > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( A [ j ] - B [ j ] < 0 ) { difsum + = A [ j ] - B [ j ] ; cnt + + ; } else if ( A [ j ] - B [ j ] > 0 ) { bigger . add ( A [ j ] - B [ j ] ) ; } } int big [ ] = bigger . toArray ( new Integer [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < big . length ; k + + ) { for ( int l = 0 ; l < big . length - k - 1 ; l + + ) { if ( big [ l ] > big [ l + 1 ] ) { temp = big [ l ] ; big [ l ] = big [ l + 1 ] ; big [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = big [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { for ( int l = 0 ; l < = k ; l + + ) { if ( i + j + l = = s ) ans + + ; } } } System . out . println ( ans ) ; } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } System . out . println ( sold ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int counter = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) counter + + ; } } } System . out . println ( counter ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; s = buf . readLine ( ) ; int i = Integer . parseInt ( s ) ; i = i ^ 3 ; System . out . println ( i + \ r \ n ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; double x = ( a + b ) / 2 ; System . out . print ( int ( Math . seil ( x ) ) ) ; } } import java . util . Scanner ; public class Main { static int T [ ] ; static int A [ ] ; static Long TA [ ] ; static Long TT [ ] ; static int N ; static int ans = 0 ; public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; T = new int [ N ] ; TT = new Long [ N ] ; TA = new Long [ N ] ; A = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { T [ i ] = sc . nextInt ( ) ; A [ i ] = sc . nextInt ( ) ; } TT [ 0 ] = T [ 0 ] ; TA [ 0 ] = A [ 0 ] ; ans + = T [ 0 ] + A [ 0 ] ; for ( int i = 0 ; i < N - 1 ; i + + ) { update ( i ) ; } System . out . println ( ans ) ; } static void update ( int m ) { int k = Math . max ( ( TT [ m ] + T [ m + 1 ] - 1 ) / T [ m + 1 ] , ( TA [ m ] + A [ m + 1 ] - 1 ) / A [ m + 1 ] ) ; ans + = T [ m + 1 ] * k - TT [ m ] - TA [ m ] + A [ m + 1 ] * k ; TT [ m + 1 ] = T [ m + 1 ] * k ; TA [ m + 1 ] = A [ m + 1 ] * k ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int tmp = sc . nextInt ( ) ; if ( tmp < min ) { min = Math ( min , tmp ) ; cnt + + ; } } System . out . print ( cnt ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 3 ; x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } public class main { public static void ( String [ ] args ) { int x = math . pow ( 2 , 3 ) ; System . out . println ( " x " ) ; } } public class Main { public static cul int ( int x ) { x = x * * 3 ; return x ; } public static void main ( String [ ] args ) { y = cul ( x ) ; Sytem . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x < = 100 ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int y = 0 ; long min ; long a [ ] = new long [ n + 1 ] ; long b [ ] = new long [ n + 1 ] ; long c [ ] = new long [ n + 1 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = sc . nextInt ( ) ; b [ i ] = sc . nextInt ( ) ; c [ i ] = a [ i ] - b [ i ] ; if ( i = = 1 ) { min = b [ i ] ; } if ( c [ i ] ! = 0 ) { y = 1 ; } if ( c [ i ] > = 0 ) { if ( b [ i ] < = min ) min = b [ i ] ; } } long ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { ans + = b [ i ] ; } if ( y = = 0 ) { System . out . println ( 0 ) ; } else { System . out . println ( ans - min ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int ia = 0 ; ia < a , ia + + ) { for ( int ib = 0 ; ib < b , ib + + ) { for ( int ic = 0 ; ic < c , ic + + ) { if ( x = = a * 50 + b * 100 + c * 500 ) { count + + ; } } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class InputSample { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int n = 0 ; if ( 2 ^ n < = N ) { n = n + 1 ; } else { System . out . println ( 2 ^ n ) ; } } } import java . lang . Math . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int x = scan . nextInt ( ) ; int out = Math . pow ( x , 3 ) ; System . out . println ( out ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] x = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( x [ 4 ] - x [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else if ( x [ 4 ] - x [ 0 ] < = k ) { Systme . out . println ( " Yay ! " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 & & x < = 100 ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int A1 = scanner . nextInt ( ) ; int A2 = scanner . nextInt ( ) ; int A3 = scanner . nextInt ( ) ; int max = A1 ; int min = A1 ; if ( A2 > max ) { max = A2 ; } if ( A2 < min ) { min = A2 ; } if ( A3 > max ) { max = A3 ; } if ( A3 < min ) { min = A3 ; } System . out . println ( max - min ) ; scanner . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashSet ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int ab [ ] = new int [ 2 ] ; ab [ 0 ] = sc . nextInt ( ) ; ab [ 1 ] = sc . nextInt ( ) ; for ( int i = 0 ; i < ab . length ; i + + ) { if ( ab [ i ] = = 1 ) { ab [ i ] = ab [ i ] + 13 ; } } if ( ab [ 0 ] > ab [ 1 ] ) { System . out . println ( " Alice " ) ; } else if ( b [ 0 ] < ab [ 1 ] ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Drow " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; ? ? class Main { ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? try { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? String line = br . readLine ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( getCubed ( line ) ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } catch ( Exception e ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? e . printStackTrace ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? private static long getCubed ( String line ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? long x = Long . parseLong ( line ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return ( long ) Math . pow ( x , 3 ) ; ? ? ? ? ? ? ? ? ? ? } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } import java . util . ArrayList ; import java . util . Scanner ; class Scratch { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; ArrayList < Integer > valList = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { valList . add ( scanner . nextInt ( ) ) ; } int k = scanner . nextInt ( ) ; Integer val = valList . get ( 0 ) ; for ( int i = 1 ; i < valList . size ( ) ; i + + ) { if ( Math . abs ( val - valList . get ( i ) ) > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } System . out . println ( " Yay ! " ) ; } } import java . io . * ; import java . util . NoSuchElementException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; char ar [ ] = str . toCharArray ( ) ; int L = ar . length ; int left = sc . nextInt ( ) ; for ( int i = 0 ; i < L - 1 ; i + + ) { int aaa = va ( ( int ) ar [ i ] ) ; if ( aaa ! = 26 & & aaa < left ) { isa = true ; ar [ i ] = ' a ' ; left - = aaa ; } } while ( left > 0 ) { if ( left > = 26 ) { left % = 26 ; } else { ar [ L - 1 ] + = left ; left = 0 ; if ( ar [ L - 1 ] > 122 ) ar [ L - 1 ] + = 97 - 123 ; } } System . out . println ( String . valueOf ( ar ) ) ; } static int va ( int aa ) { return - aa + 97 + 26 ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; system . out . println ( x * 3 ) } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x < = 100 ; System . out . println ( x * x * x ) ; } } public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; System . out . println ( " Please enter an integer x " ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( " Cube of a x in aline : " + ( x * x * x ) ) ; } } public class Main { public static void Main ( String [ ] args ) { byte x = Integer . parseInt ( args [ 0 ] ) ; x = x * x * x ; System . out . pritln ( x ) ; } } import java . util . Scanner ; public class Haiku { public static void main ( String [ ] args ) { int five = 0 ; int seven = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { int num = Integer . parseInt ( sc . next ( ) ) ; switch ( num ) { case 5 : five + + ; break ; case 7 : seven + + ; break ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( solution ( x ) ) ; } public static solution ( int x ) { return x * x * x ; } } class test { public static void main ( String args [ ] ) { int fiveCount = 0 ; int sevenCount = 0 ; for ( String arg : args [ ] ) { if ( Integer . parseInt ( arg ) = = ' 5' ) { fiveCount + + } if ( Integer . parseInt ( arg ) = = ' 7' ) { fiveCount + + } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " OK " ) } else { System . out . print ( " NO " ) } } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double x ; x = readDouble ( in ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . printlin ( x ) ; } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { List < Integer > list = new ArrayList < Integer > ( ) ; int sum = 0 ; for ( ; ; ) { int x = scan . nextInt ( ) ; if ( x = = 0 ) { break ; } String number = String . valueOf ( x ) ; for ( int i = 0 ; i < number . length ( ) ; i + + ) { char ch = number . charAt ( i ) ; Srting c = String . valueOf ( ch ) ; int n = Integer . parseInt ( c ) ; sum + = n ; } list . add ( sum ) ; } for ( int n : list ) { System . out . println ( n ) ; } } } class Main { public static void main ( String [ ] args ) System . out . println ( x * x * x ) } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; 1 < = x < = 100 ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( x < = 100 & & x > = 1 ) { ; System . out . println ( x * x * x ) ; } } } class Xcubic { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; if ( 1 < = x < = 100 ) { int ans = x * x * x ; System . out . println ( ans ) ; } } } public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; System . out . println ( " Please enter an integer x " ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { int result = x * x * x ; System . out . println ( " Cube of a x in aline : " + result ) ; } else { System . out . println ( " Please enter an integer x between 1 and 100 " ) ; } } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int res = 0 ; for ( h = 0 ; h < a ; h + + ) { for ( i = 0 ; i < b ; i + + ) { int y = ( x - 500 * h - 100 * i ) / 50 ; if ( y = > 0 & & y < = c ) { res + + ; } } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main5 { int X ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; System . out . print ( X * X * X ) ; } public static void main ( String [ ] args ) { Main5 obj = new Main5 ( ) ; obj . solve ( ) ; } } # coding : UTF - 8 x = input ( ) y = x * 3 print int ( y ) ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class maint { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int x = a . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; } int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) ; if ( a + b > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main20190603 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; scan . close ( ) ; String [ ] data = str . split ( " " ) ; int charge = 0 ; int age = 0 ; int price = 0 ; age = Integer . parseInt ( data [ 0 ] ) ; price = Integer . parseInt ( data [ 1 ] ) ; if ( 6 < = age & & age < = 12 ) { charge = price / 2 ; } else if ( age > 12 ) { charge = price ; } System . out . println ( charge ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; long a = 0 ; long b = 0 ; long swap = 0 ; long r = 0 ; long x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long max = A [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } if ( max > M * 2 ) System . out . println ( 0 ) ; else { int ans = M / max + 1 ; System . out . println ( ans ) ; } } } class Main { public static void main ( String [ ] args ) { int a = x ; int sum = 0 ; sum = a * a * a ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; num = num * 2 ; System . out . plintln ( unm ) ; } } class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; int a = x * x * x ; System . out . println ( a ) ; } } public class { public static void main ( String [ ] args ) { System . out . println ( y = x * * 3 ) print int ( y ) } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { StringTokenizer token = new StringTokenizer ( br . readLine ( ) ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( Integer . parseInt ( token . nextElement ( ) . toString ( ) ) = = 7 ) { sevenCounter + + ; } else { fiveCounter + + ; } } } catch ( IOException ex ) { } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * * 3 ) ; } } import java . util . * ; import java . awt . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] p = new int [ m ] ; int [ ] y = new int [ m ] ; int [ ] [ ] cop = new int [ 2 ] [ m ] ; for ( int i = 0 ; i < m ; i + + ) { p [ i ] = sc . nextInt ( ) ; y [ i ] = sc . nextInt ( ) ; cop [ 0 ] [ i ] = p [ i ] ; cop [ 1 ] [ i ] = y [ i ] ; } Arrays . sort ( cop , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] o1 , int [ ] o2 ) { return Integer . compare ( o1 [ 1 ] , o2 [ 1 ] ) ; } } ) ; int [ ] count = new int [ n ] ; int [ ] num = new int [ 1000000001 ] ; for ( int i = 0 ; i < m ; i + + ) { num [ cop [ 1 ] [ i ] - 1 ] = + + count [ cop [ 0 ] [ i ] - 1 ] ; } for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < 5 - p [ i ] / 10 ; j + + ) { System . out . print ( " 0 " ) ; } System . out . print ( p [ i ] ) ; for ( int j = 0 ; j < 5 - ( num [ y [ i ] - 1 ] 1 ) / 10 ; j + + ) { System . out . print ( " 0 " ) ; } System . out . print ( num [ y [ i ] - 1 ] ) ; System . out . println ( " " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int 500 yen = sc . nextInt ( ) ; int 100 yen = sc . nextInt ( ) ; int 50 yen = sc . nextInt ( ) ; int value = sc . nextInt ( ) ; int max500 = value / 500 ; int max100 ; int result = 0 ; int nokori500 ; int nokori100 ; for ( int i = 0 ; i < max500 ; i + + ) { nokori500 = value - 500 * i ; max100 = ( value - i * 500 ) / 100 ; for ( int j = 0 ; j < max100 ; j + + ) { nokori100 = nokori500 - 100 * j ; if ( nokori100 % 50 = = 0 ) { result + + ; } } } System . out . println ( result ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ; int x = Integer . parseInt ( reader . readLine ( ) ) ; x = Math . pow ( x , 3 ) ; System . out . print ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kbScanner = new Scanner ( System . in ) ; int num = kbScanner . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { if ( args [ 0 ] < = 5 ) System . out . println ( " 0 " ) ; else if ( args [ 0 ] < = 12 ) System . out . println ( args [ 1 ] / 2 ) ; else System . out . println ( args [ 1 ] ) ; } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; system . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class ABC068B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = 1 ; i < = N ; i + + ) { if ( Math . pow ( 2 , i ) < = N & & N < Math . pow ( 2 , i + 1 ) ) { System . out . println ( ( int ) Math . pow ( 2 , i ) ) ; break ; } } } } import java . math . BigInteger ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . Scanner ; import java . util . AbstractMap . SimpleEntry ; import java . util . HashSet ; import java . util . Iterator ; class Main { static final int MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { long num = sc . nextLong ( ) ; A [ i ] = num ; } int MK = 62 ; int [ ] dp = new int [ MK ] ; for ( int k = 0 ; k < MK ; k + + ) { long mask = 1l < < k ; for ( int i = 0 ; i < N ; i + + ) { if ( ( A [ i ] & mask ) = = 0l ) { dp [ k ] + + ; } } } long ans = 0 ; for ( int k = 0 ; k < MK ; k + + ) { long tmp = 1l < < k ; tmp % = MOD ; tmp * = ( dp [ k ] * ( N - dp [ k ] ) ) % MOD ; tmp % = MOD ; ans + = tmp ; ans % = MOD ; } System . out . println ( ans % MOD ) ; } } package charactor ; import java . util . Scanner ; public class Sum _ of _ Numbers { public static void main ( String [ ] args ) { int sum = 0 ; StringBuilder out = new StringBuilder ( ) ; Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String words = sc . next ( ) ; if ( words . equals ( " 0 " ) ) break ; char ch [ ] = words . toCharArray ( ) ; sum = 0 ; for ( int i = 0 ; i < ch . length ; i + + ) { String str = String . valueOf ( ch [ i ] ) ; int num = Integer . parseInt ( str ) ; sum + = num ; } out = new StringBuilder ( out + ( sum + " \ n " ) ) ; } System . out . print ( out ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; byte max = 0 ; byte min = 123 ; byte input ; for ( int i = 0 ; i < 5 ; i + + ) { input = sc . nextByte ( ) ; max = Math . max ( max , input ) ; min = Math . min ( min , input ) ; } byte k = sc . nextByte ( ) ; if ( k > = max - min ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { System . out . println ( " Please input number . ( 1 < = x < = 100 ) " ) ; int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( " answer is " + x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int x = scn . nextInt ( ) ; int xr = Math . pow ( x , ( 1 / 5 ) ) ; int a = 0 , b = 0 ; boolean flg = true ; while ( flg ) { for ( b = 0 ; b > = xr ; b -- ) { if ( Math . pow ( a , 5 ) - Math . pow ( b , 5 ) = = x ) { flg = false ; break ; } } if ( flg ) { a + + ; } else break ; } System . out . println ( a + " " + b ) ; } } import java . util . Scanner ; public class Main { public static void Main ( Stirng [ ] args ) { int n = 0 ; while ( n = = 0 ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 | | A = = 7 ) { Scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 | | B = = 7 ) { if ( A + B ! = 12 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } Scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . out . println ( " Yes ! " ) ; } else { break ; } } } } } } Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * a ) ; import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void run ( ) { while ( sc . hasNext ( ) ) { Point [ ] p = new Point [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { p [ i ] = new Point ( sc . nextDouble ( ) , sc . nextDouble ( ) ) ; } if ( ! isInner ( p [ 0 ] , p [ 1 ] , p [ 2 ] , p [ 3 ] ) ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } } boolean isInner ( Point a , Point b , Point c , Point p ) { if ( p . sub ( a ) . mult ( b . sub ( a ) ) > 0.0 ) return false ; if ( p . sub ( b ) . mult ( c . sub ( b ) ) > 0.0 ) return false ; if ( p . sub ( c ) . mult ( a . sub ( c ) ) > 0.0 ) return false ; return true ; } public static void main ( String [ ] args ) { new Main . run ( ) ; } class Point { double x , y ; Point ( double x , double y ) { this . x = x ; this . y = y ; } Point sub ( Point p ) { return new Point ( x - p . x , y - p . y ) ; } double mult ( Point p ) { return x * p . y - y * p . x ; } } } public class Hankei { public static void main ( String [ ] args ) { double r = 2 ; double a , b , c ; a = r * r * Math . PI ; b = Math . PI ; c = a / b ; System . out . print ( ( int ) c ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } Array . sort ( a ) ; System . out . println ( a [ n - 1 ] - a [ 0 ] ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max _ x = Integer . MIN _ VALUE ; int max _ y = Integer . MIN _ VALUE ; int min _ x = Integer . MAX _ VALUE ; int min _ y = Integer . MAX _ VALUE ; int x = 0 ; int y = 0 ; int itizi = 0 ; for ( int i = 0 ; i < N ; i + + ) { x = sc . nextInt ( ) ; y = sc . nextInt ( ) ; if ( x > y ) { itizi = y ; y = x ; x = itizi ; } max _ x = Math . max ( x , max _ x ) ; min _ x = Math . min ( x , min _ x ) ; max _ y = Math . max ( y , max _ y ) ; min _ y = Math . min ( y , min _ y ) ; } long a = ( long ) Math . abs ( max _ x - min _ x ) * ( long ) Math . abs ( max _ y - min _ y ) ; long b = ( long ) Math . abs ( max _ x - min _ y ) * ( long ) Math . abs ( max _ y - min _ x ) ; if ( a > b ) System . out . println ( b ) ; else System . out . println ( a ) ; } } public class Main { public static void main ( String args [ ] ) { int x = 2 ; System . out . println ( x * * 3 ) ; } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } import java . utill . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int A1 = Math . abs ( A ) ; int V = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int B1 = Math . abs ( B ) ; int W = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int sp = V - W ; double a = Math . signum ( A ) ; double b = Math . signum ( B ) ; if ( a = = b ) { int k = B1 - A1 ; int def = Math . abs ( k ) ; } else { int def = B1 + A1 ; } if ( A = = B ) { System . out . println ( " YES " ) ; } else if ( V > W ) { if ( sp * T > = def ) { System . out . println ( " YES " ) ; } } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; system . out . println ( answer ) ; } } import java . util . * ; import java . sio . * ; public class CardPoker { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = b ) System . out . println ( " Draw " ) ; else if ( a = = 1 ) System . out . println ( " Alice " ) ; else if ( b = = 1 ) System . out . println ( " Bob " ) ; else if ( a > b ) System . out . println ( " Alice " ) ; else System . out . println ( " Bob " ) ; } } import java . util . * ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; InputStreamReader reader = new InputStreamReader ( System . in ) ; int n = sc . nextInt ( ) ; int s ; boolean p = false ; boolean w = false ; boolean g = false ; boolean y = false ; for ( int i = 0 ; i < n ; i + + ) { try { s = reader . read ( ) ; if ( ( char ) s = = ' P ' ) p = true ; else if ( ( char ) s = = ' W ' ) w = true ; else if ( ( char ) s = = ' G ' ) g = true ; else if ( ( char ) s = = ' Y ' ) y = true ; else t = false ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } if ( p = = w = = g = = true ) { if ( y = = false ) System . out . println ( " Three " ) ; else System . out . println ( " Four " ) ; } } } import java . lang . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int x = stdid . nextInt ( ) ; x = x * x * x ; System . out . println ( String . valueOf ( x ) + " \ r \ n " ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; } catch ( IOException e ) { System . out . println ( e ) ; } System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String po = sc . nextLine ( ) ; String p [ ] = po . substring ( " / " , 0 ) ; System . out . println ( ( Integer . parseInt ( p [ 1 ] ) < 5 ) ? " Heisei " : " TBD " ) ; } } import java . util . Scanner ; public class Coins { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int fiveHundred = Integer . parseInt ( scanner . nextLine ( ) ) ; int hundred = Integer . parseInt ( scanner . nextLine ( ) ) ; int fifty = Integer . parseInt ( scanner . nextLine ( ) ) ; int money = Integer . parseInt ( scanner . nextLine ( ) ) ; if ( money % 100 = = 50 ) { if ( fifty = = 0 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } fifty - = 1 ; money - = 50 ; } int total = 0 ; for ( int i = Math . min ( fiveHundred , Math . floorDiv ( money , 500 ) ) ; i > = 0 ; i -- ) { total + = countUp ( money - ( 500 * i ) , hundred , fifty ) ; } System . out . println ( total ) ; } public static int countUp ( int sum , int hundred , int fifty ) { int c = 0 ; for ( int i = Math . min ( hundred , sum / 100 ) ; i > = 0 ; i -- ) { if ( ( sum - ( i * 100 ) ) < = ( fifty * 50 ) ) { c + + ; } } return c ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } Main kari = new Main ( ) ; if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = kari . setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; Iterator it = setwise2 . iterator ( ) ; List < Integer > setList = new ArrayList < > ( ) ; while ( it . hasNext ( ) ) { setList . add ( it . next ( ) ) ; } for ( int i = 0 ; i < setList . size ( ) ; i + + ) { for ( int j = i ; j < setList . size ( ) ; j + + ) { setwise2 . add ( gcd ( setList . get ( i ) , setList . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwise2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise2 ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . util . Scanner ; Public class Main { public Static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; System . out . println ( answer ) ; } } import java . util . * ; public class JavaApplication69 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int C = in . nextInt ( ) ; if ( ( 5 < = A ) & & ( 7 < = B ) & & ( 5 < = C & & C < = 10 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Cube { public static void main ( String [ ] args ) { int x ; Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int pow = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { pow * = x ; } System . out . println ( pow ) ; } } import java . util . Scanner ; public class MMM { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class A _ 054 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) , B = sc . nextInt ( ) ; if ( A = = 1 ) { A = 14 ; } if ( B = = 1 ) { B = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( B > A ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } } class Main { public static void main ( String args [ ] ) { int x = 0 ; DataInputStream d = new DataInputStream ( System . in ) x = d ; x = d * d * d ; System . out . println ( x ) ; } } import java . util . Scanner ; class java { public static void main ( String [ ] args ) { Scanner hankei = new Scanner ( System . in ) ; int r = hankei . nextInt ( ) ; System . out . println ( r * r ) ; } } public class v { public static void main ( String [ ] args ) { int x ; x = 2 ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ThreeCube { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int a = kb . nextInt ( ) ; System . out . printf ( " % d \ n " , a * a * a ) ; } } public class Main { public static void main ( String args [ ] ) { int i , o ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( br . readline ( ) ) ; o = i * i * i ; System . out . println ( o ) ; } } import java . io . * ; public class Exercise { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . io * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , ans ; x = Integer . ParseInt ( br . readLine ) ; ans = x * x * x ; System . out . println ( ans ) ; } } 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 ( ) ; if ( ( a + b ) % 2 = = 1 ) System . out . println ( ( a + b ) / 2 + 1 ) ; else System . out . println ( ( atb ) / 2 ) ; } } import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( x * x * x ) System . out . println ( y ) ; } } import java . util . * ; import java . util . function . * ; public class Main { public static void main ( String [ ] args ) { long mod = 10 * 9 + 7 ; Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long [ ] A = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long c = 0 ; for ( int j = 0 ; j < N ; j + + ) { if ( ( ( A [ j ] > > > i ) & 1 ) = = 1 ) { c + + ; } } long a = ( c * ( N - c ) ) % m ; for ( int j = 0 ; j < i ; j + + ) { a = ( a < < 1 ) % m ; } ans + = a ; ans % = m ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class irohaDigit { public static void main ( String [ ] args ) { int N ; int D ; Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; D = sc . nextInt ( ) ; int d [ ] = new int [ 10 ] ; for ( int i = 0 ; i < D ; i + + ) { d [ sc . nextInt ( ) ] = 1 ; } int sum = 0 ; int start9 = 0 ; int maxD = String . valueOf ( N ) . length ( ) ; for ( int i = maxD - 1 ; i > = 0 ; i -- ) { int x = N / ( int ) ( Math . pow ( 10 , i ) ) ; N = N % ( int ) Math . pow ( 10 , i ) ; if ( d [ x ] = = 1 ) { { for ( int j = x ; j < 10 ; j + + ) { if ( d [ j ] ! = 1 ) { x = j ; break ; } else if ( j = = 9 ) { j = - 1 ; start9 = 1 ; } } } } if ( i = = ( maxD - 1 ) & & start9 = = 1 ) sum = sum + 10 * ( int ) Math . pow ( 10 , i ) ; else sum = sum + x * ( int ) Math . pow ( 10 , i ) ; if ( N = = 0 ) break ; } System . out . print ( sum ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) : String input = br . readLine ( ) ; int x = Integer . parseInt ( input ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] [ ] array = new int [ 8 ] [ 2 ] ; for ( int i = 0 ; i < N ; + + i ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; array [ i ] [ 1 ] = sc . nextInt ( ) ; } double total = 0.0d ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = 0 ; j < N ; j + + ) { if ( i = = j ) continue ; total + = Math . sqrt ( nijo ( array [ i ] [ 0 ] - array [ j ] [ 0 ] ) + nijo ( array [ i ] [ 1 ] - array [ j ] [ 1 ] ) ) ; } } System . out . println ( 2.0d * total / N ) ; } private int nijo ( int x ) { return x * x ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 , max = 1 , p ; i < n ; i + + ) { p = sc . nextInt ( ) ; if ( p = > max ) { count + + ; max = p ; } } System . out . println ( count ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList l = new ArrayList ( ) ; while ( sc . hasNext ( ) ) { String [ ] s = sc . next ( ) . split ( " , " ) ; double w = Double . parseDouble ( s [ 1 ] ) ; double h = Double . parseDouble ( s [ 2 ] ) ; if ( w / ( h * h ) > = 25 ) l . add ( Integer . parseInt ( s [ 0 ] ) ) ; } if ( l . isEmpty ( ) ) System . out . println ( " 該当なし " ) ; else f o ( Int ger i : l ) Sys e m . o ut.pri n tln ( i ) ; } } import java . util . * ; public class C { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; List < Info > list = new ArrayList < > ( m ) ; for ( int i = 0 ; i < m ; + + i ) { int p = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; list . add ( new Info ( p , y , i ) ) ; } Collections . sort ( list , ( I0 , I1 ) - > ( I0 . p ! = I1 . p ) ? I0 . p - I1 . p : I0 . y - I1 . y ) ; int x = 1 ; for ( int i = 0 ; i < m ; + + i ) { if ( i > 0 & & list . get ( i - 1 ) . p = = list . get ( i ) . p ) { + + x ; } else { x = 1 ; } list . get ( i ) . x = x ; } Collections . sort ( list , ( I0 , I1 ) - > I0 . o - I1 . o ) ; for ( int i = 0 ; i < m ; + + i ) { showZero ( 6 - String . valueOf ( list . get ( i ) . p ) . length ( ) ) ; System . out . print ( list . get ( i ) . p ) ; showZero ( 6 - String . valueOf ( list . get ( i ) . x ) . length ( ) ) ; System . out . println ( list . get ( i ) . x ) ; } } static void showZero ( int num ) { for ( int i = 0 ; i < num ; + + i ) { System . out . print ( 0 ) ; } } } class Info { int p ; int y ; int o ; int x ; public Info ( int p , int y , int o ) { this . p = p ; this . y = y ; this . o = o ; } } import java . math . BigDecimal ; import java . math . MathContext ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; BigDecimal x [ ] , y [ ] ; x = new BigDecimal [ N ] ; y = new BigDecimal [ N ] ; for ( int i = 0 ; i < N ; i + + ) { int x1 , y1 ; x1 = sc . nextInt ( ) ; y1 = sc . nextInt ( ) ; x [ i ] = new BigDecimal ( x1 ) ; y [ i ] = new BigDecimal ( y1 ) ; } int c = 2 ; for ( int i = 2 ; i < = N ; i + + ) { c * = i ; } c = c / N ; int C = 1 ; for ( int i = 2 ; i < = N ; i + + ) { C * = i ; } BigDecimal sum = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { BigDecimal x1 = x [ i ] . add ( x [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; BigDecimal y1 = y [ i ] . add ( y [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; x1 = x1 . multiply ( x1 ) ; y1 = y1 . multiply ( y1 ) ; x1 = x1 . add ( y1 ) ; x1 = x1 . sqrt ( MathContext . DECIMAL64 ) ; sum = sum . add ( x1 ) ; } } sum = sum . multiply ( new BigDecimal ( c ) ) ; sum = sum . divide ( new BigDecimal ( C ) , 10 , BigDecimal . ROUND _ HALF _ UP ) ; System . out . println ( sum . toPlainString ( ) ) ; } } public class XCubic { public static void main ( String [ ] args ) { int x = 2 ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( Math . pow ( x , 3 ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Atc { public static void main ( String [ ] args ) { Integer x = 5 ; Integer y = 7 ; boolean b = false ; Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > inputs = new ArrayList < > ( ) { { add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; add ( sc . nextInt ( ) ) ; } } ; if ( inputs . remove ( x ) & & inputs . size ( ) = = 2 ) { if ( inputs . remove ( x ) & & inputs . size ( ) = = 1 ) { if ( inputs . remove ( y ) & & inputs . size ( ) = = 0 ) { b = true ; } } } if ( b ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static int cul ( int x ) { return Math . pow ( x , 3 ) ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } import java . util . * ; class Main { static int a , b ; static boolean s ; public static void main ( String [ ] $ ) { Scanner c = new Scanner ( System . in ) ; int k = c . nextInt ( ) , x = c . nextInt ( ) , y = c . nextInt ( ) ; x * = a = x < 0 ? - 1 : 1 ; y * = b = y < 0 ? - 1 : 1 ; if ( s = x < y ) x ^ = y ^ ( y = x ) ; int n = ( x + y + k - 1 ) / k ; if ( k % 2 = = 0 & & ( x + y ) % 2 = = 1 ) { System . out . println ( - 1 ) ; return ; } else if ( x + y < k ) if ( ( x + y ) % ( n = 2 ) = = 1 ) { System . out . println ( 3 ) ; p ( x , x - k ) ; p ( x + ( k + x - y ) / 2 , x - k + ( k - x + y ) / 2 ) ; p ( x , y ) ; return ; } else if ( ( k - ( x + y ) % k ) % k % 2 = = 1 ) n + + ; System . out . println ( n ) ; int m = ( k * n - x - y ) / 2 , i = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( m > k * i ) { p ( 0 , - k * i ) ; } else if ( x + m > k * i ) { p ( k * i - m , - m ) ; } else { p ( x , k * i - 2 * m - x ) ; } } } static void p ( int x , int y ) { System . out . println ( a * ( s ? y : x ) + " " + b * ( s ? x : y ) ) ; } } double a , b , c , d ; system . out . println ( `` enter value a `` ) ; a = sc . nextDouble ( ) ; system . out . println ( `` enter value b `` ) ; b = sc . nextDouble ( ) ; system . out . println ( `` enter value c `` ) ; c = sc . nextDouble ( ) ; system . out . println ( `` enter value d `` ) ; d = sc . nextDouble ( ) ; if ( ( 1 > a ) | | ( a > 10000 ) | | ( 1 > b ) | | ( b > 10000 ) | | ( 1 > c ) | | ( c > 10000 ) | | ( 1 > d ) | | ( d > 10000 ) ) { system . out . println ( `` error `` ) } if ( ( a * b - c * d ) > = 0 ) { system . out . println ( a * b ) } ; else { system . out . println ( c * d ) } ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . UnsupportedEncodingException ; public class Sample { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in , " UTF-8 " ) ) ; int n = br . read ( ) ; if ( n > = 1 & & n < = 100 ) System . out . println ( n * n * n ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; if ( a = = 1 ) a + = 13 ; if ( b = = 1 ) b + = 13 ; if ( a > b ) System . out . println ( " Allice " ) ; else if ( b > a ) System . out . println ( " Bob " ) ; else System . out . println ( " Draw " ) ; input . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) ! = null ) { int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } stdReader . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . io . * ; import java . util . * ; import java . lang . * ; public class area { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } mport java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String input = br . readLine ( ) ; if ( input . equals ( " 0 " ) ) { break ; } int total = 0 ; char [ ] charAry = input . toCharArray ( ) ; for ( int i = 0 ; i < charAry . length ; i + + ) { total + = Character . getNumericValue ( charAry [ i ] ) ; } System . out . println ( total ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int v = Integer . parseInt ( line ) ; int v2 = v ; v2 * = v * v ; System . out . println ( v2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sc . nextInt ( ) , x = 0 , y = 0 ; for ( int i = 1 ; i < n ; i + + ) { x + = 800 ; if ( i % 15 = = 0 ) { y + = 200 ; } } System . out . println ( x - y ) ; } } public class Main { public static void main ( String [ ] args ) { double x ; x = x * x * x ; System . out . printf ( " % .0f " , x ) ; } } import java . util . * ; import java . io . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; if ( k < Math . abs ( a - b ) ) flag = true ; if ( k < Math . abs ( a - c ) ) flag = true ; if ( k < Math . abs ( a - d ) ) flag = true ; if ( k < Math . abs ( a - e ) ) flag = true ; if ( k < Math . abs ( b - c ) ) flag = true ; if ( k < Math . abs ( b - d ) ) flag = true ; if ( k < Math . abs ( b - e ) ) flag = true ; if ( k < Math . abs ( c - d ) ) flag = true ; if ( k < Math . abs ( c - e ) ) flag = true ; if ( k < Math . abs ( d - e ) ) flag = true ; if ( flag = = false ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } } import java . util . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class D { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int BigH2 = H2 - H1 ; int BigH2M2 = BigH2 * 60 + M2 ; int clearTime = BigH2M2 - M1 ; int answer = clearTime - K ; System . out . println ( answer ) ; } } class MAIN { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readline ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( sanjo ( x ) ) ; } public int sanjo ( int x ) { int y = x * x * x ; return y ; } } public class Main { System . out . println ( x * x * x ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int average = Math . ceil ( ( a + b ) / 2 ) ; System . out . println ( average ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a ; int b ; a = Integer . parseInt ( br . readLine ( ) ) ; sannjyou sa = new sannjyou ( ) ; b = sa . sann ( a ) ; System . out . println ( b ) ; } public class sannjyou { private int a ; public int sann ( int b ) { a = b ; int k ; k = a * a * a ; return k ; } } } import java . io . * class Main { public static void main ( String args [ ] ) { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = buf . readLine ( ) ; int x = Integer . parseInt ( a ) ; x = x * x * x ; System . out . println ( x ) ; } } puts gets . to _ i * * 3 import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { while ( scanner . hasNext ( ) ) { String [ ] s = scanner . nextLine ( ) . split ( " , " ) ; Student student = new Student ( s [ 0 ] , Double . parseDouble ( s [ 1 ] ) , Double . parseDouble ( s [ 2 ] ) ) ; if ( student . bmi . is ? ? ? ? ? ? ( ) ) { System . out . println ( student . ? ? ? ? ± ? ? ? ? ? ? ? ) ; lass tudent inal tring ? ? ? ± ? ? ? ? ? ? ? ; f nal B i b i ; S udent ( S t ring ? ? ? ± ? ? ? ? ? ? ? , d o ble ? ? ? ? ? k g , d o ble ? ? ? ? ? m ) { h s . ? ? ? ? ± ? ? ? ? ? ? ? = ? ? ± ? ? ? ? ? ? ? ; t h i s bmi = ne miI pl ( ? ? ? ? ? ? k g , ? ? ? ? ? m ) ; } } n e face Bmi in ? ? ? ? ? ? ? ? ¢ ? ? ? ? = 2 5 ; b ol e n is ? ? ? ? ? ( ) ; } c l a s BmiIm l imple ents Bmi { pri a e final doubl ? ? ? ? ? k g ; p r iv a e final doubl ? ? ? ? ? m ; B m i I m l ( doubl e ? ? ? ? ? k g , d o ub l ? ? ? ? ? m ) { t h i . ? ? ? ? ? k g = ? ? ? ? k g ; t h is . ? ? ? ? ? m = ? ? ? ? m ; } p u b i doubl calc ( { r e t r ? ? ? ? ? k g / M at . ow ( ? ? ? ? ? ? m , 2 ) ; } @ O v r i de publi boole n is ? ? ? ? ? ( ) { r e t r calc ( > = ? ? ? ? ? ? ? ? ¢ ? ? ? ? ; } } class Coin { static final int INF = 100000 ; public static int coinChangeMod ( int d [ ] , int n , int k ) { int [ ] M = new int [ n + 1 ] ; M [ 0 ] = 0 ; int [ ] S = new int [ n + 1 ] ; S [ 0 ] = 0 ; for ( int j = 1 ; j < = n ; j + + ) { int minimum = INF ; int coin = 0 ; for ( int i = 1 ; i < = k ; i + + ) { if ( j > = d [ i ] ) { if ( ( 1 + M [ j - d [ i ] ] ) < minimum ) { minimum = 1 + M [ j - d [ i ] ] ; coin = i ; } } } M [ j ] = minimum ; S [ j ] = coin ; } int l = n ; while ( l > 0 ) { System . out . println ( d [ S [ l ] ] ) ; l = l - d [ S [ l ] ] ; } return M [ n ] ; } public static void main ( String [ ] args ) { int d [ ] = { 0 , 1 , 2 , 3 } ; coinChangeMod ( d , 5 , 3 ) ; } } pmport java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } } public class Main { ? ? ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int ans = x * x * x ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( ans ) ; ? ? ? ? ? ? ? ? } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int countFive = 0 ; int countSeven = 0 ; if ( a = = 5 ) { countFive + + ; } else { countSeven + + ; } if ( b = = 5 ) { countFive + + ; } else { countSeven + + ; } if ( c = = 5 ) { countFive + + ; } else { countSeven + + ; } if ( countFive = 5 ) { System . out . println ( " YES " ) } else { System . out . println ( " NO " ) } } } import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; public class Haiko { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Map < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < 3 ; i + + ) { int k = scan . nextInt ( ) ; map . put ( k , map . getOrDefault ( k , 0 ) + 1 ) ; } if ( map . get ( 5 ) = = 2 & & map . get ( 7 ) = = 1 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; String date = scan . next ( ) ; System . out . println ( date . compareTo ( " 2019 / 04 / 30 " ) < = 0 ? " Heisei " : " TBD " ) ; } } import java . util . Scanner ; public class App { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nextInt = sc . nextInt ( ) ; System . out . println ( nextInt * nextInt * nextInt ) ; } } import lib . Input ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Input . getInt ( " x " ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x < = 100 ; int cubic = x * x * x ; System . out . println ( cubic ) ; } } public class TwoCoins { public static void main ( string args [ ] ) { int coinVal ; int coinVal2 ; int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; system . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; while ( n > = answer ) { answer * = 2 ; } System . out . println ( answer / 2 ) ; } } pimport java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Map < Integer , int [ ] > map = new TreeMap < Integer , int [ ] > ( ) ; for ( int i = 0 ; i < m ; i + + ) { int [ ] array = new int [ 2 ] ; array [ 0 ] = i ; array [ 1 ] = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; map . put ( b , array ) ; } int [ ] ary = new int [ n ] ; String [ ] s = new String [ m ] ; for ( int [ ] num : map . values ( ) ) { ary [ num [ 1 ] - 1 ] + + ; s [ num [ 0 ] ] = String . format ( " % 06d % 06d " , num [ 1 ] , ary [ num [ 1 ] - 1 ] ) ; } StringBuilder sb = new StringBuilder ( ) ; for ( String ss : s ) { sb . append ( ss + " \ n " ) ; } System . out . println ( sb ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = < 5 ) { System . out . println ( 0 ) ; return ; } else if ( a > = 13 ) { System . out . println ( b ) ; } else { System . out . println ( b / 2 ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; scan . nextLine ( ) ; List < Integer > values = Arrays . sort ( Arrays . of ( scan . nextLine ( ) . split ( " " ) ) . map { i - > new Integer ( i ) ; } ; ) ; Map < Integer , Integer > searchResult = new HashMap ( ) < > ; int i = 0 ; for ( i ; i < values . get ( values . size - 1 ) ; i + + ) { searchResult . put ( calc ( list , i ) , i ) ; } searchResult Object [ ] mapkey = mMap . keySet ( ) . toArray ( ) ; Arrays . sort ( mapkey ) ; for ( Integer nKey : mMap . keySet ( ) ) { System . out . println ( mMap . get ( nKey ) ) ; break ; } } public static int calc ( List < Integer > list , Integer point ) { Integer result = 0 ; int i = 0 ; for ( i ; i < list . size ; i + + ) { result + = ( ( list . get ( i ) - point ) * ( list . get ( i ) - point ) ) ; } return result ; } } import java . util . Scanner ; import java . util . Random ; import java . math . * ; public class tokyokaijo2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int j = 0 , h = 0 ; int x = 0 , y = 0 , z = 0 , c = 0 ; j = Math . abs ( w ) ; h = Math . abs ( v ) ; if ( j - h > 0 ) { System . out . println ( " NO " ) ; } else { x = v * t + a ; y = a - v * t ; z = w * t + b ; c = b - w * t ; if ( b > a & & x > = z ) { System . out . println ( " YES " ) ; } else if ( b < a & & y < = c ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class datetest { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; Date heiseiDate = sdf . parse ( " 2019 / 04 / 30 " ) ; if ( formatDate . before ( heiseiDate ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { ArrayList < String > array = new ArrayList < String > ( ) ; Scanner scanner = new Scanner ( System . in ) ; int a = sccaner . nextInt ( ) ; while ( true ) { String s = scanner . nextString ( ) ; if ( String . valueOf ( s ) . length ( ) = = 0 ) { break ; } array . add ( s ) ; } int n = 0 ; boolean i = false ; for ( n = 0 ; n < a ; n + + ) { if ( " Y " = = array . get ( n ) ) i = true ; } if ( i ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = N1 [ i ] ; break ; } } if ( count = = 5 ) count = 4 ; System . out . println ( sum - 10 * count + min ) ; } import java . io . * ; import java . util . * ; import java . lang . * ; public class area { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int n , l ; n = in . nextInt ( ) ; l = in . nextInt ( ) ; String [ ] S = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) S [ i ] = in . next ( ) ; S . sort ( ) ; for ( int i = 0 ; i < n ; i + + ) System . out . print ( S [ i ] ) ; System . out . println ( ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; return 0 ; } } public static void main ( String [ ] args ) { if ( ! args [ 0 ] . isEmpty ) { int num = args [ 0 ] ; } int retNum = num * num * num ; System . out . println ( retNum ) ; } import java . io . * ; import java . util . * ; import java . lang . * ; public class file { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } class Main { public static void main ( String args [ ] ) { double x ; System . out . println ( Math . pow ( x , 2 ) ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int i = br . readLine ( ) ; i = i * i ; System . out . println ( i ) ; } } import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; if ( A < = B ) { if ( A * V * T < = B * V * T ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { int B = - ( B * T ) ; int A = - ( A * T ) ; if ( A * V * T > = B * V * T ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } 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 ( ) ; if ( a > b ) { System . out . println ( " Alice " ) ; } else if ( a = = b ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } import java . util . * ; class test { public static void main ( String args [ ] ) { } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] A = new int [ N ] ; int [ ] B = new int [ N ] ; int Asum = 0 ; int Bsum = 0 ; int difsum = 0 ; int cntdif = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; Asum + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; Bsum + = B [ i ] ; } if ( Asum < Bsum ) { System . out . println ( 0 ) ; } else { ArrayList bigger < int > = new ArrayList < int > ( ) ; for ( int j = 0 ; j < N ; j + + ) { if ( int dif = A [ j ] - B [ j ] < 0 ) { difsum + = dif ; cnt + + ; } else if ( dif > 0 ) { bigger . add ( dif ) ; } } int big [ ] = bigger . toArray ( new int [ bigger . size ( ) ] ) ; int temp ; for ( int k = 0 ; k < bigger . length ; k + + ) { for ( int l = 0 ; l < bigger . length - k - 1 ; l + + ) { if ( bigger [ l ] > bigger [ l + 1 ] ) { temp = bigger [ l ] ; bigger [ l ] = bigger [ l + 1 ] ; bigger [ l + 1 ] = temp ; } } } int m = 0 ; while ( difsum < = 0 ) { difsum + = bigger [ m ] ; m + + ; cnt + + ; } } System . out . println ( cnt ) ; } } class Main { int x ; System . out . println ( x ^ 3 ) ; } package src . AtCoder . abc145 ; import java . util . Scanner ; public class abc145 _ a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( Math . pow ( sc . nextInt ( ) , 2 ) ) ; } } import java . io . * ; public class cubic { public static void main ( String [ ] args ) throws IOException { String s ; int a ; int b ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; s = buf . readLine ( ) ; a = Integer . parseInt ( s ) ; b = a * a * a ; System . out . println ( b ) ; } } import java . util . Scanner ; public class Main054A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = b ) { System . out . println ( " draw " ) ; } else if ( a = = 1 ) { System . out . println ( " Alice " ) ; } else if ( b = = 1 ) { System . out . println ( " Bob " ) ; } else if ( a > b ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } sc . close ( ) ; } } package aoj3 ; public class ? ? ? Main { public static void main ( String args [ ] ) { System . out . println ( " Hello World " ) ; int = x System . out . printl ( 1 ? ? ? x ? ? ? 100 ) } } import java . util . Scanner ; public class ABC068B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; for ( int i = N ; i > = 1 ; i -- ) { if ( i % 2 = = 0 ) { System . out . println ( i ) ; break ; } } } } # include < bits / stdc + + . h > using namespace std ; int main ( ) { int a , b ; cin > > a > > b ; if ( a = = 13 ) cout < < b < < endl ; else if ( a < = 5 ) cout < < 0 < < endl ; else cout < < b / 2 ; return 0 ; } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } Main kari = new Main ( ) ; if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = kari . setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; Iterator < Integer > it = setwise2 . iterator < > ( ) ; List < Integer > setList = new ArrayList < > ( ) ; while ( it . hasNext ( ) ) { setList . add ( it . next ( ) ) ; } for ( int i = 0 ; i < setList . size ( ) ; i + + ) { for ( int j = i ; j < setList . size ( ) ; j + + ) { setwise2 . add ( gcd ( setList . get ( i ) , setList . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwise2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise2 ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) thorws java . lang . Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = input . readLine ( ) ; int output = Integer . parseInt ( x ) ; output = output ^ 3 ; System . out . println ( output ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( anser ) ; } } public class Main { public static void main { int x ; System . out . println ( x * x * x ) ; } } import java . io public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; class At { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double z = ( n + m ) / 2.00 ; int z1 = ( int ) z ; int z2 = n + m ; if ( z2 % 2 ! = 0 ) { if ( z1 % 2 = = 1 ) { z1 + = 1 ; } } System . out . println ( z1 ) ; } } import java . util . Scanner ; public class Main { public static int [ ] powerCard = new int [ ] { 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 1 } ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; String [ ] card = s . split ( " " ) ; int i = Integer . parseInt ( card [ 0 ] ) ; int j = Integer . parseInt ( card [ 1 ] ) ; if ( ( i < 14 & & j < 14 ) & & ( i > 0 & & j > 0 ) { for ( int k = 0 ; k < powerCard . length ; k + + ) { if ( powerCard [ k ] = = i ) { i = k ; } if ( powerCard [ k ] = = j ) { j = k ; } } if ( i > j ) { System . out . println ( " Alice " ) ; } else if ( i < j ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } else { System . out . println ( " Draw " ) ; } } } import java . util * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N + 1 ] ; B [ 0 ] = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; B [ i + 1 ] = B [ i ] + A [ i ] ; } double C = B [ N ] / N ; int D = ( int ) C ; int x = D ; int y = 0 ; if ( C > D + 0.5 ) { x = x + 1 ; } for ( int j = 0 ; j < N ; j + + ) { y = y + ( A [ j ] - x ) * ( A [ j ] - x ) ; } System . out . println ( y ) ; } } import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ans = 0 ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputnum ; int ans ; while ( true ) { inputnum = sc . nextInt ( ) ; if ( inputnum = = 0 ) break ; while ( inputnum ! = 0 ) { ans + = inputnum % 10 ; inputnum - = inputnum % 10 ; if ( inputnum = = 0 ) break ; inputnum = inputnum / 10 ; } System . out . println ( ans ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] check = new int [ 3 ] ; check [ 0 ] = int A = scan . nextInt ( ) ; check [ 1 ] = int B = scan . nextInt ( ) ; check [ 2 ] = int C = scan . nextInt ( ) ; int count _ 5 = 0 ; int count _ 7 = 0 ; for ( int i = 0 ; i < check . length ; i + + ) { if ( check [ i ] = = 5 ) { count _ 5 + + ; } else if ( check [ i ] = = 7 ) { count _ 7 + + ; } check [ i ] } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) * ( x [ j ] * x [ i ] - x [ i ] * x [ i ] ) ) ; } if ( Math . sqrt ( sum ) = = int ( Math . sqrt ( sum ) ) ) { counter + + ; } } } System . out . print ( counter ) ; } } import java . util . Scanner ; public class Test1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int a = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 1 ; ; i + + ) { int b = a % 10 ; a = ( a - b ) / 10 ; sum = sum + b ; if ( a = = 0 ) break ; } if ( sum = = 0 ) break ; System . out . printf ( " % d \ n " , sum ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int num ; String buf ; try { BufferdReader br = new BufferdeReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; num = Integer . parseInt ( buf ) ; System . out . println ( num * num * num ) ; } catch ( Exception e ) { } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( problem145a ( r ) ) ; } private static int problem145a ( int r ) { return r * r ; } import java . io . * ; public class AOJ2 { public static void main ( String [ ] args ) { String line ; int x ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } catch ( NumberFormatException e ) { System . out . println ( e ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . lang . * ; import java . io . * ; class MAIN { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readline ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( sanjo ( x ) ) ; } public static int sanjo ( int x ) { int y = x * x * x ; return y ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; int ans = aaa + bbb + ccc + ddd + eee + min - 10 ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; if ( A = = B ) { System . out . println ( " DRAW " ) ; } else if ( A = = 1 & & B > = 2 & & B < = 13 ) { System . out . println ( " Alice " ) ; } else if ( B = = 1 & & A > = 2 & & B < = 13 ) { System . out . println ( " Bob " ) ; } else if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( A < B ) { System . out . println ( " Bob " ) ; } } } import java . util . * ; public class HinaArare { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Character > list = new ArrayList < Character > ( ) ; while ( n -- > 0 ) list . add ( sc . next ( ) . charAt ( 0 ) ) ; List < Character > list2 = new ArrayList < Character > ( new HashSet < > ( list ) ) ; if ( list2 . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else if ( list2 . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } } } import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; a = a * a * a ; System . out . println ( a ) ; } } import java . io . * ; public class B { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { System . out . println ( " 値を入力してください : " ) ; String line = reade r . r adLine ) ; i t n = I n teger.pa r s e nt ( i e ; Syste m .out.pri n tln ( n * * n ) ; } cat c h ( IOEx c e p t i o n ) Syst m .out.printl ( e ) } } } import java . util . * ; public class test { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int [ ] array = new int [ 6 ] ; for ( int i = 0 ; i < array . length ; i + + ) { array [ i ] = reader . nextInt ( ) ; } if ( array [ 4 ] - array [ 0 ] < = array [ 5 ] ) System . out . println ( " Yay ! " ) ; else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; if ( a < 0 ) { b = a * - 1 ; } if ( ( V - W ) * T > = b | | a = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class OneCardPoker { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int alice = sc . nextInt ( ) , bob = sc . nextInt ( ) ; if ( alice = = 1 & & bob ! = 1 ) System . out . println ( " Alice " ) ; else if ( bob = = 1 & & alice ! = 1 ) System . out . println ( " Bob " ) ; else if ( alice < bob ) System . out . println ( " Bob " ) ; else if ( alice > bob ) System . out . println ( " Alice " ) ; else System . out . println ( " Draw " ) ; } } public class main { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < = x & & x < = 100 ) { ; System . out . println ( x * x * x ) ; } } } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; if ( n _ customer > 1 ) { while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } } System . out . println ( sold ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int re = ( h * h ) + ( r * r ) ; double res = Math . sqrt ( re ) ; System . out . println ( res ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . util . * public class main { public static void main ( Staring [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] dist = new int [ 5 ] ; for ( int i = 5 ; i < 5 ; i + + ) { dist [ i ] = sc . nextInt ( ) ; } int limit = sc . nextInt ( ) ; if ( a [ 4 ] - a [ 0 ] < k ) { System . out . println ( " Yay ! " ) ; return 0 ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; import java . io . * ; import java . awt . geom . * ; public class TaskC { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; long MOD = 1 _ 000 _ 000 _ 007 ; String [ ] s = br . readLine ( ) . split ( " " ) ; long n = Long . parseLong ( s [ 0 ] ) ; long m = Long . parseLong ( s [ 1 ] ) ; if ( m > n + 1 | | m < n - 1 ) { System . out . println ( 0 ) ; System . exit ( 0 ) ; } long fact1 = 1 ; long fact2 = 1 ; for ( int i = 0 ; i < m ; i + + ) { fact1 * = ( i + 1 ) ; fact1 % = MOD ; } for ( int i = 0 ; i < n ; i + + ) { fact2 * = ( i + 1 ) ; fact2 % = MOD ; } long ans = ( fact1 * fact2 ) % MOD ; if ( m = = n ) ans * = 2 ; ans % = MOD ; System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int input = args [ 0 ] ; int output = input * input * input ; System . out . println ( output ) ; } } import java . util . Scanner ; public class P { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int hdeg = 30 * h ; int mdeg = 6 * m ; int deg = Math . abs ( hdeg - mdeg ) ; double cosdeg = Math . cos ( deg * Math . PI / 180 ) ; double asrq = a * a ; double bsqr = b * b ; double c = Math . sqrt ( asqr + bsqr - 2 * a * b * cosdeg ) ; System . out . println ( c ) ; } } System . out . println ( Math . pow ( ( double ) x , 3d ) ) ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) , M = sc . nextInt ( ) , i , j , k , l ; String [ ] a = new String [ N ] , b = new String [ M ] ; boolean f = true ; for ( i = 0 ; i < N ; i + + ) { a [ i ] = sc . next ( ) ; } for ( i = 0 ; i < M ; i + + ) { b [ i ] = sc . next ( ) ; } for ( i = 0 ; i < N - M + 1 ; i + + ) { for ( j = 0 ; j < N - M + 1 ; j + + ) { for ( k = 0 ; k < M ; k + + ) { for ( l = 0 ; l < M ; l + + ) { if ( a [ i + k ] . charAt ( j + l ) ! = b [ k ] . charAt ( l ) ) { f = false ; break ; } } } if ( f = = true ) { System . out . println ( " Yes " ) ; System . exit ( 0 ) ; ; } f = true ; } } System . out . println ( " No " ) ; } import java . util . Scanner ; public class AtcoderBCA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = sc . nextInt ( ) ; int hoge ; for ( int i = 0 ; i < a . length ; i + + ) { for ( int j = 0 ; j < i ; j + + ) { if ( a [ i ] < a [ j ] ) { hoge = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = hoge ; } } } hoge = a [ 1 ] - a [ 2 ] ; int task = hoge + a [ 2 ] ; System . out . println ( task ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; line = in . readLine ( ) System . out . print ( Integer . parseInt ( line ) ^ 3 ) ; in . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( - 1 ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; int x , cube ; x = Integer . parseInt ( r . readLine ) ; cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { { public static void main ( String [ ] args ) { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = buf . readLine ( ) ; int x = Integer . parseInt ( a ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . lang . Math ; class Test { public static void main ( String [ ] args ) ? ? ? throws java . io . IOException { int c ; c = System . in . read ( ) ; System . out . println ( pow ( c , 3 ) ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) int b = sc . nextInt ( ) ; String c [ ] = new String [ a ] ; for ( int i = 0 ; i < b ; i + + ) { c [ i ] = sc . next ( ) ; } Arrays . sort ( c ) ; for ( int i = 0 ; i < b ; i + + ) { System . out . print ( c [ i ] ) ; } } } import java . util . * ; public class xCubic { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; System . out . println ( Math . round ( Math . pow ( x , 3 ) ) ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " x * x * x " ) ; } } import java . util . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String inp [ ] = br . redaLine ( ) ; int a = Integer . parseInt ( inp [ 0 ] ) ; int b = Integer . parseInt ( inp [ 1 ] ) ; if ( a < = 12 & & a > = 6 ) b / = 2 else if ( a < = 5 ) b = 0 ; System . out . print ( b ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int getValue = sc . nextInt ( ) ; int res = getValue * getValue * getValue ; System . out . println ( res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cnt = 0 ; String str = " " ; int N1 = Integer . parseInt ( sc . next ( ) ) ; int N2 = Integer . parseInt ( sc . next ( ) ) ; int W1 = Integer . parseInt ( sc . next ( ) ) ; int W2 = Integer . parseInt ( sc . next ( ) ) ; System . out . print ( Math . max ( N1N2 , W1 * W2 ) ) ; System . out . println ( ) ; } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int answer = ( int ) Math . pow ( x , 3 ) ; System . out . println ( answer ) ; } } package Contest1506 ; import java . util . Scanner ; public class A1506 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; scn . close ( ) ; System . out . println ( ( k = = 1 ) ? " 0 " : n - k ) ; } } import java . io . * ; public class X Cubic { public static void main ( String [ ] args ) throws IOException { int x , x _ 3 ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; x _ 3 = x * x * x ; System . out . println ( x _ 3 ) ; } } public class Main { public static cul int ( int x ) { y = x * x * x ; return y ; public static void main ( String [ ] args ) { int y = int ( x ) ; Sytem . out . println ( y ) ; } } # include " stdio.h " int main ( x ) { printf ( " % d \ n " , x * x * x ) ; } import java . util . * ; public class Main { public static Long gcd ( Long x , Long y ) { if ( x < y ) return gcd ( y , x ) ; if ( y = = 0 ) return x ; return gcd ( y , x % y ) ; } public static Long lcm ( Long x , Long y ) { return x * y / gcd ( x , y ) ; } public static Long fac ( Long x ) { if ( x = = 0 ) return x + 1 ; return x * fac ( x - 1 ) ; } public static Long per ( Long x , Long y ) { return fac ( x ) / fac ( x - y ) ; } public static Long com ( Long x , Long y ) { return per ( x , y ) / fac ( y ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; Long b = sc . nextLong ( ) ; Long c = sc . nextLong ( ) ; Long [ ] in = new int [ a ] ; double d = 0 ; Long e = a - a ; Long f = e ; Long g = e ; f + + ; for ( int i = 0 ; i < a ; i + + ) { in [ i ] = sc . nextLong ( ) ; } Arrays . sort ( in ) ; for ( int i = 0 ; i < b ; i + + ) { d + = in [ a - i - 1 ] ; } d / = b ; for ( int i = 0 ; i < a ; i + + ) { if ( i > = a - c & & in [ i ] = = in [ a - b ] ) { f + + ; if ( i > = a - b ) { g + + ; } } } for ( Long i = g ; i < = f ; i + + ) { e + = com ( f , i ) ; } System . out . println ( d ) ; System . out . println ( e ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; system . out . println ( x * x * x ) ; } catch ( Exception e ) { } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; Public class Main { Static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; System . out . println ( answer ) ; } } import java . lang . * ; import java . util . * ; ? ? ? ? class Main { ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? Scanner stdId = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? ? ? int n = stdId . nextInt ( ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int sum = 0 ; sum = x * x * x ; System . out . println ( sum ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( Systm . in ) ; int r , sum ; r = sc . nextInt ( ) ; System . out . print ( r ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . next ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; ? ? class Main { ? ? ? ? public static void main ( String [ ] args ) throws java . io . IOException { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ? ? ? ? ? ? ? ? ? ? String hoge = input . readLine ( ) ; ? ? ? ? ? ? ? ? int i = Integer . parseInt ( hoge ) ; ? ? ? ? ? ? ? ? ? ? System . out . println ( i * i * i ) ; ? ? ? ? } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } int setGcd ( Set < Integer > s ) { Set < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise . size ( ) = = 1 ) { if ( setwize . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA = new String [ ] ; String [ ] imgB = new String [ ] ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = " " ; imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = " " ; imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . * ; import java . io . * ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; short x = scan . nextShort ( ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int x = stdin . nextInt ( ) ; if ( x > = 1 | | x < = 100 ) { System . out . println ( x * x * x ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; int b ; if ( a < 0 ) { b = a * - 1 ; } if ( ( V - W ) * T > = b | | a = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( a + e < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } public class Main { public static void main ( String [ ] args ) { Int x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } 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 ( ) ; if ( a > = 13 ) { System . out . println ( B ) ; } else if ( a < = 12 & & a > = 6 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 1 ; for ( int i = 0 ; i < N ; i + + ) { max = Math . pow ( 2 , i ) ; if ( max > N ) { break ; } } max = max / 2 ; System . out . println ( max ) ; } } public class ITP1 _ 2 _ A { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . next ( ) ; List < String > list = new ArrayList < > ( ) ; replace ( list , new StringBuilder ( text ) , " " , 0 ) ; int maxScoore = 0 ; int maxIndex = 0 ; int index = 0 ; for ( String str : list ) { int score = 0 ; for ( int i = 0 ; i < str . length ; i + + ) { if ( str . charAt ( i ) = = ' ? ' ) { continue ; } if ( str . charAt ( i ) = = ' D ' ) { score + + ; } else { if ( str . charAt ( i + 1 ) = = ' D ' ) { score + + ; } } } if ( score > maxScore ) { maxScore = score ; maxIndex = index ; } index + + ; } return list . get ( maxIndex ) } private void replace ( List < String > list , String text , String tmp , int index ) { for ( int i = index ; i < text . length ) { tmp + = text . charAt ( i ) ; if ( text . charAt ( i ) = = ' ? ' ) { replace ( list , new StringBuilder ( text ) , tmp + ' P ' , i + 1 ) ; replace ( list , new StringBuilder ( text ) , tmp + ' D ' , i + 1 ) ; } } list . add ( tmp + ' \ n ' ) ; } } public class Main { public static cul int ( int x ) { x = x * * 3 ; return x ; } public static void main ( String [ ] args ) { cul ( x ) ; Sytem . out . println ( x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( reader . readLine ( ) ) ; x = Math . pow ( x , 3 ) ; System . out . print ( x ) ; } } import java . util . Scanner ; public class Abc127A { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int age = in . nextInt ( ) ; int cost = in . nextInt ( ) ; in . close ( ) ; int ans = age > 12 ? cost : age < 6 ? 0 : cost / 2 ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x = 6 * * 3 ; System . out . prinln ( x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word ; try { word = reader . readLine ( ) ; int num = Integer . parseInt ( word ) ; int ans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { reader . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } } Compile Error Logs : You are not authorized to see the message . ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Judge : 4 / 4 JAVA CPU : 00.03 sec Memory : 24408 KB Length : 723 B 2016 - 02 - 22 23 : 58 2016 - 02 - 22 23 : 58 ? ? ? ? ? ? ? ? ? ? ? ± ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ase erdict PU ime emory n ut ase ame ase 1 : ccepted 0.03 ec 4408 B est _ case _ 1 ase 2 : ccepted 0.03 ec 3900 B est _ case _ 2 ase 3 : ccepted 0.03 ec 4124 B est _ case _ 3 ase 4 : ccepted 0.03 ec 4132 B est _ case _ 4 rev ext ccepted 0.03 ec 4408 B udge nput 1 n1. t xt ) udge utput 1 ut1. t xt ) omments ? \ ? ? ? ? ? ? ? ? § ? ? ? ? ? ? C tegories F ee T gs import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; System . out . println ( i * i * i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long X = sc . nextInt ( ) ; int A = 0 ; int B = 0 ; boolean tf = false ; for ( int i = - 100 ; i < 100 ; i + + ) { for ( int j = - 100 ; j < 100 ; j + + ) { if ( i * i * i * i * i - j * j * j * j * j = = X ) { A = i ; B = j ; tf = true break ; } } if ( tf ) break ; } System . out . println ( A + " " + B ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int n = sc . nextInt ( ) ; if ( n = = 0 ) break ; int a = sc . nextInt ( ) ; double h = sc . nextDouble ( ) / 100 ; double w = sc . nextDouble ( ) ; double b = Math . abs ( 22 - w / ( h * h ) ) ; for ( int i = 1 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; h = sc . nextDouble ( ) / 100 ; w = sc . nextDouble ( ) ; double a = Math . abs ( 22 - w / ( h * h ) ) ; if ( a < b ) { b = a ; a = x ; } else if ( a = = b & & x < a ) a = x ; } System . out . println ( a ) ; } } } import lib . Input ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ; public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { int f ( int x ) { int c = 0 ; while ( x % 2 = = 0 ) { x / = 2 ; + + c ; } return c ; } public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; int max = 0 , res = 1 ; for ( int i = 1 ; i < = n ; + + i ) { if ( f ( i ) > max ) { res = i ; max = Math . max ( max , f ( i ) ) ; } } out . println ( res ) ; } } static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; import java . util . Scanner ; public class AskCubeOfX { public int Input ( ) { int x = 0 ; Scanner in = new Scanner ( System . in ) ; x = in . nextInt ( ) ; return x ; } public int askCube ( int x ) { return x * x * x ; } public void Print ( int cube ) { System . out . println ( cube ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 0 , cube = 0 ; AskCubeOfX test = new AskCubeOfX ( ) ; x = test . Input ( ) ; cube = test . askCube ( x ) ; test . Print ( cube ) ; } } import java . util . Scanner ; public class Test { static int n , min = Integer . MAX _ VALUE ; static int [ ] nums ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; nums = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } if ( n = = 2 ) { min = nums [ 0 ] = = nums [ 1 ] ? 1 : 0 ; System . out . println ( min ) ; return ; } t ( 0 , 0 ) ; System . out . println ( min ) ; } public static void t ( int i , int pv ) { if ( i > = n ) return ; if ( i = = 0 ) { int cv = 0 ; for ( int x = 2 ; x < n ; x + + ) if ( x % 2 = = 0 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; t ( i + 1 , cv ) ; } else { int cv = 0 ; for ( int x = 0 ; x < n ; x + + ) { if ( ( pv + cv ) > min ) break ; if ( i ! = x & & i % 2 = = x % 2 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; } if ( nums [ i - 1 ] = = nums [ i ] & & pv = = 0 & & cv = = 0 ) cv = n / 2 ; min = Math . min ( min , pv + cv ) ; t ( i + 1 , pv + cv ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String T = sc . next ( ) ; int N = T . length ( ) ; String t [ ] = T . split ( " " , 0 ) ; String anss = " 0 " ; for ( int i = 0 ; i < N ; i + + ) { if ( t [ i ] . equals ( " ? " ) ) { t [ i ] = = " D " ; } anss = anss + t [ i ] ; } String ans = anss . split ( 1 , N + 1 ) ; System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) { int x ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String but = br . readLine ( ) ; x = Integer . parseInt ( but ) ; if ( x > = 0 & & x < = 100 ) { x = x * x * x ; } } } import java . util . * ; import java . text . * ; public Class Main { public static void main ( String args [ ] ) { SimpleDateFormat f = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date heisei = f . parse ( " 2019 / 04 / 30 " ) ; Date d = f . parse ( args [ 0 ] ) ; if ( d . after ( heisei ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int n = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( i * 500 + j * 100 + k * 50 ) = = x ) { n + + ; } } } } System . out . println ( n ) ; } } } import java . util . Scanner ; import . java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = sc . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( a [ 1 ] - a [ 0 ] + a [ 2 ] - a [ 1 ] ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; int i = x ^ 3 ; System . out . println ( i ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ; public class BC042 _ IrohaAndHaiku { public static void main ( String [ ] args ) throws IOException { InputReader in = new InputReader ( ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) arr [ i ] = in . nextInt ( ) ; Arrays . sort ( arr ) ; if ( isHaiku ( arr ) ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } public static boolean isHaiku ( int [ ] arr ) { int [ ] haiku = { 5 , 5 , 7 } ; for ( int i = 0 ; i < 3 ; i + + ) if ( arr [ i ] ! = haiku [ i ] ) return false ; return true ; } static class InputReader { public BufferedReader br ; public StringTokenizer st ; public InputReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = null ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } public class Main { public static void main ( String [ ] args ) { int a = a ; int e = e ; int k = e - a ; if ( k < = 15 ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int kekka ; kekka = x * x * x ; System . out . println ( kekka ) ; } } import java . io . * public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . lang . * ; import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner stdId = new Scanner ( system . in ) ; int n = stdId . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } } import java . util . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int count [ ] = { 0 , 0 } ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 3 ; i + + ) { if ( num [ i ] = = 5 ) count [ 0 ] + + ; else if ( num [ i ] = = 7 ) count [ 1 ] + + ; } if ( count [ 0 ] = = 2 & & count [ 1 ] = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Na = sc . nextInt ( ) ; int Nb = sc . nextInt ( ) ; int Nc = sc . nextInt ( ) ; int Nd = sc . nextInt ( ) ; int Ne = sc . nextInt ( ) ; int count = 0 ; int [ ] N1 = new int [ 5 ] ; N1 [ 0 ] = Na % 10 ; N1 [ 1 ] = Nb % 10 ; N1 [ 2 ] = Nc % 10 ; N1 [ 3 ] = Nd % 10 ; N1 [ 4 ] = Ne % 10 ; int sum = Na - N1 [ 0 ] + Nb - N1 [ 1 ] + Nc - N1 [ 2 ] + Nd - N1 [ 3 ] + Ne - N1 [ 4 ] + 40 ; Arrays . sort ( N1 ) ; int min = 9 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( N1 [ i ] = = 0 ) count + + ; else { min = Ni [ i ] ; break ; } } System . out . println ( sum - 10 * count + min ) ; } } public class Main { public static void main ( String [ ] args ) { int a = new java . util . Scanner ( System . in ) . nextLine ( ) ; int b = new java . util . Scanner ( System . in ) . nextLine ( ) ; int c = new java . util . Scanner ( System . in ) . nextLine ( ) ; if ( a = = 7 & & b = = 5 & & c = = 5 ) { Sytem . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { Sytem . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 5 & & c = = 7 ) { Sytem . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . scanner ; public class Main ( ) { public staic void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; public class Itp1 _ 1b { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Itp1 _ 1b obj = new Itp1 _ 1b ( ) ; obj . solve ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scaner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; int mp = x * * 3 ; System . out . println ( mp ) ; } } # include < bits / stdc + + . h > using namespace std ; int main ( void ) { ios : : sync _ with _ stdio ( 0 ) ; cin . tie ( 0 ) ; cout . tie ( 0 ) ; int n ; cin > > n ; int MAX = INT _ MIN ; int MIN = INT _ MAX ; int temp ; for ( int i = 0 ; i < n ; + + i ) { cin > > temp ; MAX = max ( MAX , temp ) ; MIN = min ( MIN , temp ) ; } cout < < MAX - MIN < < endl ; return 0 ; } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long m = sc . nextLong ( ) ; long leastCommon = 1 ; for ( int i = 0 ; i < n ; i + + ) { long num = sc . nextLong ( ) ; leastCommon = calcLeastCommon ( leastCommon , num ) ; if ( leastCommon > m * 2 ) { print ( 0 ) ; return ; } } print ( ( m + leastCommon / 2 ) / leastCommon ) ; sc . close ( ) ; } public static long calcLeastCommon ( long x , long y ) { return x * y / calcGreatestCommon ( x , y ) ; } public static long calcGreatestCommon ( long x , long y ) { long temp ; while ( x % y ! = 0 ) { temp = y ; y = x % y ; x = temp ; } return y ; } public static void print ( Object obj ) { System . out . println ( obj ) ; } } public class Main { public static cul int ( int x ) { x = x * * 3 ; return x ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( ) int i = x ^ 3 ; System . out . println ( i ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Long n = sc . nextLong ( ) ; List < Long > a = new ArrayList < Long > ( ) ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { a . add ( i , sc . nextLong ( ) ) ; } if ( a . get ( 0 ) = = a . get ( 1 ) ) { a . get ( 1 ) = a . get ( 0 ) + 1 ; count + + ; } if ( 4 < = n ) { for ( int i = 2 ; i < n ; i + = 2 ) { if ( a . get ( 0 ) ! = a . get ( i ) ) { count + + ; } } for ( int i = 3 ; i < n ; i + = 2 ) { if ( a . get ( 1 ) ! = a . get ( i ) ) { count + + ; } } } System . out . println ( count ) ; } } public class XCubic { public static void main ( String [ ] args ) { int x ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int num = scanner . nextInt ( ) ; int x = Math . pow ( num , 3 ) ; System . out . println ( " num " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanne ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = new String ( in . readLine ( ) ) ; String [ ] input = line . split ( " " , 0 ) ; int age = Integer . parseInt ( input [ 0 ] . trim ( ) ) ; int price = Integer . parseInt ( input [ 1 ] . trim ( ) ) ; if ( age < = 5 ) { System . out . print ( " 100 " ) ; } else if ( age < = 12 ) { System . out . print ( price / 2 ) ; } else { System . out . print ( price ) ; } } catch ( IOException e ) { System . out . print ( e ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { int n ; int [ ] v1 , v2 ; { Scanner s = new Scanner ( System . in ) ; n = s . nextInt ( ) ; v1 = new int [ n ] ; v2 = new int [ n ] ; for ( int i = 0 ; i < n / 2 ; i + + ) { v1 [ s . nextInt ( ) ] + + ; v2 [ s . nextInt ( ) ] + + ; } } System . out . println ( n - v1 [ max ( v1 ) ] - v2 [ max ( v2 ) ] ) ; } static int max ( int [ ] v ) { int ans = 0 ; for ( int i = 1 ; i < v . length ; i + + ) { if ( v [ i ] > v [ ans ] ) { ans = i ; } } return ans ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = Integer . parseInt ( sc . next ( ) ) ; int cityNum = Integer . parseInt ( sc . next ( ) ) ; Map < String , List < Integer > > map = new HashMap < String , List < Integer > > ( ) ; String [ ] [ ] array = new String [ cityNum ] [ 2 ] ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( String . valueOf ( i + 1 ) , new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { array [ i ] [ 0 ] = sc . next ( ) ; array [ i ] [ 1 ] = sc . next ( ) ; map . get ( array [ i ] [ 0 ] ) . add ( Integer . parseInt ( array [ i ] [ 1 ] ) ) ; } for ( String key : map . keySet ( ) ) { Collections . sort ( map . get ( key ) ) ; for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { for ( int j = 0 ; j < array . length ; j + + ) { if ( array [ j ] [ 0 ] . equals ( key ) & & Integer . parseInt ( array [ j ] [ 1 ] ) = = ( map . get ( key ) . get ( i ) ) ) { StringBuilder sb = new StringBuilder ( ) ; while ( key . length ( ) < 6 ) { sb . append ( " 0 " ) ; } sb . append ( key ) ; while ( map . get ( key ) . get ( i ) . length < 6 ) { sb . append ( " 0 " ) ; } array [ j ] [ 0 ] = sb . append ( map . get ( key ) . get ( i ) ) . toString ( ) ; } } } } for ( String [ ] ary2 : array ) { System . out . println ( ary2 [ 0 ] ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A + B + C ) ! = 17 ) { System . out . println ( " No " ) ; } else if ( A ! = 7 & & B ! = 7 & & C ! = 7 ) { System . out . println ( " No " ) ; } else if ( A ! = 5 & & B ! = 5 & & C ! = 5 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } ; } ; import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { int n = scan . nextInt ( ) ; if ( n = = 0 ) break ; int ans = 0 , x = 0 , near = 0 , j = 0 ; for ( int i = 0 ; i < n ; i + + ) { int num = scan . nextInt ( ) ; int w ; double h ; h = scan . nextDouble ( ) / 100 ; w = scan . nextInt ( ) ; int bmi = ( int ) ( ( double ) w / ( h * h ) ) ; if ( i = = 0 ) ans = num ; if ( bmi > = 22 ) x = bmi - 22 ; else x = 22 - bmi ; near = Double . MAX _ VALUE ; if ( near > x ) { near = x ; ans = num ; } } System . out . println ( ans ) ; } } } class Main { public static void main ( String [ ] args ) { Main m = new Main ( ) ; System . out . println ( m . cube ( m . readInt ( System . in ) ) ) ; } private Main ( ) { } int readInt ( InputStream is ) { java . io . DataInputStream dis = new java . io . DataInputStream ( is ) ; return dis . readInt ( ) ; } int cube ( int n ) { return n * n * n ; } } import java . io * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , ans ; x = Integer . ParseInt ( br . readLine ) ; ans = x * x * x ; System . out . println ( ans ) ; } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * a ) ; } import java . util . * ; public class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { for ( int z = 0 ; z < = k ; z + + ) { if ( x + y + z = = s ) { count + + ; } } } } System . out . println ( count ) ; } } import java . util . * ; public class Test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < 13 & & a > = 6 ) b / = 2 ; else if ( a < 6 ) b = 0 ; System . out . println ( b ) ; } } package atCoder ; import java . util . Scanner ; public class ABC082 _ Round _ Up _ The _ Mean { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; double x = ( a + b ) / 2 ; double ans = Math . ceil ( x ) ; System . out . println ( ( int ) ans ) ; } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { StringTokenizer token = new StringTokenizer ( " 5 5 7 " ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( Integer . parseInt ( token . nextElement ( ) . toString ( ) ) = = 7 ) sevenCounter + + ; else fiveCounter + + ; } } catch ( Exception ex ) { } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { class static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int n = Integer . parseInt ( line ) ; System . out . println ( n + " / n " ) ; } catch ( Ioexception e ) { System . out . println ( e ) ; } } } import java . util . * ; import java . util . stream . * ; class Main { public static void main ( String [ ] args ) { var scanner = new Scanner ( System . in ) ; var x = scanner . nextInt ( ) ; var amax = ( int ) pow ( x + 0.9 , 0.2 ) ; for ( int a = 1 ; a < = amax ; a + + ) { var b = fact5 ( x - a * a * a * a * a ) ; if ( b > = 0 ) { System . out . println ( a + " " + ( - b ) ) ; System . exit ( 0 ) ; } } var bmax = ( int ) pow ( x / 5 + 0.9 , 0.25 ) ; for ( int b = 1 ; b < = bmax ; b + + ) { var a = fact5 ( x + b * b * b * b * b ) ; if ( a > = 0 ) { System . out . println ( a + " " + b ) ; System . exit ( 0 ) ; } } static int fact5 ( int x ) { assert x > 0 ; var r = ( int ) pow ( x + 0.9 , 0.2 ) ; if ( x > r * r * r * r * r ) r = - 1 ; return r ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { Sytem . out . println ( " 入出力エラーです " ) ; } } } import java . util . * ; public static void main ( String [ ] atgs ) { Scanner scan = new Scanner ( System . in ) ; int ans = 0 ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; scan . close ( ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . next ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader rd = new BufferedReader ( new InputStreamReader ( system . in ) ) ; int read = IntegerParseInt ( rd . ReadLine ( ) ) ; system . out . println ( ( int ) Math . pow ( read , 3 ) ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BuferedReader ( new InputStreamReader ( Systen . in ) ) ; try { String temp = reader . readLine ( ) ; int x = Integer . parseInt ( temp ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " Input only 1data " ) ; } return ; } } # include < stdio . h > int main ( void ) { int num , a ; while ( 1 ) { scanf ( " % d " , & num ) ; if ( num = = 0 ) break ; else { int sum = 0 ; while ( num > 0 ) { a = num % 10 ; sum = sum + a ; num = num / 10 ; } printf ( " % d \ n " , sum ) ; } } return 0 ; } import java . io * public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Math . pow ( b , 3 ) ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = null ; sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; boolean flag = false ; for ( int i = 1 ; i < = T ; i + + ) { if ( A + ( V * i ) = = B + ( W * i ) | | if ( A + ( V * i ) = = B ) { flag = true ; break ; } } if ( flag ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } n = gets . to _ i puts n * n import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] t = new int [ N ] ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { t [ i ] = sc . nextInt ( ) ; a [ i ] = sc . nextInt ( ) ; } long [ ] dp = new long [ N ] ; dp [ 0 ] = t [ 0 ] + a [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { long tnum = ( dp [ i - 1 ] / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ) * t [ i - 1 ] ) ; long anum = ( dp [ i - 1 ] / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ) * a [ i - 1 ] ) ; long rate = Math . max ( ( long ) Math . ceil ( ( double ) tnum / ( double ) t [ i ] ) , ( long ) Math . ceil ( ( double ) anum / ( double ) a [ i ] ) ) ; dp [ i ] = rate * ( long ) ( t [ i ] + a [ i ] ) ; } System . out . println ( dp [ N - 1 ] ) ; } } import java . io . * ; import java . util . * ; import java . lang . * ; public class NAIN { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( br . readLine ( ) ) ; int b = Integer . parseInt ( br . readLine ( ) ) ; int c = Integer . parseInt ( br . readLine ( ) ) ; int d = Integer . parseInt ( br . readLine ( ) ) ; int area = a * b ; int area1 = c * d ; if ( area > = area1 ) System . out . println ( area ) ; else if ( area < area1 ) System . out . println ( area1 ) ; } } import java . util . * ; import java . text . * ; public class Main { public static void main ( String args [ ] ) { SimpleDateFormat f = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date heisei = f . parse ( " 2019 / 04 / 30 " ) ; Date d = f . parse ( args [ 0 ] ) ; if ( d . after ( heisei ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * x * x ) + ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class AtCoder2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int inputNum = sc . nextInt ( ) ; sc . nextLine ( ) ; String input = sc . nextLine ( ) ; int centerValue = inputNum / 2 ; String [ ] arrayStr = input . split ( " " ) ; int [ ] arrayInt = new int [ arrayStr . length ] ; int [ ] arrayIntCopy = new int [ arrayStr . length ] ; for ( int i = 0 ; i < arrayStr . length ; i + + ) { arrayInt [ i ] = Integer . parseInt ( arrayStr [ i ] ) ; arrayIntCopy [ i ] = Integer . parseInt ( arrayStr [ i ] ) ; } for ( int i = 0 ; i < arrayStr . length ; i + + ) { arrayInt [ i ] = 0 ; Arrays . sort ( arrayInt ) ; System . out . println ( arrayInt [ centerValue ] ) ; System . arraycopy ( arrayIntCopy , 0 , arrayInt , 0 , arrayInt . length ) ; } sc . close ( ) ; } } import java . lang . * ; import java . util . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( in ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } } import java . util . * ; class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { if ( str . equals ( " 0 " ) ) break ; int t = 0 ; for ( int i = 0 ; i < str . length ( ) ; i + + ) { t + = Character . getNumericValue ( str . charAt ( i ) ) ; } System . out . println ( t ) ; } } } Scanner sn = new Scanner ( System . in ) ; int A = sn . nextInt ( ) ; int B = sn . nextInt ( ) ; int C = sn . nextInt ( ) ; int sum = A + B + C ; if ( sum = = 17 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } # include < iostream > using namespace std ; int main ( ) { int a , b , x , y ; cin > > a > > b ; x = a * b ; y = 2 * ( a + b ) ; cout < < x < < y < < endl ; return 0 ; } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( scan . next ( ) ) ; } Arrays . sort ( a ) ; System . out . println ( a [ n - 1 ] - a [ 0 ] ) ; } } lass Main { public static void main ( String args [ ] ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int y = x * x * x ; System . out . prinln ( " y " ) ; } } import java . text . * ; import java . util . * ; public class MainJ { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; try { DateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date date1 = sdf . parse ( a ) ; Date date2 = sdf . parse ( " 2019 / 04 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } } class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readln ( ) . trim ( ) ) ; System . out . println ( " " + x * x * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } catch IOException { } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ; ) { solve ( sc ) ; } } public static void solve ( Scanner sc ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . printf ( " % d % n " , Math . floor ( ( a + b ) / 2 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( C < a + b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class x _ cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( ( int ) ( x * x * x ) ) ; } } public class Main { public static void main ( String [ ] args ) } { int year = args [ 0 ] . substring ( 0 , 3 ) ; int month = args [ 0 ] . substring ( 5 , 6 ) ; int day = args [ 0 ] . substring ( 8 , 9 ) ; Date inputDay = new Date ( year , month , day , 12 , 0 , 0 ) ; Date s = new Date ( 2019 , 4 , 30 , 12 , 0 , 0 ) ; if ( s . before ( inputDay ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . Scanner ; public class A001 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int c = s . nextInt ( ) ; int d = s . nextInt ( ) ; int e = s . nextInt ( ) ; int k = s . nextInt ( ) ; int [ ] f = { a , b , c , d , e , k } ; for ( int i = 0 ; i < f . length ; i + + ) { int n1 = 0 ; int n2 = 0 ; int ans = 0 ; for ( int j = 0 ; j < f . length ; j + + ) { if ( i = = j ) { continue ; } n1 = f [ i ] ; n2 = f [ j ] ; if ( n1 > n2 ) { ans = n1 - n2 ; } else { ans = n2 - n1 ; } ; if ( ans > k ) { System . out . println ( " : ( " ) ; return ; } } ; } ; System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numlist [ ] = new int [ 5 ] ; int k ; int result = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ( numlist [ i + 1 ] - numlist [ i ] ) > k ) { result = 1 ; break ; } } if ( result = = 0 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int numlist [ ] = new int [ 5 ] ; int k ; int result = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { numlist [ i ] = sc . nextInt ( ) ; } k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { if ( ( numlist [ i + 1 ] - numlist [ i ] ) = = 2 ) { result = 1 ; break ; } } if ( result = = 0 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } package internship ; import java . util . Scanner ; public class { public static void main ( String [ ] args ) { int x = 0 , temp , tot ; boolean swi = false ; Scanner sc = new Scanner ( System . in ) ; while ( swi = = true ) { temp = sc . nextInt ( ) ; if ( 1 < = temp | | 100 < = temp ) x = temp ; swi = true ; } tot = x * x * x ; System . out . println ( tot ) ; System . out . println ( ) ; } } import java . util . Scanner ; public class tamrini { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a ; a = new int [ 3 ] ; boolean dool = false ; for ( int i = 0 ; i < 3 ; i + + ) { int x = scanner . nextInt ( ) ; if ( x ! = 5 & & x ! = 7 ) { System . out . println ( " NO " ) ; dool = true ; break ; } a [ i ] = x ; } if ( dool = = false ) { boolean chool = false ; for ( int i = 0 ; i < 2 ; i + + ) { if ( a [ i ] > a [ i + 1 ] ) { System . out . println ( " NO " ) ; chool = true ; break ; } } if ( chool = = false ) System . out . println ( " YES " ) ; } scanner . close ( ) ; } } # include < iostream > # include < vector > # include < cmath > # include < algorithm > using namespace std ; const double EPS = 1e-8 ; int main ( ) { int H , W ; string f [ 600 ] ; while ( cin > > H > > W ) { for ( int i = H - 1 ; i > = 0 ; i -- ) cin > > f [ i ] ; vector < pair < double , int > > vd ; for ( int i = 1 ; i < = H ; i + + ) { for ( int j = 0 ; j < = W ; j + + ) { int cnt = 0 ; for ( int k = 0 ; k < 4 ; k + + ) { int ni = i - k % 2 , nj = j - k / 2 ; if ( 0 < = ni & & ni < H & & 0 < = nj & & nj < W & & f [ ni ] [ nj ] = = ' # ' ) cnt + + ; } if ( cnt % 2 = = 1 ) { if ( 0 < = i - 1 & & i - 1 < H & & 0 < = j & & j < W & & f [ i - 1 ] [ j ] = = ( cnt = = 1 ? ' # ' : ' .' ) ) vd . push _ back ( make _ pair ( ( double ) j / i , 1 ) ) ; if ( 0 < = i & & i < H & & 0 < = j - 1 & & j - 1 < W & & f [ i ] [ j - 1 ] = = ( cnt = = 1 ? ' # ' : ' .' ) ) vd . push _ back ( make _ pair ( ( double ) j / i , - 1 ) ) ; } } } sort ( vd . begin ( ) , vd . end ( ) ) ; int res = 1 , cur = 1 ; for ( int i = 0 ; i < vd . size ( ) ; ) { int idx = i ; while ( idx < vd . size ( ) & & abs ( vd [ i ] . first - vd [ idx ] . first ) < EPS ) cur + = vd [ idx + + ] . second ; i = idx ; res = max ( cur , res ) ; } cout < < res < < endl ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; double [ ] x = new double [ a ] ; double [ ] y = new String [ a ] ; for ( int i = 0 ; i < a ; i + + ) { x [ i ] = sc . nextDouble ( ) ; y [ i ] = sc . nextDouble ( ) ; } double b = 0 ; for ( int i = 0 ; i < a - 1 ; i + + ) { for ( int j = i + 1 ; j < a ; j + + ) { b + = Math . sqrt ( ( x [ i ] - x [ j ] ) * ( x [ i ] - x [ j ] ) + ( y [ i ] - y [ j ] ) * ( y [ i ] - y [ j ] ) ) ; } } b * = 2 / a ; System . out . println ( b ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ 5 ] fromAnt ; int [ 5 ] toAnt ; for ( int i = 0 ; i < 5 ; i + + ) { fromAnt [ i ] = sc . nextInt ( ) ; toAnt [ i ] = fromAnt [ i ] ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( toAnt [ j ] - fromAnt [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; return ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; if ( formatDate . before ( 20 19 / 0 4 / 3 0 ) ) { S y s em.out . pri n tln ( " He i s ei " ) ; } e l e { Sy s em.out . pri n tln ( " TB D " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; boolean hantei = false ; long amari = 0 ; long a = 0 , b = 0 , swap = 0 , r = 0 , x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; if ( i = = 0 ) amari = A [ i ] % 2 ; else { if ( A [ i ] % 2 ! = amari ) { hantei = true ; break ; } } } long max = A [ 0 ] ; if ( hantei = = false ) { for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } } if ( max > M * 2 | | hantei = = true ) System . out . println ( 0 ) ; else { long ans = ( M - ( max / 2 ) ) / max + ( long ) 1 ; System . out . println ( ans ) ; } } } public class Main { public class void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; int sum = x * x * x ; System . out . println ( sum ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line1 = br . readLine ( ) ; line1 = line1 . trim ( ) ; int N = Integer . parseInt ( line1 ) ; long PosA = 0 ; long PosB = 0 ; long a = 0 ; long b = 0 ; long mag = 0 ; for ( int i = 0 ; i < N ; i + + ) { String lines = br . readLine ( ) ; lines = lines . trim ( ) ; String [ ] temp = lines . stlip ( " " ) ; a = Integer . parseInt ( temp [ 0 ] ) ; b = Integer . parseInt ( temp [ 1 ] ) ; if ( PosA < = a & & PosB < = b ) { PosA = a ; PosB = b ; } else { mag = ( long ) Math . ceil ( Math . max ( ( double ) PosA / a , ( double ) PosB / b ) ) ; PosA = a * mag ; PosB = b * mag ; } } } } import java . util . * ; import java . io . * ; public class main { public static void main ( String [ ] args ) throws Exception { new main ( ) . print ( ) ; return ; } void print ( ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; } } import java . io . Scanner ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) ( Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int X [ ] = new int [ N ] ; int sum = 0 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { X [ i ] = sc . nextInt ( ) ; sum = sum + X [ i ] ; } double M = ( double ) Math . round ( sum / N ) ; int ans1 = 0 ; for ( int i = 0 ; i < X . length ; i + + ) { ans1 = X [ i ] ; ans + = ( int ) Math . pow ( ans1 - M , 2 ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int d = Integer . parseInt ( sc . next ( ) ) ; int x = a * b ; int y = c * d ; if ( x < y ) System . out . println ( y ) ; else if ( x > y ) System . out . println ( x ) ; else System . out . println ( x ) ; } } import static java . lang . System . out ; import java . util . Scanner ; class Main { public void main ( String ... args ) { String x = new Scanner ( System . in ) . nextLine ( ) ; int input = Integer . parseInt ( x ) ; out . println ( x * x * x ) ; } } import java . util . Scanner ; public class ABC _ 042 { public static void main ( String [ ] args ) { int number1 = 0 ; int number2 = 0 ; int number3 = 0 ; String anser = " NO " ; Scanner scan = new Scanner ( System . in ) ; number1 = scan . nextInt ( ) ; number2 = scan . nextInt ( ) ; number3 = scan . nextInt ( ) ; if ( checkFiveOrSeven ( number1 ) ) { if ( checkFiveOrSeven ( number2 ) ) { if ( checkFiveOrSeven ( number3 ) ) { if ( number1 + number2 + number3 = = 17 ) { anser = " YES " ; } } } } System . out . println ( anser ) ; } private static boolean checkFiveOrSeven ( int number ) { if ( number = = 5 | | number = = 7 ) { return true ; } return false ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int n = Integer . parseInt ( str ) ; int ans = 1 ; int min = 0 ; str = scan . nextLine ( ) ; String [ ] substr = str . split ( " " , 0 ) ; int [ ] array = new int [ 200000 ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = Integer . parseInt ( substr [ i ] ) ; } if ( array [ 1 ] < = array [ 0 ] ) { min = array [ 1 ] ; ans + + ; } else { min = array [ 0 ] ; } for ( int i = 2 ; i < n ; i + + ) { if ( min > array [ i ] ) { min = array [ i ] ; ans + + ; } } System . out . println ( ans ) ; scan . close ( ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; String str = br . readline ( ) ; int N = Integer . parseInt ( str ) ; int Ans = N ^ 3 ; System . out . println ( Ans ) ; } } import java . util . * ; public class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ; int i , tmp , pre ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String [ ] a = new String [ n ] ; String [ ] b = new String [ m ] ; for ( i = 0 ; i < n ; i + + ) { a [ i ] = sc . next ( ) ; } for ( i = 0 ; i < m ; i + + ) { b [ i ] = sc . next ( ) ; } for ( i = 0 ; i < n - m + 1 ; i + + ) { for ( int j = 0 ; j < n - m + 1 ; j + + ) { if ( j = = 0 ) tmp = 0 ; else tmp = pre ; tmp = a [ i ] . indexOf ( b [ i ] , tmp ) ; if ( tmp = = - 1 ) break ; pre = tmp ; if ( Main . check ( tmp , i , a , b ) ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } public static boolean check ( int col , int row , String [ ] a , String [ ] b ) { for ( int i = 1 ; i < m ; i + + ) { if ( a [ row + i ] . indexOf ( b [ i ] , col ) ! = col ) return false ; } return true ; } } 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 ( ) ; System . out . println ( a * b + " " + ( a * 2 + b * 2 ) ) ; } import java . util . Scanner ; public class xcubic { public static void main ( String [ ] arg ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . io . * ; public class Keisan4 { public static void main ( String [ ] args ) { System . out . println ( " Input number " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int N = Integer . parseInt ( line ) ; if ( N < = 1 | | 100 < = N ) { System . out . println ( " Number is not collect " ) ; } else { System . out . println ( N * N * N ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " Number is not collect " ) ; } } } class Main { public static void main ( String args [ ] ) { int x = Integer . parseInt ( arg [ 0 ] ) System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Test1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { String box = sc . next ( ) ; int sum = 0 ; for ( int i = 0 ; i < box . length ( ) ; i + + ) { sum + = box . charAt ( i ) - ' 0' ; } System . out . printf ( " % d \ n " , sum ) ; } } } package zen ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class SumOfThree { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; int max = Integer . parseInt ( s [ 0 ] ) ; int ans = Integer . parseInt ( s [ 1 ] ) ; int result = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int k = ans - ( i + j ) ; if ( 0 < = k & & k < = ans ) result + + ; } } System . out . println ( result ) ; } } package ABC145 ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int a = r * r ; System . out . println ( a ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { int age = 0 ; int change = 0 ; int result = 0 ; Scanner sc = new Scanner ( System . in ) ; age = sc . nextInt ( ) ; change = sc . nextInt ( ) ; if ( age < = 5 ) { result = 0 ; } else if ( 6 < = age & & age < = 12 ) { result = change / 2 ; } else { result = change ; } System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int k = scn . nextInt ( ) ; int s = scn . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { if ( s > = x + y & & s - ( x + y ) < = k ) { count = count + 1 } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; System . out . println ( Math . max ( a * b , c * d ) ) ; } } package test . java ; import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double a = scan . nextDouble ( ) ; double b = 3 ; System . out . println ( " " + Math . pow ( a , b ) + " " ) ; } } import java . util . Scanner ; class BinaryConversion { public static long [ ] decimalToBinary ( long num ) { long [ ] a = new long [ 60 ] ; int i = a . length - 1 ; while ( num ! = 0 ) { a [ i ] = num % 2 ; num / = 2 ; i -- ; } return a ; } public static long binaryToDecimal ( long [ ] a ) { long num = 0 ; for ( int i = 0 ; i < a . length ; i + + ) { num + = ( a [ i ] * Math . pow ( 2 , a . length - 1 - i ) ) ; } return num ; } } public class XOR { public static long [ ] xor ( long num1 , long num2 ) { long [ ] a = BinaryConversion . decimalToBinary ( num1 ) ; long [ ] b = BinaryConversion . decimalToBinary ( num2 ) ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = ( a [ i ] + b [ i ] ) % 2 ; } return a ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] num = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { num [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < num . length - 1 ; i + + ) { for ( int j = i + 1 ; j < num . length ; j + + ) { long [ ] temp = XOR . xor ( num [ i ] , num [ j ] ) ; sum + = BinaryConversion . binaryToDecimal ( temp ) ; } } sum % = ( Math . pow ( 10 , 9 ) + 7 ) ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Abc127A01 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > 12 ) { System . out . println ( b ) ; } else if ( a > 5 ) { System . out . println ( b / 2 ) ; } else { System . out . println ( 0 ) ; } } } public void Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } for ( int a = 0 ; a < N ; a + + ) { for ( int b = 0 ; b < = i ; b + + ) { if ( P [ a ] > P [ b ] ) { break ; } } count + = 1 ; } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner stdIn . new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int y = ( n / 15 ) * 200 ; int x = n * 800 ; System . out . println ( x - y ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ) ; ans = x * x * x ; System . out . printline ( ans ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { MyScanner scanner = new MyScanner ( ) ; int A = scanner . nextIn ( ) ; int B = scanner . nextIn ( ) ; int C = scanner . nextIn ( ) ; int X = scanner . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < = A ; i + + ) { int ans1 = + 500 * i ; for ( int j = 0 ; j < = B ; j + + ) { int ans2 = + 100 * j ; for ( int k = 0 ; k < = C ; k + + ) { int ans3 = + 50 * k ; if ( ans1 + ans2 + ans3 = = X ) { ans + + ; } } System . out . print ( ans ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c - sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( e - a < = k ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; import java . util . InputMismatchException ; class main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int r = scanner . nextInt ( ) ; scanner . close ( ) ; System . out . println ( r * r ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int b = 0 ; int xcubic ; int a = 0 ; while ( b = 0 ) { while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 00 ) i = - 1 ; } x c bi a a a ; Sys e . u . p r n ln ( xcu i ) ; } } } import java . util . Scanner ; import java . util . Date ; import java . text . ParseException ; import java . text . SimpleDateFormat ; public class StillTBD { public static void main ( String [ ] args ) { try { Scanner scanner = new Scanner ( System . in ) ; String input _ str = scanner . next ( ) ; scanner . close ( ) ; SimpleDateFormat sdFormat = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date input _ date = sdFormat . parse ( input _ str ) ; Date standard _ date = sdFormat . parse ( " 2019 / 04 / 30 " ) ; if ( input _ date . compareTo ( standard _ date ) > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } StillTBD ( ) { } } class public { public static void main ( Stirng args [ ] ) { int a = 2 ; System . out . printlin ( math . pow ( a , 3 ) ) ; } } class Main { public static void main { String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } } private static int solution ( int n , int [ ] seq ) { HashMap < Integer , Integer > bucket = new HashMap < > ( ) ; int overflow = 0 ; for ( int i = 0 ; i < seq . length ; i + + ) { if ( bucket . containsKey ( seq [ i ] ) ) { int val = bucket . get ( seq [ i ] ) ; bucket . put ( seq [ i ] , val + 1 ) ; } else bucket . put ( seq [ i ] , 1 ) ; } int counter = 0 ; for ( Map . Entry map : bucket . entrySet ( ) ) { int val = ( int ) map . getValue ( ) ; if ( val > 2 ) overflow + + ; if ( val = = 1 ) { counter + + ; if ( counter = = 2 ) { overflow + + ; counter = 0 ; } } } return overflow ; } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { int a , b ; Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = a * a * a ; System . out . println ( b ) ; } } public class main { public static void main { int x ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } } } class Main { public static void main ( String [ ] args ) { int x = 2 ; double sum = 0 ; sum = Math . pow ( x , 3 ) ; System . out . println ( sum ) ; } import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int c = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = sc . nextInt ( ) ; if ( n > 5 ) { num [ 2 ] = n ; } else { num [ c + + ] = n ; } } if ( num [ 0 ] = = 5 & & num [ 1 ] = = 5 & & num [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( ) ; System . out . println ( str * str * str ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; boolean second = false long a = 0 , b = 0 , swap = 0 , r = 0 , x = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long max = A [ 0 ] ; if ( max = = 2 ) second = true ; for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; if ( b = = 2 ) second = true ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } if ( max > M * 2 | | ( second = = true & & max / 2 % = = 0 ) ) System . out . println ( 0 ) ; else { long ans = ( M - ( max / 2 ) ) / max + ( long ) 1 ; System . out . println ( ans ) ; } } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int x = n * m ; int y = 2 * ( n + m ) ; System . out . print ( x ) ; System . out . print ( " " ) ; System . out . print ( y ) } } import java . util . Scanner ; import java . util . Arrays ; public class AtCoder1 { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 100 ] ; int i = 0 , sum = 0 ; float sum1 = 0 ; for ( i = 0 ; i < 3 ; i + + ) { a [ i ] = s . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ 0 ] - a [ 2 ] ) ; } } import java . util . * ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A + B + C ) ! = 17 ) { System . out . println ( " No " ) ; } else if ( A ! = 7 & & B ! = 7 & & C ! = 7 ) { System . out . println ( " No " ) ; } else if ( A ! = 5 & & B ! = 5 & & C ! = 5 ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } import java . util . * ; public class at51B { public static void main ( String [ ] atgs ) { Scanner scan = new Scanner ( System . in ) ; int ans = 0 ; int K = scan . nextInt ( ) ; int S = scan . nextInt ( ) ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { ans = ans + 1 ; } } } System . out . println ( ans ) ; scan . close ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; if ( 1 < = x & & x > = 100 ) { x = x * x * x ; System . out . println ( x ) ; } } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = ( int ) Math . pow ( b , 3 ) ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 ; x = < 100 ; System . out . println ( " x * x * x " ) ; } } import java . util . Scanner ; public class a _ circle { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int r = scan . nextInt ( ) ; System . out . println ( r * r ) ; } } x = int ( input ( ) ) println ( x * x * x ) import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; float rad = Math . abs ( H * 30 + M * 0.5 - M * 6 ) ; if ( rad > = 180 ) { rad = 360 - rad ; } double C = 0 ; C = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( rad ) ) ; System . out . println ( Math . pow ( C , 0.5 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) ; long v = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long w = sc . nextLong ( ) ; long t = sc . nextLong ( ) ; if ( w > = v ) { System . out . print ( " NO " ) ; System . exit ( 0 ) ; } double dis = Math . abs ( a - b ) ; double num = v - w ; num * = t ; if ( num > = dis ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; boolean gg = true ; Integer [ ] array = new Integer [ n ] ; int a = 1 ; int b = 0 ; for ( int i = 0 ; i < n ; i + + ) { array [ n ] = s . nextInt ( ) ; if ( i ! = 0 ) { if ( array [ n ] < array [ a ] ) { a + + ; } else { b = array [ n ] ; } } } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class A { public static int min ( int [ ] a ) { int min = a [ 0 ] ; for ( int i = 0 ; i < a . length ; i + + ) { if ( a [ i ] < min & & a [ i ] ! = - 1 ) { min = a [ i ] ; a [ i ] = - 1 ; System . out . println ( a [ i ] ) ; } } return min ; } public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , y , z ; String s = reader . readLine ( ) ; String [ ] inp = s . split ( " " ) ; x = Integer . parseInt ( inp [ 0 ] ) ; y = Integer . parseInt ( inp [ 1 ] ) ; z = Integer . parseInt ( inp [ 2 ] ) ; int [ ] arr = new int [ 3 ] ; arr [ 0 ] = x ; arr [ 1 ] = y ; arr [ 2 ] = z ; int cost = 0 ; int a = Math . min ( x , Math . min ( y , z ) ) ; if ( a = = x ) { int b = Math . max ( y , z ) ; cost = cost + Math . abs ( b - a ) ; cost = cost + ( Math . max ( y , z ) - b ) ; } else if ( a = = y ) { int b = Math . max ( x , z ) ; cost = cost + Math . abs ( b - a ) ; cost = cost + ( Math . max ( x , z ) - b ) ; } else if ( a = = z ) { int b = Math . max ( x , y ) ; cost = cost + Math . abs ( b - a ) ; cost = cost + ( Math . max ( x , y ) - b ) ; } System . out . println ( cost ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( System . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) ; e . printStackTrace ( ) ; } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; final int A , V , B , W , T ; A = sc . nextInt ( ) ; V = sc . nextInt ( ) ; B = sc . nextInt ( ) ; W = sc . nextInt ( ) ; T = sc . nextInt ( ) ; sc . close ( ) ; int diff = Math . abs ( A - B ) ; if ( Math . abs ( V - W ) * T > = diff & & V - M > 0 & & B - A > 0 ) { System . out . println ( " YES " ) ; } if ( Math . abs ( V - W ) * T > = diff & & M - V > 0 & & A - B > 0 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; public class B { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int n = Integer . parseInt ( line ) ; if ( 1 < = n & & n < = 100 ) { System . out . println ( n * n * n ) ; } else { System . out . println ( " 値の範囲が正しくありません " ) ; } } catch ( IOException e ) y tem.o t .println ( e ) } } class main1 { public void Main ( ) { String S ; int i = Integer . parseInt ( S ) ; if ( i < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . next ( ) ; if ( text . charAt ( text . length - 1 ) = = ' ? ' ) { text = text . substring ( 0 , text . length - 1 ) + " D " ; } while ( text . indexOf ( " ? " ) > - 1 ) { text = text . replaceAll ( " P \ \ ? " , " PD " ) ; text = text . replaceAll ( " \ \ ? D " , " PD " ) ; } System . out . println ( text ) ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { int flg = 0 ; for ( int j = 0 ; j < i ; j + + ) { if ( P [ i ] > P [ j ] ) { flg = 1 ; } } if ( flg = = 0 ) { count = count + 1 ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; char [ ] [ ] A = new char [ n ] [ n ] ; char [ ] [ ] B = new char [ m ] [ m ] ; for ( int i = 0 ; i < n ; i + + ) { String n = scn . next ( ) ; for ( int j = 0 ; j < n ; j + + ) { A [ i ] [ j ] = n . charAt ( j ) ; } } for ( int i = 0 ; i < m ; i + + ) { String m = scn . next ( ) ; for ( int j = 0 ; j < m ; j + + ) { B [ i ] [ j ] = m . charAt ( j ) ; } } String ans = " No " ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( i + m > n | | j + m > n ) { break ; } for ( int k = 0 ; k < m ; k + + ) { for ( int l = 0 ; l < m ; l + + ) { if ( A [ i + k ] [ j + l ] = = B [ k ] [ l ] ) { ans = " Yes " ; break ; } } } } } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ^ 3 ; System . out . println ( x ) ; } } import java . util . * public class Main { public static void main ( String [ ] args ) { int result ; Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int PI = 3.14 ; result = r * r * PI / 1 * 1 * PI ; System . out . println ( " result " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; if ( a = = 1 ) { if ( b ! = 1 ) { System . out . println ( " Alice " ) ; } } if ( b = = 1 ) { if ( a ! = 1 ) { System . out . println ( " Bob " ) ; } } if ( ( a > b ) & & ( a ! = 1 ) & & ( b ! = 1 ) ) System . out . println ( " Alice " ) ; if ( ( a < b ) & & ( a ! = 1 ) & & ( b ! = 1 ) ) System . out . println ( " Bob " ) ; if ( a = = b ) System . out . println ( " Draw " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; String [ ] s = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] = = ' Y ' ) { ans + = 1 ; } } if ( ans = = 0 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; public class Main { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; HashMap < Integer , Arraylist < Integer > > h = new HashMap < Integer , Arraylist < Integer > > ( ) ; Hashmap < Integer , Integer > hm = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; if ( ! h . containkey ( P ) ) { h . put ( P , new ArrayList < Integer > ( ) ) ; } h . get ( P ) . add ( Y ) ; hm . put ( Y , i ) ; } for ( int key : h . keyset ( ) ) { Collection . sort ( h . keyset ( ) ) ; } String [ ] ans = new String [ M ] ; for ( int key : h . keyset ( ) ) { string first = key + " " ; for ( int i = 0 ; i < 6 - ( key + " " ) . length ; i + + ) { first = " 0 " + first ; } for ( int i = 0 ; i < h . get ( key ) . size ; i + + ) { int ind = hm . get ( h . get ( key ) . get ( i ) ) ; String second = ( i + 1 ) + " " ; for ( int j = 0 ; j < 6 - ( ( i - 1 ) + " " ) . size ; j + + ) { second = " 0 " + second ; } ans [ ind ] = first + second ; } } for ( String an : ans ) { System . out . println ( an ) ; } } } import java . util . Scanner ; ? ? public class Main { ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? Scanner sc = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? int x = sc . nextInt ( ) ; int answer = x * x * x ; ? ? ? ? ? ? ? ? System . out . println ( answer ) ; ? ? ? ? } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ( ) ; } min = a [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } } system . out . println ( count ) ; } } import java . io . * ; class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( Reader in ) ; System . out . print ( i * i * i ) ; } } 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 Solution { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastReader in = new FastReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastReader in , PrintWriter out ) { out . println ( ( int ) Math . pow ( in . nextInt ( ) , 2 ) ) ; } } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } package ABC . ABC051 ; import java . util . Scanner ; public class B { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int answer = 0 ; if ( S > K * 3 ) { System . out . println ( 0 ) ; return ; } for ( int i = K ; i > = 0 ; i -- ) { int tmp1 = S - i ; if ( tmp1 > K + K ) { break ; } for ( int j = K ; j > = 0 ; j -- ) { int tmp2 = tmp1 - j ; if ( tmp2 < 0 ) { continue ; } else if ( tmp2 > K ) { break ; } answer + + ; } } System . out . println ( answer ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } public class XCubic { public static void main ( String [ ] args ) { int y = new java . util . Scanner ( System . in ) . nextInt ( ) ; int x = 1 ; x = y * y * y ; System . out . print ( x ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner tc = new Scanner ( System . in ) ; int N , K ; N = tc . nextInt ( ) ; K = tc . nextInt ( ) ; if ( K > = 1 & & K < = 100 & & N > = 1 & & N < = 100 ) { if ( N > K ) { int D = N - K ; System . out . println ( D ) ; } if ( K > N ) { int D = K - N ; System . out . println ( D ) ; } } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] unko = new int [ 3 ] ; int sum = 1 ; for ( int i = 0 ; i < 3 ; i + + ) { unko [ i ] = cs . nextInt ( ) ; sum * = unko [ i ] ; } if ( sum = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int N4 = sc . nextInt ( ) ; ArrayList < int > a = new ArrayList < int > ( ) ; a . add ( 1 ) ; a . add ( 7 ) ; a . add ( 9 ) ; a . add ( 4 ) ; if ( a . indexOf ( N1 ) ! = - 1 ) { a . remove ( a . indexOf ( N1 ) ) ; if ( a . indexOf ( N2 ) ! = - 1 ) { a . remove ( a . indexOf ( N2 ) ) ; if ( a . indexOf ( N3 ) ! = - 1 ) { a . remove ( a . indexOf ( N3 ) ) ; if ( a . indexOf ( N4 ) ! = - 1 ) { System . out . println ( " YES " ) ; } } } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; public class TwoRectangles { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int s1 = a * b ; int s2 = c * d ; if ( s1 > = s2 ) { System . out . println ( s1 ) ; } else { System . out . println ( s2 ) ; } } } import java . io . * ; public class B { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( 1 < = x & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " 値の範囲が正しくありません " ) ; } } catch ( IOException e ) y tem.o t .println ( e ) } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; class stillTBD { public static void main ( String args [ ] ) { try { Date boundaryDate = ConvertDateFromString ( " 2019 / 04 / 30 " ) ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; int result = ConvertDateFromString ( input ) . compareTo ( boundaryDate ) ; if ( ( result = = - 1 ) | | ( result = = 0 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } scanner . close ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static Date ConvertDateFromString ( String dateStr ) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date formatDate = sdf . parse ( dateStr ) ; System . out . println ( formatDate ) ; return formatDate ; } } # include < iostream > using namespace std ; int main ( ) { int a , b , x , y ; cin > > a > > b ; x = a * b ; y = 2 * ( a + b ) ; cout < < x < < " " < < y < < endl ; return 0 ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 1 ; i < = N ; i + + ) { for ( int j = 1 ; j < = i ; j + + ) { if ( P [ i - 1 ] < = P [ j - 1 ] ) { break ; } } if ( j = = i ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = New Scaner ( System . in ) ; int x ; x = scan . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { public static void main ( string args [ ] ) { Scanner scan = new Scanner ( Ststem . in ) ; int x = scan . next ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } 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 array [ ] [ ] = new int [ m ] [ 4 ] ; for ( int i = 0 ; i < m ; i + + ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; array [ i ] [ 1 ] = sc . nextInt ( ) ; array [ i ] [ 2 ] = i ; } Comp comp = new Comp ( ) ; Arrays . sort ( array , ( a , b ) - > Integer . compare ( a [ 0 ] , b [ 0 ] ) ) ; int index = 0 ; for ( int i = 1 ; i < = m ; i + + ) { if ( i = = m ) { checkYear ( array , index , i ) ; } else if ( array [ i - 1 ] [ 0 ] ! = array [ i ] [ 0 ] ) { checkYear ( array , index , i ) ; index = i ; } } Arrays . sort ( array , ( a , b ) - > Integer . compare ( a [ 2 ] , b [ 2 ] ) ) ; for ( int i = 0 ; i < m ; i + + ) { System . out . printf ( " % 012d \ n " , array [ i ] [ 0 ] * 1000000 + array [ i ] [ 3 ] ) ; } } private static void checkYear ( int array [ ] [ ] , int index , int i ) { for ( int j = index ; j < i ; j + + ) { int min = 1000000001 ; int minIndex = 0 ; for ( int k = index ; k < i ; k + + ) { if ( array [ k ] [ 3 ] ! = 0 ) { continue ; } if ( array [ k ] [ 1 ] < min ) { min = array [ k ] [ 1 ] ; minIndex = k ; } } array [ minIndex ] [ 3 ] = j - index + 1 ; } } } import java . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int x = a . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String args [ ] ) { Integer s = new Integer ( ) ; int data s . Integer . parseInt ( args [ 0 ] ) ; System . out . println ( data * data * data ) ; } } import java . util . Scanner ; public class IrohaandHaiku { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 | | b = = 5 | | c = = 5 ) { if ( a = = 7 | | b = = 7 | | c = = 7 ) { if ( a + b + c = = 17 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } } public class Xcubic { public static void main ( String [ ] args ) { int X = 2 ; System . out . println ( X * X * X ) ; } } import java . math . BigDecimal ; import java . math . MathContext ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; BigDecimal x [ ] , y [ ] ; x = new BigDecimal [ N ] ; y = new BigDecimal [ N ] ; for ( int i = 0 ; i < N ; i + + ) { int x1 , y1 ; x1 = sc . nextInt ( ) ; y1 = sc . nextInt ( ) ; x [ i ] = new BigDecimal ( x1 ) ; y [ i ] = new BigDecimal ( y1 ) ; } int c = 2 ; for ( int i = 2 ; i < = N ; i + + ) { c * = i ; } c = c / N ; int C = 1 ; for ( int i = 2 ; i < = N ; i + + ) { C * = i ; } BigDecimal sum = new BigDecimal ( 0 ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { BigDecimal x1 = x [ i ] . add ( x [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; BigDecimal y1 = y [ i ] . add ( y [ j ] . multiply ( new BigDecimal ( - 1 ) ) ) ; x1 = x1 . multiply ( x1 ) ; y1 = y1 . multiply ( y1 ) ; x1 = x1 . add ( y1 ) ; x1 = x1 . sqrt ( MathContext . DECIMAL32 ) ; sum = sum . add ( x1 ) ; } } sum = sum . multiply ( new BigDecimal ( c ) ) ; sum = sum . divide ( new BigDecimal ( C ) , 10 , BigDecimal . ROUND _ HALF _ UP ) ; System . out . println ( sum . toPlainString ( ) ) ; } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { System . out . println ( " Please input number . ( 1 < = x < = 100 ) " ) ; int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( " answer is " + x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int m = scn . nextInt ( ) ; char [ ] [ ] aa = new char [ n ] [ n ] ; char [ ] [ ] bb = new char [ m ] [ m ] ; for ( int i = 0 ; i < n ; i + + ) { String a = scn . next ( ) ; for ( int j = 0 ; j < n ; j + + ) { A [ i ] [ j ] = a . charAt ( j ) ; } } for ( int i = 0 ; i < m ; i + + ) { String b = scn . next ( ) ; for ( int j = 0 ; j < m ; j + + ) { bb [ i ] [ j ] = b . charAt ( j ) ; } } String ans = " No " ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { if ( i + m > n | | j + m > n ) { break ; } for ( int k = 0 ; k < m ; k + + ) { for ( int l = 0 ; l < m ; l + + ) { if ( aa [ i + k ] [ j + l ] = = bb [ k ] [ l ] ) { ans = " Yes " ; break ; } } } } } System . out . println ( ans ) ; } } public void static main ( String [ ] args ) { int [ ] x = { 2 , 3 } ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( Sting [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( system . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . printIn ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . print ( x * x * x ) ; } } import java . io . * ; class oneCardPoker { public static void main ( String args [ ] ) throws IOException { int number [ ] ; number = new int [ 2 ] ; BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String strNum [ ] = str . split ( " " ) ; for ( int i = 0 ; i < 2 ; i + + ) { number [ i ] = Integer . parseInt ( strNum [ i ] ) ; } if ( number [ 0 ] > number [ 1 ] ) { System . out . println ( " Alice " ) ; } else if ( number [ 0 ] < number [ 1 ] ) { System . out . println ( " BOb " ) ; } else if ( number [ 0 ] = = number [ 1 ] ) { System . out . println ( " Draw " ) ; } return ; } } import java . util . * ; public class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Mian { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { if ( ( a = = 7 ) & & ( b = = 5 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 5 ) & & ( b = = 7 ) & & ( c = = 5 ) ) { System . out . println ( " YES " ) ; } else if ( ( a = = 5 ) & & ( b = = 5 ) & & ( c = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int n = Integer . parseInt ( sc . next ( ) ) ; if ( n = = 5 ) five + + ; else if ( n = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int answer = x ^ 3 ; System . out . println ( answer ) ; } } import java . io . * ; public class Exercise { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { int [ ] A = new int [ 3 ] ; Scanner scan = new Scanner ( System . in ) ; A [ 0 ] = Integer . parseInt ( scan . next ( ) ) ; A [ 1 ] = Integer . parseInt ( scan . next ( ) ) ; A [ 2 ] = Integer . parseInt ( scan . next ( ) ) ; int tmpmin = 101 ; int nummin = 0 ; int tmpmax = 0 ; int nummax = 0 ; int num = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( tmpmin > = A [ i ] ) { tmpmin = A [ i ] ; nummin = i ; } if ( tmpmax < A [ i ] ) { tmpmax = A [ i ] ; nummax = i ; } if ( i ! = nummin & & i ! = nummax ) { num = i ; } } int cost = 0 ; cost + = A [ num ] - A [ nummin ] ; cost + = A [ nummax ] - A [ num ] ; System . out . println ( cost ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; int intInputData = parseInt ( r . readLine ( ) ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class AssignA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] N = new int [ 4 ] ; N [ 0 ] = sc . nextInt ( ) ; N [ 1 ] = sc . nextInt ( ) ; N [ 2 ] = sc . nextInt ( ) ; N [ 3 ] = sc . nextInt ( ) ; boolean ans = solve ( N ) ; System . out . println ( ans ? " YES " : " NO " ) ; } private static boolean solve ( int [ ] N ) { Arrays . sort ( N ) ; if ( N [ 0 ] = = 1 & & N [ 1 ] = = 4 & & N [ 2 ] = = 7 & & N [ 3 ] = = 9 ) { return true ; } return false ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = in . readLine ( ) ) ! = null ) { if ( line . equals ( " " ) ) line = " ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ; System . out . print ( Integer . parseInt ( line ) ^ 3 ) ; } stdReader . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( - 1 ) ; } } } import java . io . * ; class Main { public static void main ( String arg [ ] ) { int num ; String buf ; try { BufferedREader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; num = Integer . parseInt ( bur ) ; System . out . print ( num * num * num ) ; System . out . print ( " \ n " ) ; } catch ( Exception e ) { } } } public class Xcubic { public static void main ( String [ ] args ) { int X = 2 ; System . out . println ( X * X * X ) ; int Y = 3 ; System . out . println ( Y * Y * Y ) ; } } import java . io * class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( ( int ) Match . pow ( x , 3 ) ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = a . substring ( 5 , 7 ) ; int n = Interger . parseInt ( a ) ; if ( n > 4 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } import java . util . * ; public class AOJ _ 02 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { System . out . println ( sc . nextInt ( ) + sc . nextInt ( ) ) ; } } } import java . util . * ; class Main { public static void main ( string [ ] args ) { Scanner sc = New Scanner ( System . In ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * x * x ) + ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] argas ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( a . charAt ( i ) = = " 1 " ) count + + ; } System . out . println ( count ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Vector ; public class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String num = br . readLine ( ) ; if ( num = = null ) { break ; } int a = num . split ( " " ) [ 0 ] , b = num . split ( " " ) [ 1 ] ; System . out . println ( a + b ) ; } } } class Main { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } mport java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int m = scanner . nextInt ( ) ; int [ ] pList = new int [ m ] ; int [ ] yList = new int [ m ] ; Map < Integer , Integer > yearTree = new TreeMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < m ; i + + ) { pList [ i ] = scanner . nextInt ( ) ; yList [ i ] = scanner . nextInt ( ) ; yearTree . put ( yList [ i ] , pList [ i ] ) ; } int [ ] pCounter = new int [ n ] ; for ( int yi : yearTree . keySet ( ) ) { yearTree . put ( yi , + + pCounter [ yearTree . get ( yi ) - 1 ] ) ; } for ( int i = 0 ; i < m ; i + + ) { System . out . println ( String . format ( " % 06d % 06d " , pList [ i ] , yList [ i ] ) ) ; } } } public class XCube { public static void main ( String [ ] args ) { int x = 2 ; int y = x * x * x ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BuffreredReader br = new BufferedReader ( is ) ; int i = br . readLine ( ) ; int j = i * i ; System . out . println ( " + j + " ) ; } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String nb = br . readLine ( 3 ) ; int x = I teger.p a rseInt ( n b ) ; S y s em.out . pri n tln ( Mat h .pow ( x , 3 ) ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int X = x ; for ( int i = 0 ; i < 2 ; i + + ) { X * = x ; } System . out . println ( X ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String s = br . readLine ( ) ; String [ ] str = br . readLine ( ) . split ( ' / ' ) ; int y = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; if ( y > 2019 | | ( y < = 2019 & & ( m > 5 ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } import java . util . * ; public class Main81B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; A < a ; a + + ) { for ( int b = 0 ; B < b ; b + + ) { int c = ( X - a * 500 - b * 100 ) / 50 ; if ( c < = C & & c > = 0 ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } class Main { public static void main ( String [ ] args ) { int x = 3 ; int sum = 0 ; sum = x * x * ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 | | a = = 5 & & b = = 7 & & c = = 5 = | | a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . * ; import java . lang . * ; ? ? class Main { ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Scanner s = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int x = s . nextInt ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( x * x * x ) ; ? ? ? ? ? ? ? ? } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int [ ] b = new int [ a ] ; int sum = 0 ; for ( int i = 0 ; i < a ; i + + ) { b [ i ] = sc . nextInt ( ) ; sum + = b [ i ] ; } int pos = 0 ; if ( sum % a > = a ( float ) / 2 ) pos = ( sum / a ) + 1 ; else pos = sum / a ; sum = 0 ; for ( int i = 0 ; i < a ; i + + ) { sum + = ( b [ i ] - pos ) * ( b [ i ] - pos ) ; } System . out . println ( sum ) ; } public static long factorial ( long n ) { if ( n = = 0 ) { return new Long ( 1 ) ; } System . out . println ( n * factorial ( n - 1 ) ) ; return n * factorial ( n - 1 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; n = n * n * n System . out . println ( n ) ; } } import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A = = 1 ) { A = 14 ; } if ( B = = 1 ) { B = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; return ; } if ( B > A ) { System . out . println ( " Bob " ) ; return ; } if ( A = = B ) { System . out . println ( " Draw " ) ; } } } import java . util . * ; class Main ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] fromAnt ; int [ ] toAnt ; for ( int i = 0 ; i < 5 ; i + + ) { fromAnt [ i ] = sc . nextInt ( ) ; toAnt [ i ] = fromAnt [ i ] ; } for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( toAnt [ j ] - fromAnt [ i ] > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; return ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int ans = 0 ; char [ ] s = new char [ N ] ; for ( int i = 0 ; i < N ; i + + ) { s [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( s [ i ] = = ' Y ' ) { ans + = 1 ; } } if ( ans = = 0 ) { System . out . println ( " Three " ) ; } if ( ans > 0 ) { System . out . println ( " Four " ) ; } } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws IOException { int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scan . nextInt ( ) ; } int ans = Integer . MAX _ VALUE ; for ( int i = 1 ; i < = 100 ; i + + ) { int temp = 0 ; for ( int j = 0 ; j < n ; j + + ) { temp + = ( int ) Math . pow ( ( x [ j ] - i ) , 2 ) ; } if ( temp < ans ) ans = temp ; } System . out . println ( ans ) ; } } n1 = int ( input ( ) ) r1 = n1 * n1 print ( r1 ) import java . util . Scanner ; public class ProblemA { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { n = sc . nextInt ( ) ; if ( n = = 5 ) { five + + ; } else if ( n = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] = N [ 4 ] N [ 0 ] = sc nextInt ( ) ; N [ 1 ] = sc nextInt ( ) ; N [ 2 ] = sc nextInt ( ) ; N [ 3 ] = sc nextInt ( ) ; Arrays . sort ( N [ ] ) ; if ( N [ 0 ] = = 1 ) { if ( N [ 1 ] = = 4 ) { if ( N [ 2 ] = = 7 ) { if ( N [ 3 ] = = 9 ) { System . println ( " YES " ) ; } } } } else { System . println ( " NO " ) ; } } } import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ans = 0 ; System . out . println ( ans ) ; } } import java . util . * ; class Mani ( ) { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nums [ ] ; for ( int i = 0 ; i < nums . length ; i + + ) nums [ i ] = sc . nextInt ( ) ; if ( nums [ 1 ] = < nums [ 3 ] ) { System . out . print ( " NO " ) ; } else { for ( int i = 0 ; i < nums [ 4 ] + 1 ; i + + ) { if ( nums [ 0 ] > = nums [ 2 ] ) { System . out . print ( " YES " ) ; break ; } else if ( nums [ 4 ] = = i ) { System . out . print ( " NO " ) ; } nums [ 0 ] + = nums [ 1 ] ; nums [ 2 ] + = nums [ 3 ] ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; long sum _ N = 1 ; long sum _ M = 1 ; long ans = 0 ; int n _ m = Math . abs ( N - M ) ; if ( n _ m < 2 ) { for ( long i = N ; i < = 0 ; i -- ) { sum _ N * = i ; } for ( long j = M ; j < = 0 ; j -- ) { sum _ M * = j ; } if ( n _ m = 0 ) { ans = sum _ N * sum _ M * 2 ; } else { ans = sum _ N * sum _ M ; } } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x : = 3 ; System . out . println ( x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * x * x ) + ) ; } } import java . util . Scanner ; import java . util . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] K = new int [ N ] ; int L = 100 ; int R = 0 ; int ans = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { K [ i ] = sc . nextInt ( ) ; L = Math . min ( L , K [ i ] ) ; R = Math . max ( R , K [ i ] ) ; } for ( int i = L ; i < = R ; i + + ) { int tmp = 0 ; for ( int i = 0 ; i < N ; i + + ) { tmp + = ( K [ i ] - i ) * ( K [ i ] - i ) ; } ans = Math . min ( ans , tmp ) ; } System . out . print ( ans ) ; } } public static int calculateCube ( int x ) { int result = 0 ; if ( x > = 1 | | x < = 100 ) { result = x * x * x ; } return result ; } public static void main ( String [ ] args ) { int cubic = calculateCube ( 2 ) ; System . out . println ( cubic ) ; } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 7 | | B = = 7 | | C = = 7 ) { if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( B = = 7 ) { if ( C = = 5 & & A = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( C = = 7 ) { if ( A = = 5 & & B = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } else { System . out . println ( " no " ) ; } } } import java . io ; class Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamreader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( a * a * a ) ; } } import java . util . * ; public class Aaa { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; double pow = 1 ; double ans = 0 ; for ( i = 1 ; i < = N ; i + + ) { pow = pow * i ; ans = ( double ) pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ( int ) ans ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = new int ( in . readLine ( ) ) ; Ststem . out . println ( x * x * x ) ; } } import java . io . * class Main { public static void main ( String [ ] args ) throws IOException { Buffered reader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int a = parseInt ( str ) ; System . out . print ( a * a * a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class sample { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = a * a * a ; print ( b ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util * . ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a & & b = = 5 ) { if ( c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) } if ( a & & c = = 5 ) { if ( b = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) } if ( b & & c = = 5 ) { if ( a = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) } } } public class Pangkat { public static void main ( String [ ] args ) { int a = 0 , c = 0 ; int b = 3 ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } public class main { public static void main ( string [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } package abc042 ; import java . util . Scanner ; public class Iroha _ and _ Haiku { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int A = stdIn . nextInt ( ) ; int B = stdIn . nextInt ( ) ; int C = stdIn . nextInt ( ) ; if ( A = = 5 & & B = = 5 & & C = = 7 ) System . out . println ( " Yes " ) ; else if ( A = = 5 & & B = = 7 & & C = = 5 ) System . out . println ( " Yes " ) ; else if ( A = = 7 & & B = = 5 & & C = = 5 ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ' \ n ' + scanner . next ( ) + ' \ n ' ) ; if ( sb . charAt ( sb . length ( ) - 2 ) = = ' ? ' ) { sb . setChatAt ( sb . length ( ) - 2 , ' D ' ) ; } while ( sb . indexOf ( " ? " ) > - 1 ) { for ( int i = 1 ; i < sb . length ( ) - 1 ; i + + ) { if ( sb . charAt ( i ) = = ' ? ' ) { if ( sb . charAt ( i - 1 ) = = ' P ' ) { sb . setCharAt ( i , ' D ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' D ' ) { sb . setCharAt ( i , ' P ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' P ' ) { sb . setCharAt ( i , ' D ' ) ; } else if ( sb . charAt ( i + 1 ) = = ' ? ' ) { continue ; } } } } System . out . println ( sb . substring ( 1 , sb . length ( ) - 1 ) ) ; } } # coding : UTF _ 8 x = input ( ) y = x * * 3 print int ( y ) ; import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int input = scan . nextInt ( ) ; int ans = input * input * input ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; string str = br . readline ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int i , o ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( br . readLine ( ) ) ; o = i * i * i ; System . out . println ( o ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; sc . close ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } package score100 ; import java . util . Scanner ; public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = b & & b = = 5 & & c = = 7 | | b = = c & & c = = 5 & & a = = 7 | | c = = a & & a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int x = Integer . parseInt ( line ) ; int a = x * x * x ; System . out . println ( a ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } import java . util . * ; import java . math . * ; class contest { public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; long n ; n = cin . nextInt ( ) ; n = ( int ) Math . pow ( n , 2 ) ; System . out . println ( n ) ; } } ; import java . util . * ; public class Program { public void run ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int y = 1 ; for ( int i = 0 ; i < 3 ; i + + ) y * = x ; System . out . println ( y ) ; } public static void main ( String [ ] args ) { Program p = new Program ( ) ; p . run ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( System . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( 9 ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) e . printStackTrace ( ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ; min = a [ 0 ] ; } for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } system . out . println ( min ) ; } } } class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextLine ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; for ( int i = 1 ; i < N ; i + + ) { int Min ; int Max ; if ( Min > a ) Min = a ; if ( Max < a ) Max = a ; } System . out . println ( Max - Min ) ; } class Main { public static void main ( String args [ ] ) { int x ; System . in . read ( x ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { String s ; int i , g ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { s = sc . next ( ) if ( s . equals ( " 0 " ) ) break ; g = 0 ; for ( i = 0 ; i < s . length ( ) ; i + + ) g + = s . charAt ( i ) - 48 ; System . out . println ( g ) ; } } } class Main { public static void main ( String [ ] args ) { int x = 3 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long M = sc . nextLong ( ) ; long sum _ N = 0 ; long sum _ M = 0 ; if ( ABS ( N - M ) < 2 ) { for ( i = N ; i = 0 ; i -- ) { sum _ N * = i ; } for ( j = M ; j = 0 ; j -- ) { sum _ M * = j ; } } System . out . println ( sum _ N * sum _ M ) ; } } package abc055 ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( 800 * n - 200 * ( n / 15 ) ) ; } } public class Main { public static void main ( String [ ] args ) { String test = args [ 0 ] ; int temp = ( int ) args [ 0 ] ; int answer = temp * temp * temp ; System . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int y = Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } import heapq n , m = [ int ( v ) for v in input ( ) . split ( ' ' ) ] costs = [ ] links = [ ] for i in range ( n ) : costs . append ( [ 0 ] * i ) links . append ( set ( ) ) for i in range ( m ) : l , r , c = [ int ( v ) for v in input ( ) . split ( ' ' ) ] l - = 1 r - = 1 for j in range ( l , r ) : for k in range ( j + 1 , r + 1 ) : c0 = costs [ k ] [ j ] if c0 = = 0 or c0 > c : costs [ k ] [ j ] = c links [ k ] . add ( j ) h = [ ] heapq . heappush ( h , ( 0 , n - 1 ) ) closed = n while len ( h ) > 0 : c0 , n0 = heapq . heappop ( h ) if closed < = n0 : continue closed = n0 if n0 = = 0 : print ( c0 ) exit ( ) for n1 in links [ n0 ] : c1 = costs [ n0 ] [ n1 ] heapq . heappush ( h , ( c0 + c1 , n1 ) ) print ( " -1 " ) import java . util . * ; import java . lang . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ar = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { ar [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ar ) ; int k = sc . nextInt ( ) ; if ( k > e - a ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } sc . close ( ) ; } } import java . util . * ; class Solution { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int l = scan . nextInt ( ) ; String [ ] ss = new String [ n ] ; int i = 0 ; while ( i < n ) { ss [ i ] = scan . next ( ) ; i + + ; } Arrays . sort ( ss ) ; String res = " " ; for ( String s : ss ) { res + = s ; } System . out . println ( res ) ; } } import java . util . * ; import java . text . SimpleDateFormat ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; SimpleDateFormat format = new SimpleDateFormat ( " yyyy / MM / dd " ) ; try { Date date = format . parse ( sc . next ( ) ) ; Date last = format . parse ( " 2019 / 04 / 30 " ) ; System . out . println ( date . after ( last ) ? " TBD " : " Heisei " ) ; } catch ( Exception e ) { } } # include < iostream > # include < string > # include < math . h > # include < algorithm > # define rep ( i , n ) for ( int i = 0 ; i < n ; i + + ) using namespace std ; int main ( ) { int a ; cin > > a ; cout < < a * 800 - a / 15 * 200 < < endl ; return 0 ; } import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int radius = sc . nextInt ( ) ; System . out . println ( 3.1415 * radius * radius ) ; } } class Main { public static void main ( String [ ] args ) { int i = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( i * i * i ) ; Return 0 ; } } class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; System . out . println ( x * x * x ) ; } } package javaapplication1 ; import java . util . Scanner ; public class jou { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; a = a * a * a ; System . out . println ( a ) ; } } import java . util . Scanner ; public class Ferris _ Wheel { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num1 = scan . nextInt ( ) ; int num2 = scan . nextInt ( ) ; if ( num1 < = 12 ) { num2 / = 2 ; } if ( num1 < = 5 ) { num2 = 0 ; } System . out . println ( num2 ) ; scan . close ( ) ; } } ipackage AtCoder2020May3Beginner ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( int i = 1 ; i * i < = n ; i + + ) { if ( n % i = = 0 ) { al . add ( i ) ; al . add ( n / i ) ; } } Collections . sort ( al ) ; for ( int val : al ) { for ( int i = 0 ; i < = val ; i + + ) { if ( check ( i , i - val , n ) ) { System . out . println ( i + " " + ( i - val ) ) ; return ; } } } System . out . println ( " a " ) ; } public static boolean check ( long a , long b , int x ) { long val1 = a * a * a * a * a ; long val2 = b * b * b * b * b ; if ( val1 - val2 = = ( long ) x ) { return true ; } else { return false ; } } } import java . util . Scanner ; class main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int y ; y = scan . nextInt ( x ) ; y = y * y * y ; System . out . println ( y ) ; } } import java . io . * ; class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( Reader in ) ; System . out . print ( i * i * i ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class APointInATriangle { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; Boolean isNull = str = = null ; while ( ! isNull ) { String [ ] datas = str . split ( " " , 8 ) ; double x1 = Double . parseDouble ( datas [ 0 ] ) ; double y1 = Double . parseDouble ( datas [ 1 ] ) ; double x2 = Double . parseDouble ( datas [ 2 ] ) ; double y2 = Double . parseDouble ( datas [ 3 ] ) ; double x3 = Double . parseDouble ( datas [ 4 ] ) ; double y3 = Double . parseDouble ( datas [ 5 ] ) ; double xp = Double . parseDouble ( datas [ 6 ] ) ; double yp = Double . parseDouble ( datas [ 7 ] ) ; double x = xp - x1 ; double y = yp - y1 ; double p = x2 - x1 ; double q = y2 - y1 ; double r = x3 - x1 ; double u = y3 - y1 ; double [ ] coefficient = Simultaneous ( p , r , x , q , u , y ) ; double s = coefficient [ 0 ] ; double t = coefficient [ 1 ] ; if ( s < 0 | | t < 0 ) { System . out . println ( " NO " ) ; } else if ( s + t > 0 & & s + t < 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } str = br . readLine ( ) ; isNull = str = = null ; } } private static double [ ] Simultaneous ( double a , double b , double c , double d , double e , double f ) { double x = ( double ) ( e * c - b * f ) / ( a * e - b * d ) ; double y = ( double ) ( a * f - c * d ) / ( a * e - b * d ) ; double [ ] answer = { x , y } ; return answer ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ; int x = reader . readLine ( ) ; System . out . print ( Math . pow ( x , 3 ) ) ; } } package com . company ; import java . io . * ; import java . util . * ; public class lowelements { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 0 ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i - 1 ] > arr [ i ] | | arr [ i - 1 ] = = 1 ) { sum + + ; } } if ( arr [ n - 1 ] = = 1 ) { sum + + ; } out . println ( sum ) ; out . close ( ) ; } 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 . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( i + 1 , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } map . entrySet ( ) . stream ( ) . sorted ( Map . Entry . comparingByValue ( ) ) ; foreach ( String key : map . keySet ( ) ) { for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int cnt = 0 ; if ( K > 1 ) { cnt = N - K ; } System . out . println ( cnt ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new ImputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int x = Integer . parseInt ( s ) ; int a = x * x * x ; System . out . println ( a ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; class TestClass { public static void main ( String args [ ] ) throws Exception { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int a [ ] = new int [ n ] ; System . out . println ( findXor ( a , n ) ) ; } static int findXor ( int arr [ ] , int n ) { int xoR = 0 ; for ( int i = 0 ; i < n ; i + + ) { xoR = xoR ^ arr [ i ] ; } return xoR * 2 ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * * 3 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x , ans ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . println ( ans ) ; } } import java . io . * ; class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( Reader in ) ; System . out . print ( i * i * i ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; Date heiseiDate = new SimpleDateFormat ( " yyyy / MM / dd " ) . format ( 2019 / 04 / 30 ) ; if ( formatDate . before ( heiseiDate ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + a * a * a + ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] KISU = new int [ 100001 ] ; int [ ] GUSU = new int [ 100001 ] ; for ( int i = 0 ; i < = 100000 ; i + + ) { KISU [ i ] = 0 ; GUSU [ i ] = 0 ; } for ( int i = 0 ; i < N ; i + + ) { if ( i % 2 = = 0 ) { KISU [ sc . nextInt ( ) ] + + ; } else if ( i % 2 = = 1 ) { GUSU [ sc . nextInt ( ) ] + + ; } } int K _ MAX = 0 ; int G _ MAX = 0 ; int K _ NUM = 0 ; int G _ NUM = 0 ; int K _ 2nd = 0 ; int G _ 2nd = 0 ; int K _ 2nu = 0 ; int G _ 2nu = 0 ; for ( int i = 0 ; i < = 100000 ; i + + ) { if ( K _ MAX < KISU [ i ] ) { K _ MAX = KISU [ i ] ; K _ NUM = i ; } if ( G _ MAX < GUSU [ i ] ) { G _ MAX = GUSU [ i ] ; G _ NUM = i ; } } Arrays . sort ( KISU ) ; Arrays . sort ( GUSU ) ; K _ 2nd = KISU [ 99998 ] ; G _ 2nd = GUSU [ 99998 ] ; if ( K _ NUM ! = G _ NUM ) { System . out . println ( N - K _ MAX - G _ MAX ) ; } else if ( K _ NUM = = G _ NUM ) { int [ ] [ ] mat = new int [ 2 ] [ 2 ] ; mat [ 0 ] [ 0 ] = K _ MAX ; mat [ 0 ] [ 1 ] = K _ 2nd ; mat [ 1 ] [ 0 ] = G _ MAX ; mat [ 1 ] [ 1 ] = G _ 2nd ; System . out . println ( Math . min ( N - mat [ 0 ] [ 0 ] - mat [ 1 ] [ 1 ] , N - mat [ 0 ] [ 1 ] - mat [ 1 ] [ 0 ] ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; long k = sc . nextLong ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < s . length ( ) ; i + + ) { if ( ( 26 - ( s . charAt ( i ) - ' a ' ) ) < = k ) { k - = 26 - ( s . charAt ( i ) - ' a ' ) ; sb . append ( ' a ' ) ; } else { sb . append ( s . charAt ( i ) ) ; } } if ( k > 0 ) { char t = sb . charAt ( s . length ( ) - 1 ) ; sb . delete ( s . length ( ) - 1 , s . length ( ) ) ; sb . append ( ( char ) ( ( t + k ) % 26 ) ) ) ; } System . out . println ( sb ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } import java . util . Scanner ; import java . util . List ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( a = = b ) { if ( a = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } elif ( a = = c ) { if ( a = = 5 & & b = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } elif ( b = = c ) { if ( b = = 5 & & a = = 7 ) { System . out . println ( " YES " ) ; System . exit ( 0 ) ; } } System . out . println ( " NO " ) ; } } public class Main { public static void main ( Stating [ ] args ) { int x = 2 ; x = x * x * x ; System . out . println ( " x = " + x ) ; } } import java . util . * ; class rect { int ar [ ] = new int [ 4 ] ; public void input ( ) { int i ; Scanner read = new Scanner ( System . in ) ; System . out . println ( " enter " ) ; for ( i = 0 ; i < 4 ; i + + ) { ar [ i ] = read . nextInt ( ) ; } } public int recto ( ) { int a = ( ar [ 0 ] * ar [ 1 ] ) ; int b = ( ar [ 2 ] * ar [ 3 ] ) ; if ( a > b ) return a ; else if ( a < b ) return b ; else return a ; } public static void main ( String [ ] args ) { rect obj = new rect ( ) ; obj . input ( ) ; obj . recto ( ) ; } } inport . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader rd = New BufferedReader ( new InputStreamReader ( system . in ) ) ; int read = IntegerParseInt ( rd . ReadLine ( ) ) ; system . out . println ( ( int ) Math . pow ( read , 3 ) ) ; } } public class wafu { public static void main ( String [ ] args ) { int A ; int B ; int C ; if ( A = = 5 & & B = = 7 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else if ( A = = 5 & & B = = 5 & & C = = 7 ) { System . out . println ( " Yes " ) ; } else if ( A = = 7 & & B = = 5 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int num = scan . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . util . Scanner ; public class P { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ab = Math . abs ( a - b ) ; int ac = Math . abs ( a - c ) ; int ad = Math . abs ( a - d ) ; int ae = Math . abs ( a - e ) ; int bc = Math . abs ( b - c ) ; int bd = Math . abs ( b - d ) ; int be = Math . abs ( b - e ) ; int cd = Math . abs ( c - d ) ; int ce = Math . abs ( c - e ) ; int de = Math . abs ( d - e ) ; int count = 0 ; if ( ab < k ) { count + + ; } if ( ac < k ) { count + + ; } if ( ad < k ) { count + + ; } if ( ae < k ) { count + + ; } if ( bc < k ) { count + + ; } if ( bd < k ) { count + + ; } if ( be < k ) { count + + ; } if ( cd < k ) { count + + ; } if ( ce < k ) { count + + ; } if ( de < k ) { count + + ; } if ( count > 0 ) { System . out . println ( " Yay ! " ) ; } else { Systme . out . println ( " : ( " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Input { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextlnt ( ) ; int b = scan . nextlnt ( ) ; int n = scan . nextlnt ( ) ; if ( a * n < = b * s ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; class kuma { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * x ) ; } } class Cubic { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int fcount = 0 ; int scount = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int a = stdIn . nextInt ( ) ; if ( a = = 5 ) fcount + + ; else if ( a = = 7 ) scount + + ; } if ( fcount = = 2 & & scount = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] KISU = new int [ 100001 ] ; int [ ] GUSU = new int [ 100001 ] ; for ( int i = 0 ; i < = 100000 ; i + + ) { KISU [ i ] = 0 ; GUSU [ i ] = 0 ; } for ( int i = 0 ; i < N ; i + + ) { if ( i % 2 = = 0 ) { KISU [ sc . nextInt ( ) ] + + ; } else if ( i % 2 = = 1 ) { GUSU [ sc . nextInt ( ) ] + + ; } } int K _ MAX = 0 ; int G _ MAX = 0 ; int K _ NUM = 0 ; int G _ NUM = 0 ; int K _ 2nd = 0 ; int G _ 2nd = 0 ; int K _ 2nu = 0 ; int G _ 2nu = 0 ; for ( int i = 0 ; i < = 100000 ; i + + ) { if ( K _ MAX < KISU [ i ] ) { K _ MAX = KISU [ i ] ; K _ NUM = i ; } if ( G _ MAX < GUSU [ i ] ) { G _ MAX = GUSU [ i ] ; G _ NUM = i ; } } Arrays . sort ( KISU ) ; Arrays . sort ( GUSU ) ; K _ 2nd = KISU [ 99999 ] ; G _ 2nd = GUSU [ 99999 ] ; if ( K _ NUM ! = G _ NUM ) { System . out . println ( N - K _ MAX - G _ MAX ) ; } else if ( K _ NUM = = G _ NUM ) { int [ ] [ ] mat = new int [ 2 ] [ 2 ] ; mat [ 0 ] [ 0 ] = K _ MAX ; mat [ 0 ] [ 1 ] = K _ 2nd ; mat [ 1 ] [ 0 ] = G _ MAX ; mat [ 1 ] [ 1 ] = G _ 2nd ; System . out . println ( Math . min ( N - mat [ 0 ] [ 0 ] - mat [ 1 ] [ 1 ] , N - mat [ 0 ] [ 1 ] - mat [ 1 ] [ 0 ] ) ) ; } } } public class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; x = x * x * x ; System . out . println ( x ) ; } } import javafx . util . Pair ; 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 ( ) ; Map < Integer , List < Long > > dic = new HashMap < > ( ) ; List < Pair < Integer , Long > > toi = new ArrayList < > ( ) ; for ( int i = 0 ; i < m ; i + + ) { int x = sc . nextInt ( ) ; long y = sc . nextLong ( ) ; toi . add ( new Pair < > ( x , y ) ) ; List < Long > list = dic . getOrDefault ( x , new ArrayList < > ( ) ) ; list . add ( y ) ; dic . put ( x , list ) ; } Map < Integer , Long [ ] > sortDic = new HashMap < > ( ) ; dic . entrySet ( ) . stream ( ) . forEach ( e - > { Long [ ] tmp = e . getValue ( ) . toArray ( new Long [ e . getValue ( ) . size ( ) ] ) ; Arrays . sort ( tmp ) ; sortDic . put ( e . getKey ( ) , tmp ) ; } ) ; for ( int i = 0 ; i < toi . size ( ) ; i + + ) { Pair mon = toi . get ( i ) ; String x = mon . getKey ( ) . toString ( ) ; String paddingleft = x . format ( " % 6s " , x ) . replace ( " " , " 0 " ) ; String index = String . valueOf ( Arrays . binarySearch ( sortDic . get ( mon . getKey ( ) ) , mon . getValue ( ) ) + 1 ) ; String paddingRight = index . format ( " % 6s " , index ) . replace ( " " , " 0 " ) ; System . out . println ( paddingleft + paddingRight ) ; } } } public class Main { private static int N ; private static int M ; private static int area [ ] ; private static int city [ ] ; private static ArrayList < Integer > p [ ] ; private static Scanner sc ; public static void main ( String [ ] args ) { sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; area = new int [ M ] ; city = new int [ M ] ; p = new ArrayList [ M ] ; for ( int i = 0 ; i < M ; i + + ) { area [ i ] = sc . nextInt ( ) ; city [ i ] = sc . nextInt ( ) ; if ( p [ area [ i ] ] = = null ) p [ area [ i ] ] = new ArrayList < Integer > ( ) ; p [ area [ i ] ] . add ( city [ i ] ) ; } for ( int j = 1 ; j < = N ; j + + ) { Collections . sort ( p [ j ] ) ; } for ( int k = 0 ; k < M ; k + + ) { int pos = p [ area [ k ] ] . indexOf ( city [ k ] ) + 1 ; String str = String . format ( " % 06d % 06d " , area [ k ] , pos ) ; System . out . println ( str ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int count5 = 0 ; int count7 = 0 ; Scanner sc = new Scanner ( System . in ) ; Stirng [ ] line = sc . nextLine ( ) . split ( " " ) ; for ( String n : line ) { if ( n . equals ( " 5 " ) ) { count5 + + ; } if ( n . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " OK " ) ; } else { System . out . println ( " NG " ) ; } } } public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int sum = 1 ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; for ( int k = min ; k < max ; k + + ) { int challengeSum ; for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( k - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( challengeSum ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double radM = ( double ) ( M * 6.0 ) ; double radH = ( double ) ( ( H * 60 + M ) * 0.5 ) ; double rad = Math . abs ( radM - radH ) ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( rad / 180 * Math . PI ) ) ; System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] atgs ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int num = Integer . parseInt ( line ) ; System . out . println ( num * num ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BUfferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } class main1 { public void Main ( ) { String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int xcubic ; int a = 0 ; while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 0 0 ) i = - 1 ; } xc u b c * a a ; Sys e . u . p r n ln ( " " + c b i c + " " ; } } import java . util . * fun main ( args : Array < String > ) { val sc = Scanner ( System . ` in ` ) val a : Int = sc . nextInt ( ) val b : Int = sc . nextInt ( ) val c : Int = sc . nextInt ( ) val d : Int = sc . nextInt ( ) if ( a * b > = c * d ) { print ( a * b ) } else if ( a * b < c * d ) { print ( c * d ) } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; System . out . println ( Math . pow ( a , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = Integer . parseInt ( scan . next ( ) ) ; scan . close ( ) ; int y = ( int ) Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } import java . util . * ; class xCubic { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int n = Integer . parselnt ( so . next ( ) ) ; int result = n * n * n ; System . out . println ( result ) ; } } } import java . until . Scanner ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } public class Min { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; int a = sca . nextInt ( ) ; int b = sca . nextInt ( ) ; int c = sca . nextInt ( ) ; int x = sca . nextInt ( ) ; int y = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( 500 * i ) + ( 100 * j ) + ( 50 * k ) = = x ) { y + + ; } } } } System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int z = 0 ; for ( int i ; A = = X ; i + + ) { z = z + i ; } for ( int j ; B = = X ; j + + ) { z = z + j ; } for ( int k ; C = = X ; k + + ) { z = z + k ; } System . out . print ( z ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int s1 = Math . abs ( a - b ) + Math . abs ( b - c ) ; int s2 = Math . abs ( a - c ) + Math . abs ( b - c ) ; int s3 = Math . abs ( a - b ) + Math . abs ( a - c ) ; System . out . println ( Math . min ( s1 , Math . min ( s2 , s3 ) ) ) ; } } class Main { int x ; public static void main ( String [ ] args ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; int y ; 1 = < x = < 100 ; y = x * x * x ; System . out . println ( " x " ) ; System . out . println ( " y " ) ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; final int [ ] [ ] original = new int [ M ] [ 3 ] ; final int [ ] [ ] year = new int [ 1000001 ] [ 2 ] ; final int [ ] inputOrder = new int [ M ] ; final int [ ] area = new int [ N + 1 ] ; for ( int i = 0 ; i < M ; i + + ) { original [ i ] [ 0 ] = i ; original [ i ] [ 1 ] = sc . nextInt ( ) ; original [ i ] [ 2 ] = sc . nextInt ( ) ; year [ original [ i ] [ 2 ] ] [ 0 ] = original [ i ] [ 1 ] ; inputOrder [ i ] = original [ i ] [ 2 ] ; } for ( int i = 1 ; i < year . length ; i + + ) { area [ year [ i ] [ 0 ] ] + + ; year [ i ] [ 1 ] = area [ year [ i ] [ 0 ] ] ; } String tempArea ; String tempYearOrder ; for ( int i = 0 ; i < M ; i + + ) { tempArea = String . valueOf ( year [ inputOrder [ i ] ] [ 0 ] ) ; tempYearOrder = String . valueOf ( year [ inputOrder [ i ] ] [ 1 ] ) ; while ( tempArea . length ( ) < 6 ) { tempArea = " 0 " + tempArea ; } while ( tempYearOrder . length ( ) < 6 ) { tempYearOrder = " 0 " + tempYearOrder ; } System . out . println ( tempArea + tempYearOrder ) ; } } } import java . util . Scanner ; public class Main { 3. public static void main ( String [ ] args ) { 4 . Scanner sc = new Scanner ( System . in ) ; 5. int n = sc . nextInt ( ) ; 6. int x = 800 * n ; 7. int y = 200 * ( n / 25 ) ; 8 . System . out . println ( x - y ) ; 9 . } 10 . } # include < bits / stdc + + . h > using namespace std ; typedef long long LL ; const int maxn = 2e3 + 5 ; LL a [ maxn ] ; LL b [ maxn ] [ maxn ] ; int main ( ) { int n ; LL x , sum = 1L L < < 60L L ; cin > > n > > x ; for ( int i = 1 ; i < = n ; i + + ) cin > > a [ i ] ; for ( int i = 1 ; i < = n ; i + + ) { b [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < = n - 1 ; k + + ) { int pos = i - k ; if ( pos < = 0 ) pos = n - abs ( pos ) ; b [ i ] [ k ] = min ( b [ i ] [ k - 1 ] , a [ pos ] ) ; } } for ( int k = 0 ; k < = n - 1 ; k + + ) { LL ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { ans + = b [ i ] [ k ] ; } sum = min ( sum , ans + x * k ) ; } cout < < sum < < endl ; } public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k = = 1 ) System . out . println ( " 0 " ) ; else System . out . println ( n - k ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a ; int b ; a = Integer . parseInt ( br . readLine ( ) ) ; sannjyou sa = new sannjyou ( ) ; b = sa . sann ( a ) ; System . out . println ( b ) ; } } public class sannjyou { private int a ; public int sann ( int b ) { a = b ; int k ; k = a * a * a ; return k ; } } package helloworld ; import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int n = r . nextInt ( ) ; System . out . println ( n * n ) ; } } public class study { public static void main ( String [ ] args ) { int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int a = 60 * ( H2 - H1 ) , b = M2 - M1 + a ; int l = b - K ; System . out . println ( l ) ; } } public class Xcube { public static void main ( String [ ] args ) { int x = 0 ; try { x = Integer . parseInt ( args [ 0 ] ) ; } catch ( NumberFormatException e ) { System . out . println ( args [ 0 ] + " ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y tem.ex i t ( 1 ) ; } y tem.ou t .pr i ntln ( x * ) } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int mindex = 0 ; int sum = 0 ; int [ ] alist = { a , b , c , d , e } ; int [ ] slist = 5 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( alist [ mindex ] % 10 = = 0 | | alist [ mindex ] % 10 > alist [ i ] % 10 & & alist [ i ] % 10 ! = 0 ) { mindex = i ; } } for ( int i = 0 ; i < 5 ; i + + ) { if ( i = mindex | | alist [ i ] % 10 = = 0 ) { sum + = alist [ i ] ; } else { sum + = alist [ i ] / 10 * 10 + 10 ; } } System . out . println ( sum ) ; } } package javaapplication1 ; import java . util . Scanner ; public class sum { public static void main ( String args [ ] ) { int m , n , sum = 0 ; Scanner s = new Scanner ( System . in ) ; while ( true ) { m = s . nextInt ( ) ; if ( m = = 0 ) break ; sum = 0 ; while ( m ! = 0 ) { n = m % 10 ; sum + = n ; m = m / 10 ; } System . out . println ( sum ) ; } } } } public class Main ( ) { public static void main ( String [ ] args ) throws Exception { int y = 2 ; int x = y * y * y ; System . out . println ( x ) ; } } inport java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; String x = " NO " ; if ( a = = 5 ) { if ( ( b = = 5 ) % % ( c = = 7 ) ) { x = " YES " ; } else if ( ( b = = 7 ) % % ( c = = 5 ) ) { x = " YES " ; } } else if ( a = = 7 ) { if ( ( b = = 5 ) & & ( c = = 5 ) ) { x = " YES " ; } } System . out . println ( x ) ; } } public class Main { public static int cul ( int x ) { y = Math . pow ( x , 3 ) ; return y ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = " " ; for ( ; ; ) { System . out . print ( " > " ) ; input = in . readLine ( ) ; try { Integer . parseInt ( input ) ; } catch ( NumberFormatException e ) { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; nt nteger. p arseInt ( i nput ) ; f ( ( x ) | x 00 ) ) { ystem. o ut. p rintln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } e s e { x ; S y tem.ou t .pr i ntln ( x ) ; b r ak ; } public class TwoCoins ( ) { public static void main ( string args [ ] ) { private int coinVal ; private int coinVal2 ; private int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; if ( coinVal + coinVal2 > = toyPrice ) { system . out . println ( " yes " ) ; } else { system . out . println ( " no " ) ; } } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String nb = br . readLine ( ) ; int x = I teger.p a rseInt ( n b ) ; S y s em.out . pri n tln ( Mat h .pow ( x , 3 ) ) ; } } import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner std = new Scanner ( System . in ) ; int n = std . nextInt ( ) ; System . out . println ( math . pow ( n , 3 ) ) ; } } class Main { public static void main ( String args [ ] ) { double d = Integer . parseInt ( args [ 0 ] ) ; int i = Math . pow ( d , 3 ) ; System . out . println ( i ) ; } } import java . util . * ; import java . util . Collections ; public class Main { public static void main ( String [ ] args ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; System . out . println ( Math . max ( A * B , C * D ) ) ; } } public class XCubic { public static void GetCubed ( int num ) { int n = ( int ) Math . pow ( num , 3 ) ; System . out . println ( n ) ; } public static void main ( String [ ] args ) { GetCubed ( Integer . parseInt ( args [ 0 ] ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . Scanner ; public class Iroha { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } String yon = " NO " ; if ( a [ 0 ] = = 5 ) { if ( a [ 1 ] = = 5 ) { if ( a [ 2 ] = = 7 ) { yon = " YES " ; } } else if ( a [ 1 ] = = 7 ) { if ( a [ 2 ] = = 5 ) { yon = " NO " ; } } } else if ( a [ 0 ] = = 7 ) { if ( a [ 1 ] = = 5 ) { if ( a [ 2 ] = = 5 ) { yon = " YES " ; } } } System . out . println ( yon ) ; } } package app ; import java . util . * ; public class App { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < a . length ; i + + ) { System . out . println ( i + " 文字目を入力してください " ) ; a [ i ] = sc.nextInt ( ) ; } n t f v = 0 ; int s e v n = 0 for i t = ; i < a l n g h ; i + + ) f a [ ] = = 5 ) { f i e + + ; e l s e i ( a i ] = 7 ) { s v n + + ; } } i f ( iv = = 2 & & se v n = 1 ) { Sy te . ut print n ( Y E S ) ; } e l se { System . o ut. p r i t n ( " N " ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; List < String > sl = new ArrayList < String > ( Arrays . asList ( s . split ( " / " ) ) ) ; if ( Integer . parseInt ( sl . get ( 0 ) ) < 2019 ) { System . out . println ( " Heisei " ) ; } else if ( Integer . parseInt ( sl . get ( 1 ) ) < 4 ) { System . out . println ( " Heisei " e ; } else { System . out . println ( " TBD " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = a ; + + i ) { for ( int j = 0 ; j < = b ; + + j ) { if ( ( x - 500 * i - 100 * j ) / 50 > = 0 & & ( x - 500 * i - 100 * j ) / 50 < = c ) { + + count ; } } } System . out . println ( count ) ; import java . util . * ; public class B _ Coins { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int count = 0 ; for ( int a = 0 ; a < = A ; a + + ) { for ( int b = 0 ; b < = B ; b + + ) { int c = ( X - a * 500 - b * 100 ) / 50 ; if ( c > = 0 & & c < = C ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; import java . text . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int big = Math . pow ( r , 2 ) ; System . out . println ( big ) ; } } # include < stdio . h > int main ( int argc , const char * argv [ ] ) { int a , b ; while ( scanf ( " % d % d \ n " , & a , & b ) ! = EOF ) { printf ( " % d \ n " , a + b ) ; } return 0 ; } import java . io . * ; import java . util . * ; public class lowelements { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 0 ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i - 1 ] > arr [ i ] | | arr [ i - 1 ] = = 1 ) { sum + + ; } } if ( arr [ n - 1 ] = = 1 ) { sum + + ; } out . println ( sum ) ; out . close ( ) ; } 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 ; } } } package Vol000 ; import java . util . Scanner ; public class AOJ0 _ 64 { public static void main ( String arg [ ] ) { Scanner in = new Scanner ( System . in ) ; int count = 0 ; String tmp = " 0 " ; while ( in . hasNext ( ) ) { char ch [ ] = in . nextLine ( ) . toCharArray ( ) ; for ( int i = 0 ; i < ch . length ; i + + ) { while ( i < ch . length & & ( Character . isDigit ( ch [ i ] ) ) ) { tmp + = ch [ i ] ; i + + ; } count + = Integer . valueOf ( tmp ) ; tmp = " 0 " ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int index = new Integer ( scan . nextLine ( ) ) ; String [ ] scanLine = scan . nextLine ( ) . split ( " " ) ; int range = 0 ; for ( int i = 0 ; i < scanLine . lengh ; i + + ) { range + = ( index - new Integer ( scanLine [ i ] ) ) * ( index - new Integer ( scanLine [ i ] ) ) ; } System . out . println ( range ) ; } } package atcoder . beginner ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; System . out . println ( " age value > " ) ; String [ ] input = scanner . nextLine ( ) . split ( " " ) ; int age = Integer . valueOf ( input [ 0 ] ) ; int value = Integer . valueOf ( input [ 1 ] ) ; int cost = value ; if ( age < = 5 ) { cost = 0 ; } else if ( age > = 6 & & age < = 12 ) { cost = value / 2 ; } System . out . println ( cost ) ; } } import java . util . Scanner ; public class CubeCalculation { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int number = stdin . nextInt ( ) ; if ( number > = 1 & & number < = 100 ) { int result = number * number * number ; System . out . println ( " Cube result : " + result ) ; } else { System . out . println ( " Only can calculate between 1 and 100 " ) ; } } } mport java . util . ArrayList ; import java . util . Scanner ; import java . util . Collections ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int number = scan . nextInt ( ) ; int length = scan . nextInt ( ) ; ArrayList list = new ArrayList ( number ) ; for ( int i = 0 ; i < number ; i + + ) { list . set ( i , scan . nextLine ( ) ) ; } Collections . sort ( list ) ; for ( int i = 0 ; i < number ; i + + ) { System . out . print ( list . get ( i ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a + b > c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . until . Scanner ; public class Index { public static void main ( Stirng [ ] args ) { int n = 0 ; while ( n = = 0 ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 & & A = = 7 ) { Scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } Scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . out . println ( " Yes ! " ) ; } else { break ; } } } } } } public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { long x , kk , ans ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; long [ ] [ ] dp = new long [ n + 500 ] [ n + 500 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 9000000000000000000L ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { dp [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = ( ( i - k ) + n ) % n ; if ( pi < = 0 ) pi = n + pi ; if ( dp [ i ] [ k - 1 ] > = a [ pi ] ) dp [ i ] [ k ] = a [ pi ] ; else dp [ i ] [ k ] = dp [ i ] [ k - 1 ] ; } } long sum = 0 ; for ( int k = 0 ; k < n ; k + + ) { sum = 0 ; for ( int i = 1 ; i < = n ; i + + ) { sum + = dp [ i ] [ k ] ; } if ( sum < ans ) ans = sum + k * x ; } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public void main ( string [ ] args ) { Scanner in = new Scanner ( System . in ) ; String x = in . next ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { int count _ 5 = 0 , count _ 7 = 0 ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { int num = scan . nextInt ( ) ; if ( num = = 5 ) count _ 5 + + ; if ( num = = 7 ) count _ 7 + + ; } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } 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 ans = ( a + b ) / 2 System . out . println ( ( a + b ) % 2 = = 0 ? ans : ans + 1 ) ; } } class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferdReader ( new InputStreamReader ( System . in ) ) ; line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( " + ( x * x * x ) + " ) ; } } import java . util . Scanner ; public class Main02 { public static void main ( String [ ] args ) { String input = new Scanner ( System . in ) . nextLine ( ) ; int x ; try { x = Integer . parseInt ( input ) ; if ( ! ( x > = 1 & & x < = 100 ) ) { throw new IllegalArgumentException ( ) ; } System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a = sc . nextInt ( ) ; if ( a = = 5 ) { five + + ; } if ( a = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } import java . io . * ; class Main { public static main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( 500 * a + 100 * b + 50 * c = = x ) count + + ; } } } Sysetm . out . println ( count ) ; } } 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 ans = ( a + b ) / 2 System . out . println ( ( a + b ) % 2 = = 0 ? ans : ans + 1 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int ans = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { z = S - x - y ; if ( z < = K & & z > = 0 ) { ans + + ; } } } System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( + ( x * 3 ) + ) ; } } import java . io . * ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int num = Integer . parseInt ( line ) ; int Y ; Y = 3 ; System . out . println ( Math . pow ( num , Y ) ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " The input number was not correct . " ) ; } } } import java . util . * ; class Codechef { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int arr [ ] [ ] = new int [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; j + + ) { arr [ i ] [ j ] = sc . nextInt ( ) ; } } int count = 0 ; double dist = 0 ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { dist + = ( double ) ( Math . pow ( arr [ i ] [ k ] - arr [ j ] [ k ] , 2 ) ) ; } dist = ( double ) Math . sqrt ( dist ) ; double ans = Math . ceil ( dist ) ; if ( ans = = dist ) count + + ; dist = 0 ; } } System . out . println ( count ) ; sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String str ; String str1 ; String str2 ; String str3 ; String str4 ; String str5 ; int a , b , c , d , e , k ; System . out . println ( " aの値を入力してください " ) ; str = scanner.next ( ) ; Sys e .out.pr i ntln ( " b 値を入力して く ださい " ) ; str1 = scanner.next ( ) ; System.out.printl n ( " の値を入 し ください " ) ; str2 = canner . nex t ( ) ; Sys t e m.out.println ( " dの値を入力してください " ) ; str 3 = scan e .next ( ) ; Sys t e m out.pr i ntl n ( " eの値を入 力 し てください " ) ; str4 = scanner.next ( ) ; Sy s t e .out p intln ( " k の値を入 力 し て ださい " ) ; str 5 = scan n e r.next ( ) ; a = Integer.parseInt ( str ) ; = I t ger.par s eInt ( s t 1 ) ; c = In t eger.pa r s eInt ( str2 ) ; d = Integer.parseInt ( s t r 3 ; e nteger. p arse I n t s r ) ; k = I nteger.p a rse I n ( t 5 ) ; if ( e-a < = k ) { S y s e . ut.prin t ln ( " Yay ! " ) ; } e l e { System. o ut.print l n ( " : ( " ; } } } import java . util . Scanner ; public class Prob3 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] original = new int [ 2 ] ; int [ ] multiples = new int [ 2 ] ; int [ ] manipulate = new int [ 2 ] ; int t = sc . nextInt ( ) ; original [ 0 ] = sc . nextInt ( ) ; original [ 1 ] = sc . nextInt ( ) ; int numvotes = original [ 0 ] + original [ 1 ] ; for ( int i = 0 ; i < t - 1 ; i + + ) { manipulate [ 0 ] = sc . nextInt ( ) ; manipulate [ 1 ] = sc . nextInt ( ) ; if ( manipulate [ 0 ] > original [ 0 ] & & manipulate [ 1 ] > original [ 1 ] ) { numvotes + = ( manipulate [ 1 ] - original [ 1 ] ) + ( manipulate [ 0 ] - original [ 0 ] ) ; original [ 0 ] = manipulate [ 0 ] ; original [ 1 ] = manipulate [ 1 ] ; continue ; } if ( manipulate [ 0 ] = = original [ 0 ] & & manipulate [ 1 ] = = original [ 1 ] ) continue ; multiples [ 0 ] = manipulate [ 0 ] ; multiples [ 1 ] = manipulate [ 1 ] ; int n = 1 ; while ( multiples [ 0 ] < original [ 0 ] | | multiples [ 1 ] < original [ 1 ] ) { multiples = multiply ( manipulate , n ) ; n + + ; } numvotes + = ( multiples [ 1 ] - original [ 1 ] ) + ( multiples [ 0 ] - original [ 0 ] ) ; original [ 0 ] = multiples [ 0 ] ; original [ 1 ] = multiples [ 1 ] ; } System . out . println ( numvotes ) ; } public static int [ ] multiply ( int [ ] input , int n ) { int [ ] output = { input [ 0 ] , input [ 1 ] } ; for ( int i = 0 ; i < input . length ; i + + ) { output [ i ] * = n ; } return output ; } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String input = sc . next ( ) ; String [ ] PARTS = { " dream " , " dreamer " , " erase " , " eraser " } ; boolean flag = true ; boolean able = true ; while ( flag ) { flag = false ; for ( int i = 0 ; i < PARTS . length ; i + + ) { if ( input . endsWith ( PARTS [ i ] ) ) { input = input . substring ( input . length ( ) - 6 ) ; flag = true ; } } if ( input . length ( ) = = 0 ) able = true ; else able = false ; } if ( able ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int N = s . nextInt ( ) ; int [ ] S = new int [ N ] ; boolean flg = false ; for ( int i = 0 ; i < N ; i + + ) { flg | = s . next ( ) . equals ( " Y " ) ; } System . out . println ( flg ? " Four " : " Three " ) ; } } import java . util . * ; public class B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > list _ a = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i + + ) { int din = sc . nextInt ( ) ; list _ a . add ( din ) ; } Collections . sort ( list _ a ) ; int ans = 0 ; for ( int i = 1 ; i < n ; i + + ) { ans + = list _ a . get ( i ) - list _ a . get ( i - 1 ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String args [ ] ) { int a = 2 int x = 3 System . out . println ( a * x ) ; } } class Main { public int x ; public static void main ( String [ ] args ) { try { BufferedReader stdReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) ! = null ) { int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } stdReader . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } import java . util . * ; public class main { public static main ( String args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; if ( a > = 13 ) { System . out . println ( b + " \ n " ) ; } else if ( a < 13 & & a > = 6 ) { System . out . println ( ( b / 2 ) + " \ n " ) ; } else { System . out . println ( " 0 \ n " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; String text = scanner . next ( ) ; List < String > list = new ArrayList < > ( ) ; replace ( list , new StringBuilder ( text ) , " " , 0 ) ; int maxScoore = 0 ; int maxIndex = 0 ; int index = 0 ; for ( String str : list ) { int score = 0 ; for ( int i = 0 ; i < str . length ; i + + ) { if ( str . charAt ( i ) = = ' ? ' ) { continue ; } if ( str . charAt ( i ) = = ' D ' ) { score + + ; } else { if ( str . charAt ( i + 1 ) = = ' D ' ) { score + + ; } } } if ( score > maxScore ) { maxScore = score ; maxIndex = index ; } index + + ; } return list . get ( maxIndex ) ; } private void replace ( List < String > list , String text , String tmp , int index ) { for ( int i = index ; i < text . length ; i + + ) { tmp + = text . charAt ( i ) ; if ( text . charAt ( i ) = = ' ? ' ) { replace ( list , new StringBuilder ( text ) , tmp + ' P ' , i + 1 ) ; replace ( list , new StringBuilder ( text ) , tmp + ' D ' , i + 1 ) ; } } list . add ( tmp + ' \ n ' ) ; } } using System ; public class Cubic { public static void Main ( string ) { Console . WriteLine ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean b = false ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { b = true ; break ; } } if ( b ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } int calc ( int r ) { int ans ; return ans = r * r ; } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { public void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } public class XCubic { public static void main ( String [ ] args ) { int x = 0 ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class PrintChessboard { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } public static void main ( String [ ] args ) { int [ ] seq = { 1 , 1 , 1 , 1 } ; int res _ 2 = solution _ 2 ( seq . length , seq ) ; System . out . println ( res _ 2 ) ; } private static int solution _ 2 ( int length , int [ ] seq ) { int overflow = 0 ; int p1 = seq [ 0 ] ; int p2 = seq [ 1 ] ; for ( int i = 2 ; i < seq . length ; i + + ) { if ( p1 = = p2 ) { overflow + + ; } else if ( i % 2 = = 0 ) { if ( seq [ i ] ! = p1 ) overflow + + ; p1 = seq [ i ] ; } else if ( i % 2 ! = 0 ) { if ( seq [ i ] ! = p2 ) overflow + + ; } } return overflow ; } package test ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class main { public static void main ( String args [ ] ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( a * a * a ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Test1 { public static void main ( String [ ] args ) { InputStreamReader str = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( str ) ; try { String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; if ( 0 < = x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error " ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int i = 0 , count = 0 , d ; String a , c ; int b [ ] ; b = new int [ 100000 ] ; Scanner n = new Scanner ( System . in ) ; while ( true ) { a = n . nextLine ( ) ; if ( a = = ' 0' ) { break ; } for ( i = 0 ; i < a . length ; i + + ) { c = a . charAt ( i ) ; d = Integer . parseInt ( c ) ; sum = sum + d ; } b [ i ] = sum ; count + + ; i + + ; } while ( count > i ) { System . out . printf ( " % d " , b [ i ] ) ; i + + ; System . out . printf ( " \ n " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x ^ 3 ) ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class atcoder0221 _ C { public class Main { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; List < Integer > X = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < N ; i + + ) { X . add ( scan . nextInt ( ) ) ; } int i = 0 ; int sum = 0 ; for ( int tmp : X ) { sum = sum + tmp ; i + + ; } int av = sum / i ; int av2 = av ; if ( sum % i > 0 ) { av2 = av + + ; } int result = 0 ; int result2 = 0 ; if ( i > 1 ) { for ( int tmp2 : X ) { result = result + ( tmp2 - av ) * ( tmp2 - av ) ; } for ( int tmp3 : X ) { result2 = result2 + ( tmp3 - av2 ) * ( tmp3 - av2 ) ; } if ( result > result2 ) { result = result2 ; } if ( result = = 0 ) { result = av ; } } else { result = av ; } System . out . println ( result ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a = = b ) { System . out . println ( " Draw " ) ; } else if ( ( a > b & & b ! = 1 ) | | a = = 1 ) { System . out . println ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String x = sc . next ( ) ; if ( x . equals ( " 0 " ) ) break ; boolean can = true ; int sum = 0 ; for ( int i = 0 ; i < x . length ( ) ; i + + ) { sum + = Integer . parseInt ( x [ i ] ) ; } System . out . printtln ( sum ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String T = sc . next ( ) ; sc . close ( ) ; String [ ] a = T . split ( " " ) ; for ( int i = 0 ; i < T . length ( ) ; i + + ) { if ( a [ i ] . equals ( " ? " ) ) { a [ i ] = " D " ; } } for ( int i = 0 ; i < T . length ( ) ; i + + ) System . out . print ( a [ i ] ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; long T [ ] = new int [ N ] ; long A [ ] = new int [ N ] ; long xt = 1 ; long xa = 1 ; for ( int i = 0 ; i < N ; i + + ) { T [ i ] = Integer . parseInt ( sc . next ( ) ) ; A [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < N ; i + + ) { long kake = ( long ) Math . max ( Math . ceil ( ( xt - 1 + T [ i ] ) / T [ i ] ) , Math . ceil ( ( xa - 1 + A [ i ] ) / A [ i ] ) ) ; xt = T [ i ] * kake ; xa = A [ i ] * kake ; } System . out . println ( xt + xa ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int x = Math . abs ( a1 - a2 ) ; int y = Math . abs ( a2 - a3 ) ; int z = Math . abs ( a3 - a1 ) ; int max = Math . max ( x , y ) ; int max = Math . max ( z , max ) ; System . out . println ( x + y + z - max ) ; sc . close ( ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Striung str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . io . ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( Math . pow ( x , 3 ) ; } } String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) } else { System . out . println ( " TBD " ) } class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( System . in ) ; System . out . print ( str * str * str ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String bs = b . readLine ( ) ; int x = Integer . parseInt ( bs ) ; for ( int i = 1 ; i < 3 ; i + + ) { x * x = x ; } System . out . println ( x ) ; } } import java . util . Scanner ; class a { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; Scanner scan1 = new Scanner ( System . in ) ; int B = scan1 . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } else if ( 6 < = A & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; double ans = Math . pow ( Integer . parseInt ( line ) , 3 ) ; String crlf = System . getProperty ( " line.separator " ) ; System . out . println ( ans " + " crlf ) ; } catch ( Exception e ) { e.printStackTrace ( ) ; } } } class Xcubic { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = br . readLine ( ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int a = new java . util . Scanner ( System . in ) . nextLine ( ) ; int b = new java . util . Scanner ( System . in ) . nextLine ( ) ; int c = new java . util . Scanner ( System . in ) . nextLine ( ) ; switch ( a , b , c ) { case a = 7 & & b = = 5 & & c = = 5 : System . out . println ( " YES " ) ; break ; case a = = 5 & & b = = 7 & & c = = 5 : Ssytem . out . println ( " YES " ) break ; case a = = 5 & & b = = 5 & & c = = 7 : Ssytem . out . println ( " YES " ) break ; default : Ssytem . out . print ( " NO " ) ; } } } public class study _ 1 { public static void main ( String [ ] args ) { int A = 30 ; int B = 100 ; if ( A < 6 ) { System . out . println ( " 0円 " ) ; } e se i ( < 1 ) { S stem.o u t.p r intln ( B / 2 + " 円 " ) ; } e s { Sy s em.out . pri n tln ( B + " 円 " ) ; } } } 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 ( ) ; ArrayList [ ] year = new ArrayList [ n ] ; for ( int i = 0 ; i < n ; i + + ) { year [ i ] = new ArrayList < Integer > ( ) ; } int [ ] p = new int [ m ] ; int [ ] y = new int [ m ] ; HashMap < Integer , Integer > map = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < m ; i + + ) { p [ i ] = sc . nextInt ( ) - 1 ; y [ i ] = sc . nextInt ( ) ; year [ p [ i ] ] . add ( y [ i ] ) ; } for ( int i = 0 ; i < n ; i + + ) { Collections . sort ( year [ i ] ) ; for ( int j = 0 ; j < year [ i ] . size ( ) ; j + + ) { map . put ( year [ i ] . get ( j ) , j + 1 ) ; } } for ( int i = 0 ; i < m ; i + + ) { p [ i ] + + ; String s1 = String . valueOf ( p [ i ] ) ; String ans1 = p [ i ] ; for ( int j = 0 ; j < 6 - s1 . length ( ) ; j + + ) { ans1 = " 0 " + ans1 ; } int t2 = map . get ( year [ i ] ) ; String s2 = String . valueOf ( t2 ) ; String ans2 = s2 ; for ( int j = 0 ; j < 6 - s2 . length ( ) ; j + + ) { ans2 = " 0 " + ans2 ; } System . out . println ( ans1 + ans2 ) ; } } } public class contest { public static void main ( String args [ ] ) { double pi ; pi = 3.14 ; int r = 0 ; int a = ( int ) ( 3.14 * r * r ) ; int a2 = ( int ) 3.14 ; int howMuch = a / a2 ; System . out . print ( howMuch ) ; } } public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BuffreredReader br = new BufferedReader ( is ) ; String str = br . readLine ( ) ; int i = Integer . parseInt ( str ) ; int j = i * i ; System . out . println ( " + j + " ) ; } } # include < iostream > using namespace std ; int main ( ) { int r ; cin > > r ; int x = r * r ; cout < < x < < endl ; } class Main { public static void main ( String args [ ] ) { System . out . println ( x * x * x ) ; } } inport java . util . scanner public class main ( ) { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } public class Main { public static cul int ( int x ) { y = x * x * x ; return y ; } public static void main ( String [ ] args ) { int y = int ( x ) ; Sytem . out . println ( y ) ; } } package app ; import java . util . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int BigH2 = H2 - H1 ; int BigH2M2 = BigH2 * 60 + M2 ; int clearTime = BigH2M2 - M1 ; int answer = clearTime - K ; System . out . println ( answer ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ; ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; int h = ( double ) H * 30 ; int m = ( double ) M * 6 ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( Math . abs ( h - m ) ) ) ) ; System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; int ans = pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int Max = 0 ; int sum1 = 0 ; int sum2 = 0 ; int [ ] X = sc . nextInt [ N ] ; for ( int i = 0 ; i < N ; i + + ) { X [ i ] = sc . nextInt ( ) ; if ( Max < x [ i ] ) { Max = x [ i ] ; } } sc . close ( ) ; sum1 = pow ( 1 , N , X ) ; for ( int j = 2 ; j < = Max ; j + + ) { sum2 = pow ( 2 , N , X ) ; if ( sum1 = > sum2 ) { sum1 = sum2 ; } } System . out . println ( sum1 ) ; } private static int pow ( int n1 , int N , int array [ ] ) { int sum = 0 ; for ( int k = 0 ; k < N ; k + + ) { sum + = Math . pow ( array [ k ] - n1 , 2 ) ; } return sum ; } } import java . util . Scanner ; public class x { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; System . out . println ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ) ; String string = sc . next ( ) ; string = string . replace ( " ? " , " D " ) ; System . out . println ( string ) ; } } q import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ? ? ? ( new FileReader ( " foo.in " ) ) ; ? ? ? String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class ABC042A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N , count5 , count7 ; count5 = count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { N = sc . nextInt ( ) ; if ( N = = 5 ) { + + count5 ; } else if ( N = = 7 ) { + + count7 ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . io . * ; public class Cubic { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int k ; if ( a > 13 ) { k = b ; } else if ( a < = 6 ) { k = b / 2 ; } else if ( a > 6 ) { k = 0 ; } System . out . println ( k ) ; } } import java . text . * ; import java . util . * ; public class MainJ { public static void main ( String [ ] args ) { Locale . setDefault ( Locale . JAPAN ) ; Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; try { Date date1 = DateFormat . getDateInstance ( ) . parse ( a ) ; Date date2 = DateFormat . getDateInstance ( ) . parse ( " 2019 / 04 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff > 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } } package com . ACM ; import java . util . Scanner ; public class Haiku { public void syllables ( int A , int B , int C ) { if ( ( A < 0 | | A > 10 ) | | ( B < 0 | | B > 10 ) | | ( C < 0 | | C > 10 ) ) { System . exit ( 0 ) ; } else { switch ( A ) { case 5 : if ( ( B = = 5 & & C = = 7 ) | | ( B = = 7 & & C = = 5 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } break ; case 7 : if ( B = = 5 & & C = = 5 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } break ; default : System . out . println ( " No " ) ; break ; } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( " 输入 " ) ; i n t A = s . n ex t Int ( ) ; i n t B = s . n ex t Int ( ) ; i n t C = s . n ex t Int ( ) ; n e w Hai u ( ) .s y l l ables ( A , B , C ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class Main { ? ? public static void main ( String [ ] args ) { ? ? ? ? InputStreamReader isr = new InputStreamReader ( System . in ) ; ? ? ? ? BufferedReader br = new BufferedReader ( isr ) ; ? ? ? ? String buf = br . readLine ( ) ; ? ? ? ? int x = Integer . parseInt ( buf ) ; ? ? ? ? int mp = Math . pow ( x , 3 ) ; ? ? ? ? System . out . println ( mp ) ; ? ? } } mport java . util . Scanner ; public class Main { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Main obj = new Main ( ) ; obj . solve ( ) ; } } import java . lang . * ; import java . util . * ; import java . io . * ; class Main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( in ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } } package Contest1506 ; import java . util . Scanner ; class A1506 { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int n = scn . nextInt ( ) ; int k = scn . nextInt ( ) ; scn . close ( ) ; System . out . println ( ( k = = 1 ) ? " 0 " : n - k ) ; } } public class Main { public static void main ( String args [ ] ) { Scanner scn = new Scanner ( System . in ) ; double a = scn . nextInt ( ) ; double b = scn . nextInt ( ) ; double h = scn . nextInt ( ) ; double m = scn . nextInt ( ) ; double ans = 0 ; double r = Math . abs ( ( ( ( ( h * 60 ) + m ) / 2 ) - ( m * 6 ) ) ) ; if ( r = = 0 ) { System . out . println ( Math . abs ( a - b ) ) ; } else if ( r = = 180 ) { System . out . println ( a + b ) ; } else { ans = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * Math . cos ( Math . toRadians ( r ) ) ) ) ; System . out . println ( ans ) ; } scn . close ( ) ; } } import java . util . Scanner ; public class A _ ABC042 _ A { public static void main ( String [ ] args ) { final String FIVE = " 5 " ; final String SEVEN = " 7 " ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; scanner . close ( ) ; String [ ] arrStr = ( input . split ( " " , 0 ) ) ; int fivCnt = 0 ; int sevCnt = 0 ; for ( String num : arrStr ) { if ( num . equals ( FIVE ) ) { fivCnt + + ; } else if ( num . equals ( SEVEN ) ) { sevCnt + + ; } } String res ; if ( fivCnt = = 2 & & sevCnt = = 1 ) { res = " YES " ; } else { res = " NO " ; } System . out . println ( res ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { int ans = 0 ; Scanner s = new Scanner ( System . in ) ; System . out . println ( " Enter a number " ) ; int x = s . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { ans = x * x * x ; System . out . println ( " Answer of cubic " + ans ) ; } else { System . out . println ( " Number is invalid " ) ; } } } import java . io . * class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } } import java . lang . * ; import java . io . * ; class MAIN { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( sanjo ( x ) ) ; } public static int sanjo ( int x ) { int y = x * x * x ; return y ; } } import java . util . Scanner ; public classMain { public static void main ( String [ ] args ) { Scanner sc = newScanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x System . out . println ( answer ) ; } } import java . util . Scanner ; class Test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int inputNum = Integer . parseInt ( str ) ; int intNum = inputNum * inputNum * inputNum ; System . out . println ( intNum ) ; } import java . util . * ; public class mondai7 { public static void main ( String [ ] args ) { int n , l , r , d , p = 0 , t = 0 , x = 0 , kiroku = 0 , max = 0 , max2 = 0 , hensu = 0 ; Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; int [ ] ten = new int [ n ] ; int [ ] byou = new int [ n ] ; r = scan . nextInt ( ) ; int [ ] ban = new int [ r ] ; l = scan . nextInt ( ) ; for ( int i = 0 ; i < r ; i + + ) { d = scan . nextInt ( ) ; t = scan . nextInt ( ) ; x = scan . nextInt ( ) ; if ( i = = 0 ) { kiroku = t ; byou [ 0 ] = t ; } ten [ d - 1 ] = ten [ d - 1 ] + x ; for ( int j = 1 ; j < n ; j + + ) { if ( ten [ max ] < ten [ j ] ) { max = j ; } } ban [ p ] = max ; if ( i > 0 ) { byou [ ban [ p - 1 ] ] = byou [ ban [ p - 1 ] ] + t - kiroku ; } kiroku = t ; hensu = max ; max = 0 ; p = p + 1 ; } byou [ hensu ] = byou [ hensu ] + ( l - t ) ; for ( int k = 1 ; k < n ; k + + ) { if ( byou [ max2 ] < byou [ k ] ) { max2 = k ; } } System . out . println ( max2 + 1 ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) if ( x < 0 | | x > 100 ) { return - 1 ; } return x * x * x ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } } import java . util . Scanner ; public class Beginning { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in , " UTF-8 " ) ; int n [ ] = { 1 , 9 , 7 , 4 } ; String [ ] inp = new String [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { inp [ i ] = sc . next ( ) ; } int cont = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = 0 ; j < 4 ; j + + ) { if ( n [ i ] = = Integer . parseInt ( inp [ j ] ) ) cont + + ; } } if ( cont = = 4 ) { System . out . print ( " YES " ) ; } else if ( cont ! = 4 ) { System . out . print ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int a = scn . nextInt ( ) ; int v = scn . nextInt ( ) ; int b = scn . nextInt ( ) ; int w = scn . nextInt ( ) ; int t = scn . nextInt ( ) ; double tt ; String ans = " YES " ; if ( b > a ) tt = ( double ) ( b - a ) / ( v - w ) ; if ( a > b ) tt = ( double ) ( a - b ) / ( v - w ) ; if ( t < tt ) ans = " NO " ; if ( w > v ) ans = " NO " ; System . out . println ( ans ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int [ ] args = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { args [ i ] = Integer . parseInte ( br . readLine ( ) ) ; } int c1 = 0 ; int c2 = 0 ; int c10 = 0 ; int counter = 0 ; if ( args [ 0 ] + args [ 1 ] * 2 + args [ 2 ] * 10 > = args [ 3 ] ) { for ( ; c10 < = args [ 2 ] ; c10 + + ) { if ( c10 * 10 > args [ 3 ] ) { break ; } else if ( c1 + c2 * 2 + c10 * 10 < args [ 3 ] ) { } else { for ( ; c2 < = args [ 1 ] ; c2 + + ) { if ( c10 * 10 + c2 * 2 > args [ 3 ] ) { break ; } else if ( c10 * 10 + c2 * 2 < args [ 3 ] ) { } else { counter + + ; } } } } } System . out . println ( counter ) ; } } public class Main11 { public static void main ( String [ ] args ) { int x = 3 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } package internship ; import java . util . Scanner ; public class test1 { public static void main ( String [ ] args ) { int x = 0 , temp , tot ; boolean swi = false ; Scanner sc = new Scanner ( System . in ) ; while ( swi = = true ) { temp = sc . nextInt ( ) ; if ( 1 < = temp | | 100 < = temp ) x = temp ; swi = true ; } tot = x * x * x ; System . out . println ( tot ) ; System . out . println ( ) ; } } public class Main { public static void main ( String [ ] args ) { int a ; try ( Scanner scanner = new Scanner ( System . in ) ) { a = scanner . nextInt ( ) ; } a = a * a * a ; System . out . println ( a ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int inputNum = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( inputNum * inputNum * inputNum ) ; } import java . util . * ; public class main { private static Scanner sc = new Scanner ( System . in ) ; static int x1 , x2 , x3 , y1 , y2 , y3 , xp , yp ; public static void main ( String [ ] args ) { while ( sc . hasNextInt ( ) ) { int xm [ ] = new int [ 3 ] ; int ym [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { xm [ i ] = sc . nextInt ( ) ; ym [ i ] = sc . nextInt ( ) ; } xp = sc . nextInt ( ) ; yp = sc . nextInt ( ) ; Arrays . sort ( xm ) ; Arrays . sort ( ym ) ; if ( xm [ 0 ] < xp ) { if ( xm [ 3 ] > xp ) { if ( ym [ 0 ] < yp ) { if ( ym [ 3 ] < yp ) { System . out . println ( " Yes " ) ; } else { mm ( ) ; } } else { mm ( ) ; } } else { mm ( ) ; } } else { mm ( ) ; } } } private static void mm ( ) { System . out . println ( " No " ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . println ( Math . pow ( Integer . parseInt ( new Scanner ( System . in ) . next ( ) ) , 3 ) ) ; } } import scala . io . { StdIn = > in } object Main extends App { val Array ( a , b ) = in . readLine . split ( " " ) . map ( _ . toInt ) val ans = a match { case x if x < = 5 = > 0 case x if x < = 12 = > b / 2 case _ = > b } println ( ans ) } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; i = i * i * i ; System . out . println ( i ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int a = Integer . parseInt ( line ) ; a = a * a * a ; System . out . println ( a ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner kbd = new Scanner ( System . in ) ; int a = kbd . nextInt ( ) ; int b = kbd . nextInt ( ) ; int h = kbd . nextInt ( ) ; int m = kbd . nextInt ( ) ; double A = h * 30 + m * 0.5 ; double B = m * 6 ; double C = 0 ; if ( A - B > = 0 ) { C = A - B ; } else { C = B - A ; } if ( C > 180 ) { C = 360 - C ; } C = Math . toRadians ( C ) ; double x = b * Math . sin ( C ) * b * Math . sin ( C ) ; double y = ( b * Math . cos ( C ) - a ) * ( b * Math . cos ( C ) - a ) ; System . out . println ( Math . sqrt ( x + y ) ) ; } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int max = 1 ; for ( int i = 0 ; i < N ; i + + ) { max = 2 * * i ; if ( max > N ) { break ; } } max = max / 2 ; System . out . println ( max ) ; } } public class Main { public static void main ( String [ ] args ) { int x = number ; x > = 1 & & x < = 100 ; System . out . println ( x * x * x ) ; } } import java . io . * ; import java . util . * ; public class Main { public int cube ( int x ) { public static int answer = x * x * x ; return answer ; } public static void main ( String args [ ] ) throws Exception { int submit = cube ( 3 ) ; System . out . println ( submit ) ; } } public class Test { public static void main ( String args ) { int x = args . toInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; import java . util . Map . Entry ; public class Main { static int N , M ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; Map < Integer , Integer > ml = new LinkedHashMap < Integer , Integer > ( ) ; Map < Integer , String > result = new LinkedHashMap < Integer , String > ( ) ; Map < Integer , Integer > m = new TreeMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < M ; i + + ) { int pi = sc . nextInt ( ) ; int yi = sc . nextInt ( ) ; ml . put ( yi , pi ) ; m . put ( yi , pi ) ; } int count ; String xiaquid , cityorder , cityid ; for ( int i = 1 ; i < = N ; i + + ) { count = 0 ; for ( Map . Entry < Integer , Integer > entry : m . entrySet ( ) ) { int v = entry . getValue ( ) ; if ( i = = v ) { count + + ; xiaquid = String . format ( " % 06d " , Integer . valueOf ( v ) ) ; cityorder = String . format ( " % 06d " , Integer . valueOf ( count ) ) ; cityid = xiaquid + cityorder ; result . put ( entry . getKey ( ) , cityid ) ; } } } for ( Map . Entry < Integer , Integer > entry : ml . entrySet ( ) ) { for ( Map . Entry < Integer , String > entry2 : result . entrySet ( ) ) { if ( entry . getKey ( ) = = entry2 . getKey ( ) ) System . out . println ( entry2 . getValue ( ) ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( IOException e ) { } int i = Math . pow ( x , 3 ) ; System . out . println ( i ) ; } } import java . io . * ; import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { String line = br . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x = = 0 ) { break ; } int sum ; while ( x > 0 ) { int y = x ; y = y / 10 ; y = y * 10 ; sum + = ( x - y ) ; x = ( y / 10 ) ; } System . out . println ( sum ) ; } } } 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 ( ) ; if ( 0 < = A & & A < = 5 ) { int B = 0 ; System . out . println ( A B ) ; } else if ( 6 < = A & & A < = 12 ) { int B = B / 2 ; System . out . println ( A B ) ; } else if ( 13 < = A & & A < = 100 ) { System . out . println ( A B ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Xcubic { public static void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } import java . util . * ; public class X _ Cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; try { int x = scan . nextInt ( ) ; if ( ( x > = 100 ) | | ( x < = 0 ) ) System . exit ( 0 ) ; x = x * x * x ; System . out . println ( " " + x + " " ) ; } catch ( InputMismatchException e ) { System . out . println ( " ? ? ¨ ? ? ? ? ? ? " ) ; public class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int x = stdid . nextInt ( ) ; x = x * x * x ; System . out . println ( String . valueOf ( x ) + " \ r \ n " ) ; } } public class Main { public static void main ( String [ ] args ) { int x = new java . util . Scannner ( System . in ) . nextInt ( ) ; int i = x * x * x ; System / out . println ( i ) ; } } import java . util . Scanner public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; Sytem . out . println ( x - y ) ; } } import java . util . Scanner ; public class work { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int xcubic ; int a = 0 ; while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 0 0 ) i = - 1 ; } xc u b c * a a ; Sys e . u . p r n ln ( xcu i ) ; } } public class Main { public static void main ( String [ ] args ) { int year = args [ 0 ] . substring ( 0 , 3 ) ; int month = args [ 0 ] . substring ( 5 , 6 ) ; int day = args [ 0 ] . substring ( 8 , 9 ) ; Date inputDay = new Date ( year , month , day , 12 , 0 , 0 ) ; Date s = new Date ( 2019 , 4 , 30 , 12 , 0 , 0 ) ; if ( s . before ( inputDay ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } import java . util . * ; public class Main { long MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { b [ i ] = sc . nextInt ( ) ; } long [ ] c = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { c [ i ] = a [ i ] - b [ i ] ; } long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { sum + = c [ i ] ; } if ( sum < 0 ) { System . out . println ( " -1 " ) ; return ; } Arrays . sort ( c ) ; int r = n - 1 ; boolean ru = false ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( c [ i ] > = 0 ) break ; ans + + ; while ( r > = 0 ) { if ( ! ru ) { ru = true ; ans + + ; } if ( c [ i ] + c [ r ] > = 0 ) { int tmp = c [ i ] + c [ r ] ; c [ i ] = 0 ; c [ r ] = tmp ; break ; } else { c [ i ] = c [ i ] + c [ r ] ; ru = false ; r -- ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class ABC087B _ Coins { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = a ; i + + ) { int rest1 = x ; rest1 = rest1 - 500 * i ; if ( rest1 < 0 | | rest1 > 100 * b + 50 * c ) { continue ; } for ( int j = 0 ; j < = b ; j + + ) { int rest2 = rest1 ; rest2 = rest2 - 100 * j ; if ( rest2 < 0 | | rest2 > 50 * c ) { continue ; } if ( rest2 % 50 = = 0 & & rest2 / 50 < = c ) { count + + ; } } } System . out . println ( count ) ; sc . close ( ) ; } } import java . util . Scanner ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Iterator ; import java . util . Collections ; import java . util . Comparator ; import java . util . Random ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = 0.5 ; x + = ( a + b / 2 ) ; System . out . print ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 3 ; int x = Math . pow ( x , 3 ) ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = nre Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = ( a + b ) / 2 ; if ( ( a + b ) % 2 = = 0 ) { System . out . println ( ( a + b ) / 2 ) ; } else { System . out . println ( ( a + b + 1 ) / 2 ) ; } } } import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; if ( A < B ) { if ( A + ( V * T ) < B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else if ( A + ( V * T ) > = B + ( W * T ) ) { System . out . println ( " No " ) ; } } else if ( B < A ) { if ( B - ( W * T ) > = A - ( V * T ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } else if ( A = = B ) { if ( A + ( V * T ) < = B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } } import java . util . Scanner ; class Haiku { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; System . out . println ( " 整数値a : " ) ; int a = s dIn n e xtInt ( ) ; Syst e m . ut.pri n tln ( " 整数値b : " ) ; int b = stdIn. n e x Int ) ; Syst e m.out.p r i n ln ( " 整数 値 c : " ) ; int c = s tdIn.nextInt ( ) ; f ( a = 7 ) { if ( b = = 5 & & c = = 5 { S y st e m . ut . p ri n tl n ( " Y e s ) ; } e l se { System. o u t.p r i n l ( " No " ; } } e lse if ( a = = 5 ) { i f ( b = & c = = 7 { S y st e m . ut . p ri n tl n ( " Y e s ) ; } e l se i f ( b = = 7 & & c = = 5 ) { y tem. ut . p ri n tl n ( " Y e s ) ; } e l se { System. o u t.p r i n l ( " No " ; } } e lse { System . o ut . p r n l ( " Ye s ) ; } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int ans ; if ( k > 1 ) { ans = n - k ; } else { ans = 0 ; } System . out . println ( ans ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; s = reader . readLine ( ) ; String [ ] inp = s . split ( " " ) ; int a , b , c ; a = Integer . parseInt ( inp [ 0 ] ) ; b = Integer . parseInt ( inp [ 1 ] ) ; c = Integer . parseInt ( inp [ 2 ] ) ; if ( a + b > = c ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } import java . util . * ; class test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( [ ] String args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; floor ( average ( x , y ) ) ; } private average ( int x , int y ) { return ( x + y ) / 2 ; } private int floor ( float z ) { return Math . floor ( z ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; if ( A = = 1 ) { A = 14 ; } else if ( B = = 1 ) { B = 14 ; } if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( B > A ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int list [ ] = new int [ 3 ] ; for ( int i = 0 ; i < N ; i + + ) { list [ i ] = sc . nextInt ( ) ; } Arrays . sort ( list ) ; System . out . println ( ( list [ 1 ] - list [ 0 ] ) + ( list [ 2 ] - list [ 1 ] ) ) ; } } class Main { public static void main ( String [ ] args ) { int i = 2 if ( i > = 1 & & i < 101 ) { System . out . println ( " Input = " + i ) ; System . out . println ( " Output = " + i * i * i ) ; } else { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } } } import java . util . Scanner ; public class ATC { static int n , min = Integer . MAX _ VALUE ; static int [ ] nums ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; nums = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { nums [ i ] = sc . nextInt ( ) ; } if ( n = = 2 ) { min = nums [ 0 ] = = nums [ 1 ] ? 1 : 0 ; System . out . println ( min ) ; return ; } t ( 0 , 0 ) ; System . out . println ( min ) ; } public static void t ( int i , int pv ) { if ( i > = n ) return ; if ( i = = 0 ) { int cv = 0 ; for ( int x = 2 ; x < n ; x + + ) if ( x % 2 = = 0 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; t ( i + 1 , cv ) ; } else { int cv = 0 ; for ( int x = 0 ; x < n ; x + + ) { if ( ( pv + cv ) > min ) break ; if ( i ! = x & & i % 2 = = x % 2 & & nums [ i ] ! = nums [ x ] ) cv + = 1 ; } if ( nums [ i - 1 ] = = nums [ i ] & & pv = = 0 & & cv = = 0 ) cv = n / 2 ; min = Math . min ( min , pv + cv ) ; t ( i + 1 , pv + cv ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class P01 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( ) ; System . out . print ( str * str * str ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( + ( a * a * a ) + ) ; } } public static void main ( String [ ] args ) { int count5 = 0 ; int count7 = 0 ; for ( String arg : args ) { if ( arg . equals ( " 5 " ) ) { count5 + + ; } else if ( arg . equals ( " 7 " ) ) { count7 + + ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int [ ] p = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int arrayMin = Integer . Max _ Value ; for ( int i = 0 ; i < n ; i + + ) { arrayMin = Math . min ( p [ i ] , arrayMin ) ; if ( arrayMin = = p [ i ] ) { count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } elif ( A > = 6 & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferedReader br = new BufferedReader ( new StreamReader ( System . in ) ) ; try { buf = br . readline ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( " 入出力エラーです " ) ; } } } import java . util . Scanner ; import java . util . Random ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = nextInt ( ) ; int num = a / 15 ; System . out . println ( 800 * a - num ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String a = scanner . nextLine ( ) ; if ( a . equals ( " 0 " ) ) break ; int sum = 0 ; for ( String b : a . split ( " " ) ) { sum + = Integer . parseInt ( b ) ; } System . out . println ( sum ) ; } } } public class Main { public static void main ( String [ ] args ) { int = x x = x * x * x system . out , println ( < x < 100 ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long MOD = ( long ) Math . pow ( 10 , 9 ) + 7 ; int n = sc . nextInt ( ) ; long [ ] [ ] rui = new long [ 60 ] [ 2 ] ; for ( int i = 0 ; i < n ; i + + ) { long a = sc . nextLong ( ) ; for ( int j = 0 ; j < 60 ; j + + ) { long t = a / ( long ) Math . pow ( 2 , j ) ; rui [ j ] [ ( int ) ( t % 2 ) ] + + ; } } long ans = 0 ; for ( int i = 0 ; i < 60 ; i + + ) { long t = ( long ) Math . pow ( 2 , i ) % MOD ; long t = ( t * rui [ i ] [ 0 ] ) % MOD ; t = ( t * rui [ i ] [ 1 ] ) % MOD ; ans = ( ans + t ) % MOD ; } System . out . println ( ans ) ; } } public class Index { public static void main ( Stirng [ ] args ) { INT A , B , C ; while ( 1 ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; A = new String ( in . readLine ( ) ) ; if ( A = = 5 & & A = = 7 ) { B = new String ( in . readLine ( ) ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } C = new String ( in . readLine ( ) ) ; if ( A + B + C = = 17 ) { System . outprintln ( " Yes ! " ) ; } else { break ; } } } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main2 ( ) . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int r [ ] = new int [ n ] ; for ( int i = 0 ; i < r . length ; i + + ) { r [ i ] = sc . nextInt ( ) ; } double c [ ] = new double [ n ] ; for ( int i = 0 ; i < c . length ; i + + ) { c [ i ] = r [ i ] ; for ( int j = 0 ; j < i ; j + + ) { double t = Math . sqrt ( 4 * r [ i ] * r [ j ] ) ; c [ i ] = Math . max ( c [ j ] + t , c [ i ] ) ; } } double max = 0 ; for ( int i = 0 ; i < n ; i + + ) { max = Math . max ( max , c [ i ] + r [ i ] ) ; } System . out . println ( max ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tempList [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { tempList [ i ] = sc . nextInt ( ) ; } Arrays . sort ( tempList ) ; int [ ] anserList = { 5 , 5 , 7 } ; if ( Arrays . equals ( tempList , anserList ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class IrohaAndHaiku { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String line = in . nextLine ( ) ; in . close ( ) ; String [ ] ary = line . split ( " " ) ; boolean w7 = false ; boolean [ ] w5 = { false , false } ; for ( String w : ary ) { int intW = Integer . parseInt ( w . trim ( ) ) ; if ( intW ! = 5 & & intW ! = 7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 5 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " NO " ) ; return ; } else if ( intW = = 7 & & w7 = = false ) { w7 = true ; } else if ( intW = = 5 ) { if ( w5 [ 0 ] = = false ) { w5 [ 0 ] = true ; } else if ( w5 [ 1 ] = = false ) { w5 [ 1 ] = true ; } } } if ( w7 & & w5 [ 0 ] & & w5 [ 1 ] ) { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( Math . ceil ( double ( a + b ) / 2.0 ) ) ; } } import java . util . * ; public class ABC113C { public static void main ( String [ ] args ) { new ABC113C ( ) . execute ( ) ; } private void execute ( ) { Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; final int M = sc . nextInt ( ) ; int [ ] prefs = new int [ M ] ; int [ ] years = new int [ M ] ; Map < Integer , Integer > yearPref = new HashMap < > ( ) ; Map < Integer , Integer > order = new HashMap < > ( ) ; Map < Integer , String > cityNumbers = new HashMap < > ( ) ; for ( int i = 0 ; i < M ; i + + ) { prefs [ i ] = sc . nextInt ( ) ; years [ i ] = sc . nextInt ( ) ; yearPref . put ( years [ i ] , prefs [ i ] ) ; } int [ ] ys = years . clone ( ) ; Arrays . sort ( ys ) ; for ( int i = 0 ; i < ys . length ; i + + ) { int y = ys [ i ] ; int p = yearPref . get ( y ) ; if ( ! order . containsKey ( p ) ) { order . put ( p , 0 ) ; } int ord = order . get ( p ) + 1 ; order . put ( p , ord ) ; String cityNum = String . format ( " % 06d " , p ) + String . format ( " % 06d " , ord ) ; cityNumbers . put ( y , cityNum ) ; } for ( int i = 0 ; i < M ; i + + ) { System . out . println ( cityNumbers . get ( years [ i ] ) ) ; } sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] b = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) b [ N ] = sc . nextInt ( ) ; int ans = 0 ; boolean plus = 0 ; for ( int i = 0 ; i < N ; i + + ) { plus = true ; for ( int j = 0 ; j < i ; j + + ) { if ( b [ j ] < b [ i ] ) { plus = false ; break ; } } if ( plus ) ans + + ; } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = n ; n = x * x * x ; System . out . println ( n ) ; } } a public class Main { public static void main ( String [ ] args ) { int x ; int num = x * 3 ; System . out . println ( num ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { int x , a ; System . out . println ( " Input x : " ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; a = x * x * x ; System . out . println ( " x ^ 3 = " + a ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " The input number was not correct . " ) ; } } } public class ITP1 _ 1B { public static void main ( String [ ] args ) { int arg = Integer . valueOf ( args [ 0 ] ) ; int answer = arg * arg * arg ; System . out . print ( answer ) ; } } import java . util * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String po = sc . nextLine ( ) ; po = po . replace ( " / " , " . " ) ; String p [ ] = po . substring ( " . " , 0 ) ; System . out . println ( ( Integer . parseInt ( p [ 1 ] ) < 5 ) ? " Heisei " : " TBD " ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x * ) ; } } public class Main { public static void main ( String [ ] args ) { ? ? ? int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( " x * x * x " ) ; } } import java . io . * ; import java . util . * ; public class Main { @ SuppressWarnings ( " unchecked " ) static boolean [ ] used ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int V = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; List < Edge > [ ] edges = new List [ V ] ; for ( int i = 0 ; i < V ; i + + ) { edges [ i ] = new ArrayList < Edge > ( ) ; } used = new boolean [ V ] ; } static class Edge { int to , cap , rev ; Edge ( int to , int cap , int rev ) { this . to = to ; this . cap = cap ; this . rev = rev ; } } } import sys stdin = sys . stdin ni = lambda : int ( ns ( ) ) na = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) ns = lambda : stdin . readline ( ) . rstrip ( ) # ignore trailing spaces n = ni ( ) a = na ( ) mn = 9999999999 ct = 0 for i in range ( n ) : if mn > a [ i ] : ct + = 1 mn = a [ i ] print ( ct ) import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Manager { public Manager ( ) { } static int input ; public static void main ( String args [ ] ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; input = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } public class XCubic { public static void main ( String [ ] args ) { int inputValue = Integer . valueOf ( System . console ( ) . readLine ( ) ) ; System . out . println ( inputValue * inputValue * inputValue ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; Integer lenChara = Integer . valueOf ( scan . nextLine ( ) ) ; String targetChara = scan . nextLine ( ) ; if ( lenChara % 2 = = 0 ) { int divide = lenChara / 2 ; String start = targetChara . substring ( 0 , divide ) ; String end = targetChara . substring ( divide , targetChara . length ( ) ) ; if ( start . equals ( end ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else { System . out . println ( " No " ) ; } } class Main { public static void main ( String [ ] args ) { int x = args [ 0 ] ; x = x * x * x ; System . out . plintln ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ( ) ; min = a [ 0 ] ; } for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } system . out . println ( count ) ; } } } import java . util . Scanner ; public class Main9 { public static void main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { String data1 = scanner . nextLine ( ) ; String data2 = scanner . nextLine ( ) ; String data3 = scanner . nextLine ( ) ; String [ ] data1Array = data1 . split ( " " ) ; String [ ] data2Array = data2 . split ( " " ) ; long startPosA = Long . parseLong ( data1Array [ 0 ] ) ; long moveDisA = Long . parseLong ( data1Array [ 1 ] ) ; long startPosB = Long . parseLong ( data2Array [ 0 ] ) ; long moveDisB = Long . parseLong ( data2Array [ 1 ] ) ; long time = Long . parseLong ( data3 ) ; boolean isCatch = false ; for ( int i = 1 ; i < = time ; i + + ) { startPosA + = moveDisA ; startPosB + = moveDisB ; if ( startPosA > = startPosB ) { isCatch = true ; break ; } } System . out . println ( isCatch ? " YES " : " NO " ) ; } } } import java . util . Scanner ; class Main { public static void main ( string [ ] args ) { Scanner in = new Scanner ( System . in ) ; String x = in . next ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } import java . util . scanner ; class Main { public static void main ( String [ ] args ) { System . out . println ( " ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? 3 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? " ) ; ystem. o ut. p rint ( " ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? > " ) ; nt tdIn. n extInt ( ) ; ystem. o ut. p rint ( " ? ? \ ? ? ? ? ? ? ? ? ? " ? ? ? 3 ? ? ? ? ? ? " ? ? § ? ? ? " ) ; } } import java . util . Scanner ; public class NOMURA2020BSandbox { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String T = sc . next ( ) ; System . out . println ( T . replaceAll ( " / ? " , " D " ) ) ; } } import java . io . IOException ; class Main { public static void main ( String [ ] args ) { try { int x = System . in . read ( ) ; int a = x * x * x ; } catch ( IOException e ) { } System . out . println ( a ) ; } } 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 ( ) ; System . out . println ( ( a + b ) + " " + s ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; List < Position > positions = new ArrayList < Position > ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i + + ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; positions . add ( new Position ( x , y ) ) ; } int c = 0 ; double distances = 0.0 ; for ( int i = 0 ; i < positions . size ( ) ; i + + ) { for ( int y = 0 ; y < positions . size ( ) ; y + + ) { if ( i = = y ) { continue ; } c + + ; distances + = calcDistance ( positions . get ( i ) , positions . get ( y ) ) ; } } System . out . println ( ( distances / c ) ) ; } static double calcDistance ( Position a , Position b ) { return Math . sqrt ( Math . pow ( a . x - b . x ) + Math . pow ( a . y - b . y ) ) ; } public class Position { public int x ; public int y ; public Position ( int x , int y ) { this . x = x ; this . y = y ; } } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] a ; a = new int [ 3 ] ; boolean dool = false ; for ( int i = 0 ; i < 3 ; i + + ) { int x = scanner . nextInt ( ) ; if ( x ! = 5 & & x ! = 7 ) { System . out . println ( " NO " ) ; dool = true ; break ; } a [ i ] = x ; } if ( dool = = false ) { boolean chool = false ; for ( int i = 0 ; i < 2 ; i + + ) { if ( a [ i ] > a [ i + 1 ] ) { System . out . println ( " NO " ) ; chool = true ; break ; } } if ( chool = = false ) System . out . println ( " YES " ) ; } scanner . close ( ) ; } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } # include < iostream > int main ( ) { int x ; std : : cin > > x ; std : : cout < < x * x * x < < std : : endl ; return 0 ; } public class ABC042 { public static void main ( String [ ] args ) { int seven = 0 ; int five = 0 ; String [ ] num = new String [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = new java . util . Scanner ( System . in ) . nextLine ( ) ; } for ( int i = 0 ; i < 3 ; i + + ) { if ( num [ i ] . length ( ) = = 5 ) { five + + ; } if ( num [ i ] . length ( ) = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int num _ 1 = Integer . parseInt ( str ) ; String str = scan . next ( ) ; int num _ 2 = Integer . parseInt ( str ) ; String str = scan . next ( ) ; int num _ 3 = Integer . parseInt ( str ) ; if ( num _ 1 = " 7 " ) { if ( num _ 2 = " 5 " & & num _ 3 = " 5 " ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( num _ 2 = " 7 " ) { if ( num _ 1 = " 5 " & & num _ 3 = " 5 " ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( num _ 3 = " 7 " ) { if ( num _ 2 = " 5 " & & num _ 1 = " 5 " ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } class Main { public static void main ( String [ ] args ) { int input = args [ 0 ] ; System . out . println ( input * input * input ) ; } } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; if ( n _ customer > 1 ) { while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer ) break ; } } else { sold + + ; } System . out . println ( sold ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int N = Integer . parseInt ( str ) ; str = scan . next ( ) ; int L = Integer . parseInt ( str ) ; ArrayList < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { String input = scan . next ( ) ; list . add ( input ) ; } Collections . sort ( list ) ; for ( int i = 0 ; i < 3 ; i + + ) { String input = list . get ( i ) ; String ans = ans + input ; } System . out . println ( ans ) ; } } n = gets . to _ i puts n * n import java . util . Map . Entry ; import java . util . * ; import java . math . * ; import org . w3c . dom . css . Counter ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H1 = sc . nextInt ( ) ; int M1 = sc . nextInt ( ) ; int H2 = sc . nextInt ( ) ; int M2 = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int BigH2 = H2 - H1 ; int BigH2M2 = BigH2 * 60 + M2 ; int clearTime = BigH2M2 - M1 ; int answer = clearTime - K ; System . out . println ( answer ) ; } } public class main { public static void Input ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextINt ( ) ; int B = sc . nextINt ( ) ; int C = sc . nextINt ( ) ; int X = sc . nextINt ( ) ; int y = 0 ; int count = 0 ; for ( int i = 0 ; i < A ; i + + ) { for ( int j = 0 ; j < B ; j + + ) { y = ( X - 500 * i - 100 * j ) / 50 ; if ( y > = 0 & & y < = C ) { count = count + 1 ; } } } System . out . println ( count ) ; } } class Main { public static void main ( Strings [ ] args ) { int x ; x = 0 ; System . out . println ( x ^ 3 ) ; } } # include < stdio . h > # define uint unsigned int int in ( ) { int x = 0 , c ; for ( ; ( uint ) ( ( c = getchar ( ) ) - ' 0' ) > = 10 ; ) { if ( c = = ' -' ) return - in ( ) ; if ( ! ~ c ) throw ~ 0 ; } do { x = ( x < < 3 ) + ( x < < 1 ) + ( c - ' 0' ) ; } while ( ( uint ) ( ( c = getchar ( ) ) - ' 0' ) < 10 ) ; return x ; } int main ( ) { int n , S ; while ( n = in ( ) , S = in ( ) , ( n | | S ) ) { int w [ 102 ] = { } , a [ 102 ] = { } ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int b ; w [ b = in ( ) ] + + ; a [ b ] + + ; } for ( int i = 99 ; i > = 0 ; i -- ) w [ i ] + = w [ i + 1 ] ; for ( int i = 0 ; i < = 100 ; i + + ) if ( 2 * i > S ) ans + = a [ i ] * ( a [ i ] - 1 ) / 2 ; for ( int i = 1 ; i < = 100 ; i + + ) ans + = a [ i ] * w [ i > S - i ? i + 1 : S - i + 1 ] ; printf ( " % d % c " , ans , 10 ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = 0 ; try { x = Integer . parseInt ( in . readLine ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } System . out . println ( ( int ) Math . pow ( ( double ) x , 3d ) ) ; } } import java . util . Scanner ; public class demo { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double a , b , h , m ; a = in . nextDouble ( ) ; b = in . nextDouble ( ) ; h = in . nextDouble ( ) ; m = in . nextDouble ( ) ; in . close ( ) ; double h _ angle = 0.5 * ( h * 60 + m ) ; double m _ angle = 6 * m ; double angle = Math . abs ( h _ angle - m _ angle ) ; angle = Math . min ( angle , 360 - angle ) ; double res = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( angle * Math . PI / 180 ) ) ; System . out . printf ( " % .20f \ n " , res ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nextTime = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { nextTime = sc . nextInt ( ) ; if ( i ! = 4 ) nextTime = Math . ceil ( nextTime ) ; } System . out . println ( nextTime ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ans = Math . abs ( Math . max ( Math . max ( a , b ) , c ) - Math . min ( Math . min ( a , b ) , c ) ) ; System . out . println ( ans ) } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parse ( args [ 0 ] ) ; int y = Math . pow ( x , 3 ) ; System . out . println ( y ) ; } } impmport java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; double xr = 360 * ( x * 60 + y ) / 720 ; double yr = 360 * y / 60 double e = Math . max ( xr - yr , yr - xr ) ; double r = Math . sqrt ( Math . pow ( b , 2 ) + Math . pow ( c , 2 ) - 2 * b * c * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } public class AtCorder091 { public static void main ( String [ ] args ) { int a = 0 ; int b = 0 ; int c = 0 ; a = Integer . parseInt ( args [ 0 ] ) ; b = Integer . parseInt ( args [ 1 ] ) ; c = Integer . parseInt ( args [ 2 ] ) ; if ( ( ( a > = 1 ) & & ( a < = 500 ) ) & & ( ( b > = 1 ) & & ( b < = 500 ) ) & & ( ( c > = 1 ) & & ( b < = 1000 ) ) ) { if ( c < = a + b ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int x = scanner . nextint ( ) ; int y = x * x * x ; System . out . println ( y ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( " enter x : " ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x ^ 3 ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; double [ ] x = new double [ N ] ; double [ ] y = new double [ N ] ; double [ ] ans = new double [ 40320 ] ; double [ ] aa = new double [ ] { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 } ; double [ ] bb = new double [ ] { 0 , 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 } ; for ( int i = 0 ; i < N ; i + + ) { x [ i ] = sc . nextDouble ( ) ; y [ i ] = sc . nextDouble ( ) ; } int count = 0 ; for ( int i = 0 ; i < = N - 2 ; i + + ) { for ( int k = i + 1 ; k < = N - 1 ; k + + ) { ans [ count ] = Math . sqrt ( ( x [ i ] - x [ k ] ) * ( x [ i ] - x [ k ] ) + ( y [ i ] - y [ k ] ) * ( y [ i ] - y [ k ] ) ) ; count + + ; } } double total = 0 ; for ( int i = 0 ; i < 40320 ; i + + ) { total + = ans [ i ] ; } System . out . println ( ( total * aa [ N - 1 ] / bb [ N ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextLong ( ) ; } int m = 1000000007 ; long answer = 0 ; for ( int i = 0 ; i < 61 ; i + + ) { long d = ( 1L < < i ) ; long count = 0 ; for ( int j = 0 ; j < a . length ; j + + ) { if ( ( d & a [ j ] ) > 0 ) { count + + ; } } count = count * ( n - count ) ; answer = ( answer + ( ( d * count ) % m ) % m ; } System . out . println ( answer % m ) ; } } import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . StringTokenizer ; import java . io . 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 ) ; ABeginning solver = new ABeginning ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class ABeginning { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = 4 ; int [ ] arr = in . nextArray ( n ) ; Arrays . sort ( arr ) ; out . println ( Arrays . equals ( arr , new int [ ] { 1 , 4 , 7 , 9 } ) ? " YES " : " NO " ) ; } } static class InputReader implements AutoCloseable { 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 ( ) ) ; } public int [ ] nextArray ( int n ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = nextInt ( ) ; } return arr ; } public void close ( ) { } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int L = scan . nextInt ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; for ( int i = 0 ; i < N ; i + + ) { String [ ] str = new String [ N ] ; str [ i ] = reader . readLine ( ) ; } Arrays . sort ( str ) ; for ( String out : str ) { System . out . print ( out ) ; } reader . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; Date formatDate = sdf . parse ( sdate ) ; if ( formatDate < = 2019 / 04 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int L = scan . nextInt ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = new String [ N ] ; for ( int i = 0 ; i < N ; i + + ) { str [ i ] = scan . next ( ) ; } Arrays . sort ( str ) ; for ( String out : str ) { System . out . print ( out ) ; } scan . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int [ ] [ ] x = new int [ n ] [ d ] ; int counter = 0 ; for ( int j = 0 ; j < n ; j + + ) { for ( int i = 0 ; i < d ; i + + ) { x [ j ] [ i ] = scan . nextInt ( ) ; } } for ( int i = 0 ; i < n - 1 ; i + + ) { int sum = 0 ; for ( int j = i + 1 ; j < n ; j + + ) { for ( int k = 0 ; k < d ; k + + ) { sum + = ( ( x [ j ] x [ i ] - x [ i ] x [ i ] ) * ( x [ j ] x [ i ] - x [ i ] x [ i ] ) ) ; } if ( Math . sqrt ( sum ) = = int ( Math . sqrt ( sum ) ) ) { counter + + ; } } } System . out . print ( counter ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] data = new int [ 3 ] ; for ( int i = 0 ; i < data . length ; i + + ) { data [ i ] = sc . nextInt ( ) ; } Arrays . sort ( data ) ; return ( data [ 1 ] - data [ 0 ] ) > ( data [ 2 ] - data [ 1 ] ) ? ( data [ 2 ] - data [ 1 ] ) : ( data [ 1 ] - data [ 0 ] ) ; } } class Main { public static void main ( String args [ ] ) { int n = 0 ; System . in ( n ) ; System . out . println ( n * n * n ) ; } } import java . io . * public class Xcube { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readline ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = input . readLine ( ) ; int output = Integer . parseInt ( x ) ; output = output * output * output System . out . println ( output ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = reader . readLine ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main { String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ABC = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { ABC [ i ] = sc . nextInt ( ) ; } Arrays . sort ( ABC ) ; boolean flg = false ; if ( ABC [ 0 ] = = 5 ) { if ( ABC [ 1 ] = = 5 ) { if ( ABC [ 2 ] = = 7 ) { flg = true ; } } } if ( flg ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( solution ( x ) ) ; } public static int solution ( int x ) { return x * x * x ; } } mport java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int N = gi ( ) ; int m = 2 ; for ( int i = 1 ; i < = N ; i + + ) { int c = 0 ; int a = i ; while ( true ) { if ( a % 2 ! = 0 ) { break ; } a / = 2 ; c + + ; } if ( c > m ) { m = c ; } } System . out . print ( m ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } class Main { public static void main ( string [ ] args ) { int x ; } } / * package whatever import java . io . * ; import java . util . * ; class GFG { private static final long MOD = ( long ) ( 1e9 + 7 ) ; public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; long [ ] a = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = input . nextLong ( ) ; long xor = 0l , sum = 0l ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { xor = ( a [ i ] ^ a [ j ] ) % MOD ; sum + = ( xor % MOD ) ; } } System . out . println ( sum % MOD ) ; } } class Main { public static void main ( String [ ] args ) { int x = System . in . read ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int n = stdId . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer \ n ) ; } } import java . util . * ; public class A { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { int x 2 ; x = x * x * x ; System . out . println ( x ) ; } } package atcorder ; public class HelloWorld { public static void main ( String args [ ] ) { int [ ] arg = new int [ 3 ] ; int y ; for ( int x = 0 ; x < 3 ; x + + ) { arg [ x ] = Integer . parseInt ( args [ x ] ) ; } if ( arg [ 0 ] < arg [ 1 ] ) { y = arg [ 0 ] ; arg [ 0 ] = arg [ 1 ] ; arg [ 1 ] = y ; System . out . println ( " テスト1 " ) ; } i f ( r [ 1 ] < a r g 2 ) { y = a g 1 ; a r g [ 1 = a r g 2 ; a r g [ 2 = y ; f ( r [ 0 ] < a r g 1 ) { y = a g 0 ; a r g [ 0 = a r g 1 ; a r g [ 1 = y ; o r i t x = 0 ; < 3 ; x + ) { S ys t e .out.p r int l n ( arg [ x ] ) ; } S y s e .out.p r int l n ( ( arg [ 0 ] - a r g 1 ) + ( a r [ ] - a r g 2 ) ) ; } } public class Main { public statilc void main ( ) { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; System . out . println ( i * i * i ) ; } } import java . util . Scanner ; public class Main { public Static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = ( x * x * x ) ; System . out . println ( answer ) ; } } class Main { ? ? ? public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = Integer . parseInt ( scan . next ( ) ) ; System . out . println ( Math . pow ( a , 3 ) ) ; ? ? ? } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; double pi = 3.14159265359 ; double a = r * r * pi ; System . out . println ( ( int ) Math . floor ( a / pi ) ) ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int n = 8 ; int j = 2 ; int k = 0 ; while ( ( ( n / j ) / 2 ) % 2 = = 0 ) { if ( n % j = = 0 ) { j = j * 2 ; k = k + 1 ; } else { break ; } } System . out . println ( j * 2 ) ; } } public class Main { public static void main ( String [ ] args ) throws IOException { int num = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( num * num * num ) ; } } import java . util . Scanner ; import java . lang . Math ; class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; System . out . println ( pow ( n , 3 ) ) ; } } import java . util . * ; static class Colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double arg1 = 30 * H + 0.5 * M ; double arg2 = 6 * M ; double x1 = A * Math . cos ( Math . toRadians ( arg1 ) ) ; double y1 = A * Math . sin ( Math . toRadians ( arg1 ) ) ; double x2 = B * Math . cos ( Math . toRadians ( arg2 ) ) ; double y2 = B * Math . sin ( Math . toRadians ( arg2 ) ) ; System . out . println ( Math . hypot ( x2 - x1 , y2 - y1 ) ) ; } } import Java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ; int x = Java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; } } import java . util . Scanner ; class GoodDistance { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int count = 0 ; double [ ] [ ] a = new double [ N ] [ D ] ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = 0 ; j < D ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < N - 1 ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { double sum = 0 ; for ( int k = 0 ; k < D ; k + + ) { sum + = Math . pow ( a [ i ] [ k ] - a [ j ] [ k ] , 2 ) ; } sum = Math . sqrt ( sum ) ; if ( sum % 1 = = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class solution { public static void main ( String [ ] args ) { int n , b ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; b = sc . nextInt ( ) ; if ( n > = 13 ) { System . out . println ( b ) ; } else if ( n > 5 & & n < 13 ) { System . out . println ( b / 2 ) ; } else { System . out . println ( " 0 " ) ; } } } import java . util . Scanner ; public class Main { public static void swap ( long a [ ] , int b , int e , int t ) { for ( int i = 0 ; i < e - b ; i + + ) { long tmp = a [ b + i ] ; a [ b + i ] = a [ t + i ] ; a [ t + i ] = tmp ; } } public static void main ( Stirng [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; swap ( a , b , e , t ) ; } for ( int i = 0 ; i < n - 1 ; i + + ) System . out . print ( a [ i ] + " " ) ; System . out . println ( a [ n - 1 ] ) ; } } import java . util . * ; public class Colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double arg1 = 30 * H + 0.5 * M ; double arg2 = 6 * M ; double x1 = A * Math . cos ( Math . toRadians ( arg1 ) ) ; double y1 = A * Math . sin ( Math . toRadians ( arg1 ) ) ; double x2 = B * Math . cos ( Math . toRadians ( arg2 ) ) ; double y2 = B * Math . sin ( Math . toRadians ( arg2 ) ) ; System . out . println ( Math . hypot ( x2 - x1 , y2 - y1 ) ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 1 ; x * * 3 System . out . println ( x ) ; } } public class ABC054 _ A { public static void main ( String [ ] args ) { int A = 8 , B = 6 ; if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( A = = B ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; System out . println ( x - y ) ; } } import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] ai = new int [ n ] ; int [ ] bi = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { ai [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i + + ) { bi [ i ] = sc . nextInt ( ) ; } int minusNums = 0 ; int minusNumsLength = 0 ; int [ ] plusNums = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { if ( ai [ i ] - bi [ i ] < 0 ) { minusNums + = ai [ i ] - bi [ i ] ; minusNumsLength + + ; } else { plusNums [ i ] = ai [ i ] - bi [ i ] ; } } if ( minusNums = = 0 ) { System . out . println ( " 0 " ) ; return ; } Arrays . sort ( plusNums ) ; for ( int i = 0 ; i < plusNums . length ; i + + ) { minusNums + = plusNums [ plusNums . length - i - 1 ] ; if ( minusNums > = 0 ) { System . out . println ( minusNumsLength + i + 1 ) ; return ; } } System . out . println ( " -1 " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String S = sc . next ( ) ; int year = Integer . parseInt ( S . substring ( 0 , 4 ) ) ; int month = Integer . parseInt ( S . substring ( 5 , 7 ) ) ; int day = Integer . parseInt ( S . substring ( 8 , 10 ) ) ; if ( year < 2019 ) { System . out . println ( " Heisei " ) ; return ; } if ( month < = 4 & & year = = 2019 ) { System . out . println ( " Heisei " ) ; return ; } System . out . println ( " TBD " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = New Scanner ( System . in ) ; int n = scan . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . Scanner ; public class Sanjyou { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int it = 3 ; int total = 0 ; scanner . close ( ) ; System . out . println ( helper ( n , it , total ) ) ; } public int helper ( int n , int it , int total ) { if ( it = = 0 ) { return total ; } else { return helper ( n , it - 1 , total * n ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] [ ] array = new int [ n ] [ 3 ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] [ 0 ] = sc . nextInt ( ) ; array [ i ] [ 1 ] = sc . nextInt ( ) ; array [ i ] [ 2 ] = array [ i ] [ 1 ] - array [ i ] [ 0 ] ; } long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( array [ i ] [ 0 ] < array [ i ] [ 1 ] ) ans + = array [ i ] [ 1 ] ; } System . out . println ( ans ) ; } } import java . util . Arrays ; import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ; int SideA = keyboard . nextInt ( ) ; int SideB = keyboard . nextInt ( ) ; int SideC = keyboard . nextInt ( ) ; int [ ] arr = new int [ ] { SideA , SideB , SideC } ; Arrays . sort ( arr ) ; if ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } keyboard . close ( ) ; } class Main { public static void main ( String [ ] args ) { int x , ans ; ans = x ^ 3 ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ams = 0 ; System . out . println ( ans ) ; } } public class Main { private static String judgeDists ( int [ ] dists , int k ) { if ( k < 0 | | k > 123 ) return " : ( " ; for ( int tmp : dists ) { if ( tmp < 0 | | tmp > 123 ) return " : ( " ; } for ( int i = 0 ; i < dists . length ; i + + ) { for ( int j = i + 1 ; j < dists . length ; j + + ) { if ( dists [ j ] - dists [ i ] > k ) return " : ( " ; } } return " Yay ! " ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] dists = new int [ 5 ] ; dists [ 0 ] = sc . nextInt ( ) ; dists [ 1 ] = sc . nextInt ( ) ; dists [ 2 ] = sc . nextInt ( ) ; dists [ 3 ] = sc . nextInt ( ) ; dists [ 4 ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; System . out . println ( judgeDists ( dists , k ) ) ; } } import java . util . Scanner ; public class Sanjyou { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class StillTBD . java { public static void main ( String [ ] args ) { String s ; String k = " 2019 / 04 / 30 " ; Scanner input = new Scanner ( System . in ) ; s = input . nextLine ( ) ; if ( s = = null ? k = = null : s . equals ( k ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C < = ( A + B ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public class main { public static void main { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int h1 = sc . nextInt ( ) ; int m1 = sc . nextInt ( ) ; int h2 = sc . nextInt ( ) ; int m2 = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int h = h2 - h1 ; int m = ( h * 60 + m2 ) - m1 ; int ret = m - k ; System . out . printf ( String . valueOf ( ret ) ) ; } } import java . io . * ; import java . util . * ; public class LowElements { public static void main ( String [ ] args ) { out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; MyScanner sc = new MyScanner ( ) ; int n = sc . nextInt ( ) ; String [ ] input = new String [ n ] ; input = sc . nextLine ( ) . split ( " " ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( input [ i ] ) ; } int sum = 0 ; for ( int i = 1 ; i < n ; i + + ) { if ( arr [ i - 1 ] > arr [ i ] | | arr [ i - 1 ] = = 1 ) { sum + + ; } } if ( arr [ n - 1 ] = = 1 ) { sum + + ; } out . println ( sum ) ; out . close ( ) ; } 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 . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] antenas = { a , b , c , d , e } ; boolean connect = true ; check : for ( int i = 0 ; i < antenas . length - 2 ; i + + ) { for ( int j = i ; j < antenas . length - 1 ; j + + ) { if ( antenas [ j ] - antenas [ i ] > k ) { connect = false ; break check ; } } } String output = connect ? " Yay ! " : " : ) " ; System . out . println ( output ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class AtcoderABC87B { public static void main ( String [ ] args ) throws Exception { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = Integer . parseInt ( input . readLine ( ) ) ; int b = Integer . parseInt ( input . readLine ( ) ) ; int c = Integer . parseInt ( input . readLine ( ) ) ; int target = Integer . parseInt ( input . readLine ( ) ) ; int count = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( i * 500 ) + ( j * 100 ) + ( k * 50 ) = = target ) count + + ; } } } System . out . println ( count ) ; } } public class Main { public static void main ( String [ ] args ) { int 1 < = x < = 100 ; N = x * x * x ; System . out . println ( N ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; int x * = 3 ; System . out . println ( x ) ; } } import java . lang . Math ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } public class main { static int N , M ; static int [ ] arr ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; M = sc . nextInt ( ) ; arr = new int [ N ] ; for ( int i = 0 ; i < M ; i + + ) { int P = sc . nextInt ( ) ; int Y = sc . nextInt ( ) ; arr [ P - 1 ] + + ; } for ( int i = 0 ; i < arr . length ; i + + ) { for ( int j = 0 ; j < arr [ i ] ; j + + ) { String id1 = String . format ( " % 06d " , i + 1 ) ; String id2 = String . format ( " % 06d " , j + 1 ) ; System . out . println ( id1 + id2 ) ; } } } } class Main { public static void main ( String [ ] args ) { int x ; double sum = 0 ; sum = Math . pow ( x , 3 ) ; System . out . println ( sum ) ; } } import java . util . Scanner ; public class Test _ c { public static void Main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int P [ ] = new int [ N ] ; int sum = 1 ; boolean flag = true ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = scan . nextInt ( ) ; } int pre _ min = P [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { loop : for ( int j = 1 ; j < i + 1 ; j + + ) { flag = true ; if ( P [ i ] > pre _ min ) { flag = false ; continue loop ; } } if ( flag = = true ) { sum + = 1 ; pre _ min = P [ i ] ; } } System . out . print ( sum ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class AOJ { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a < 13 ) { b = b / 2 ; } else if ( a < 5 ) { b = 0 ; } System . out . println ( b ) ; } } import java . util . scanner ; public class main ( ) { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; public class Xcube { public static void main ( String [ ] args ) { int x = 0 ; try { x = Integer . parseInt ( args [ 0 ] ) ; } catch ( NumberFormatException e ) { System . out . println ( args [ 0 ] + " ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y tem.ex i t ( 1 ) ; } y tem.ou t .pr i ntln ( x * ) } package helloworld ; import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int n = r . nextInt ( ) ; System . out . println ( n * n ) ; } } public static void main ( [ ] String args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; int y = in . nextInt ( ) ; floor ( average ( x , y ) ) ; } private average ( int x , int y ) { return ( x + y ) / 2 ; } private int floor ( float z ) { return Math . floor ( z ) ; } public class Main { public static void main ( String [ ] args ) { int result = 0 ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { result = x * x * x ; System . out . println ( result ) ; } } } import java . util . Scanner ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int res = 0 ; if ( a < = 5 ) { res = 0 ; } else if ( a < = 12 ) { res = b / 2 ; } else { res = b ; } System . out . println ( res ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . nextLine ( ) ) { int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; System . out . println ( a + b ) ; } } } class Test1 { public static void main ( String [ ] args ) { InputStreamReader str = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( str ) ; try { String buf = br . readLine ( ) ; int x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner scan = new Scanner ( System . in ) ; while ( true ) { if ( str . equals ( " 0 " ) ) break ; int t = 0 ; for ( int i = 0 ; i < str . length ( ) ; i + + ) { t + = Character . getNumericValue ( str . charAt ( i ) ) ; } System . out . println ( t ) ; } } } class Main { public static void main ( String [ ] args ) { int x = 3 ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { int x , ans ; BufferedReader br = new BufferedReader ( new InputStremaReader ( System . in ) ) ; x = Integer . parseInt ( br . readLine ) ; ans = x * x * x ; System . out . println ( ans ) ; } } public class main { public static void main ( String args [ ] ) { double a = 9d ; double b = 4d ; double ans = Math . pow ( a , b ) ; System . out . println ( " ans " ) ; class math { public static void main ( String args [ ] ) { int x ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class XCubic { public static void run ( ) { int xc = readInput ( ) ; printCubic ( xc ) ; } public int readInput ( ) { Scanner sc = new Scanner ( System . in ) ; return sc . nextInt ( ) ; } public void printCubic ( int x ) { System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { XCubic . run ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ; sc . nextInt ; sc . nextInt ; sc . nextInt ; int e = sc . nextInt ; int k = sc . nextInt ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { DataInputStream r = new DataInputStream ( System . in ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = ( long ) Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; while ( ( str = input . readLine ( ) ) ! = null ) { String str _ ary [ ] = str . split ( " , " ) ; Double a [ ] = new Double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = Double . parseDouble ( str _ ary [ i ] ) ; } if ( a [ 1 ] / Math . pow ( a [ 2 ] , 2 ) > = 25 ) System . out . println ( ( int ) a [ 0 ] ) ; } } } import java . io . * ; public class Power { public static void main ( String args [ ] ) { int x = 0 ; do { System . out . println ( " 0 ? ? ? 100 ? ? ? ? ? ´ ? ? ° ? ? § ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? : " ) ; I n p tStreamReader isr = n w Inp tStreamReader ( Sys t em.in ) ; B u f eredReader br n w Buf eredReader ( isr ) ; t r y St r ng buf = b . ea d Line ( ) ; x = I t ger.par s eInt ( buf ) ; } c a c h ( Exc e ption e ) { x = 0 } h l e ( x < 0 | | 1 0 0 < x ) ; S y s em.out . pri n tln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; S y s t m.out. p rin t ln ( " ? ? ? " + Ma t h pow ( x , 3 ) + " ? ? ? ? ? § ? ? ? " ) ; } } public class Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; system . out . println ( answer ) ; } } public class Main { public static int cul ( int x ) { y = x * x * x ; return y ; } public static void main ( String [ ] args ) { int y = cul ( x ) ; Sytem . out . println ( y ) ; } } 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 ( ) ; if ( a > b ) { System . out . println ( " Alice " ) ; } else if ( a = = b ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } import java . io . * ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = Integer . parseInt ( in . next ( ) ) ; System . out . println ( x ^ 3 ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; String [ ] lines = line . split ( " " ) ; int A = Integer . parseInt ( lines [ 0 ] ) ; int B = Integer . parseInt ( lines [ 1 ] ) ; if ( B > 12 ) { System . out . println ( A ) ; } else if ( B > 5 ) { System . out . println ( A / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . io . * ; public class Xcubic { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; if ( x > = 1 & & x < = 100 ) { System . out . println ( x * x * x ) ; } else { System . out . println ( " error : number is 1 to 100 " ) ; } } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " number format error ! " ) ; } } } import java . io . * public class Main { public static void main ( String args [ ] ) { System . out . println ( " 数字を入力してください " ) ; BufferedReader rea d e r = new Buffered eader ( e In utStreamReader ( Sys em.in ) ) ; String l i ne = r e ad e r . eadLin ( ) ; n x = I n teger.pa r a s Int l n ) ; x = x * x * x ; S yste m . u . r n l n x ) } } import java . util . * ; class Circle { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int result = ( int ) ( Math . pow ( r , 2 ) ) ; s . close ( ) ; System . out . println ( result ) ; } } import java . util . Scanner ; public class C { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; Integer a = scanner . nextInt ( ) ; Integer b = scanner . nextInt ( ) ; Integer h = scanner . nextInt ( ) ; Integer m = scanner . nextInt ( ) ; double result ; double angle = ( h * 360 / 12 + m * 30 / 60 ) - m * 360 / 60 ; result = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . printf ( " % .20f " , result ) ; } } import java . util . Scanner ; public class abc145 _ a { public static void main ( final String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; final int n = Integer . parseInt ( sc . next ( ) ) ; System . out . println ( n * n ) ; } } import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Scanner ; public class CF { private static final long M = 998 _ 244 _ 353 ; public static void main ( String [ ] args ) throws Exception { try ( BufferedInputStream in = new BufferedInputStream ( System . in ) ; PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ) { Scanner sc = new Scanner ( in ) ; int [ ] times = new int [ 5 ] ; int [ ] actual = new int [ 5 ] ; int maxDiff = Integer . MIN _ VALUE ; int diffPos = - 1 ; for ( int i = 0 ; i < 5 ; i + + ) { int x = sc . nextInt ( ) ; actual [ i ] = x ; int sum = 0 ; sum + = x / 10 * 10 ; if ( x % 10 > 0 ) sum + = 10 ; times [ i ] = sum ; int diff = sum - x ; if ( diff > maxDiff ) { maxDiff = diff ; diffPos = i ; } } int total = 0 ; for ( int i = 0 ; i < times . length ; i + + ) if ( i ! = diffPos ) total + = times [ i ] ; out . println ( total + actual [ diffPos ] ) ; } } } import java . util . * ; class A { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { n [ i ] = sc . nextInt ( ) ; } Arrays . sort ( n ) ; if ( n [ 0 ] ! = 1 | | n [ 1 ] ! = 4 | | n [ 2 ] ! = 7 | | n [ 3 ] ! = 9 ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; } } package AtCoder ; import java . util . Arrays ; import java . util . Scanner ; public class abc121 _ a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int k = sc . nextInt ( ) ; if ( arr [ 4 ] - arr [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } public class X { public static void main ( String [ ] args ) { Scanner scanNum = new Scanner ( System . in ) ; int x = scanNum . nextInt ( ) ; System . out . println ( x * x * x ) ; } } package aoj3 ; public class ? ? ? Main { public static void main ( String args [ ] ) { System . out . println ( " Hello World " ) ; int = x x = 3 * 3 * 3 System . out . printl ( 1 ? ? ? x ? ? ? 100 ) } } import java . util . * ; public class colon { public static void main ( String agrs [ ] ) { Scanner in = new Scanner ( System . in ) ; double a = in . nextDouble ( ) ; double b = in . nextDouble ( ) ; double h = in . nextDouble ( ) ; double m = in . nextDouble ( ) ; h * = 30 ; m * = 6 ; h + = m / 12 ; if ( m = = 0 ) { m = 360.0 ; } if ( h = = 0 ) { h = 360.0 ; } double angle = Math . min ( Math . abs ( h - m ) , Math . abs ( m - h ) ) ; angle / = 180 ; angle * = Math . PI ; double hyp = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - ( 2 * a * b * Math . cos ( angle ) ) ; hyp = Math . sqrt ( hyp ) ; System . out . println ( hyp ) ; } } import java . util . * ; public class test { public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; str = str . replace ( " eraser " , " " ) ; str = str . replace ( " erase " , " " ) ; str = str . replace ( " dreamer " , " " ) ; str = str . replace ( " dream " , " " ) ; if ( str . equals ( " " ) ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } } import java . util . * ; class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( Stinrg [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { int z = s - x - y ; if ( ( z < = k ) & & ( z = 0 ) ) { count + + ; } } } System . out . println ( count ) ; } } 提出情報 public class Main { public static void main ( String [ ] args } { int year = args [ 0 ] . substring ( 0 , 3 ) ; int month = args [ 0 ] . substring ( 5 , 6 ) ; int day = args [ 0 ] . substring ( 8 , 9 ) ; Date inputDay = new Date ( year , month , day . 12 , 0 , 0 ) ; Date s = new Date ( 2019 , 4 , 30 , 12 , 0 , 0 ) ; if ( s . before ( inputDay ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } public class Main4 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String prm = sc . nextLine ( ) ; String [ ] numberArray = prm . split ( " " ) ; int distance = Integer . parseInt ( numberArray [ 5 ] ) ; int firstAntenna = Integer . parseInt ( numberArray [ 0 ] ) ; int lastAntenna = Integer . parseInt ( numberArray [ 4 ] ) ; if ( lastAntenna - firstAntenna > distance ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; class stillTBD { public static void main ( String args [ ] ) { try { Date boundaryDate = ConvertDateFromString ( " 2019 / 04 / 30 " ) ; Scanner scanner = new Scanner ( System . in ) ; String input = scanner . nextLine ( ) ; int result = ConvertDateFromString ( input ) . compareTo ( boundaryDate ) ; if ( ( result = = - 1 ) | | ( result = = 0 ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } scanner . close ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } public static Date ConvertDateFromString ( String dateStr ) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date formatDate = sdf . parse ( dateStr ) ; System . out . println ( formatDate ) ; return formatDate ; } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String num = sc . next ( ) ; int [ ] x ; x = new int [ 1000 ] ; int length = num . length ( ) ; int sum = 0 ; if ( length = = 0 ) { break ; } else { for ( int i = 0 ; i < length ; i + + ) x [ i ] = num . charAt ( i ) - ' 0' ; } for ( int i = 0 ; i < length ; i + + ) { sum + = x [ i ] ; } System . out . println ( sum ) ; } } } public class Main { public static void main ( String [ ] arg ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String ipt = br . readLine ( ) ; int x = Integer . parseInt ( ipt ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; class Main { public static void main ( string [ ] args ) { Scanner sc = New Scanner ( System . in ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ) ; } } class Test { ? ? ? import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int inputNum = Integer . parseInt ( str ) ; int intNum = inputNum * inputNum * inputNum ; System . out . println ( intNum ) ; } } import java . io . * ; public class Cubic { public static void main ( String [ ] args ) { String line ; int x ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } catch ( NumberFormatException e ) { System . out . println ( e ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } public class main { public static void main ( String [ ] args ) { int x ; int kekka ; x = 2 ; kekka = x * x ; System . out . println ( kekka ) ; x = 8 ; kekka = x * x ; System . out . println ( kekka ) ; x = 3 ; kekka = x * x ; System . out . println ( kekka ) ; x = 27 ; kekka = x * x ; System . out . println ( kekka ) ; } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int n = gi ( ) ; int [ ] A = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { A [ i ] = gi ( ) ; } Arrays . parallelSort ( A ) ; System . out . print ( A [ A . length - 1 ] - A [ 0 ] ) ; } public static String gs ( ) { return scanner . next ( ) ; } public static int gi ( ) { return Integer . parseInt ( scanner . next ( ) ) ; } public static long gl ( ) { return Long . parseLong ( scanner . next ( ) ) ; } public static double gd ( ) { return Double . parseDouble ( scanner . next ( ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int n [ ] = new int [ 4 ] ; String m ; int p = 0 ; for ( int i = 0 ; i < N ; i + + ) { m = sc . next ( ) ; if ( m = = " ' P ' " ) n [ 0 ] + + ; if ( m = = " ' G ' " ) n [ 1 ] + + ; if ( m = = " ' W ' " ) n [ 2 ] + + ; if ( m = = " ' Y ' " ) n [ 3 ] + + ; } for ( int k = 0 ; k < 4 ; k + + ) if ( n [ k ] > 0 ) p + + ; if ( p = = 3 ) { System . out . println ( " three " ) ; } else if ( ) { System . out . println ( " four " ) ; } } } public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { String value ; int input ; int output ; System . out . println ( " ? ? ´ ? ? ° ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; v lue = n w j va.u t il.S c anner ( S y stem.i n ) . n e xtLine ( ) ; i put = I n teger.p a rseInt ( v a lue ) ; o tput = ( i n t ) ( M a th.p o w ( ( d o uble ) i n put , 3 ) ) ; S stem.o u t.p r intln ( o u tput ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class HelloWorld { public static void main ( String [ ] args ) { int target = 0 ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; target = Integer . parseInt ( reader . readLine ( ) ) ; } catch ( Exception E ) { E . printStackTrace ( ) ; } int min1 = ( int ) ( Math . pow ( target / 2 , 1.0 / 5 ) ) ; int max1 = ( int ) ( Math . pow ( target , 1.0 / 5 ) ) ; int a = max1 ; int judge = 1 ; while ( a > = min1 ) { double b = Math . pow ( target - Math . pow ( a , 5 ) , 1 / 5 ) ; if ( b - ( int ) ( b ) = = 0.0 ) { System . out . print ( a ) ; System . out . print ( " " + ( - ( int ) ( b ) ) ) ; judge = 0 ; break ; } a - = 1 ; } a = max1 ; if ( judge = = 1 ) { while ( Math . pow ( a , 5 ) - Math . pow ( a - 1 , 5 ) < = target ) { double b = Math . pow ( target + Math . pow ( a , 5 ) , 1 / 5 ) ; if ( b - ( int ) ( b ) = = 0.0 ) { System . out . print ( a ) ; System . out . print ( ( int ) ( b ) ) ; break ; } a + = 1 ; } } } } mport java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } sort ( a , 0 , 2 ) ; int cost = ( a [ 1 ] - a [ 0 ] ) ; cost + = ( a [ 2 ] - a [ 1 ] ) ; System . out . println ( cost ) ; } private static void sort ( int [ ] d , int left , int right ) { if ( left > = right ) { return ; } int p = d [ ( left + right ) / 2 ] ; int l = left , r = right ; int tmp ; while ( l < = r ) { while ( d [ l ] < p ) { l + + ; } while ( d [ r ] > p ) { r -- ; } if ( l < = r ) { tmp = d [ l ] ; d [ l ] = d [ r ] ; d [ r ] = tmp ; l + + ; r -- ; } } sort ( d , left , r ) ; sort ( d , l , right ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = in . next ( ) ; int s = in . next ( ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { for ( int z = 0 ; z < = k ; z + + ) { if ( s = = x + y + z ) ans + + ; } } } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int A1 = scanner . nextInt ( ) ; int A2 = scanner . nextInt ( ) ; int A3 = scanner . nextInt ( ) ; int [ ] list = { A1 , A2 , A3 } ; int cost = 0 ; int cost1 = list [ 0 ] * 0 + Math . abs ( list [ 2 ] - list [ 0 ] ) + Math . abs ( list [ 1 ] - list [ 2 ] ) ; int cost2 = list [ 1 ] * 0 + Math . abs ( list [ 0 ] - list [ 1 ] ) + Math . abs ( list [ 2 ] - list [ 0 ] ) ; int cost3 = list [ 2 ] * 0 + Math . abs ( list [ 0 ] - list [ 2 ] ) + Math . abs ( list [ 1 ] - list [ 0 ] ) ; int [ ] min = { cost1 , cost2 , cost3 } ; Arrays . sort ( min ) ; for ( int i : min ) { cost = min [ 0 ] ; } System . out . println ( cost ) ; } } import java . util . Random ; public class Main { public static void main ( String args [ ] ) { int A , B ; Random ran = new Random ( ) ; A = ran . newInt ( 13 ) ; B = ran . newInt ( 13 ) ; A + = 1 ; B + = 1 ; if ( A = = 1 & & B = = 1 ) { System . out . println ( " Draw " ) ; } if ( A = = 1 & & B ! = 1 ) { System . out . println ( " Alice " ) ; } if ( A ! = 1 & & B = = 1 ) { System . out . println ( " Bob " ) ; } if ( A < B ) { System . out . println ( " Bob " ) ; } if ( A = = B ) { System . out . println ( " Draw " ) ; } if ( A > B ) { System . out . println ( " Alice " ) ; } } } public class main . java { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( 1 < = x & & x < = 100 ) { ; System . out . println ( x * x * x ) ; } } } import java . util . * ; public class AtCoder _ Beginner123 { public static void main ( String [ ] args ) { Scanner sc = new java . util . Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int distance [ ] = new int [ 10 ] ; distance [ 0 ] = b - a ; distance [ 1 ] = c - a ; distance [ 2 ] = d - a ; distance [ 3 ] = e - a ; distance [ 4 ] = c - b ; distance [ 5 ] = d - b ; distance [ 6 ] = e - b ; distance [ 7 ] = d - c ; distance [ 8 ] = e - c ; distance [ 9 ] = e - d ; int flag = 1 ; for ( int i = 0 ; i < 10 ; i + + ) { if ( k < distance [ i ] ) { flag = 0 ; break ; } } if ( flag = = 1 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a [ ] = new a [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; System . out . println ( a [ n - 1 ] - a [ 0 ] ) ; } } public class Main { public static void main ( String [ ] args ) { Main . cube ( 1 ) ; } public int cube ( int x ) { int volume = x * x * x ; return volume ; } } class Main ; import java . util . Scanner ; public class A145 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int r = scan . nextInt ( ) ; scan . close ( ) ; System . out . println ( ( int ) Math . pow ( r , 2 ) ) ; } } class Main { public static void main ( String [ ] args ) { int x = Input . getInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int c = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; System . out . println ( Math . max ( a * b , c * d ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * 800 - ( a / 15 ) * 200 ) ; } import java . io . * ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; int x ; s = buf . readLine ( ) ; x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( Integer [ ] a ) { Scanner x = new Scanner ( System . in ) ; int a = x . next ( ) ; double b = 3 ; int c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } import java . ulti . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int current = sc . nextInt ( ) ; int mini = current , maxi = current , distance = 0 ; do { int res = Math . max ( Math . abs ( current - mini ) , Math . abs ( current - maxi ) ) ; if ( res > distance ) { distance = res ; } current = sc . nextInt ( ) ; } while ( sc . next ( ) ! = null ) ; if ( distance > current ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " Yay ! " ) ; } } } # include < iostream > # include < algorithm > # include < string > # define rep ( i , n ) for ( i = 0 ; i < n ; i + + ) using namespace std ; int main ( ) { int a , b ; cin > > a > > b ; if ( a = = b ) { cout < < " Draw " < < endl ; } else if ( a = = 1 ) { cout < < " Alice " < < endl ; } else if ( b = = 1 ) { cout < < " Bob " < < endl ; } else { if ( a > b ) { cout < < " Alice " < < endl ; } else { cout < < " Bob " < < endl ; } } return 0 ; } import java . util . Scanner ; public class xcubic { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; sc . close ( ) ; } } import java . util . * public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N1 = sc . nextInt ( ) ; int N2 = sc . nextInt ( ) ; int N3 = sc . nextInt ( ) ; int N4 = sc . nextInt ( ) ; ArrayList < int > a = new ArrayList < int > ( ) ; a . add ( 1 ) ; a . add ( 7 ) ; a . add ( 9 ) ; a . add ( 4 ) ; if ( a . indexOf ( N1 ) ! = - 1 ) { a . remove ( a . indexOf ( N1 ) ) ; if ( a . indexOf ( N2 ) ! = - 1 ) { a . remove ( a . indexOf ( N2 ) ) ; if ( a . indexOf ( N3 ) ! = - 1 ) { a . remove ( a . indexOf ( N3 ) ) ; if ( a . indexOf ( N4 ) ! = - 1 ) { System . out . println ( " YES " ) ; } } } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; private class Colon { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double arg1 = 30 * H + 0.5 * M ; double arg2 = 6 * M ; double x1 = A * Math . cos ( Math . toRadians ( arg1 ) ) ; double y1 = A * Math . sin ( Math . toRadians ( arg1 ) ) ; double x2 = B * Math . cos ( Math . toRadians ( arg2 ) ) ; double y2 = B * Math . sin ( Math . toRadians ( arg2 ) ) ; System . out . println ( Math . hypot ( x2 - x1 , y2 - y1 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; double ans = pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( new Main ( Main . readInt ( System . in ) ) . cubic ( ) ) ; } private static int readInt ( java . io . InputStream in ) { java . io . BufferReader reader = null ; try { reader = new java . io . BufferedReader ( new java . io . InputStreamReader ( in ) ) ; return Integer . parseInt ( reader . readLine ( ) ) ; } catch ( java . io . IOException e ) { e . printStackTrace ( ) ; } finally { if ( reader ! = null ) { try { reader . close ( ) ; } catch ( java . io . IOException e ) { e . printStackTrace ( ) ; } } } } private final int x ; private Main ( int x ) { this . x = x ; } private int cubic ( ) { return x * x * x ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] d = new int [ 3 ] ; d [ 0 ] = a ; d [ 1 ] = b ; d [ 2 ] = c ; Arrays . sort ( d ) ; if ( ( d [ 0 ] = = 5 & & d [ 1 ] = = 5 ) & & d [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class at _ iroha { public static void main ( String [ ] args ) { int A ; int B ; int C ; int i = A * B * C ; if ( i = = 175 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; public class HInaArare { public static void main ( ) throws IOException { int i = ( int ) System . in . read ( ) , sum = 0 ; int [ ] fin = new int [ 4 ] ; char [ ] a = new char [ i ] ; char [ ] check = { ' P ' , ' W ' , ' G ' , ' Y ' } ; for ( int j = 0 ; j < i ; j + + ) { a [ i ] = ( char ) System . in . read ( ) ; } for ( int j = 0 ; j < check . length ; j + + ) { for ( int k = 0 ; k < a . length ; k + + ) { if ( a [ k ] = = check [ j ] ) { fin [ j ] = 1 ; } } } for ( int m = 0 ; m < check . length ; m + + ) { if ( fin [ m ] = = 1 ) { sum + + ; } } if ( sum > 3 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . io . * ; class Test { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; int x = Integer . parseInt ( s ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] list = new int [ 5 ] ; int [ ] check = { 9 , 0 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 } ; a Scanner sc = new Scanner ( System . in ) ; list [ 0 ] = sc . nextInt ( ) ; list [ 1 ] = sc . nextInt ( ) ; list [ 2 ] = sc . nextInt ( ) ; list [ 3 ] = sc . nextInt ( ) ; list [ 4 ] = sc . nextInt ( ) ; int result = 0 ; int cnt = 1 ; for ( int i = 0 ; i < check . length ; i + + ) { for ( int j = 0 ; j < list . length ; j + + ) { int amari = list [ j ] % 10 ; if ( amari = = check [ i ] ) { if ( cnt ! = 5 ) { if ( amari ! = 0 ) { result + = list [ j ] + 10 - amari ; } else { result + = list [ j ] ; } } else { result + = list [ j ] ; } cnt + + ; } } } System . out . println ( result ) ; } } import java . util . * ; import java . io . * ; public class first { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; return ; } } public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = " " ; for ( ; ; ) { System . out . print ( " > " ) ; input = in . readLine ( ) ; try { Integer . parseInt ( input ) ; } catch ( NumberFormatException e ) { System . out . println ( " ? ? ° ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? " ) ; nt nteger. p arseInt ( i nput ) ; f ( ( x ) | x 00 ) ) { ystem. o ut. p rintln ( " ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ° ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? § ? ? ? " ) ; } e s e { x ; S y tem.ou t .pr i ntln ( x ) ; b r ak ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int count2 = 0 ; for ( int j = 0 ; j < = i ; j + + ) { if ( a = = true ) { break ; } boolean a = false ; if ( p [ i ] > p [ j ] ) { a = true ; break ; } count2 + + ; } if ( count2 = = i + 1 ) { count + + ; } } System . out . print ( count ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new Int [ 3 ] ; for ( i = 1 ; i < = 3 ; i + + ) { A [ i ] = sc . nextInt ( ) ; } Arrays . sort ( A ) ; System . out . println ( A [ 3 ] - A [ 1 ] ) ; } } import java . util . * ; public class A _ RoundUptheMean { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int x = ( a + b ) % 2 ; int y = ( a + b ) / 2 ; if ( x = = 0 ) { System . out . println ( y ) ; } else { y = y + 1 ; System . out . println ( y ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int sum = 1 ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) < sum ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; for ( min ; min < max ; min + + ) { int challengeSum ; for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( min - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( challengeSum ) ; } } import java . util . Scanner ; import java . util . Arrays ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; while ( true ) { String s = scanner . nextLine ( ) ; char [ ] c = s . toCharArray ( ) ; int sum = 0 ; if ( s = = " 0 " ) { break ; } for ( int i = 0 ; i < s . length ; i + + ) { sum + = Integer . parseInt ( c [ i ] ) ; } System . out . println ( sum ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ret = 0 ; for ( int a = 0 ; a < = A ; a + + ) { for ( int b = 0 ; b < = B ; b + + ) { X = X - 500 * a - 100 * b ; for ( int c ; c < = C ; c + + ) { if ( X = = 50 * c ) { ret + + ; } } } } System . out . println ( ret ) ; sc . close ( ) ; } } import java . util . * ; public class Main { private static final Scanner scan = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { while ( scan . hasNext ( ) ) { double x1 = scan . nextDouble ( ) ; double y1 = scan . nextDouble ( ) ; double x2 = scan . nextDouble ( ) ; double y2 = scan . nextDouble ( ) ; double x3 = scan . nextDouble ( ) ; double y3 = scan . nextDouble ( ) ; double xp = scan . nextDouble ( ) ; double yp = scan . nextDouble ( ) ; double S _ abc = 1.0 / 2.0 * Math . abs ( x1 * ( y2 - y3 ) + x2 * ( y3 - y1 ) + x3 * ( y1 - y2 ) ) ; double S _ pab = 1.0 / 2.0 * Math . abs ( xp * ( y1 - y2 ) + x1 * ( y2 - yp ) + x2 * ( yp - y1 ) ) ; double S _ pac = 1.0 / 2.0 * Math . abs ( xp * ( y1 - y3 ) + x1 * ( y3 - yp ) + x3 * ( yp - y1 ) ) ; double S _ pbc = 1.0 / 2.0 * Math . abs ( xp * ( y2 - y3 ) + x2 * ( y3 - yp ) + x3 * ( yp - y2 ) ) ; if ( S _ abc = = S _ pab + S _ pac + P _ pbc ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } import java . util . Scanner ; public class Test { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int v = scanner . nextInt ( ) ; scanner . close ( ) ; System . out . println ( v * v * v ) ; } } class Main { public main ( ) { String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { z = s - x - y ; if ( x + y + z = = k ) { count + + } } } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . io . BufferedReader ; public class XCubic { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int a = 2 ; int b = 3 ; double ans = Math . pow ( a , b ) ; System . out . println ( " ans " ) ; } } public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { double x1 = sc . nextDouble ( ) ; double y1 = sc . nextDouble ( ) ; double x2 = sc . nextDouble ( ) ; double y2 = sc . nextDouble ( ) ; double x3 = sc . nextDouble ( ) ; double y3 = sc . nextDouble ( ) ; double xp = sc . nextDouble ( ) ; double yp = sc . nextDouble ( ) ; double s = TriangleArea ( x3 - x1 , y3 - y1 , x2 - x1 , y2 - x1 ) ; double s1 = TriangleArea ( xp - x1 , yp - y1 , x2 - x1 , y2 - x1 ) ; double s2 = TriangleArea ( xp - x1 , yp - y1 , x3 - x1 , y3 - x1 ) ; double s3 = TriangleArea ( xp - x2 , yp - y2 , x3 - x2 , y3 - y2 ) ; if ( s = = s1 + s2 + s3 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } sc . close ( ) ; } double TriangleArea ( double x1 , double y1 , double x2 , double y2 ) { double s = ( ( x1 * y2 ) - ( x2 * y1 ) ) / 2 ; if ( s < = 0 ) { s * = - 1 ; } return s ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( ) ; System . out . println ( i * i * i ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class main2 { private static Scanner sc = new Scanner ( System . in ) ; static double xp , yp ; public static void main ( String [ ] args ) { while ( sc . hasNextDouble ( ) ) { double xm [ ] = new double [ 3 ] ; double ym [ ] = new double [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { xm [ i ] = sc . nextDouble ( ) ; ym [ i ] = sc . nextDouble ( ) ; } xp = sc . nextDouble ( ) ; yp = sc . nextDouble ( ) ; Arrays . sort ( xm ) ; Arrays . sort ( ym ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( xm [ i ] = = xp & & ym [ i ] = = yp ) break ; } if ( xm [ 0 ] < xp & & xm [ 2 ] > xp & & ym [ 0 ] < yp & & ym [ 2 ] > yp ) { System . out . println ( " Yes " ) ; } else { mm ( ) ; } } } private static void mm ( ) { System . out . println ( " No " ) ; } } import java . util . Scanner ; public class Main { public void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String x = scan . nextInt ( ) ; if ( x < 1 ) { x = 1 ; } if ( x > 100 ) { x = 100 ; } System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String nb = buf . readLine ( 3 ) ; int x = Integer . parseInt ( nb ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { int x ; System . out . println ( " x " ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int answer = num * num * num ; } } import java . util . Scanner ; import java . util . InputMismatchException ; public class Antennas { public static void main ( String args [ ] ) { int distance [ ] = new int [ 5 ] ; int limit = 0 ; try { Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < distance . length ; i + + ) { distance [ i ] = scanner . nextInt ( ) ; } limit = scanner . nextInt ( ) ; scanner . close ( ) ; } catch ( InputMismatchException e ) { System . out . println ( e ) ; } for ( int i = distance . length - 1 ; i > = 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) { if ( distance [ i ] - distance [ j ] - 1 > limit ) { System . out . println ( " : ( " ) ; System . exit ( 1 ) ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { int i = 1 ; int b = 0 ; int xcubic ; int a = 0 ; while ( b = 0 ) { while ( i > 0 ) { System . out . println ( " 数字を入力して下さい ( 1以上100以下 ) " ) ; BufferedReader x = new Buffe r e d eader ( new Inpu S r amR ader ( System.in ) ) ; = Integer.parseI n t ( x.re a dL i n e ) ; if ( a > = 1 & & a < = 1 00 ) i = - 1 ; } x c bi a a a ; Sys e . u . p r n ln ( xcu i ) ; } } } public class Min { public static void main ( String [ ] args ) { Scanner sca = new Scanner ( System . in ) ; int a = sca . nextInt ( ) ; int b = sca . nextInt ( ) ; int c = sca . nextInt ( ) ; int x = sca . nextInt ( ) ; int y = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { for ( int k = 0 ; k < = c ; k + + ) { if ( ( 500 * i ) + ( 100 * j ) + ( 50 * k ) = = x ) { y + + ; } } } } System . out . println ( y ) ; } } import java . util . Scanner ; class kuma { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int x = stdIn . nextInt ( ) ; System . out . println ( x * x ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double angH = 30 * h ; double angM = 5.5 * m ; double ang = Math . abs ( angH - angM ) ; double c = 0 ; c = a * a + b * b - 2 * a * b * Math . cos ( ang ) ; System . out . print ( c ) ; } } r import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( answer ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String bs = b . readLine ( ) ; int bi = Integer . parseInt ( bs ) ; int x = Math . pow ( bi , 3 ) ; System . out . println ( x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] argas ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { char b = a . charAt ( i ) ; if ( b . equals ( 1 ) ) count + + ; } System . out . println ( count ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { int x = new Scanner ( System . in ) . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = x * * 3 System . out . println ( x ) ; } } public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . io * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int input = Integer . parseInt ( reader . readLine ( ) ) ; System . out . println ( ( int ) Math . pow ( input , 3 ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) int x = in . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } package a042 ; public class Iroha { public static void Main ( String [ ] args ) { int [ ] oto = new int [ 3 ] ; for ( int i = 0 ; i < args . length ; i + + ) { oto [ i ] = Integer . parseInt ( args [ i ] ) ; } if ( oto [ 0 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 0 ] ; oto [ 0 ] = toriaezu ; } if ( oto [ 2 ] ! = 5 ) { int toriaezu = oto [ 1 ] ; oto [ 1 ] = oto [ 2 ] ; oto [ 2 ] = toriaezu ; } if ( oto [ 0 ] = = 5 & & oto [ 1 ] = = 7 & & oto [ 2 ] = = 5 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) { System . out . println ( " Please input x : " ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s ; try { s = reader . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int value ; value = Integer . parseInt ( in . readLine ( ) ) ; System . out . println ( value * value * value ) ; in . close ( ) ; } } import java . io . * ; import java . util . * ; public class Main { @ SuppressWarnings ( " unchecked " ) static boolean [ ] used ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int V = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; for ( int i = 0 ; i < V ; i + + ) { } } public static int dfs ( int now , int goal , int f ) { if ( now = = goal ) { return f ; } used [ now ] = true ; for ( int i = 0 ; i < edges [ now ] . size ( ) ; i + + ) { Edge e = edges [ now ] . get ( i ) ; if ( ! used [ e . to ] & & e . cap > 0 ) { int flow = dfs ( e . to , goal , Math . min ( f , e . cap ) ) ; if ( flow = = 0 ) continue ; e . cap - = flow ; edges [ e . to ] . get ( e . rev ) . cap + = flow ; return flow ; } } return 0 ; } public static int fordFulkerson ( int s , int e ) { int flow = 0 ; while ( true ) { Arrays . fill ( used , false ) ; int river = dfs ( s , e , Integer . MAX _ VALUE ) ; if ( river = = 0 ) return flow ; flow + = river ; } } public static void addEdge ( int f , int t , int c ) { edges [ f ] . add ( new Edge ( t , c , edges [ t ] . size ( ) ) ) ; edges [ t ] . add ( new Edge ( f , 0 , edges [ f ] . size ( ) - 1 ) ) ; } static class Edge { int to , cap , rev ; Edge ( int to , int cap , int rev ) { this . to = to ; this . cap = cap ; this . rev = rev ; } } } import java . io * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x , ans ; x = Integer . ParseInt ( br . readLine ( ) ) ; ans = x * x * x ; System . out . println ( ans ) ; } } import java . io . * ; class Test { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; int x = r . readLine ( ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 2 ; int y = x * x * x ; System . out . println ( y ) ; int x = 3 ; System . out . println ( y ) ; } } class Main { public static void main ( String [ ] args ) { BufferReader br = new BufferReader ; int x = Java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { int A = 5 ; int B = 7 ; int C = 5 ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int cost = 0 ; if ( a > = 13 ) { cost = b ; } else if ( a > = 6 & & a < = 12 ) { cost = b / 2 ; } else { cost = 0 ; } System . out . println ( cost ) ; } } import java . util . Arrays ; import java . util . Comparator ; import java . util . stream . Collectors ; public class AtCoder { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) , m = scanner . nextInt ( ) ; City [ ] cities = new City [ m ] ; for ( int i = 0 ; i < m ; i + + ) cities [ i ] = new City ( scanner . nextInt ( ) , scanner . nextInt ( ) ) ; Arrays . stream ( cities ) . collect ( Collectors . groupingBy ( city - > city . p ) ) . values ( ) . forEach ( cityList - > { cityList . sort ( Comparator . comparingInt ( city - > city . y ) ) ; for ( int i = 0 ; i < cityList . size ( ) ; ) cityList . get ( i ) . o = + + i ; } ) ; for ( City city : cities ) System . out . println ( String . format ( " % 06d % 06d " , city . p , city . o ) ) ; } static class City { int p , y , o ; City ( int p , int y ) { this . p = p ; this . y = y ; } } } public class test { public static void main ( String [ ] atgs ) { Scanner s = new Scanner ( System . in ) ; String str = s . nextLine ( ) ; s = s . replace ( " eraser " , " " ) ; s = s . replace ( " erase " , " " ) ; s = s . replace ( " dreamer " , " " ) ; s = s . replace ( " dream " , " " ) ; if ( s . equals ( " " ) ) System . out . println ( " true " ) ; else System . out . println ( " false " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void Main ( Stirng [ ] args ) { int n = 0 ; while ( n = = 0 ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 & & A = = 7 ) { Scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } Scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . out . println ( " Yes ! " ) ; } else { break ; } } } } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; long M = sc . nextLong ( ) ; long [ ] A = new long [ N ] ; long a = 0 ; long b = 0 ; long swap = 0 ; long r = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextLong ( ) ; } long max = A [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { a = max ; b = A [ i ] ; x = a * b ; if ( a < b ) { swap = a ; a = b ; b = swap ; } r = a % b ; while ( r ! = 0 ) { a = b ; b = r ; r = a % b ; } max = x / b ; } if ( max > M * 2 ) System . out . println ( 0 ) ; else { int ans = M / max + 1 ; System . out . println ( ans ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = System . in ; public static void cubic ( int x ) { result = x ^ 3 ; System . out . println ( result ) ; } } } package tinhlapphuong ; import java . util . Scanner ; public class TinhLapPhuong { public static void main ( String [ ] args ) { int n ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; lapPhuong ( n ) ; } public static void lapPhuong ( int n ) { int ketQua = n * n * n ; System . out . println ( " Lap phuong cua n la : " + ketQua ) ; } } import java . util . Scanner ; public class FiveAntennas { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < array . length ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean flag = true ; for ( int i = 0 ; i < array . length ; i + + ) { for ( int j = i + 1 ; j < array . length ; j + + ) { if ( array [ j ] - array [ i ] > k ) { System . out . println ( " : ( " ) ; flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yay ! " ) ; } } } public class X _ Cubic { private int x ; private int num ; public static void main ( String [ ] args ) { X _ Cubic cubic = new X _ Cubic ( ) ; cubic . run ( ) ; } private void run ( ) { num = x * 5 ; System . out . println ( num ) ; } } package abc091 ; import java . util . Scanner ; public class ABC091 _ A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C < = ( A + B ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class atcoder { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tempList [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { tempList [ i ] = sc . nextInt ( ) ; } Arrays . sort ( tempList ) ; int [ ] anserList = { 5 , 5 , 7 } ; if ( Arrays . equals ( tempList , anserList ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Test m = new Test ( ) ; String line = br . readLine ( ) ; double num = Double . parseDouble ( line ) ; double ans = Math . pow ( num , ( double ) 3 ) ; System . out . println ( ( int ) ans ) ; } import java . util . Scanner ; public class L _ 1 _ 2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; if ( a * b > = = c * d ) { System . out . println ( a * b ) ; } else { System . out . println ( c * d ) ; } } } import java . util . * ; public class a { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( a > 12 ) { a = 0 ; } if ( b > 12 ) { b = 0 ; } if ( a > b ) { System . out . println ( " Alice " ) ; } else { if ( b > a ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; int a = B - A ; if ( a < 0 ) { int b = a * - 1 ; } if ( ( V - W ) * T > = b | | a = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . scanner ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; System . out . println ( a * a * a ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . Lead . Line ( ) ; int a = Integer . parseInt ( str ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; class Scratch { public static void main ( String [ ] args ) { int a , b , c ; Scanner input = new Scanner ( System . in ) ; a = input . nextInt ( ) ; b = input . nextInt ( ) ; c = input . nextInt ( ) ; if ( a + b + c = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i ; for ( i = 1 ; i < N ; i + + ) { int pow = pow * i ; int ans = pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String word ; try { word = reader . readLine ( ) ; int num = Integer . parseInt ( word ) ; int ans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { reader . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } } class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; x = x * x * x ; System . out . plintln ( x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) thows IOException { BufferedResder br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; string str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String args [ ] ) { Scanner input = new Scanner ( System . in ) ; while ( true ) { System . out . println ( input . nextInt ( ) + input . nextInt ( ) ) ; } } } import java . util . Scanner ; import java . lang . Math ; public class XCubic { public static void main ( String [ ] args ) { Scanner standard = new Scanner ( System . in ) ; int x = 0 ; int y = 0 ; x = standard . nextInt ( ) ; if ( x > 0 & & x < 101 ) { y = x * x * x ; } System . out . print ( y ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class exe { public static void main ( String [ ] args ) { try { int i ; BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( d . readLine ( ) ) ; System . out . println ( i * i * i ) ; } catch ( IOException e ) { } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int x [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = scan . nextInt ( ) ; } int answer = 10000 ; for ( int i = 0 ; i < 100 ; i + + ) { int sum = 0 ; for ( int j = 0 ; j < n ; j + + ) { sum + = Math . pow ( ( x [ j ] - i ) , 2 ) ; } if ( answer > sum ) { answer = sum ; } } System . out . println ( sum ) ; } } public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int n = Integer . parseInt ( line ) ; System . out . println ( n + " / n " ) ; } catch ( Ioexception e ) { System . out . println ( e ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; System . out . println ( a * b > = c * d ? a * b ? c * d ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int min = 0 ; int count = 1 ; for ( int i = 0 ; i < a . length ; + + i ) { a [ i ] = sc . nextInt ; min = a [ 0 ] ; } for ( int i = 0 ; i < n ; i + + ) { if ( min > a [ i ] ) { min = a [ i ] ; count + = 1 ; } system . out . println ( count ) ; } } } import java . util . Arrays ; import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] abc = new int [ 3 ] ; int five = 0 ; int seven = 0 ; String ans = " NO " ; for ( int i = 0 ; i < 3 ; i + + ) { int abc [ i ] = sc . nextInt ( ) ; if ( abc [ i ] = = 5 ) { five + + ; } else if ( abc [ i ] = = 7 ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { ans = " YES " ; } System . out . println ( ans ) ; } } import java . awt . * ; 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 ( ) ; Point [ ] junban = new Point [ m ] ; Map < Integer , ArrayList < Integer > > list = new HashMap < > ( ) ; for ( int i = 0 ; i < m ; i + + ) { int p = sc . nextInt ( ) ; int year = sc . nextInt ( ) ; junban [ i ] = new Point ( p , year ) ; ArrayList < Integer > value = list . get ( p ) ; if ( value = = null ) { value = new ArrayList < > ( ) ; } value . add ( year ) ; list . put ( p , value ) ; } for ( Integer key : list . keySet ( ) ) { ArrayList < Integer > l = list . get ( key ) ; Collections . sort ( l ) ; } for ( int i = 0 ; i < m ; i + + ) { Point p = junban [ i ] ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( " 0 " . repeat ( Math . max ( 0 , 6 - String . valueOf ( p . x ) . length ( ) ) ) ) ; builder . append ( p . x ) ; int v = list . get ( p . x ) . indexOf ( p . y ) + 1 ; builder . append ( " 0 " . repeat ( Math . max ( 0 , 6 - String . valueOf ( v ) . length ( ) ) ) ) ; builder . append ( v ) ; System . out . println ( builder ) ; } } } import static java . lang . System . out ; import java . util . Scanner ; public class Main { public void main ( String ... args ) { int input = new Scanner ( System . in ) . nextLine ( ) ; input = Integer . parseInt ( input ) ; out . println ( input * input * input ) ; } int power ( int num , int index ) { if ( index = = 0 ) { return 1 ; } if ( index < 2 ) { return num ; } return num * power ( num , index - 1 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = br . readLine ; int b = Integer . parseInt ( a ) ; System . out . println ( a * a * a ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextIn ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 ) & & ( C = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( A = = 5 & & C = = 5 ) & & ( B = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( B = = 5 & & C = = 5 ) & & ( A = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Day4H { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = k ; i + + ) { if ( i > s ) break ; if ( i = = s ) { cnt + + ; break ; } for ( int j = 0 ; j < = k ; j + + ) { if ( i + j > s ) break ; if ( i + j = = s ) { cnt + + ; break ; } for ( int l = 0 ; l < = k ; l + + ) { if ( i + j + l > s ) break ; if ( i + j + l = = s ) { cnt + + ; break ; } } } } System . out . println ( cnt ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int M = Integer . parseInt ( sc . next ( ) ) ; String [ ] imgA ; String [ ] imgB ; Boolean checkAB ; int j ; int k ; String s = " No " ; for ( int i = 0 ; i < N ; i + + ) { imgA [ i ] = " " ; imgA [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < M ; i + + ) { imgB [ i ] = " " ; imgB [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < ( N - M + 1 ) ; i + + ) { for ( j = 0 ; j < ( N - M + 1 ) ; j + + ) { checkAB = true ; for ( k = 0 ; j < M ; j + + ) { checkAB = ( checkAB ) & & ( imgA [ j + k ] . substring ( i , i + M ) = = imgB [ k ] ) ; } if ( checkAB ) { s = " Yes " ; } } } System . out . println ( s ) ; sc . close ( ) ; } } import java . util . * ; public class X _ cube { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { Scanner s = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int a , b , c ; a = s . nextInt ( ) ; b = s . nextInt ( ) ; c = s . nextInt ( ) ; int fiv = 0 , sev = 0 ; if ( a = = 5 ) fiv + + ; if ( a = = 7 ) sev + + ; if ( b = = 5 ) fiv + + ; if ( b = = 7 ) sev + + ; if ( c = = 5 ) fiv + + ; if ( c = = 7 ) sev + + ; if ( fiv = = 2 & & sev = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int Ansewer = x * x * x ; System . out . println ( Ansewer ) ; } } aaa import java . util . Scanner ; public class Postdocs { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; char [ ] out = s . toCharArray ( ) ; int index = 0 ; if ( out [ index ] = = ' ? ' ) out [ index ] = ' D ' ; index + + ; while ( index < out . length ) { if ( out [ index ] = = ' ? ' ) { if ( out [ index - 1 ] = = ' P ' ) { out [ index ] = ' D ' ; } else { if ( index < out . length - 1 & & out [ index + 1 ] = = ' ? ' ) { out [ index ] = ' P ' ; out [ index + 1 ] = ' D ' ; } else { out [ index ] = ' D ' ; } } } index + + ; } String outStr = new String ( out ) ; System . out . println ( outStr ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { int x = Integer . parseInt ( line [ 0 ] ) ; } System . out . println ( x * x * x ) ; } } import java . io . * ; public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; Scanner stdIn = new Scanner ( System . in ) ; x = stdIn . nextINT ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextLong ( ) , v = sc . nextLong ( ) , b = sc . nextLong ( ) , w = sc . nextLong ( ) , t = sc . nextLong ( ) ; long g = 0 ; fot ( long i = 1 ; i < = t ; i + + ) { ai = a + v * i ; bi = b + w * i ; if ( ai = = bi ) { System . out . println ( " YES " ) ; g + + ; break ; } } if ( g = = 0 ) { System . out . println ( " NO " ) ; } } } package spring21 ; public class ABC055 _ A { public static void main ( String [ ] args ) { int N = 20 , x , y ; x = N * 800 ; y = 200 * ( N / 15 ) ; System . out . println ( x - y ) ; } } import java . util . Scanner ; class Main { public void main ( String ... args ) { String x = new Scanner ( System . in ) . nextLine ( ) ; int input = Integer . parseInt ( x ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { int x ; int y = 0 ; System . out . print ( " input integer : " ) ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; y = x * x * x ; System . out . println ( y ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ; int age = sc . nextInt ( ) ; int priceB = sc . nextInt ( ) ; if ( priceB / 2 = = 0 ) { if ( age < = 13 ) { System . out . println ( priceB ) ; } else if ( age > = 6 | | age < = 12 ) { System . out . println ( priceB / 2 ) ; } else if ( ) { System . out . println ( " 無料です " ) ; } } e l s { S stem . ut.pri n tln ( " 値段は偶数を 入 力 してください " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . printlin ( x ) ; } } public class main { public static void main ( String args [ ] ) { int x public class javaren { public static void main ( String [ ] args ) { int n = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( n ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; for ( int i = 1 ; i < N ; i + + ) { int Min ; int Max ; if ( Min > a ) Min = a ; if ( Max < a ) Max = a ; System . out . println ( Max - Min ) ; } } } package internship ; import java . util . Scanner ; public class test1 { public static void main ( String [ ] args ) { int x = 0 , tot ; Scanner sc = new Scanner ( System . in ) ; int temp = sc . nextInt ( ) ; tot = temp * temp * temp ; System . out . println ( ( int ) tot ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long A = scanner . nextLong ( ) ; long V = scanner . nextLong ( ) ; long B = scanner . nextLong ( ) ; long W = scanner . nextLong ( ) ; long T = scanner . nextLong ( ) ; long speed = V - W ; long dist = B - A ; if ( dist < 0 | | speed < = 0 ) { System . out . prlongln ( " NO " ) ; return ; } System . out . prlongln ( ( dist - speed * T < = 0 ) ? " YES " : " NO " ) ; } } 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 avg = ( a + b ) / 2 if ( ( a + b ) % 2 = = 0 ) { System . out . println ( avg ) ; } else { System . out . println ( avg + 1 ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; int y ; x = Integer . parseInt ( args [ 0 ] ) ; y = x ^ 3 ; System . out . plintln ( y . toString ( ) ) ; } } class Main { public static void main ( String [ ] args ) { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String nb = br . readLine ( 3 ) ; int x ; = I teger.p a rseInt ( n b ) ; S y s em.out . pri n tln ( Mat h .pow ( x , 3 ) ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( b - a > k ) { System . out . println ( " : ( " ) ; break ; } else if ( c - b > k ) { System . out . println ( " : ( " ) ; break ; } else if ( d - c > k ) { System . out . println ( " : ( " ) ; break ; } else if ( e - d > k ) { System . out . println ( " : ( " ) ; break ; } else { System . out . println ( " Yay ! " ) ; } } } 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 ans = ( a + b ) / 2 ; System , out . println ( ( a + b ) % 2 = = 0 ? ans : ans + 1 ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { DataInputStream input = new DataInputStream ( System . in ) ; String s = input . readLine ( ) ; int temp = Integer . parseInt ( s ) ; int answer = temp * temp * temp ; System . out . println ( answer ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; long ans = aaa + bbb + ccc + ddd + eee + min - 10 ; System . out . println ( ans ) ; } } va . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } private void run ( ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; int R = scanner . nextInt ( ) ; int L = scanner . nextInt ( ) ; int [ ] P = new int [ N ] ; int [ ] T = new int [ N ] ; int PT = 0 ; int n1 = 0 ; for ( int i = 0 ; i < R ; i + + ) { int d = scanner . nextInt ( ) - 1 ; int t = scanner . nextInt ( ) ; int x = scanner . nextInt ( ) ; P [ d ] + = x ; if ( x > 0 ) { if ( P [ d ] > P [ n1 ] | | ( P [ d ] = = P [ n1 ] & & n1 > d ) ) { T [ n1 ] + = t - PT + 1 ; PT = t ; n1 = d ; } } if ( x < 0 ) { if ( d ! = n1 ) continue ; int n2 = n1 , p2 = P [ d ] ; for ( int j = N - 1 ; j > = 0 ; j -- ) { if ( p2 < = P [ j ] ) { n2 = j ; p2 = P [ j ] ; } } if ( n2 ! = n1 ) { T [ n1 ] + = t - PT + 1 ; PT = t ; n1 = n2 ; } } } T [ n1 ] + = L - PT + 1 ; int ans _ n = 0 , ans _ t = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( ans _ t < T [ i ] ) { ans _ t = T [ i ] ; ans _ n = i ; } } System . out . println ( ans _ n + 1 ) ; } } ffgghhgvvbbbbttSolution : ffgghhgvvbbbbttSolution : ffgghhgvvbbbbttSolution : ffgghhgvvbbbbttSolution : import java . io . BufferedReader ; import java . io . InputStreamReader ; public Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ( ) ; int x = Integer . parseInt ( input ) ; System . out . println ( x * x * x ) ; br . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( 0 ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } if ( a % 10 ! = 0 ) { double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; } else { double aaa = a ; } if ( b % 10 ! = 0 ) { double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; } else { double bbb = b ; } if ( c % 10 ! = 0 ) { double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; } else { double ccc = c ; } if ( d % 10 ! = 0 ) { double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; } else { double ddd = d ; } if ( e % 10 ! = 0 ) { double eee = ( Math . ceil ( e / 10 ) ) * 10 ; } else { double eee = e ; } double zzz = aaa + bbb + ccc + ddd + eee + min - 10 ; int ans = ( int ) zzz ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int acoin = sc . nextInt ( ) ; int bcoin = sc . nextInt ( ) ; int ccoin = sc . nextInt ( ) ; int N = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = acoin ; i + + ) { if ( i * 500 > N ) { break ; } if ( i * 500 = = N ) { count + + ; break ; } for ( int j = 0 ; j < = bcoin ; j + + ) { if ( i * 500 + j * 100 > N ) { break ; } if ( i * 500 + j * 100 = = N ) { count + + ; break ; } for ( int k = 0 ; k < = ccoin ; k + + ) { if ( i * 500 + j * 100 + k * 50 > N ) { break ; } if ( i * 500 + j * 100 + k * 50 = = N ) { count + + ; break ; } } } } System . outprintln ( count ) ; } } } class antenna { public static void main ( String [ ] args ) { int [ ] ant = { ' A ' , ' B ' , ' C ' , ' D ' , ' E ' } ; int len = no . length ; for ( int k = 0 ; k > = ant . length ; k + + ) { System . out . println ( ( k + 1 ) + no [ i ] ) ; } System . out . println ( ant ) ; System . out . println ( args [ 1 ] ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; Integer [ ] data = new Integer [ N ] ; boolean pair = true ; HashSet < Integer > setwise = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i ; j < N ; j + + ) { int res = gcd ( data [ i ] , data [ j ] ) ; if ( res ! = 1 ) { pair = false ; } setwise . add ( res ) ; } } if ( pair = true ) { System . out . println ( " pairwise coprime " ) ; } else { int result = setGcd ( setwise ) ; if ( result = = - 1 ) { System . out . println ( " setwise coprime " ) ; } else { System . out . println ( " not coprime " ) ; } } } static int setGcd ( HashSet < Integer > s ) { HashSet < Integer > setwise2 = new HashSet < > ( ) ; for ( int i = 0 ; i < s . size ( ) ; i + + ) { for ( int j = i ; j < s . size ( ) ; j + + ) { setwize2 . add ( gcd ( s . get ( i ) , s . get ( j ) ) ) ; } } if ( setwise2 . size ( ) = = 1 ) { if ( setwize2 . contain ( 1 ) ) { return - 1 ; } else { return - 2 ; } } else { return setGcd ( setwise ) ; } } static int gcd ( int a , int b ) { if ( a % b = = 0 ) return b ; else return gcd ( b , a % b ) ; } } import java . io . * ; public class itp11b { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s = r . readLine ( ) ; int a = Integer . parseInt ( s ) ; System . out . println ( a * a * a ) ; } } import java . util . Scanner ; 2. public class Main { 3. public static void main ( String [ ] args ) { 4 . Scanner sc = new Scanner ( System . in ) ; 5. int n = sc . nextInt ( ) ; 6. int x = 800 * n ; 7. int y = 200 * ( n / 15 ) ; 8 . System . out . println ( x - y ) ; 9 . } 10 . } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InpputStreamReader ( Systemin ) ) ; String word ; try { word = reader . readLine ( ) ; int num = Integer . parseInt ( word ) ; int ans = num * num * num ; System . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int k = scn . nextInt ( ) ; int s = scn . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = K ; + + y ) { if ( s > = x + y & & s - ( x + y ) < = k ) { count = count + 1 ; } } } System . out . println ( count ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class pow { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; int kotae = ath p w x , 3 ) ; S y stem.out . pr i ntln ( x + " を 3 乗 し 値は " kotae " す " ) ; } } import java . util . * ; import java . io . * ; import java . text . * ; import java . lang . * ; import java . math . * ; public class Solution { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; List < Character > arr = new ArrayList < Character > ( ) ; in . nextLine ( ) ; String str = in . nextLine ( ) ; for ( int i = 0 ; i < str . length ( ) ; i + + ) { if ( str . charAt ( i ) ! = ' ' ) arr . add ( str . charAt ( i ) ) ; } if ( arr . contains ( ' P ' ) & & arr . contains ( ' W ' ) & & arr . contains ( ' G ' ) & & arr . contains ( ' Y ' ) ) System . out . println ( " Four " ) ; else System . out . println ( " Three " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; double ans = Math . pow ( Integer . parseInt ( line ) , 3 ) ; System . out . println ( ans ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } package test ; import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; String s = in . next ( ) ; if ( n % 2 = = 1 ) { System . out . println ( " No " ) ; } else { int mid = ( int ) n / 2 ; String s _ 1 = s . substring ( 0 , mid ) ; String s _ 2 = s . substring ( mid ) ; if ( s _ 1 . equals ( s _ 2 ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } } } import java . io . * ; class prob11b { public static void main ( String args [ ] ) { int aa , bb , cc ; try { BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ; aa = Integer . parseInt ( d . readLine ( ) ) ; bb = aa * aa * aa System . out . println ( bb ) ; } catch ( Exception e ) { System . out . println ( " 数字を 入れて ください " ) ; } } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( InputStreamReader ( System . in ) ) ; String str ; ArrayList < Integer > Ans = new ArrayList < Integer > ( ) ; while ( ( str = br . readLine ( ) ) ! = null ) { String temp [ ] = str . split ( " " ) ; int sum = 0 ; for ( int i = 0 ; i < temp . length ; i + + ) { int num = Integer . parseInt ( temp [ i ] ) ; sum + = num ; } if ( Integer . parseInt ( temp [ 0 ] ) = = 0 ) { break ; } Ans . add ( sum ) ; } for ( int i = 0 ; i < Ans . size ( ) ; i + + ) { System . out . println ( Ans . get ( i ) ) ; } } } class Main { public static void main ( String [ ] args ) { int variable x ; x = x * x * x ; System . out . println ( x ) ; } } public class xt { public static void main { int x ; System . out . println ( x * x * x ) ; } } int R = r * r * 3.14 ; System . out . println ( R ) ; import java . util . Scanner ; import java . lang . * ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; int V = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; if ( A < B ) { if ( A + ( V * T ) < B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else if ( A + ( V * T ) > = B + ( W * T ) ) { System . out . println ( " No " ) ; } } else if ( B < A ) { if ( B - ( W * T ) > = A - ( V * T ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } else if ( A = = B ) { if ( A + ( V * T ) < = B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } import java . util . * ; import java . text . SimpleDateFormat ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; SimpleDateFormat f = new SimpleDateFormat ( " yyyy / MM / dd " ) ; Date d = f . parse ( s ) ; Date dh = f . parse ( " 2019 / 04 / 30 " ) ; if ( d . getTime ( ) > dh . getTime ( ) ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; int y = Integer . parseInt ( Math . pow ( x , 3 ) ) ; System . out . println ( y ) ; } } import java . util . Arrays ; import java . util . Scanner ; class main { public static void Main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tempList [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { tempList [ i ] = sc . nextInt ( ) ; } Arrays . sort ( tempList ) ; int [ ] anserList = { 5 , 5 , 7 } ; if ( Arrays . equals ( tempList , anserList ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int bi = Integer . parseInt ( b ) ; int x = Math . pow ( bi , 3 ) ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int i = 0 ; int min = N + 1 ; int count = 0 ; int P [ ] = new int [ N ] ; for ( i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; if ( A [ i ] < min ) { min = A [ i ] ; count + = 1 ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main1 { public static void main ( String [ ] args ) throws InterruptedException { Scanner sc = new Scanner ( System . in ) ; int n _ customer = sc . nextInt ( ) ; long sold = sc . nextInt ( ) - 1 ; int i = 1 ; int price = 2 ; while ( true ) { int money = sc . nextInt ( ) ; if ( money < price ) i + + ; else if ( money = = price ) { price + + ; i + + ; } else { if ( money % price = = 0 ) { sold + = money / price - 1 ; } else { sold + = money / price ; } i + + ; } if ( i = = n _ customer - 1 ) break ; } System . out . println ( sold ) ; } } import java . util . Random ; public class Main { public static void main ( String args [ ] ) { INT A , B ; Random ran = newRandom ( ) ; A = random . newInt ( 13 ) ; B = random . newInt ( 13 ) ; A + = 1 ; B + = 1 ; if ( A = = 1 & & B = = 1 ) { System . out . println ( " Draw " ) ; } if ( A = = 1 & & B ! = 1 ) { System . out . println ( " Alice " ) ; } if ( A ! = 1 & & B = = 1 ) { System . out . println ( " Bob " ) ; } if ( A < B ) { System . out . println ( " Bob " ) ; } if ( A = = B ) { System . out . println ( " Draw " ) ; } if ( A > B ) { System . out . println ( " Alice " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch ( IOException e ) { } int i = Math . pow ( x , 3 ) ; System . out . println ( i ) ; } } public class main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class exe { public static void main ( String [ ] args ) { try { int i ; BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; i = Integer . parseInt ( d . readLine ( ) ) ; System . out . println ( i * i * i ) ; } catch ( IOException e ) { } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class CopyOfMain01 _ 08B1 { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( true ) { int x = 0 ; String str = br . readLine ( ) ; if ( str . equals ( " 0 " ) ) break ; String [ ] st = str . split ( " " ) ; for ( int i = 0 ; i < st . length ; i + + ) { x + = Integer . parseInt ( st [ i ] ) ; } System . out . println ( x ) ; } br . close ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new ImputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int x = Integer . parseInt ( s ) ; int a = x * x * x ; System . out . println ( a ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; int x = 0 ; try { String str = br . readLine ( ) ; x = Integer . parseInt ( str ) ; } catch { } int i = x ^ 3 ; System . out . println ( i ) ; } } import java . util . Scanner ; public class Main { public static long m ( long a [ ] , int b , int e ) { int Min = a [ b ] ; for ( int i = b + 1 ; i < e ; i + + ) Min = Math . min ( Min , a [ i ] ) ; return Min ; } public static long M ( long a [ ] , int b , int e ) { int Max = a [ b ] ; for ( int i = b + 1 ; i < e ; i + + ) Max = Math . max ( Max , a [ i ] ) ; return Max ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = sc . nextLong ( ) ; int q = sc . nextInt ( ) ; for ( int i = 0 ; i < q ; i + + ) { int com = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; if ( com = = 0 ) System . out . println ( m ( a , b , e ) ) ; else System . out . println ( M ( a , b , e ) ) ; } } } public class Main { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner scanner = new Scanner ( " in1.txt " ) ; int arg = scanner . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( arg , 3 ) ) ; scanner . close ( ) ; } } class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( e ) ; } } } class ITP1 _ 1 _ B { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int answer = num * num * num ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( " 1 6 3 " ) ; int [ ] As = new int [ 3 ] ; As [ 0 ] = scanner . nextInt ( ) ; As [ 1 ] = scanner . nextInt ( ) ; As [ 2 ] = scanner . nextInt ( ) ; int bestCost = 99999 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( j = = i ) continue ; int sum = 3 - i - j ; int a = Math . abs ( As [ j ] - As [ i ] ) ; a + = Math . abs ( As [ sum ] - As [ j ] ) ; if ( a < bestCost ) { bestCost = a ; } } } System . out . println ( bestCost ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int ansA = 0 ; int ansB = 0 ; Out : for ( int A = 0 ; A < 300 ; A + + ) { for ( int B = - 300 ; B < 300 ; B + + ) { if ( A * A * A * A * A - B * B * B * B * B = = X ) { ansA = A ; ansB = B ; break Out ; } } } System . out . println ( ansA + " " + ansB ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int ansA = 0 ; int ansB = 0 ; Out : for ( int A = 0 ; A < 300 ; A + + ) { for ( int B = - 300 ; B < 300 ; B + + ) { if ( A * A * A * A * A - B * B * B * B * B = = X ) { ansA = A ; ansB = B ; break Out ; } } } System . out . println ( ansA + " " + ansB ) ; } } import java . text . ParseException ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Date formatDate ; Date heiseiDate ; Scanner sc = new Scanner ( System . in ) ; String sdate = sc . next ( ) ; SimpleDateFormat sdf = new SimpleDateFormat ( " yyyy / mm / dd " ) ; try { formatDate = sdf . parse ( sdate ) ; heiseiDate = sdf . parse ( " 2019 / 04 / 30 " ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; } if ( formatDate . before ( heiseiDate ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; package abc091 ; import java . util . Scanner ; public class ABC091 _ A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( C < = ( A + B ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferdReader br = new BufferReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import static java . lang . System . out ; import java . util . Scanner ; public class Main { public void main ( String ... args ) { String x = new Scanner ( System . in ) . nextLine ( ) ; int input = Integer . parseInt ( x ) ; out . println ( x * x * x ) ; } int power ( int num , int index ) { if ( index = = 0 ) { return 1 ; } if ( index < 2 ) { return num ; } return num * power ( num , index - 1 ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( i + 1 , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } foreach ( String key : map . keySet ( ) ) { Collections . sort ( map . get ( key ) ) ; for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } public class Index { public static void main ( Stirng [ ] args ) { INT A , B , C ; while ( 1 ) { scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; if ( A = = 5 & & A = = 7 ) { scanner scan2 = new Scanner ( System . in ) ; int B = scan2 . nextInt ( ) ; if ( B = = 5 & & B = = 7 ) { if ( A = = B = = 7 ) { A = 0 ; B = 0 ; System . out . println ( " NO ! " ) ; break ; } scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . outprintln ( " Yes ! " ) ; } else { break ; } } } } } } } class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int n = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = r . readLine ( ) ; Integer . parseInt ( x ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class X _ Cubic { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String strInput = scan . next ( ) ; int numInput = Integer . parseInt ( strInput ) ; int result = numInput * numInput * numInput ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Itpa _ 1B { public static int x ; public static void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { solve ( ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] a ) { int num ; Scanner scanner = new Scanner ( System . in ) ; num = Integer . parseInt ( scanner . next ( ) ) ; System . out . println ( ( Math . pow ( num , 3 ) ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { ? ? ? int x = Scanner ( System . in ) ; System . out . println ( " x * x * x " ) ; } } import java . io . * ; public class main { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . * ; import java . util . * ; class test { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( Math . pow ( n , 3 ) ) ; } } import . java . util . Scanner ; public class Main { public static void main ( Strings [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; x = scanner . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Q042 { public static void Main ( String [ ] args ) { try ( Scanner scanner = new Scanner ( System . in ) ) { int [ ] count = new int [ 11 ] ; count [ scanner . nextInt ( ) ] + + ; count [ scanner . nextInt ( ) ] + + ; count [ scanner . nextInt ( ) ] + + ; if ( count [ 5 ] = = 2 & & count [ 7 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } class main { import java . util . Scanner ; ? ? ? public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x ; x = scan . nextInt ( ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; import java . lang . math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; if ( Math . abs ( A - B ) / Math . abs ( V - W ) > T ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } } import java . util . Scanner ; public class BBBBBBBBBB { public static void main ( String [ ] args ) { long x , bal1 , bal2 , bal3 , ans , kk ; int n ; Scanner in = new Scanner ( System . in ) ; n = in . nextInt ( ) ; x = in . nextLong ( ) ; long [ ] a = new long [ n + 1000 ] ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = in . nextLong ( ) ; } ans = 0 ; kk = - 1 ; for ( int i = 1 ; i < = n ; i + + ) { bal1 = a [ i ] ; bal2 = 0 ; bal3 = a [ i ] ; for ( int k = 1 ; k < n ; k + + ) { int pi = ( ( i - k ) + n ) % n ; if ( pi = = 0 ) pi = n ; if ( bal1 > a [ pi ] + ( ( long ) k ) * x ) { bal1 = a [ pi ] + ( k ) * x ; bal2 = k ; bal3 = a [ pi ] ; } } if ( bal2 > kk ) kk = bal2 ; ans + = bal3 ; } System . out . println ( ans + ( kk ) * x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String txt1 = reader . readLine ( ) ; int x = Integer , parseInt ( txt1 ) ; int num ; num = x * x * x ; System . out . println ( num ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . io . IOException ; class Main { public static void main ( String [ ] args ) { int x ; int a ; try { x = System . in . read ( ) ; a = x * x * x ; } catch ( IOException e ) { } System . out . println ( a ) ; } } # include < stdio . h > # include < math . h > # include < stdlib . h > double main ( int argc , char * argv [ ] ) { double x , y ; x = double ( atoi ( argc [ 1 ] ) ) ; y = 3 ; double y = 3 ; y = pow ( x , y ) ; printf ( " % f \ n " , y ) ; return y ; } import java . util . Scanner ; public class Ex02 { public static void main ( String [ ] args ) { int x ; int ans ; Scanner stdin = new Scanner ( System . in ) ; x = stdin . nextInt ( ) ; ans = x * x * x ; System . out . println ( + ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int age = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; if ( age > = 13 ) { System . out . println ( b ) ; } else if ( age < = 5 ) { System . out . println ( 0 ) ; } else { System . out . println ( b / 2 ) } } } import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int h = in . nextInt ( ) ; int m = in . nextInt ( ) ; int pass _ time = h * 60 + m ; double digA = ( 0.5 * ( double ) pass _ time ) % 360 ; double digB = ( 6 * pass _ time ) % 360 ; double result = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( digA - digB ) ) ) ) ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String [ ] s = sc . nextLine ( ) . split ( " " ) ; if ( Arrays . stream ( s ) . filter ( e - > e . equals ( " Y " ) ) . count ( ) > 0L ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } sc . close ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader rd = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int read = IntegerParseInt ( rd . ReadLine ( ) ) ; system . out . println ( ( int ) Math . pow ( read , 3 ) ) ; } } import java . util . Scanner ; protected class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A , B , ans ; A = sc . nextInt ( ) ; B = sc . nextInt ( ) ; if ( A > = 13 ) ans = B ; else if ( ( A > = 6 ) & & ( A < = 12 ) ) ans = ( B / 2 ) ; else ans = 0 ; System . out . println ( ans ) ; } } class Main { public static void main ( String [ ] args ) { int x ; int l = x ^ 3 ; System . out . println ( l ) ; } } Scanner input = new Scanner ( System . in ) ; int A , B , C ; A = input . nextInt ( ) ; B = input . nextInt ( ) ; C = input . nextInt ( ) ; if ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public int calcCircle ( int num ) { return num * num ; } public static void main ( String [ ] args ) { int A = Integer . parseInt ( args [ 0 ] ) ; int B = Integer . parseInt ( args [ 1 ] ) ; int C = Integer . parseInt ( args [ 2 ] ) ; if ( ( A = = 5 & & B = = 5 ) & & ( C = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( A = = 5 & & C = = 5 ) & & ( B = = 7 ) ) { System . out . println ( " YES " ) ; } else if ( ( B = = 5 & & C = = 5 ) & & ( A = = 7 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } import java . util . * ; public class Main { public static int gcd ( int a , int b ) { int temp ; while ( ( temp = a % b ) ! = 0 ) { a = b ; b = temp ; } return b ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int A [ ] = new int [ N ] ; int B [ ] = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; B [ i ] = A [ i ] ; } int t = gcd ( A [ 0 ] , A [ 1 ] ) ; for ( int i = 2 ; i < N ; i + + ) { t = gcd ( t , A [ i ] ) ; } if ( t ! = 0 ) { System . out . println ( " not coprime " ) ; } else { for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { t = gcd ( A [ i ] , A [ j ] ) ; if ( t ! = 1 ) { System . out . ( " setwise coprime " ) ; break ; } } } System . out . println ( " pairwise coprime " ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . IOException ; class Main { public static void main ( String args [ ] ) { try { BufferedReader stdReader = _ new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line ; while ( ( line = stdReader . readLine ( ) ) ! = null ) { int num = Integer . parseInt ( line ) ; System . out . println ( ( int ) Math . pow ( num , 3 ) ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } public class Main { public static void main ( String [ ] args ) { int num = x * 3 ; System . out . println ( num ) ; } } mport java . util . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s = sc . next ( ) ; if ( s . equals ( " 0 " ) ) break ; int ret = 0 ; for ( int i = 0 ; i < s . length ( ) ; i + + ) ret + = s . charAt ( i ) - 48 ; System . out . println ( ret ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; Scanner scan = new Scanner ( System . in ) ; x = scan . nextInt ( ) ; System . out . print ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int [ ] [ ] arr = new int [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; j + + ) { arr [ i ] [ j ] = scanner . nextInt ( ) ; } } int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { int sum = 0 ; for ( int k = 0 ; k < d ; k + + ) { int value = Math . abs ( arr [ i ] [ k ] - arr [ j ] [ k ] ) ; sum + = ( value * value ) ; } double sqrt = Math . sqrt ( sum ) ; if ( sqrt = = ( int ) ( sqrt ) ) count + + ; } } System . out . println ( count ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class TaskSchedulingProblem { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int taskCost [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { taskCost [ i ] = s . nextInt ( ) ; } int minCost = 0 ; Arrays . sort ( taskCost ) ; for ( int i = 1 ; i > = 0 ; i -- ) { minCost = minCost + Math . abs ( taskCost [ i + 1 ] - taskCost [ i ] ) ; } System . out . println ( minCost ) ; } } import java . util . * ; import java . io . * ; public class Main { int n , sum = 0 ; int max1 = 0 , max2 = 0 ; int who1 = 0 , who2 = 0 ; int [ ] [ ] v ; Main ( Scanner in , PrintWriter out ) { n = in . nextInt ( ) ; v = new int [ 2 ] [ 100 _ 000 ] ; for ( int i = 0 ; i < ( n > > 1 ) ; i + + ) { int a = in . nextInt ( ) - 1 ; int b = in . nextInt ( ) - 1 ; v [ 0 ] [ a ] + + ; v [ 1 ] [ b ] + + if ( v [ 0 ] [ a ] > max1 ) { max1 = v [ 0 ] [ a ] ; who1 = a ; } if ( v [ 1 ] [ b ] > max2 ) { max2 = v [ 1 ] [ b ] ; who2 = b ; } } sum = max1 + max2 ; if ( who1 = = who2 ) sum - = Math . min ( max1 , max2 ) ; out . println ( n - sum ) ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( in , out ) ; out . close ( ) ; } } class Main { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x = in . readLine ( ) ; System . out . println ( Math . pow ( Integer . parseInt ( x ) , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner stdId = new Scanner ( System . in ) ; int x = stdId . nextInt ( ) ; x = x * x * x ; System . out . println ( String . valueOf ( x ) ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; boolean flag = true ; if ( A > B ) { flag = false ; } for ( int i = 0 ; i < T ; i + + ) { if ( flag ) { A + = V ; B + = W ; } else { A - = V ; B - = W ; } } if ( flag ) { if ( A > = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } else { if ( A < = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int V = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int T = sc . nextInt ( ) ; boolean flag = true ; if ( A > B ) { flag = false ; } for ( int i = 0 ; i < T ; i + + ) { if ( flag ) { A + = V ; B + = W ; } else { A - = V ; B - = W ; } } if ( flag ) { if ( A > = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } else { if ( A < = B ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } } 提出情報 import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputstreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int a = Integer , perseInt ( str ) ; System . out . println ( a * a * a ) ; } } import java . util . * ; public class InteractiveSorting { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int r = s . nextInt ( ) ; int result = ( int ) ( Math . pow ( r , 2 ) ) ; System . out . println ( result ) ; } } public class X _ Cubic { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } ds import java . util . Scanner ; public class ABC088C { public static void main ( String [ ] args ) { int [ ] [ ] a = new int [ 3 ] [ 3 ] ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } boolean flag = true ; x [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { y [ i ] = a [ 0 ] [ i ] - x [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { x [ i ] = a [ i ] [ 0 ] - y [ 0 ] ; } flag = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( x [ i ] + y [ j ] ! = a [ i ] [ j ] ) { flag = false ; break ; } } } if ( flag ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int S = sc . nextInt ( ) ; int T = S - 20190000 ; if ( T < = 430 ) { System . out . println ( Heisei ) ; } else { Syeten . out . println ( TBD ) ; } } } public class Main { ? ? ? public static void main ( String [ ] atrgs ) { ? ? ? ? ? ? Scanner scan = new Scanner ( System . in ) ; ? ? ? ? ? ? int x = scan . nextInt ( ) ; ? ? ? ? ? ? int i = ( x ^ 3 ) ; ? ? ? ? ? ? System . out . println ( i ) ; ? ? ? } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Scanner ; public class Test { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String a = scan . next ( ) ; String b = scan . next ( ) ; String c = scan . next ( ) ; int ab [ ] = new int [ 3 ] ; ab [ 0 ] = Integer . valueOf ( a ) . intValue ( ) ; ab [ 1 ] = Integer . valueOf ( b ) . intValue ( ) ; ab [ 2 ] = Integer . valueOf ( c ) . intValue ( ) ; Arrays . sort ( ab ) ; if ( ab [ 0 ] = = 5 & & ab [ 1 ] = = 5 & & ab [ 2 ] = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Integer A = Integer . parseInt ( sc . next ( ) ) ; Integer B = Integer . parseInt ( sc . next ( ) ) ; Integer C = Integer . parseInt ( sc . next ( ) ) ; Integer D = Integer . parseInt ( sc . next ( ) ) ; int s1 = A * B ; int s2 = C * D ; if ( s1 > s2 ) System . out . println ( s1 ) ; else System . out . println ( s2 ) ; } } x = 1 ; y = x * x * x ; System . out . println ( y ) ; package Lesson ; import java . util . Scanner ; public class Itp1 _ 1B { public static int x ; public static void solve ( ) { System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; solve ( ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; String [ ] abc = s . split ( " , " ) ; int a = Integer . parseInt ( abc [ 0 ] ) ; int b = Integer . parseInt ( abc [ 1 ] ) ; int c = Integer . parseInt ( abc [ 2 ] ) ; StringBuilder buff = new StringBuilder ( ) ; while ( true ) { if ( a ! = 0 ) { buff . append ( " a " ) ; a -- ; } else if ( c ! = 0 ) { buff . append ( " c " ) ; } else if ( b ! = 0 ) { buff . append ( " b " ) ; } else { System . out . println ( buff ) ; return ; } } } import java . util . Scanner ; import java . util . Arrays ; public class Beginner88C { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] c = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; } } int [ ] a = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { int min = 100 ; for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] < min ) min = c [ i ] [ j ] ; } a [ i ] = min ; } for ( int j = 0 ; j < 3 ; j + + ) { int min = 100 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( c [ i ] [ j ] < min ) min = c [ i ] [ j ] ; } b [ j ] = min ; } int cnt = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { for ( int k = 0 ; k < = a [ i ] ; k + + ) { for ( int l = 0 ; l < = b [ j ] ; l + + ) { if ( k + l = = c [ i ] [ j ] ) cnt + + ; } } } } if ( cnt = = 9 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; double c = ( a + b ) / 2.0 ; int d = ( a + b ) / 2 ; if ( c = = d ) { System . out . println ( d ) ; } else { System . out . println ( d + 1 ) ; } } } import java . util . * ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; String [ ] parts = s . split ( " / " ) ; int y = Integer . parseInt ( parts [ 0 ] ) ; int m = Integer . parseInt ( parts [ 1 ] ) ; int d = Integer . parseInt ( parts [ 2 ] ) ; if ( y > 2019 ) { System . out . println ( " TBD " ) ; return ; } if ( m > 4 ) { System . out . println ( " TBD " ) ; return ; } if ( d > 30 ) { System . out . println ( " TBD " ) ; return ; } System . out . println ( " Heisei " ) ; } } import java . util . Scanner ; public class Dishes5 { public static void main ( String [ ] args ) { int [ ] dish = new int [ 5 ] ; boolean [ ] t = new boolean [ 5 ] ; int max = 0 ; int min = 0 ; int time = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < dish . length ; i + + ) { dish [ i ] = sc . nextInt ( ) ; if ( dish [ i ] % 10 = = 0 ) continue ; max = dish [ max ] % 10 > dish [ i ] % 10 ? max : i ; min = dish [ min ] % 10 < dish [ i ] % 10 ? min : i ; } if ( max = = min ) { max = 0 ; min = 4 ; } t [ max ] = t [ min ] = true ; time + = ( int ) Math . ceil ( ( double ) dish [ max ] / 10 ) * 10 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ! t [ i ] ) time + = ( int ) Math . ceil ( ( double ) dish [ i ] / 10 ) * 10 ; } time + = dish [ min ] ; System . out . println ( time ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = Integer . parseInt ( scan . next ( ) ) ; int y = ( int ) Math . pow ( x , 3 ) ; System . out . println ( y ) ; scan . close ( ) ; } } # include < iostream > using namespace std ; int main ( ) { int r ; cin > > r ; cout < < r * r < < endl ; return 0 ; } class cubic { public static void main ( args [ ] ) { int x = 5 ; System . out . println ( 5 ^ 3 ) ; } } class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int i = sc . nextInt ( ) ; System . out . println ( i * i * i ) ; } } import java . util . Scanner ; public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int a ; int b ; a = sc . nextInt ( ) ; b = sc . nectInt ( ) ; System . out . println ( a * b a + b * 2 ) ; } public static void main ( String [ ] args ) { Rectangle obj = new Main ( ) ; obj . solve ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; while ( n -- > 1 ) { long newA = sc . nextLong ( ) ; long newB = sc . nextLong ( ) ; long x = ( long ) Math . ceil ( Math . max ( ( double ) a / newA ) , Math . max ( ( double ) b / newB ) ) ; a = newA * x ; b = newB * x ; } System . out . println ( a + b ) ; } } import java . text . DateFormat ; import java . text . ParseException ; import java . util . Date ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { try { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; Date date1 = DateFormat . getDateInstance ( ) . parse ( a ) ; Date date2 = DateFormat . getDateInstance ( ) . parse ( " 2019 / 4 / 30 " ) ; int diff = date1 . compareTo ( date2 ) ; if ( diff < 0 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } catch ( ParseException e ) { System . out . println ( e ) ; } } } int main ( ) { Scanner sc = new Scanner ( System . in ) ; int a ; int b ; while ( true ) { if ( ! sc . hasNext ( ) ) break ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; System . out . println ( a + b ) ; } return 0 ; } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s1 = sc . nextInt ( ) ; int s3 = sc . nextInt ( ) ; if ( s1 = s3 ) System . out . println ( " Draw " ) ; else if ( s1 = = 1 | | s1 > s3 ) System . out . println ( " Alice " ) ; else if ( s3 = = 1 | | s3 < s1 ) System . out . println ( " Bob " ) ; } } class Main { int x ; public static void main ( String [ ] args ) { x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int n = Integer . parseInt ( str ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } class main { public static void main ( String args [ ] ) { int x = 2 ; System . out . println ( x * x * x ) ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Q1 { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String head ; try { head = br . readLine ( ) ; } catch ( IOException e ) { System . err . println ( " The input is missing . " + e . getMessage ( ) ) ; return ; } int n ; try { n = Integer . parseInt ( head ) ; } catch ( NumberFormatException e ) { System . err . println ( " The input is in an illegal form . " + e . getMessage ( ) ) ; return ; } System . out . println ( n * n * n ) ; } } Public Class Main { public static void ( int x ) { int y = 3 ; y = y * x ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x ^ 3 ; System . out . println ( answer ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int hdeg = 30 * h ; int mdeg = 6 * m ; int deg = Math . abs ( hedg - mdeg ) ; double cosdeg = Math . cos ( deg * Math . pi / 180 ) ; double asrq = a * a ; double bsqr = b * b ; double c = Math . sqrt ( asr + bsqr - 2 * a * b * cosdeg ) ; System . out . println ( c ) ; } } import java . utl . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) int result = x - y ; System . out . println ( result ) } } public class Main { public static void main ( String [ ] args ) { int x = System . in ; result = x ^ 3 ; System . out . println ( result ) ; } } import java . util . Scanner ; public class ABC145A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; double c = ( a + b ) / 2.0 ; int d = ( a + b ) / 2 ; if ( c = = d ) { System . out . println ( d ) ; } else { System . out . println ( d + 1 ) ; } } } import java . Io . * ; class Main { public static void main ( String args [ ] ) { int x ; String buf ; BufferdReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { buf = br . readLine ( ) ; x = Integer . parseInt ( buf ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( " 入出力エラーです " ) ; } } } package score100 ; import java . util . Sca 入れ替 えnn er ; public lass M in { ubli tatic oid ma n ( St ing [ ] args ) { Scan n r sc = ne S a ner System. i n ) ; in t a = sc. e t nt ( ) ; int b = sc. e t nt ( ) ; int c = sc. e t nt ( ) ; if ( a = b & & b = & c = 7 | b = c & c = & a = 7 | = a & a = & b = 7 ) ys e m . ut.pri n tln ( " YES " ) ; } el s e yste . ut.pri n tln ( " NO " ) ; } } } import java . util . Scanner ; public class FiveAntennas { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; if ( e - a > = k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } scanner . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int ab = a * b ; int cd = c * d ; if ( ad = cd ) { System . out . println ( ab ) ; } else if ( ab > cd ) { System . out . println ( ab ) ; } else if ( cd > ab ) { System . out . println ( cd ) ; } } } public class Main { public static void main ( String args [ ] ) { int x ; System . out . println ( x * x * x ) ; } } class main { public static void main ( String [ ] args ) { x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { ? ? ? int x = new java . util . Scanner ( System . in ) . nextInt ( ) ; System . out . println ( " x * x * x " ) ; } } class pow { public static void main ( String [ ] args ) throws java . lang . Exception { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " 入力した値を3乗した値を出力します " ) ; System.out.println ( " 数値を入力してく だ さ い ) ; int x = Integer . p arseInt ( br.readLine ( ) ) ; double a = ( oub e x double kotae = M at h .pow ( a , 3 ) ; S stem.o t p i ntln ( x + " を 乗した値は " kotae " す " ) ; } } public class Main { public static void main ( String [ ] args ) { int = x x = x * x * x system . out , println ( ? ? ? x ? ? ? 100 ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) ; for ( int i = 0 ; i < 2 ; i + + ) x = x * x ; System . out . println ( x ) ; } } import java . lang . Scanner ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int x = in . nextInt ( ) ; out . println ( x * x * x ) ; out . flush ( ) ; } } import java . util . * ; public class Test { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int n = r . nextInt ( ) ; System . out . println ( n * n ) ; } } import java . util . Scanner ; public class Itp1 _ 1b { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { Itp1 _ 1b obj = new Itp1 _ 1b ( ) ; obj . solve ( ) ; } } import java . util . Scanner ; public class cityname { int location = 0 ; int year = 0 ; } class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; cityname [ ] city = new cityname [ 3 ] ; for ( int i = 0 ; i < M ; i + + ) { city [ i ] = new cityname ( ) ; } for ( int i = 0 ; i < M ; i + + ) { city [ i ] . location = scan . nextInt ( ) ; city [ i ] . year = scan . nextInt ( ) ; } for ( int i = 0 ; i < M ; i + + ) { int index = 1 ; for ( int j = 0 ; j < M ; j + + ) { if ( ( city [ i ] . location = = city [ j ] . location ) & & ( city [ i ] . year > city [ j ] . year ) ) { index + + ; } } System . out . println ( String . format ( " % 06d " , city [ i ] . location ) + String . format ( " % 06d " , index ) ) ; } } } import java . util . * ; public class Competition2E { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double r = sc . nextDouble ( ) ; double c = 1 ; System . out . println ( ( int ) ( Math . pow ( r , 2 ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int answer = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = b ; j + + ) { int cc = x - 500 * i + 100 * j ; int c = cc / 50 ; if ( c > = 0 & & c < = 50 & & cc % 50 = = 0 ) { answer + + ; } } } System . out . println ( answer ) ; } } import java . util . Scanner ; public class Main { public static void main ( String { } args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = 800 * n ; int y = 200 * ( n / 15 ) ; System . out . oriintin ( x - y ) ; } } import java . util . Scanner ; import java . lang . Math ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; float rad = Math . abs ( H * 30 + 0.5 M - M * 6 ) ; if ( rad > = 180 ) { rad = 360 - rad ; } double C = 0 ; C = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( rad ) ) ; System . out . println ( Math . pow ( C , 0.5 ) ) ; } } # include < bits / stdc + + . h > using namespace std ; class Main { private : public : int n ; } ; int main ( ) { int n ; cin > > n ; vector < int > list ( n ) ; for ( int i = 0 ; i < n ; i + + ) { cin > > list . at ( i ) ; } vector < string > str ( n ) ; for ( int i = 0 ; i < n ; i + + ) { stringstream ss ; ss < < bitset < 100 > ( list . at ( i ) ) ; str . at ( i ) = ss . str ( ) ; } vector < int > m ( 100 ) ; for ( int j = 0 ; j < 100 ; j + + ) { if ( str . at ( 0 ) . at ( j ) ! = str . at ( 1 ) . at ( j ) ) { m . at ( j ) + = 1 ; } } for ( int i = 2 ; i < n ; i + + ) { for ( int j = 0 ; j < 100 ; j + + ) { if ( str . at ( i ) . at ( j ) = = ' 1' ) { m . at ( j ) + = 1 ; } } } for ( int i = 0 ; i < 100 ; i + + ) { m . at ( i ) = m . at ( i ) % 2 ; } string s ; s = ( accumulate ( m . begin ( ) , m . end ( ) , 0 ) = = 0 ) ? " YES " : " NO " ; cout < < s ; } public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int p = scanner . nextInt ( ) + 1 ; int counter = scanner . nextInt ( ) ; int [ ] aArray = new int [ counter ] ; int [ ] bArray = new int [ counter ] ; ArrayList < Integer > [ ] arrayLists = new ArrayList [ p ] ; for ( int i = 0 ; i < counter ; i + + ) { int y = scanner . nextInt ( ) ; int t = scanner . nextInt ( ) ; aArray [ i ] = y ; bArray [ i ] = t ; if ( arrayLists [ y ] = = null ) arrayLists [ y ] = new ArrayList < > ( ) ; arrayLists [ y ] . add ( t ) ; } for ( int i = 0 ; i < p ; i + + ) { if ( arrayLists [ i ] ! = null & & arrayLists [ i ] . size ( ) > 1 ) { Collections . sort ( arrayLists [ i ] ) ; } } for ( int i = 0 ; i < counter ; i + + ) { int a = aArray [ i ] ; int b = bArray [ i ] ; String aString = Integer . toString ( a ) ; String c = Integer . toString ( arrayLists [ a ] . indexOf ( b ) + 1 ) ; System . out . println ( getZeros ( aString . length ( ) ) + aString + getZeros ( c . length ( ) ) + c ) ; } } public static String getZeros ( int a ) { if ( a = = 1 ) return " 00000 " ; if ( a = = 2 ) return " 0000 " ; if ( a = = 3 ) return " 000 " ; if ( a = = 4 ) return " 00 " ; if ( a = = 5 ) return " 0 " ; return " " ; } } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int k ; List < Integer > spot = new ArrayList < > ( ) ; Scanner scanner = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i + + ) { spot . add ( scanner . nextInt ( ) ) ; } k = scanner . nextInt ( ) ; List < Integer > tmpSpot = new ArrayList < > ( spot ) ; for ( int i = 0 ; i < 5 ; i + + ) { tmpSpot . remove ( i ) ; for ( int l : tmpSpot ) { if ( ( l - spot . get ( i ) ) > k ) { System . out . println ( " : ( " ) ; return ; } } } scanner . close ( ) ; System . out . println ( " Yay ! " ) ; } import java . util . ArrayList ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList l = new ArrayList ( ) ; while ( sc . hasNext ( ) ) { double w = Double . parseDouble ( s [ 1 ] ) ; double h = Double . parseDouble ( s [ 2 ] ) ; if ( w / ( h * h ) > = 25 ) l . add ( Integer . parseInt ( s [ 0 ] ) ) ; } if ( l . isEmpty ( ) ) System . out . println ( " 該当なし " ) ; else f o ( Int ger i : l ) Sys e m . o ut.pri n tln ( i ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStremaReader ( System . in ) ) ; int x = Integer . perseInt ( r . readLine ) ; int cube = x * x * x ; System . out . println ( cube ) ; } } class Main { public static void main ( Strings [ ] args ) { x = new int ( ) x = 3 ^ 3 System . out . println ( x ) ; } } import java . util . * ; import java . io . * ; public class first { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] str = ( br . readLine ( ) ) . trim ( ) . split ( " " ) ; int h1 = Integer . parseInt ( str [ 0 ] ) ; int m1 = Integer . parseInt ( str [ 1 ] ) ; int h2 = Integer . parseInt ( str [ 2 ] ) ; int m2 = Integer . parseInt ( str [ 3 ] ) ; int k = Integer . parseInt ( str [ 4 ] ) ; int tt = ( h2 * 60 + m2 ) - ( h1 * 60 + m1 ) ; System . out . println ( tt - k ) ; return ; } } import java . util . Scanner ; public class Acc2005301 { public static void main ( String [ ] args ) { int s [ ] = new int [ 5 ] ; int h , h1 , h2 , okirum , m , m1 , m2 , k , ans ; Scanner sc = new Scanner ( System . in ) ; h1 = sc . nextInt ( ) ; m1 = sc . nextInt ( ) ; h2 = sc . nextInt ( ) ; m2 = sc . nextInt ( ) ; k = sc . nextInt ( ) ; h = h2 - h1 ; m = m2 - m1 ; okirum = m + 60 * h ; if ( okirum < = k ) { System . out . printf ( " 0 " ) ; } else { ans = okirum - k ; System . out . printf ( " % d " , ans ) ; } } } import java . util . * ; public class atcoder002 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( a = = 5 & & b = = 5 & & c = = 7 ) { System . out . println ( " YES " ) ; } else if ( a = = 5 & & b = = 7 & & c = = 5 ) { System . out . println ( " YES " ) ; } else if ( a = = 7 & & b = = 5 & & c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } package abc055 ; import java . util . Scanner ; public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( 800 * n - 200 * ( n / 15 ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; System . out . println ( r ^ 2 ) ; } } public class Main { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; } import java . util . * ; class Test { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int argInt [ ] = { a , b , c } ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int arg : argInt ) { if ( arg = = 5 ) { fiveCount + + ; } if ( arg = = 7 ) { sevenCount + + ; } } if ( fiveCount = = 2 | | sevenCount = = 1 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main10 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { A [ i ] = scan . nextInt ( ) ; } Arrays . sort ( A ) ; if ( A [ 0 ] = = 5 & & A [ 1 ] = = 5 & & A [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; ? ? public class Main { ? ? ? ? ? ? ? ? ? ? public static void main ( String [ ] args ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Scanner scan = new Scanner ( System . in ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int x = scan . nextInt ( ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( x * x * x ) ; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? scan . close ( ) ; ? ? ? ? ? ? ? ? ? ? } ? ? } class Main { public static void main ( String [ ] args ) { int x ; x = x * * 3 ; System . out . println ( x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k = = 1 ) System . out . println ( 0 ) ; else System . out . println ( n - k ) ; } } public class Cubic { public static int calculateCube ( int x ) { int result = 0 ; if ( x > = 1 | | x < = 100 ) { result = x * x * x ; } return result ; } public static void main ( String [ ] args ) { int cubic = calculateCube ( 2 ) ; System . out . println ( cubic ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; int m = Integer . parseInt ( sc . next ( ) ) ; Shi [ ] shi = new Shi [ m ] ; for ( int i = 0 ; i < m ; i + + ) { shi [ i ] = new Shi ( Integer . parseInt ( sc . next ( ) ) , Integer . parseInt ( sc . nextInt ( ) ) , i ) ; } Arrays . sort ( shi , ( ac , bc ) - > ( ac . b - bc . b ) ) ; int cnt [ ] = new int [ n + 1 ] ; String [ ] strings = new String [ m ] ; for ( int i = 0 ; i < m ; i + + ) { cnt [ shi [ i ] . a ] + + ; strings [ shi [ i ] . index ] = String . format ( " % 06d " , shi [ i ] . a ) + String . format ( " % 06d " , cnt [ shi [ i ] . a ] ) ; } for ( String s : strings ) { System . out . println ( s ) ; } } } class Shi { int a , b , index ; public Shi ( int a , int b , int index ) { this . a = a ; this . b = b ; this . index = index ; } } num = int ( input ( ) ) base = 1 for i in range ( 3 ) : base * = num print ( base ) public static void main ( String [ ] args ) { int A = 30 ; int B = 100 ; if ( A < 6 ) { System . out . println ( " 0円 " ) ; } e se i ( < 1 ) { S stem.o u t.p r intln ( B / 2 + " 円 " ) ; } e s { Sy s em.out . pri n tln ( B + " 円 " ) ; } } class Hello { public static void main ( String [ ] args ) { int x ; for ( int i = 0 ; i < 2 ; i + + ) { x * = x ; } System . out . println ( x ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class FiveAntennas { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] antennas = new int [ 5 ] ; int k = 0 ; for ( int i = 0 ; i < 6 & & s . hasNextLine ( ) ; i + + ) { if ( i < 5 ) { antennas [ i ] = Integer . parseInt ( s . nextLine ( ) ) ; } else if ( i = = 5 ) { k = Integer . parseInt ( s . nextLine ( ) ) ; } else { System . exit ( - 1 ) ; } } if ( available ( antennas , k ) ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } public static boolean available ( int [ ] antennas , int k ) { for ( int i = 0 ; i < antennas . length ; i + + ) { for ( int j = i + 1 ; j < antennas . length ; j + + ) { int distance = Math . abs ( antennas [ i ] - antennas [ j ] ) ; if ( distance > k ) { return false ; } } } return true ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; int count = 1 ; int min = list . get ( 0 ) ; int max = list . get ( 0 ) ; for ( int i = 0 ; i < list . size ( ) ; i + + ) { if ( min > list . get ( i ) ) { min = list . get ( i ) ; } if ( max < list . get ( i ) ) { max = list . get ( i ) ; } } int sum = 1000000 ; for ( int k = min ; k < max ; k + + ) { int challengeSum ; for ( int j = 0 ; j < list . size ( ) ; j + + ) { challengeSum + = ( k - list . get ( j ) ) ^ 2 ; } if ( sum > challengeSum ) { sum = challengeSum ; } } System . out . println ( sum ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String num = scan . nextLine ( ) ; Integer . parseInt ( num ) ; num = num * 2 ; System . out . plintln ( unm ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; int X = sc . nextInt ( ) ; int ans = 0 ; int ans1 = 0 ; int ans2 = 0 ; int ans3 = 0 ; for ( int i = 0 ; i < = A ; i + + ) { ans1 = + 500 * i ; } for ( int j = 0 ; j < = B ; j + + ) { ans2 = + 100 * j ; } for ( int k = 0 ; k < = C ; k + + ) { ans3 = + 50 * k ; if ( and1 + and2 + and3 = = X ) { ans + + ; break } } } } System . out . print ( ans ) ; } } import java . util . Scanner ; public class Main { pulic static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int b = sc . nextInt ( ) ; int [ ] hairetu = new int [ b ] ; for ( int i = 0 ; i < hairetu . length ; i + + ) { int c = sc . nextInt ( ) ; hairetu [ i ] = c ; } int count = 0 ; int champ = hairetu [ 0 ] ; for ( int k = 0 ; k < hairetu . length ; k + + ) { if ( champ > = hairetu [ i ] ) { champ = hairetu [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; class main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextDouble ( ) , b = sc . nextDouble ( ) ; double num = ( a + b ) / 2 ; System . out . println ( Math . round ( num ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( ( int ) Math . pow ( sc . nextDouble ( ) , 3 ) ) ; sc . close ( ) ; } } import java . io . * ; public class XCubic { public static void main ( String [ ] args ) { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = new String ( in . readLine ( ) ) ; int x = Integer . parseInt ( a ) ; if ( x = = 1 | | x = = 0 ) { System . out . println ( x ) ; } System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; String inputString = scanner . nextLine ( ) ; String [ ] strStdIn = inputString . split ( " " , 0 ) ; int initialNum = Integer . parseInt ( strStdIn [ 0 ] ) ; int totalNum = Integer . parseInt ( strStdIn [ 1 ] ) ; int count = 0 ; if ( 3 * initialNum = = totalNum ) { System . out . println ( " 1 " ) ; return ; } else if ( 3 * initialNum < totalNum ) { System . out . println ( " 0 " ) ; return ; } int calculatedNum = ( 3 * initialNum ) - totalNum ; int terminater = 0 ; if ( ( initialNum - calculatedNum ) > 0 ) { terminater = initialNum - calculatedNum ; } count = 3 * ( initialNum - terminater ) ; } System . out . println ( count ) ; } } import java . util . * ; class Main { public static void main ( String [ ] a ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; int c = in . nextInt ( ) ; if ( a = = 5 | | a = = 7 | | b = = 5 | | b = = 7 | | c = = 5 | | c = = 7 ) if ( a + b + c = = 17 ) System . out . printf ( " YES " ) ; else System . out . printf ( " NO " ) ; else System . out . printf ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String ... args ) { Scanner scanner = new Scanner ( System . in ) ; StringBuilder sb = new StringBuilder ( ' \ n ' + scanner . next ( ) + ' \ n ' ) ; for ( int i = 1 ; i < sb . length ( ) - 1 ; i + + ) { if ( sb . getCharAt ( i ) = = ' ? ' ) { if ( sb . getCharAt ( i + 1 ) = = ' D ' ) { sb . append ( ' P ' ) ; } else { sb . append ( ' D ' ) ; } } } System . out . pritnln ( sb ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . next ( ) ; if ( x < = 2019 / 04 / 30 ) System . out . println ( " Heisei " ) ; else System . out . println ( " TBD " ) ; } } import java . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; x = 800 * n ; y = n / 15 * 200 ; x - y = ans ; System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 5 ; int [ ] positions = new int [ n ] for ( int i = 0 ; i < n ; i + + ) { positions [ i ] = sc . nextInt ( ) ; } int border = sc . nextInt ( ) ; boolean pass = true ; for ( int i = 0 ; i < n - 1 ; i + + ) { int difference = positions [ i + 1 ] - positions [ i ] ; if ( difference > border ) { pass = false ; break ; } } if ( pass ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int num = in . nextInt ( ) ; System . out . println ( num ^ 3 ) ; } } java . util . Scanner ; class Main { static int sqr ( int x ) { return x * x ; } public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; int [ ] x = new int [ 8 ] ; int [ ] y = new int [ 8 ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = stdIn . nextInt ( ) ; y [ i ] = stdIn . nextInt ( ) ; } double sum = 0 ; for ( int i = 0 ; i < n - 1 ; i + + ) { for ( int j = 1 ; j < n ; j + + ) { sum + = Math . sqrt ( sqr ( x [ i ] - x [ j ] ) + sqr ( y [ i ] - y [ j ] ) ) ; } } System . out . println ( sum * 2 / n ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } package contest ; import java . util . * ; public class example { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long P = sc . nextLong ( ) ; if ( N = = 1 ) { System . out . println ( P ) ; } else { long m = 12 / N + 1 ; int n = 1 ; int mlcm = 1 ; for ( int i = 0 ; i < m ; i + + ) n * = 10 ; for ( int i = 1 ; i < n + 1 ; i + + ) { if ( P % ( Math . pow ( i , N ) ) = = 0 ) { mlcm = i ; } } System . out . println ( mlcm ) ; } } } import java . io . * ; import java . util . * ; class Solution { public static void main ( String [ ] args ) { int sevenCounter = 0 ; int fiveCounter = 0 ; Scanner sc = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { if ( sc . hasNext ( ) & & sc . nextInt ( ) = = 7 ) { sevenCounter + + ; } else { fiveCounter + + ; } } if ( sevenCounter = = 1 & & fiveCounter = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class a { public static void main ( String [ ] args ) { int f = 2 ; int s = 1 ; int i ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { for ( int j = 0 ; j < 3 ; j + + ) { i = Integer . parseUnsignedInt ( br . readLine ( ) ) ; if ( i = = 5 ) { -- f ; } else if ( i = = 7 ) { -- s ; } } } catch ( NumberFormatException | IOException e ) { System . out . println ( " NO " ) ; } if ( f = = 0 & & s = = 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; while ( true ) { String s = sc . next ( ) ; if ( s = = " 0 " ) break ; int ret = 0 ; for ( int i = 0 ; i < s . length ( ) ; i + + ) ret + = s [ i ] - 48 ; System . out . println ( ret ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { int num ; Scanner scanner = new Scanner ( System . in ) ; num = Integer . parseInt ( scanner . next ( ) ) ; System . out . println ( ( Math . pow ( num , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; int d = scanner . nextInt ( ) ; int e = scanner . nextInt ( ) ; int k = e - a ; if ( k < = 15 ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ; int x = int ( reader . readLine ( ) ) ; x = Math . pow ( x , 3 ) ; System . out . print ( x ) ; } } import java . util . * ; class Q1 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; if ( ( a + b + c ) = = 17 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class VVVSequence { public static void main ( String [ ] args ) { int [ ] seq = { 1 , 1 , 1 , 1 } ; int res _ 2 = solution _ 2 ( seq . length , seq ) ; System . out . println ( res _ 2 ) ; } private static int solution _ 2 ( int length , int [ ] seq ) { int overflow = 0 ; int p1 = seq [ 0 ] ; int p2 = seq [ 1 ] ; for ( int i = 2 ; i < seq . length ; i + + ) { if ( p1 = = p2 ) { overflow + + ; } else if ( i % 2 = = 0 ) { if ( seq [ i ] ! = p1 ) overflow + + ; p1 = seq [ i ] ; } else if ( i % 2 ! = 0 ) { if ( seq [ i ] ! = p2 ) overflow + + ; } } return overflow ; } } import java . util . Scanner ; public class Restaurant { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int in = scan . nextInt ( ) ; System . out . println ( in * 800 - ( in / 15 ) * 200 ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { try { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String textline = br . readLine ( ) ; double x = Math . pow ( Integer . parseInt ( textline ) , 3 ) ; System . out . println ( ( int ) x ) ; br . close ( ) ; } catch IOException { } } } import java . io . * ; public class test { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . util . * ; import static java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] time = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { time [ i ] = scan . nextInt ( ) ; } int [ ] time2 = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { time2 [ i ] = ( int ) ceil ( ( double ) ( time [ i ] ) / 10.0 ) * 10 ; } int max = 0 ; int count = 0 ; int tmp = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { tmp = time2 [ i ] - time [ i ] ; if ( max < = tmp ) { max = tmp ; count = i ; } } int ans = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { if ( i = = count ) { ans + = time [ i ] ; } else { ans + = time2 [ i ] ; } } System . out . println ( ans ) ; } import java . util . Scanner ; class sample { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int a = scanner . nextInt ( ) ; int b = a * a * a print ( b ) ; } } 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 ( ) ; if ( ( a + b ) / 2 = = double ( a + b ) / 2 ) System . out . println ( ( a + b ) / 2 ) ; else System . out . println ( ( a + b ) / 2 + 1 ) ; } } class Test { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( n * n * n ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; boolean gg = true ; Integer [ ] array = new Integer [ n ] ; int a = 1 ; int b = 0 ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = s . nextInt ( ) ; if ( i ! = 0 ) { if ( array [ i ] < b ) { b = array [ i ] ; a + + ; } else { } } else { b = array [ i ] ; } } System . out . print ( a ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readline ( ) ; System . out . println ( str * str * str ) ; } } import java . util . Scanner class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char s = sc . next ( ) . charAt ( 6 ) ; int month = Integer . parseCharacter ( s ) ; if ( month > 4 ) { System . out . println ( " TBD " ) ; } else { System . out . println ( " Heisei " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] agrs ) { BufferedReader br = new BufferReder ( new InputStreamReader ( System . in ) ) ; int a = br . leadLine ( ) ; System . out . println ( ( a * a * a * ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; scan . nextLine ( ) ; List < Integer > values = Arrays . sort ( Arrays . of ( scan . nextLine ( ) . split ( " " ) ) . map ( i - > new Integer ( i ) ) ) ; Map < Integer , Integer > searchResult = new HashMap ( ) < > ; int i = 0 ; for ( i ; i < values . get ( values . size - 1 ) ; i + + ) { searchResult . put ( calc ( list , i ) , i ) ; } searchResult Object [ ] mapkey = mMap . keySet ( ) . toArray ( ) ; Arrays . sort ( mapkey ) ; for ( Integer nKey : mMap . keySet ( ) ) { System . out . println ( mMap . get ( nKey ) ) ; break ; } } public static int calc ( List < Integer > list , Integer point ) { Integer result = 0 ; int i = 0 ; for ( i ; i < list . size ; i + + ) { result + = ( ( list . get ( i ) - point ) * ( list . get ( i ) - point ) ) ; } return result ; } } import java . util . * public class x { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = int ( s . next ( ) ) ; System . out . print ( n ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int Menu [ ] = new int [ 5 ] ; int min = 9 ; int last = 0 ; int count = 0 ; for ( i = 0 ; i < 5 ; i + + ) { Menu [ i ] = sc . nextInt ( ) ; if ( Menu [ i ] % 10 < = min & & Menu [ i ] % 10 = = 0 ) { min = Menu [ i ] % 10 ; last = i ; } } for ( i = 0 ; i < 5 ; i + + ) { if ( i ! = last ) { count = ( Menu [ i ] / 10 + 1 ) * 10 ; } } count = count + Menu [ last ] ; System . out . println ( count ) ; } } import java . util . * ; public class Good _ distance { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int D = sc . nextInt ( ) ; int X [ ] [ ] = new int [ N ] [ D ] ; int Distsq = 0 ; double Residue ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = 0 ; j < D ; j + + ) { X [ i ] [ j ] = sc . nextInt ( ) ; } } for ( int k = 0 ; k < ( N - 1 ) ; k + + ) { for ( int l = ( k + 1 ) ; l < N ; l + + ) { for ( int m = 0 ; m < D ; m + + ) { Distsq + = ( int ) Math . pow ( ( X [ k ] [ m ] - X [ l ] [ m ] ) , 2 ) ; } Residue = Math . sqrt ( Distsq ) - Math . round ( Math . sqrt ( Distsq ) ) ; if ( Residue = = 0 ) { count + + ; } Distsq = 0 ; } } System . out . println ( count ) ; } } import java . io . * ; class Main { public static main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br ) ; x = x * x * x ; System . out . println ( x ) ; } } import javax . management . StringValueExp ; import java . lang . * ; import java . lang . reflect . Array ; import java . util . * ; import java . util . Scanner ; public class Codeforces { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] n = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) n [ i ] = sc . nextInt ( ) ; int k = n [ 5 ] ; boolean check = false ; for ( int i = 4 ; i > 0 ; i -- ) { for ( int j = i - 1 ; j > = 0 ; j -- ) if ( n [ i ] - n [ j ] > = k ) { check = true ; break ; } if ( check ) break ; } if ( check ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } object Main extends App { final private val DELIMITER = " / " val input = io . StdIn . readLine . split ( DELIMITER ) val year = input ( 0 ) . toInt val month = input ( 1 ) . toInt val day = input ( 2 ) . toInt if ( year > 2019 ) println ( " TBD " ) else if ( year = = 2019 & & month > 5 ) println ( " TBD " ) else if ( year = = 2019 & & month = = 4 & & day > 30 ) println ( " TBD " ) else println ( " heisei " ) } import java . io . * ; class main { public static void main ( String [ ] a ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . util . Scanner ; public class ThreeCube { public static void main ( String [ ] args ) { Scanner kb = new Scanner ( System . in ) ; int a = kb . nextInt ( ) ; System . out . printf ( " % d \ n " , a * a * a ) ; kb . close ( ) ; } } import java . util . * ; public class ABC057D { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int min = in . nextInt ( ) ; int max = in . nextInt ( ) ; long [ ] nums = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) nums [ i ] = in . nextLong ( ) ; Arrays . sort ( nums ) ; boolean same = true ; long ave = 0 ; int totalPostSame = 0 ; int postSame = 0 ; for ( int i = n - 1 ; i > = 0 ; i -- ) { if ( i > = 1 ) if ( nums [ i ] ! = nums [ i - 1 ] ) same = false ; if ( i > = n - min ) ave + = nums [ i ] ; if ( nums [ i ] = = nums [ n - min ] ) { totalPostSame + + ; if ( i > = n - min ) postSame + + ; } } System . out . println ( ( double ) ave / min ) ; long [ ] [ ] pascal = new long [ n + 1 ] [ n + 1 ] ; pascal [ 0 ] [ 0 ] = 1 ; for ( int i = 1 ; i < = n ; i + + ) { for ( int j = 0 ; j < = i ; j + + ) { if ( i = = j ) pascal [ i ] [ j ] = 1 ; else if ( j = = 0 ) pascal [ i ] [ j ] = 1 ; else pascal [ i ] [ j ] = pascal [ i - 1 ] [ j - 1 ] + pascal [ i - 1 ] [ j ] ; } } System . out . println ( Arrays . deepToString ( pascal ) ) ; if ( same ) { long total = 0 ; for ( int i = min ; i < = max ; i + + ) { total + = pascal [ i ] [ min ] ; } System . out . println ( total ) ; } else { System . out . println ( pascal [ totalPostSame ] [ postSame ] ) ; } } } public class Main { public static void main ( String args [ ] ) { int a = 3 ; int x = 7 ; int num = Math . pow ( a , x ) ; System . out . println ( ( int ) Math . pow ( a , x ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; import java . math . BigDecimal * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; if ( v < = w ) { System . out . println ( " NO " ) ; return ; } int l = Math . abs ( a - b ) ; int r = v - w ; BigDecimal L = BigDecimal . valueOf ( l ) ; BigDecimal R = BigDecimal . valueOf ( r ) ; BigDecimal T = L . divide ( R , 1 , BigDecimal . ROUND _ DOWN ) ; double p = T . doubleValue ( ) ; if ( ( l / r ) < = t ) { System . out . println ( " YES " ) ; return ; } else { System . out . println ( " NO " ) ; return ; } } } import java . util . Scanner ; public class IroHaAndHaiku { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; System . out . println ( ( ( A = = 5 & & B = = 5 & & C = = 7 ) | | ( A = = 5 & & B = = 7 & & C = = 5 ) | | ( A = = 7 & & B = = 5 & & C = = 5 ) ) ? " YES " : " NO " ) ; } } } import java . util . Scanner ; public class main { public void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; int A = r . nextInt ( ) ; int B = r . nextInt ( ) ; if ( A > = 13 ) { System . out . println ( B ) ; } else if ( A > = 6 & & A < = 12 ) { System . out . println ( B / 2 ) ; } else { System . out . println ( 0 ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) throws IOException { int count _ 5 = 0 , count _ 7 = 0 ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { int num = scan . nextInt ( ) ; if ( num = = 5 ) count _ 5 + + ; if ( num = = 7 ) count _ 7 + + ; } if ( count _ 5 = = 2 & & count _ 7 = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public static Main { public static void main ( String [ ] args ) ; Scanner sc = new Scanner ( System . in ) ; int x = sc nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; if ( str . equals ( " 575 " ) ) { System . out . println ( " YES " ) ; } else if ( str . equals ( " 557 " ) ) { System . out . println ( " YES " ) ; } else if ( str . equals ( " 755 " ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } import java . io . * ; public class questionA { public static void main ( String [ ] args ) { try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = new String ( in . readLine ( ) ) ; String [ ] input = line . split ( " " , 0 ) ; int age = Integer . parseInt ( input [ 0 ] . trim ( ) ) ; int price = Integer . parseInt ( input [ 1 ] . trim ( ) ) ; if ( age < = 5 ) { System . out . print ( " 100 " ) ; } else if ( age < = 12 ) { System . out . print ( price / 2 ) ; } else { System . out . print ( price ) ; } } catch ( IOException e ) { System . out . print ( e ) ; } } } public class Main { public static void main ( String [ ] args ) { int d ; int a ; int k = d - e ; if ( k < = 15 ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; final int n = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 , min = n , p ; i < n ; i + + ) { p = sc . nextInt ( ) ; if ( p = < min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; String [ ] morse = s . split ( " " ) ; int height = Integer . parseInt ( morse [ 0 ] ) ; int width = Integer . parseInt ( morse [ 1 ] ) ; int area = height * width ; int rect = 2 * ( height + width ) ; System . out . println ( area + " " + rect ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . * ; import java . math . * ; public class Main { public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line1 = br . readLine ( ) ; line1 = line1 . trim ( ) ; int N = Integer . parseInt ( line1 ) ; long PosA = 0 ; long PosB = 0 ; long a = 0 ; long b = 0 ; long mag = 0 ; for ( int i = 0 ; i < N ; i + + ) { String lines = br . readLine ( ) ; lines = lines . trim ( ) ; String [ ] temp = lines . split ( " " ) ; a = Integer . parseInt ( temp [ 0 ] ) ; b = Integer . parseInt ( temp [ 1 ] ) ; if ( PosA < = a & & PosB < = b ) { PosA = a ; PosB = b ; } else { mag = ( long ) Math . ceil ( Math . max ( ( double ) PosA / a , ( double ) PosB / b ) ) ; PosA = a * mag ; PosB = b * mag ; } } System . out . println ( PosA + PosB ) } } import java . util . Scanner ; public class A _ Restaurant { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int x = N * 800 ; int y = ( N / 15 ) * 200 ; int sum = x - y ; System . out . print ( " 合計金額 = " + sum ) ; } } import java . io . * ; class Xcubic { static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; int x = Integer . parseInt ( line ) ; int y = ( x * x * x ) ; System . out . println ( y ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; 1 < = x < = 100 ; Scanner sc = new Scanner ( System . in ) ; x = sc . nextINT ( ) ; N = x * x * x ; System . out . println ( N ) ; } } int x = 3 ; X = x * x * x ; Systemout . println ( X ) ; import java . io . * ; class Main { public static void main ( String args [ ] ) { int num ; String buf ; try { BufferdReader br = new BufferdeReader ( new InputStreamReader ( System . in ) ) ; buf = br . readLine ( ) ; num = Integer . parseInt ( buf ) ; System . out . println ( num * num * num ) ; } catch ( Exception e ) { } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( sc . next ( ) ) ; int s = Integer . parseInt ( sc . next ( ) ) ; int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( z < = 0 & & z < = k ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; System . out . print ( Math . pow ( X , 3 ) ; ) } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; x = 800 * n ; y = n / 15 * 200 ; x - y = ans ; println ( ans ) ; public class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } public class main { public static void main ( String [ ] args ) { int x ; int kekka ; x = 2 ; kekka = x * x ; System . out . println ( kekka ) ; } } import java . util . Scanner ; class Test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; scanner . nextInt ( ) ; int cs = scanner . nextInt ( ) ; int [ ] ca = new int [ cs ] ; int [ ] ys = new int [ cs ] ; for ( int i = 0 ; i < cs ; i + + ) { ca [ i ] = scanner . nextInt ( ) ; ys [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < cs ; i + + ) { int num = ca [ i ] ; int seq = getseq ( num , ys [ i ] , ca , ys ) ; System . out . println ( getFullNumber ( num ) + getFullNumber ( seq ) ) ; } } static int getseq ( int num , int year , int [ ] ca , int [ ] ys ) { int sequ = 1 ; for ( int i = 0 ; i < ys . length ; i + + ) { if ( ca [ i ] = = num & & year > ys [ i ] ) { sequ + + ; } } return sequ ; } static String getFullNumber ( int number ) { String n = String . valueOf ( number ) ; int len = 6 - n . length ( ) ; for ( int i = 0 ; i < len ; i + + ) { n = " 0 " + n ; } return n ; } } package abc082 ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; public class A { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; String [ ] strings = new String [ 2 ] ; strings = s . split ( " \ \ s + " ) ; BigDecimal d1 = new BigDecimal ( strings [ 0 ] ) ; BigDecimal d2 = new BigDecimal ( strings [ 1 ] ) ; BigDecimal average = ( d1 . add ( d2 ) . divide ( new BigDecimal ( 2 ) ) ) ; BigDecimal ans = average . setScale ( 0 , BigDecimal . ROUND _ UP ) ; System . out . println ( ans ) ; } } あ import java . io . * ; public class X _ Cubic { public static void main ( String [ ] args ) throws IOException { int x , x _ 3 ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; x = Integer . parseInt ( line ) ; x _ 3 = x * x * x ; System . out . println ( x _ 3 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner teclado = new Scanner ( Sistema . Em ) ; int A , B , C , D , E ; Um = teclado . nextInt ( ) ; B = teclado . nextInt ( ) ; C = teclado . nextInt ( ) ; D = teclado . nextInt ( ) ; E = teclado . nextInt ( ) ; int k = teclado . nextInt ( ) ; se ( B - A < = k & & C - A < = k & & D - A < = k & & E - A < = k & & C - B < = k & & D - B < = k & & E - B < = k & & D - C < = k & & E - C < = k & & E - D < = k ) { Sistema . fora . println ( " Yay ! " ) ; } mais { Sistema . fora . println ( " : ( " ) ; } } class BinaryConversion { public static long [ ] decimalToBinary ( long num ) { long [ ] a = new long [ 60 ] ; int i = a . length - 1 ; while ( num ! = 0 ) { a [ i ] = num % 2 ; num / = 2 ; i -- ; } return a ; } public static long binaryToDecimal ( long [ ] a ) { long num = 0 ; for ( int i = 0 ; i < a . length ; i + + ) { num + = ( a [ i ] * Math . pow ( 2 , a . length - 1 - i ) ) ; } return num ; } } class XOR { public static long [ ] xor ( long num1 , long num2 ) { long [ ] a = BinaryConversion . decimalToBinary ( num1 ) ; long [ ] b = BinaryConversion . decimalToBinary ( num2 ) ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = ( a [ i ] + b [ i ] ) % 2 ; } return a ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long [ ] num = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { num [ i ] = sc . nextLong ( ) ; } long sum = 0 ; for ( int i = 0 ; i < num . length - 1 ; i + + ) { for ( int j = i + 1 ; j < num . length ; j + + ) { long [ ] temp = XOR . xor ( num [ i ] , num [ j ] ) ; sum + = BinaryConversion . binaryToDecimal ( temp ) ; } } sum % = ( Math . pow ( 10 , 9 ) + 7 ) ; System . out . println ( sum ) ; } } r = int ( input ( ) . strip ( ) ) print ( r * * 2 ) import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double Pai = 3.141592653589793238462643383279 L ; double a = scan . nextInt ( ) ; double b = scan . nextInt ( ) ; double h = scan . nextInt ( ) ; double m = scan . nextInt ( ) ; double rad = Pai * 2 * ( ( h / 12.0 ) + ( ( 60.0 / m ) / 12.0 ) - m / 60.0 ) ; double rpe = ( a * a + b * b ) - ( 2 * a * b ) * Math . cos ( rad ) ; System . out . println ( rpe ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class XCubic { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; System . out . print ( x * x * x ) ; } } import java . io . * class main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( Math . pow ( num , 3 ) ) ; } } import java . io . * ; public class maint . java { public static void main ( String [ ] args ) throws IOException { System . out . println ( ( int ) Math . pow ( Integer . parseInt ( new BufferedReader ( new InputStreamReader ( System . in ) ) . readLine ( ) ) , 3 ) ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOExpection { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = integer . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { double x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } Scanner sc = new Scanner ( System . in ) ; String line = sc . nextLine ( ) ; int r = Integer . parseInt ( line ) ; System . out . println ( r * r ) ; class Main { public static void main ( String [ ] agrs ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; pablic class Main { pablic static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; String c = sc . next ( ) ; if ( a . length ( ) = = 5 & & b . length ( ) = = 7 & & c . length ( ) = = 5 ) { System . out . println ( " YES " ) ; } else if ( a . length ( ) = = 5 & & b . length ( ) = = 5 & & c . length ( ) = = 7 ) { System . out . println ( " YES " ) ; } else if ( a . length ( ) = = 5 & & b . length ( ) = = 7 & & c . length ( ) = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class v { public static void main ( String [ ] args ) { int x ; x = 2 ; x = x * + x * + x ; System . out . println ( " x = " + x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int r = scan . nextInt ( ) ; System . out . println ( r * r ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scannser sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int answer = x * x * x ; System . out . println ( answer ) ; } } import java . io . * ; import java . util . * ; class main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a [ ] = new int [ 3 ] ; a [ 0 ] = 5 ; a [ 1 ] = 7 ; a [ 2 ] = 5 ; int b [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( b [ i ] = = a [ j ] ) { a [ j ] = 0 ; count + + ; break ; } } } if ( count = 3 ) { System . out . println ( " YES " ) ; } else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; for ( ; ; ) { int x = sc . nextInt ( ) ; int num = 0 ; if ( x = = 0 ) break ; for ( ; ; ) { num = num + ( x % 10 ) ; x = x / 10 ; if ( x = = 0 ) break ; } System . out . println ( num ) ; } } import java . util . Scanner ; public class Main1 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3.0 ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int X = sc . nextInt ( ) ; int AX = X * X * X ; System . out . println ( AX ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; double eee = ( Math . ceil ( e / 10 ) ) * 10 ; int ans = aaa + bbb + ccc + ddd + eee - 10 + min ; 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 ( ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int count = 0 ; int total = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int n = i ; count = 0 ; while ( int n > 0 ) { count + = n % 10 ; n = n / 10 ; } if ( A < = count & & count < = B ) { total + = i ; } } System . out . println ( total ) ; } } import java . io . * ; class prob11b { public static void main ( String args [ ] ) { int x , bb ; BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( d . readLine ( ) ) ; bb = x * x * x ; System . out . println ( bb ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) A [ i ] = sc . nextInt ( ) ; Array . sort ( A ) ; int ans = A [ 2 ] - A [ 0 ] ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . nextInt ( ) ; sum + = a [ i ] ; } sc . nextInt ( ) ; int w = sum / n ; int mod = sum % n ; if ( mod > n / 2 ) w + + ; int ans = 0 ; for ( int i : a ) { int abs = Math . abs ( i - w ) ; ans + = abs * abs ; } System . out . println ( ans ) ; } } import java . io . * ; class Main { public static void main ( String args [ ] ) { InputStreamReader sr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( sr ) ; String xstr = br . readline ( ) ; int x = Integer . ParseInt ( xstr ) ; int y ; if ( x > = 1 & & x < = 100 ) { y = x * x * x ; System . out . println ( y ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ( ) ) ; int A = s . nextInt ( ) ; int B = s . nextInt ( ) ; int C = s . nextInt ( ) ; int nana , go ; if ( A = = 5 ) { go + + ; } else if ( A = = 7 ) { nana + + ; } if ( B = = 5 ) { go + + ; } else if ( B = = 7 ) { nana + + ; } if ( C = = 5 ) { go + + ; } else if ( C = = 7 ) { nana + + ; } if ( go = = 2 & & nana = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } def factorial ( n ) : M = 1000000007 f = 1 for i in range ( 1 , n + 1 ) : f = ( f * i ) % M return f import java . util . Scanner ; public class Sample1 _ 6 { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; String line1 = sc1 . nextLine ( ) ; String [ ] inputText = line1 . split ( " " ) ; int a = Integer . parseInt ( inputText [ 0 ] ) + Integer . parseInt ( inputText [ 1 ] ) ; int b = Integer . parseInt ( inputText [ 2 ] ) ; int c = a - b ; if ( c < 0 ) { System . out . print ( " No " ) ; } else { System . out . print ( " Yes " ) ; } } } import java . io . * ; class oneCardPoker { public static void main ( String args [ ] ) throws IOException { int number [ ] ; number = new int [ 2 ] ; BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = input . readLine ( ) ; String strNum [ ] = str . split ( " " ) ; for ( int i = 0 ; i < 2 ; i + + ) { number [ i ] = Integer . parseInt ( strNum [ i ] ) ; if ( number [ i ] = = 1 ) number [ i ] + = 13 ; } if ( number [ 0 ] > number [ 1 ] ) { System . out . println ( " Alice " ) ; } else if ( number [ 0 ] < number [ 1 ] ) { System . out . println ( " BOb " ) ; } else if ( number [ 0 ] = = number [ 1 ] ) { System . out . println ( " Draw " ) ; } return ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str1 = br . readLine ( ) ; String str2 = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x ) ; } } import java . io . * ; import java . util . * ; public class Main { static List < Edge > [ ] edges ; static boolean [ ] used ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int V = sc . nextInt ( ) ; int E = sc . nextInt ( ) ; edges = new List [ V ] ; for ( int i = 0 ; i < V ; i + + ) { } } static class Edge { int to , cap , rev ; Edge ( int to , int cap , int rev ) { this . to = to ; this . cap = cap ; this . rev = rev ; } } } class Main { public static void main ( String [ ] args ) { BufferReader br = new BufferReader ( ) ; int x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; antena ( a , e , k ) ; } public static void antena ( int a , int e , int k ) { if ( e - a > k ) { System . out . println ( " : ) " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . * ; public class Colon { public static void main ( final String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; final double a = sc . nextInt ( ) ; final double b = sc . nextInt ( ) ; final double h = sc . nextInt ( ) ; final double m = sc . nextInt ( ) ; double h _ deg = h * 360 / 12 + m * 360 / 12 / 60 ; double m _ deg = m * 360 / 60 ; sc . close ( ) ; double result = 0 ; result = Math . pow ( ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( Math . abs ( h _ deg - m _ deg ) ) ) ) , 0.5 ) ; System . out . println ( result ) ; } } import java . util . * ; class Main { public static void main ( int args [ ] ) { int coinVal ; int coinVal2 ; int total ; int toyPrice ; Scanner scanner = new Scanner ( System . in ) ; coinVal = scanner . nextInt ( ) ; coinVal = scanner . nextInt ( ) ; toyPrice = scanner . nextInt ( ) ; total = coinVal + coinVal2 ; if ( total > = toyPrice ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferdReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Integer . parseInt ( str ) ; System . out . println ( x * x : x ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int max = sc . nextInt ( ) ; boolean isEven = true ; count = 10000 ; newCount = 0 ; while ( isEven ) { isEven = true ; newCount = 0 ; for ( int i = 1 ; i < = max ; i + + ) { if ( i % 2 = = 0 ) { i = i / 2 ; } else { isEven = false ; } } if ( count > newCount ) { count = newCount ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( ( a * a ) ; } } class Main { public static void main ( String args [ ] ) { int x = 0 ; DataInputStream d = new DataInputStream ( System . in ) x = d ; x = x ^ 3 ; System . out . println ( x ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String a = buf . readLine ( ) ; int x = Integer . parseInt ( a ) ; x = x * x * x ; System . out . println ( x ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . Scanner ; public class XCubic { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int i = in . nextInt ( ) ; System . out . println ( i * i * i ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( args ^ 3 ) ; } } import java . io ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BuferedReader ( new InputStreamReader ( Systen . in ) ) ; try { String temp = reader . readLine ( ) ; int x = Integer . parseInt ( temp ) ; System . out . println ( x * x * x ) ; } catch ( IOException e ) { System . out . println ( e ) ; } catch ( NumberFormatException e ) { System . out . println ( " Input only 1data " ) ; } return ; } } # include < iostream > # include < string > # include < cstring > # include < map > # include < algorithm > # include < set > # include < vector > # include < cstdio > # include < cmath > # include < queue > using namespace std ; typedef long long LL ; const int maxn = 2e3 + 5 ; LL a [ maxn ] ; LL b [ maxn ] [ maxn ] ; int main ( ) { int n ; LL x , sum = 1L L < < 60L L ; cin > > n > > x ; for ( int i = 1 ; i < = n ; i + + ) cin > > a [ i ] ; for ( int i = 1 ; i < = n ; i + + ) { b [ i ] [ 0 ] = a [ i ] ; for ( int k = 1 ; k < = n - 1 ; k + + ) { int pos = i - k ; if ( pos < = 0 ) pos = n - abs ( pos ) ; b [ i ] [ k ] = min ( b [ i ] [ k - 1 ] , a [ pos ] ) ; } } for ( int k = 0 ; k < = n - 1 ; k + + ) { LL ans = 0 ; for ( int i = 1 ; i < = n ; i + + ) { ans + = b [ i ] [ k ] ; } sum = min ( sum , ans + x * k ) ; } cout < < sum < < endl ; } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Comparator ; import java . util . List ; import java . util . logging . Level ; import java . util . logging . Logger ; import java . util . stream . Collectors ; import java . util . stream . Stream ; public class Main { public static void main ( String [ ] args ) { System . out . println ( new Main ( ) . run ( args , System . in ) ) ; } public String run ( String [ ] args , InputStream in ) { String result = null ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; int N = Integer . parseInt ( reader . readLine ( ) ) ; List < Integer > list = reader . lines ( ) . flatMap ( s - > Stream . of ( s . replaceAll ( " \ \ s + " , " " ) . split ( " " ) ) ) . limit ( N ) . map ( Integer : : parseInt ) . sorted ( ) . collect ( Collectors . toList ( ) ) ; int min = list . get ( 0 ) ; int max = list . get ( N - 1 ) ; result = String . valueOf ( max - min ) ; } catch ( IOException ex ) { Logger . getLogger ( abc064a . Main . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } return result ; } } import java . io . * ; import java . util . * ; public class ABC127d { public static void main ( String [ ] arg ) { Scanner scan = new Scanner ( System . in ) ; int n = Integer . parseInt ( scan . next ( ) ) ; int m = Integer . parseInt ( scan . next ( ) ) ; long [ ] A = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { A [ i ] = scan . nextLong ( ) ; } for ( int i = 0 ; i < m ; i + + ) { int b = Integer . parseInt ( scan . next ( ) ) ; int c = Integer . parseInt ( scan . next ( ) ) ; Arrays . sort ( A ) ; for ( int j = 0 ; j < b ; j + + ) { while ( A [ j ] < c ) { A [ j ] = ( long ) c ; } } } long sum = 0 ; for ( long d : A ) { sum + = d ; System . out . print ( d ) ; } System . out . print ( sum ) ; } } class Main { public static void main ( String [ ] args ) { System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class Aizu { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; System . out . println ( a * a * a ) ; } } class main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( ) ; int i = br . readLine ( System . in ) ; System . out . print ( i * i * i ) ; } } import java . io . * ; import java . util . * ; import java . text . * ; import java . math . * ; import java . util . regex . * ; public class Candles { static void func ( int n , int k , int [ ] xa ) { int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < = n - k ; i + + ) { min = Math . min ( min , Math . min ( Math . abs ( xa [ i ] ) , Math . abs ( xa [ i + k - 1 ] ) ) + xa [ i + k - 1 ] - xa [ i ] ) ; } System . out . println ( min ) ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int [ ] xa = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { xa [ i ] = in . nextInt ( ) ; } func ( n , k , xa ) ; in . close ( ) ; } } import java . io . * ; class Cubic { public static void main ( String [ ] args ) thorows IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str = br . readLine ( ) ; int x = Intger . parseInt ( str ) ; System . out . println ( x * x * x ) ; } } import java . util . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) throws java . lang . Exception { try { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = fs . nextInt ( ) ; } int step = 0 ; int first = a [ 0 ] ; int second = a [ 1 ] ; if ( first = = second ) { step + + ; second = first + 1 ; } for ( int i = 2 ; i < n ; i + = 2 ) { if ( a [ i ] ! = first ) { step + + ; } } for ( int i = 3 ; i < n ; i + = 2 ) { if ( a [ i ] ! = second ) step + + ; } System . out . println ( step ) ; } catch ( Exception e ) { return ; } } static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } } import java . util . Scanner ; public class Restaurant { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int in = scan . nextInt ( ) ; System . out . println ( in * 800 - ( in / 15 ) * 200 ) ; scan . close ( ) ; } } improt java . util . * ; class Main { public static void main ( string [ ] args ) { Scanner sc = New Scanner ( System . In ) ; int num = sc . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int prefectureNum = sc . nextInt ( ) ; int cityNum = sc . nextInt ( ) ; Map < String , List < String > > map = new HashMap < String , List < String > > ( ) ; for ( int i = 0 ; i < prefectureNum ; i + + ) { map . put ( i + 1 , new ArrayList < String > ( ) ) ; } for ( int i = 0 ; i < cityNum ; i + + ) { map . get ( sc . nextLine ( ) ) . add ( sc . nextLine ( ) ) ; } map . entrySet ( ) . stream ( ) . sorted ( Map . Entry . comparingByValue ( ) ) ; for ( String key : map . keySet ( ) ) { for ( int i = 0 ; i < map . get ( key ) . size ( ) ; i + + ) { String keyAns = key ; while ( keyAns . length ( ) < = 6 ) { keyAns = " 0 " + keyAns ; } String valAns = map . get ( key ) . get ( i ) ; while ( valAns . length ( ) < = 6 ) { valAns = " 0 " + valAns ; } System . out . println ( keyAns + valAns ) ; } } } } import java . util . Scanner ; public class Input { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public class clear { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String str = scan . next ( ) ; int x = Integer . parseInt ( str ) ; int anser = 0 ; double y = ( double ) x ; double z = Math . pow ( y , 3.0 ) ; anser = ( int ) z ; System . out . println ( anser ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; long double rad = ( h / 12 + ( 60 / m ) / 12 ) - ( m / 60.0 ) ; long double rpe = ( a * a + b * b ) - ( 2 * a * b ) * cosl ( rad ) ; System . out . println ( rpe ) ; } } class Main { public static void main ( String args [ ] ) { int x = args ; int Sanjou ; Sanjou = x * x * x ; System . out . println ( Sanjou ) ; } } import java . util . Scanner ; class ABC145 _ A { { public static void main ( String [ ] args ) { Scanner r = new Scanner ( System . in ) ; System . out . println ( r * r ) ; } } public class XCubic { public static void main ( String [ ] args ) { int i = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( i * i * i ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) , d = s . nextInt ( ) ; long [ ] arr = new long [ n ] [ d ] ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = 0 ; j < d ; + + j ) { arr [ i ] [ j ] = s . nextLong ( ) ; } } int count = 0 ; long ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { for ( int j = i + 1 ; j < n ; j + + ) { long val = 0 ; for ( int k = 0 ; k < d ; + + k ) { val + = Math . pow ( ( arr [ j ] [ k ] - arr [ i ] [ k ] ) , 2 ) ; } long a = ( long ) Math . sqrt ( val ) ; if ( a * a = = val ) count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class c { public static void main ( String [ ] argc ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; int [ ] x = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int ans = ( int ) 2e9 ; for ( int i = 0 ; i < = N - K ; i + + ) { ans = Math . min ( ans , dist ( x [ i ] , x [ i + K - 1 ] ) ) ; } System . out . println ( ans ) ; } public static int dist ( int A , int B ) { int ret = 0 ; if ( A > = 0 & & B > = 0 ) { ret = B ; } else if ( A < 0 & & B < 0 ) { ret = A ; } else ret = Math . min ( 2 * Math . abs ( A ) + B , Math . abs ( A ) + 2 * Math . abs ( B ) ) ; return ret ; } } public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; int x = Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } package com . atcoder ; import java . util . ArrayList ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] array = new int [ 3 ] ; array [ 0 ] = sc . nextInt ( ) ; array [ 1 ] = sc . nextInt ( ) ; array [ 2 ] = sc . nextInt ( ) ; int minCost = 300 ; for ( int i = 0 ; i < 3 ; i + + ) { int nextMinCost = 100 ; int nextMinNumber = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { int totalCost = 0 ; if ( j = = i ) { continue ; } for ( int z = 0 ; z < 3 ; z + + ) { if ( z ! = i & & z ! = j ) { totalCost + = Math . abs ( array [ j ] - array [ i ] ) + Math . abs ( array [ z ] - array [ j ] ) ; } } if ( totalCost < minCost ) { minCost = totalCost ; } } } System . out . println ( minCost ) ; } class Main { public static void main ( String [ ] args ) { int a ; int b a = b * b * b ; System . out . println ( a ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int [ ] B = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { A [ i ] = scan . nextInt ( ) ; B [ i ] = tenth ( A [ i ] ) ; } int min = 9 ; int pointer = 0 ; int all = 0 ; int k ; for ( int i = 0 ; i < 5 ; i + + ) { if ( ichi ( B [ i ] ) < min ) { min = A [ i ] ; k = B [ i ] ; pointer = i ; } } all = B [ 0 ] + B [ 1 ] + B [ 2 ] + B [ 3 ] + B [ 4 ] - 2 * k ; all = all + min ; System . out . print ( all ) ; } public static int tenth ( int a ) { while ( a % 10 ! = 0 ) { a + + ; } return a ; } public static int ichi ( int b ) { while ( b > = 10 ) { b = b - 10 ; } return b ; } } import java . util . Scanner ; public class C _ takahashiInformation { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c11 = sc . nextInt ( ) ; int c12 = sc . nextInt ( ) ; int c13 = sc . nextInt ( ) ; int c21 = sc . nextInt ( ) ; int c22 = sc . nextInt ( ) ; int c23 = sc . nextInt ( ) ; int c31 = sc . nextInt ( ) ; int c32 = sc . nextInt ( ) ; int c33 = sc . nextInt ( ) ; int a = c11 - c21 ; int b = c12 - c22 ; int d = c13 - c23 ; int e = c21 - c31 ; int f = c22 - c32 ; int g = c23 - c33 ; if ( a = = b & b = = d & e = = f & f = = g ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class ITP1 _ 1b { int x ; public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; System . out . print ( " x = " ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } public static void main ( String [ ] args ) { ITP1 _ 1b obj = new ITP1 _ 1b ( ) ; obj . solve ( ) ; } } Scanner scan = new Scanner ( System . in ) ; String str = scan . nextLine ( ) ; int num = Integer . parseInt ( str ) ; System . out . println ( num * num ) ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int aa = a % 10 ; int bb = b % 10 ; int cc = c % 10 ; int dd = d % 10 ; int ee = e % 10 ; int min = 100 ; if ( min > aa ) { min = aa ; } if ( min > bb ) { min = bb ; } if ( min > cc ) { min = cc ; } if ( min > dd ) { min = dd ; } if ( min > ee ) { min = ee ; } if ( a % 10 ! = 0 ) { double aaa = ( Math . ceil ( a / 10 ) ) * 10 ; } else { aaa = a ; } if ( b % 10 ! = 0 ) { double bbb = ( Math . ceil ( b / 10 ) ) * 10 ; } else { bbb = b ; } if ( c % 10 ! = 0 ) { double ccc = ( Math . ceil ( c / 10 ) ) * 10 ; } else { ccc = c ; } if ( d % 10 ! = 0 ) { double ddd = ( Math . ceil ( d / 10 ) ) * 10 ; } else { ddd = d ; } if ( e % 10 ! = 0 ) { double eee = ( Math . ceil ( e / 10 ) ) * 10 ; } else { eee = e ; } double zzz = aaa + bbb + ccc + ddd + eee + min - 10 ; int ans = ( int ) zzz ; System . out . println ( ans ) ; } } import java . util . Scanner public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int C = sc . nextInt ( ) ; if ( A = = 7 | | B = = 7 | | C = = 7 ) { if ( A = = 7 ) { if ( B = = 5 & & C = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( B = = 7 ) { if ( C = = 5 & & A = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } else if ( C = = 7 ) { if ( A = = 5 & & B = = 5 ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } else { System . out . println ( " no " ) ; } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Div64 { public static void main ( String [ ] args ) { MyScanner sc = new MyScanner ( ) ; long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long c = ( long ) Math . round ( ( a + b ) / 2.0 ) ; System . out . println ( c ) ; } private 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 N = sc . nextInt ( ) ; int [ ] t = new int [ N ] ; int [ ] a = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { t [ i ] = sc . nextInt ( ) ; a [ i ] = sc . nextInt ( ) ; } long [ ] dp = new long [ N ] ; dp [ 0 ] = t [ 0 ] + a [ 0 ] ; for ( int i = 1 ; i < N ; i + + ) { long t = ( dp [ i - 1 ] * t [ i - 1 ] ) / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ; long a = ( dp [ i - 1 ] * a [ i - 1 ] ) / ( long ) ( t [ i - 1 ] + a [ i - 1 ] ) ; long rate = Math . max ( ( long ) Math . ceil ( ( double ) t / ( double ) t [ i ] ) , ( long ) Math . ceil ( ( double ) a / ( double ) a [ i ] ) ) ; dp [ i ] = rate * ( long ) ( t [ i ] + a [ i ] ) ; } System . out . println ( dp [ N - 1 ] ) ; } } public class TEST { public static void main ( String [ ] args ) { int x = 3 ; for ( int i = 0 ; i < 2 ; i + + ) { x = x * 3 ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputstreamReadar ; public class Main { public static void main ( string [ ] args ) { BufferedReadar reader = new BufferdReader ( new InputstreamReader ( system . in ) ) ; string word ; try { word = read . readLine ( ) ; int num = Integer . parseInt ( word ) ; intans = num * num * num ; system . out . println ( ans ) ; } catch ( IOException e ) { e . printStackTrace ( 9 ; } finaly { try { reader . closs ( ) ; } catch ( IOException e ) e . printStackTrace ( ) ; } } } } import java . util . * ; public class xCubic { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; System . out . println ( Math . found ( Math . pow ( x , 3 ) ) ) ; } } public class Cubic { public static void main ( String [ ] args ) { int result = 0 ; System . out . println ( " Enter the x value " ) ; Scanner input = new Scanner ( System . in ) ; int x = input . nextInt ( ) ; if ( x > = 1 & & x < = 100 ) { result = x * x * x ; System . out . println ( " X cubic value " + result ) ; } else { System . out . println ( " Your input must between 1 and 100 ! " ) ; } } } public class Main { public int main ( String [ ] args ) { int r ; int mensseki = r ^ 2 ; system . Out . Println ( menseki ) ; return menseki ; } } class Main { public static void main ( String args [ ] ) { x = 3 ; System . out . println ( x ^ 3 ) ; } } import java . util . Scanner ; import java . lang . * ; public class Main { public static int count = 0 ; public static void counter ( int fh , int hd , int ft , int goal ) { int maxFH = Math . min ( goal / 500 , fh ) ; for ( int i = 0 ; i < = maxFH ; i + + ) { int postFH = goal - i * 500 ; int maxHD = 0 ; if ( postFH > 0 ) maxHD = Math . min ( postFH / 100 , hd ) ; } for ( int j = 0 ; j < = maxHD ; j + + ) { int postHD = postFH - j * 100 ; int maxFT = 0 ; if ( postHD > 0 ) { maxFT = Math . min ( postHD / 50 , ft ) ; } for ( int k = 0 ; k < = maxFT ; k + + ) { int remainder = postHD - k * 50 ; if ( remainder = = 0 ) count + + ; } } } } public static void main ( String [ ] args ) { Scanner dataScanner = new Scanner ( System . in ) ; int goal = Integer . parseInt ( dataScanner . nextLine ( ) ) ; int fiveHundred = Integer . parseInt ( dataScanner . nextLine ( ) ) ; int hundred = Integer . parseInt ( dataScanner . nextLine ( ) ) ; int fifty = Integer . parseInt ( dataScanner . nextLine ( ) ) ; counter ( fiveHundred , hundred , fifty , goal ) ; System . out . println ( count ) ; } } public class Main { public static void main ( String [ ] args ) { int num = x ; System . out . println ( cubic ( num ) ) ; public static int cubic ( int num ) { result = num ^ 3 ; return result ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scaner sc = new Scanner ( System . in ) ; Long n = sc . nextLong ( ) ; Long p = sc . nextLong ( ) ; if ( n = = 1 ) System . out . println ( p ) ; else System . out . println ( 1 ) ; } } public class HelloWorld { public static void main ( String [ ] args ) { System . out . println ( 1 ) ; } } import java . io . * ; public class Main { public static void main ( String args [ ] ) { int x ; InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; try { String but = br . readLine ( ) ; } catch ( Exception e ) { x = 0 ; } x = Integer . parseInt ( but ) ; if ( x > = 0 & & x < = 100 ) { x = x * x * x ; } } } import java . util . Scanner ; public class x { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; System . out . println ( a * a * a ) ; } } public class Main { public void solve ( ) { Scanner sc = new Scanner ( System . in ) ; System . out . print ( " x : " ) ; i t x = s .n e xtInt ( ) ; S stem.o u t.p r intln ( x * x * x ; } p blic s atic v id m in ( S t ring [ ] a gs ) { M in o j = n w M in ( ) ; o j.s o lve ( ) ; } } class main1 { public Main ( ) { String S ; if ( S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int A , B , H , M ; try { String [ ] contexts = reader . readLine ( ) . split ( " " ) ; A = Integer . parseInt ( contexts [ 0 ] ) ; B = Integer . parseInt ( contexts [ 1 ] ) ; H = Integer . parseInt ( contexts [ 2 ] ) ; M = Integer . parseInt ( contexts [ 3 ] ) ; } finally { reader . close ( ) ; } int intAngle = Math . abs ( ( 360 / 12 ) * H - ( 360 / 60 ) * M ) ; double dblLen ; dblLen + = Math . pow ( A * 1.0 , 2.0 ) dblLen + = Math . pow ( B * 1.0 , 2.0 ) dblLen - = 2.0 * A * B * Math . cos ( Math . toRadians ( intAngle ) ) ; System . out . print ( sqrt ( dblLen ) ) ; } main ( c , d ) { while ( scanf ( " % d % d " , & c , & d ) + 1 ) printf ( " % d \ n " , c + d ) ; } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Int coina ; Int coinb ; Int toyc ; Scanner sc = new Scanner ( System . in ) ; System . out . println ( " Coin A Coin B Toy 's price " ) ; coina = sc . nextInt ( ) ; coinb = sc . nextInt ( ) ; toyc = sc . nextInt ( ) ; if ( coina + coinb < toyc ) { System . out . println ( " no " ) ; } else { System . out . println ( " yes " ) ; } } } import java . util . Scanner ; public class main { public static void main ( String [ ] args ) { Scanner tc = new Scanner ( System . in ) ; int N , K ; N = tc . nextInt ( ) ; K = tc . nextInt ( ) ; if ( N > K ) { int D = N - K ; System . out . println ( D ) ; } if ( K > N ) { int D = K - N ; System . out . println ( D ) ; } } } >>>>>>> 8996b926c73349dbddddb9d17e833321d64e26e1