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 ) ; FMitsui solver = new FMitsui ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class FMitsui { public void solve ( int testNumber , Scanner in , PrintWriter out ) { long t1 = in . nextLong ( ) ; long t2 = in . nextLong ( ) ; long a1 = in . nextLong ( ) ; long a2 = in . nextLong ( ) ; long b1 = in . nextLong ( ) ; long b2 = in . nextLong ( ) ; long suma1 = a1 * t1 ; long suma2 = a2 * t2 ; long sumb1 = b1 * t1 ; long sumb2 = b2 * t2 ; long asum = suma1 + suma2 ; long bsum = sumb1 + sumb2 ; if ( asum > bsum ) { if ( suma1 > sumb1 ) { out . println ( " 0 " ) ; } else { long dif = asum - bsum ; long tmpdif = sumb1 - suma1 ; if ( tmpdif % dif = = 0 ) { out . println ( tmpdif / dif * 2 ) ; } else { out . println ( tmpdif / dif * 2 + 1 ) ; } } } if ( asum < bsum ) { if ( suma1 < sumb1 ) { out . println ( " 0 " ) ; } else { long diff = bsum - asum ; long tmpdiff = suma1 - sumb1 ; if ( tmpdiff % diff = = 0 ) { out . println ( tmpdiff / diff * 2 ) ; } else { out . println ( tmpdiff / diff * 2 + 1 ) ; } } } if ( asum = = bsum ) { out . println ( " infinity " ) ; } } } } import java . io . IOException ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int maxCount = 0 ; int highest = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int copy = i ; int count = 0 ; while ( copy % 2 = = 0 ) { count + + ; copy / = 2 ; } if ( count > = maxCount ) { maxCount = count ; highest = i ; } } System . out . println ( highest ) ; } } 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 [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = scan . nextInt ( ) ; } int count = 1 ; int min = P [ 0 ] ; if ( N = = 1 ) { System . out . println ( 1 ) ; } else { for ( int i = 0 ; i < N - 1 ; i + + ) { if ( P [ i ] > P [ i + 1 ] & & min > = P [ i + 1 ] ) { min = P [ i + 1 ] ; count + = 1 ; } } System . out . println ( count ) ; } } } } import java . util . * ; import java . io . * ; import java . math . * ; public class Main { public static void main ( String omkar [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int A = Integer . parseInt ( st . nextToken ( ) ) ; int B = Integer . parseInt ( st . nextToken ( ) ) ; int C = Integer . parseInt ( st . nextToken ( ) ) ; int D = Integer . parseInt ( st . nextToken ( ) ) ; double a1 = ( C + 1.0 * D / 60 ) * ( Math . PI / 6.0 ) ; double a2 = 2 * Math . PI * ( 1.0 * D / 60 ) ; double dif = Math . abs ( a1 - a2 ) ; dif = Math . min ( dif , 2 * Math . PI - dif ) ; double res = A * A + B * B - 2 * A * B * Math . cos ( dif ) ; System . out . println ( Math . sqrt ( res ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int data [ ] = new int [ 5 ] ; data [ 0 ] = sc . nextInt ( ) ; data [ 1 ] = sc . nextInt ( ) ; data [ 2 ] = sc . nextInt ( ) ; data [ 3 ] = sc . nextInt ( ) ; data [ 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 ( data [ i ] - data [ j ] ) > k ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yay ! " ) ; } } import java . io . PrintStream ; import java . util . Scanner ; public class Main { static final PrintStream out = System . out ; static Scanner sc = new Scanner ( System . in ) ; static final long Mod = 1000 _ 000 _ 007L ; public static void main ( String [ ] args ) { Main main = new Main ( ) ; main . solve ( ) ; System . exit ( 0 ) ; } void solve ( ) { int K = nextInt ( ) ; int S = nextInt ( ) ; int cnt = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int num = i + j ; if ( num + K > = S & & num < = S ) { cnt + + ; } else if ( num > S ) { break ; } } } out . println ( cnt ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } public String next ( ) { return sc . next ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s1 = sc . nextInt ( ) ; int s2 = sc . nextInt ( ) ; int cnt = 0 ; int sa = 0 ; for ( int x = 0 ; x < = s1 ; x + + ) { for ( int y = 0 ; y < = s1 ; y + + ) { sa = s2 - x - y ; if ( sa > = 0 & & sa < = s1 ) { cnt + + ; } } } System . out . println ( cnt ) ; sc . close ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double n = scan . nextDouble ( ) ; double ans = 0 ; double count = 0 ; for ( double i = 0 ; ; i + + ) { if ( Math . pow ( 2 , i ) < = n ) { count + + ; } else { break ; } } System . out . println ( ( int ) Math . pow ( 2 , count - 1 ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { try ( Scanner sc = new Scanner ( System . in ) ) { int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; int [ ] [ ] population = new int [ h ] [ w ] ; int [ ] hSum = new int [ h ] ; int [ ] wSum = new int [ w ] ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { population [ i ] [ j ] = sc . nextInt ( ) ; } } int min = 10000000 ; for ( int i = 0 ; i < h ; i + + ) { for ( int j = 0 ; j < w ; j + + ) { int count = 0 ; for ( int k = 0 ; k < h ; k + + ) { for ( int l = 0 ; l < w ; l + + ) { int toh = Math . abs ( k - i ) ; int tow = Math . abs ( j - l ) ; count + = Math . min ( toh , tow ) * population [ k ] [ l ] ; } } min = Math . min ( min , count ) ; } } System . out . println ( min ) ; } } } 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 ( ) ; } int ans = 0 ; int min = n + 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > p [ i ] ) { 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 fiveCnt = 0 ; int sevenCnt = 0 ; List < Integer > list = new ArrayList < > ( ) ; list . add ( sc . nextInt ( ) ) ; list . add ( sc . nextInt ( ) ) ; list . add ( sc . nextInt ( ) ) ; for ( int value : list ) { if ( value = = 5 ) { fiveCnt + + ; } if ( value = = 7 ) { sevenCnt + + ; } } if ( fiveCnt = = 2 & & sevenCnt = = 1 ) { 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 ) ; ArrayList < Integer > cList = new ArrayList < > ( ) ; for ( int i = 0 ; i < 9 ; i + + ) { cList . add ( sc . nextInt ( ) ) ; } if ( ! verticalCheck ( cList , 0 ) | | ! verticalCheck ( cList , 3 ) ) { System . out . println ( " No " ) ; return ; } if ( ! horizonCheck ( cList , 0 ) | | ! horizonCheck ( cList , 1 ) ) { System . out . println ( " No " ) ; return ; } System . out . println ( " Yes " ) ; } private static boolean verticalCheck ( ArrayList < Integer > cList , Integer start ) { Integer v1 = cList . get ( start + 3 ) - cList . get ( start ) ; Integer v2 = cList . get ( start + 4 ) - cList . get ( start + 1 ) ; Integer v3 = cList . get ( start + 5 ) - cList . get ( start + 2 ) ; return v1 = = v2 & & v2 = = v3 ; } private static boolean horizonCheck ( ArrayList < Integer > cList , Integer start ) { Integer v1 = cList . get ( start + 1 ) - cList . get ( start ) ; Integer v2 = cList . get ( start + 4 ) - cList . get ( start + 3 ) ; Integer v3 = cList . get ( start + 7 ) - cList . get ( start + 6 ) ; return v1 = = v2 & & v2 = = v3 ; } } 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 wmin = 3 * N > > 2 ; if ( N % 4 ! = 0 ) + + wmin ; for ( long w = wmin ; w < = 3500 ; + + w ) { for ( long n = w ; n > = 1 ; -- n ) { long denominator = 4 * n * w - N * ( w + n ) ; long numerator = N * n * w ; if ( numerator % denominator ! = 0 ) continue ; long h = numerator / denominator ; if ( h > 0 & & h < = n ) { System . out . printf ( " % d % d % d " , 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 ( ) ; int [ ] list = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) list [ i ] = sc . nextInt ( ) ; int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = list [ i ] ) { count + + ; min = list [ i ] ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; for ( int i = 0 ; i < num . length ; i + + ) { num [ i ] = sc . nextInt ( ) ; } int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < num . length ; i + + ) { if ( num [ i ] = = 5 ) { count5 + + ; } else if ( num [ i ] = = 7 ) { count7 + + ; } else { break ; } } 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 ) ; String s = sc . nextLine ( ) ; System . out . println ( s . contains ( " 1 " ) & & s . contains ( " 9 " ) & & s . contains ( " 7 " ) & & s . contains ( " 4 " ) ? " YES " : " NO " ) ; sc . close ( ) ; } } 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 n = sc . nextInt ( ) ; sc . close ( ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { ans = ( int ) Math . pow ( 2 , i ) ; if ( ans > n ) { ans = ( int ) Math . pow ( 2 , i - 1 ) ; break ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int [ ] n = { scanner . nextInt ( ) , scanner . nextInt ( ) , scanner . nextInt ( ) , scanner . nextInt ( ) } ; Arrays . sort ( n ) ; System . out . println ( Arrays . equals ( n , new int [ ] { 1 , 4 , 7 , 9 } ) ? " YES " : " 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { int num = 0 ; int result1 = 1 ; int result2 = 0 ; boolean flag ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { num = Integer . parseInt ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } for ( int i = 1 ; i < = num ; i + + ) { int count = 0 ; int temp = i ; flag = true ; do { if ( temp % 2 ! = 0 ) { if ( result2 < count ) { result1 = i ; result2 = count ; } flag = false ; } else { temp = temp / 2 ; count + + ; } } while ( flag ) ; } System . out . println ( result1 ) ; } } 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 ) ; System . out . println ( ( A [ 2 ] - A [ 1 ] ) + ( A [ 1 ] - A [ 0 ] ) ) ; } } 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 . 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 a = in . nextInt ( ) ; in . nextInt ( ) ; in . nextInt ( ) ; in . nextInt ( ) ; int e = in . nextInt ( ) ; int k = in . nextInt ( ) ; if ( e - a < = k ) out . println ( " Yay ! " ) ; else out . println ( " : ( " ) ; } } 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 l = Math . min ( s , k ) ; int total = 0 ; for ( int i = l ; i > = 0 ; i -- ) { int m = Math . min ( s - i , k ) ; if ( s - i < k ) { total + = m + 1 ; } else { total + = Math . max ( k - ( s - i - m ) + 1 , 0 ) ; } } System . out . println ( total ) ; } } 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 = 0 ; for ( int i = 0 ; i < = a ; i + + ) { for ( int j = 0 ; j < = a ; j + + ) { if ( b - i - j > = 0 & & b - i - j < = a ) { c + + ; } } } System . out . println ( c ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayDeque ; import java . util . Queue ; import java . util . LinkedList ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; } void solve ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String [ ] S = new String [ N ] ; int s [ ] = new int [ 4 ] ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { S [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( S [ i ] . charAt ( 0 ) = = ' P ' ) s [ 0 ] + + ; if ( S [ i ] . charAt ( 0 ) = = ' W ' ) s [ 1 ] + + ; if ( S [ i ] . charAt ( 0 ) = = ' G ' ) s [ 2 ] + + ; if ( S [ i ] . charAt ( 0 ) = = ' Y ' ) s [ 3 ] + + ; } for ( int i = 0 ; i < 4 ; i + + ) { if ( s [ i ] > 0 ) { ans + + ; } } if ( ans = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; import java . lang . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int maxD = 1 ; while ( maxD < = N ) { maxD * = 2 ; } System . out . println ( maxD / 2 ) ; } } 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 ) { final long mod = ( long ) 1e9 + 7 ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; if ( n < m ) { int t = m ; m = n ; n = t ; } if ( n - m > = 2 ) { out . println ( 0 ) ; return ; } if ( n = = m + 1 ) { long ret = 1 ; for ( int i = 1 ; i < = m ; i + + ) { ret = ret * i % mod * i % mod ; } ret = ret * n % mod ; out . println ( ret ) ; } else { long ret = 2 ; for ( int i = 1 ; i < = n ; i + + ) ret = ret * i % mod * i % mod ; out . println ( ret ) ; } } } } 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 sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int min = p [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > = p [ i ] ) { min = p [ i ] ; sum + + ; } } System . out . println ( sum ) ; } } 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 z ; int count = 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 + = 1 ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = 0 ; for ( int i = 0 ; i < 3 ; i + + ) s + = sc . nextInt ( ) ; if ( s = = 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 ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) * 60 ; int w = sc . nextInt ( ) ; double radA = 2 * Math . PI / ( 12 * 60 ) ; double radB = 2 * Math . PI / 60 ; double x = Math . abs ( w * radB - ( h + w ) * radA ) ; double ans2 = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( x ) ; double ans = Math . sqrt ( ans2 ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { final Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; if ( 64 < = N ) { System . out . println ( 64 ) ; } else if ( 32 < = N ) { System . out . println ( 32 ) ; } else if ( 16 < = N ) { System . out . println ( 16 ) ; } else if ( 8 < = N ) { System . out . println ( 8 ) ; } else if ( 4 < = N ) { System . out . println ( 4 ) ; } else if ( 2 < = N ) { System . out . println ( 2 ) ; } else { System . out . println ( 1 ) ; } } } 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 k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { if ( 0 < = s - ( i + j ) & & s - ( i + j ) < = k ) result + + ; } } 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 . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; String [ ] arr = br . readLine ( ) . split ( " " ) ; Arrays . sort ( arr ) ; out . println ( arr [ 0 ] . equals ( " 1 " ) & & arr [ 1 ] . equals ( " 4 " ) & & arr [ 2 ] . equals ( " 7 " ) & & arr [ 3 ] . equals ( " 9 " ) ? " YES " : " NO " ) ; out . close ( ) ; } } import java . math . BigDecimal ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigDecimal a = sc . nextBigDecimal ( ) ; BigDecimal b = sc . nextBigDecimal ( ) ; BigDecimal h = sc . nextBigDecimal ( ) ; BigDecimal m = sc . nextBigDecimal ( ) ; BigDecimal hangle = new BigDecimal ( 360 ) . divide ( new BigDecimal ( 12 ) ) . multiply ( h ) . add ( m . multiply ( new BigDecimal ( 0.5 ) ) ) ; BigDecimal mangle = new BigDecimal ( 360 ) . divide ( new BigDecimal ( 60 ) ) . multiply ( m ) ; BigDecimal diffangle = hangle . subtract ( mangle ) . abs ( ) ; if ( diffangle . compareTo ( new BigDecimal ( 180 ) ) > 0 ) { diffangle = new BigDecimal ( 360 ) . subtract ( diffangle ) ; } BigDecimal cpow ; if ( diffangle . compareTo ( new BigDecimal ( 90 ) ) = = 0 ) { BigDecimal apow = a . pow ( 2 ) ; BigDecimal bpow = b . pow ( 2 ) ; cpow = apow . add ( bpow ) ; } else { BigDecimal cos = new BigDecimal ( Math . cos ( Math . toRadians ( diffangle . doubleValue ( ) ) ) ) ; BigDecimal apow = a . pow ( 2 ) ; BigDecimal bpow = b . pow ( 2 ) ; cpow = apow . add ( bpow ) . subtract ( new BigDecimal ( 2 ) . multiply ( a ) . multiply ( b ) . multiply ( cos ) ) ; } System . out . println ( Math . sqrt ( cpow . doubleValue ( ) ) ) ; } } 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 HR = 30 * H + M * 0.5 ; double MR = 360 / 60 * M ; double r = Math . abs ( HR - MR ) ; double cos = Math . cos ( Math . toRadians ( r ) ) ; double result = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * cos ; result = Math . sqrt ( result ) ; System . out . println ( result ) ; } } import java . util . * ; public class Main { static long MOD = 1000000007 ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; int [ ] x = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) x [ i ] = sc . nextInt ( ) ; int [ ] y = new int [ M ] ; for ( int i = 0 ; i < M ; i + + ) y [ i ] = sc . nextInt ( ) ; System . out . println ( ( calc ( x ) * calc ( y ) ) % MOD ) ; sc . close ( ) ; } static long calc ( int [ ] p ) { int N = p . length ; long ans = 0 ; for ( int i = 0 ; i < N - 1 ; i + + ) { long mul = ( ( long ) ( i + 1 ) * ( N - 1 - i ) ) % MOD ; ans = ( ans + mul * ( p [ i + 1 ] - p [ i ] ) ) % MOD ; } return 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 ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class Task { public void solve ( int testNumber , Scanner in , PrintWriter out ) { int N = in . nextInt ( ) ; int nums [ ] = CPUtils . readIntArray ( N , in ) ; int min = nums [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < N ; i + + ) { if ( min > = nums [ i ] ) count + + ; min = Math . min ( min , nums [ i ] ) ; } out . print ( count ) ; } } static class CPUtils { public static int [ ] readIntArray ( int size , Scanner in ) { int [ ] array = new int [ size ] ; for ( int i = 0 ; i < size ; i + + ) { array [ i ] = in . nextInt ( ) ; } return array ; } } } 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 . 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 str [ ] = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( str [ 0 ] ) ; int s = Integer . parseInt ( str [ 1 ] ) ; int count = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( x + y > s ) { break ; } int z = s - ( x + y ) ; if ( z < = k ) { count + + ; } } } System . out . println ( count ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Scanner ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; static void p ( String ans ) { System . out . println ( ans ) ; } ; static void p ( int ans ) { System . out . println ( ans ) ; } ; static void p ( long ans ) { System . out . println ( ans ) ; } ; static void p ( double ans ) { System . out . println ( ans ) ; } ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int p [ ] = new int [ N ] ; int min = 0 ; int ctn = 0 ; for ( int i = 0 ; i < N ; i + + ) { p [ i ] = sc . nextInt ( ) ; if ( i = = 0 ) { min = p [ i ] ; } if ( min > = p [ i ] ) { min = p [ i ] ; ctn + + ; } } p ( ctn ) ; } static boolean te ( ) { return true ; } } 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 ) ; List < Integer > list = new ArrayList < Integer > ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; n > i ; i + + ) { int a = sc . nextInt ( ) ; list . add ( a ) ; } int count = 0 ; int min = 1000000 ; for ( int i = 0 ; n > i ; i + + ) { int a = list . get ( i ) ; if ( min > a ) { min = a ; count + + ; } } System . out . println ( count ) ; } } 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 a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; String result = " Yay ! " ; if ( e - a > k ) 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 = new int [ 10 ] ; for ( int i = 0 ; i < 4 ; i + + ) { int tmp = sc . nextInt ( ) ; n [ tmp ] + + ; } 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 . * ; 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 ) { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ) { Iterator < String > tokens = reader . lines ( ) . map ( s - > s . split ( " " ) ) . flatMap ( Arrays : : stream ) . iterator ( ) ; Solver . INSTANCE . solve ( tokens ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } } 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 s = sc . next ( ) ; if ( " Y " . equals ( s ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int ans = 1 ; for ( int i = 1 ; i < N ; i + + ) { int a = sc . nextInt ( ) ; if ( H > = a ) { ans + + ; } H = Math . min ( a , H ) ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { static int [ ] [ ] memory ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int count = 0 ; boolean [ ] color = { false , false , false , false } ; for ( int i = 0 ; i < N ; i + + ) { String line = sc . next ( ) ; if ( ' P ' = = line . charAt ( 0 ) & & ! color [ 0 ] ) { color [ 0 ] = true ; count + + ; } else if ( ' W ' = = line . charAt ( 0 ) & & ! color [ 1 ] ) { color [ 1 ] = true ; count + + ; } else if ( ' G ' = = line . charAt ( 0 ) & & ! color [ 2 ] ) { color [ 2 ] = true ; count + + ; } else if ( ' Y ' = = line . charAt ( 0 ) & & ! color [ 3 ] ) { color [ 3 ] = true ; count + + ; } if ( count = = 4 ) break ; } if ( color [ 3 ] ) 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 ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double ans = 0 ; double hAng = ( 60 * h + m ) / 2 ; double mAng = m * 6 ; double diff = Math . abs ( hAng - mAng ) ; ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( diff ) ) ) ; 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 [ ] a = new int [ 3 ] ; a [ 0 ] = sc . nextInt ( ) ; a [ 1 ] = sc . nextInt ( ) ; a [ 2 ] = 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 ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final var A = scanner . nextDouble ( ) ; final var B = scanner . nextDouble ( ) ; final var H = scanner . nextDouble ( ) ; final var M = scanner . nextDouble ( ) ; final var alpha = ( 2.0d * Math . PI ) * ( H / 12.0d ) + ( 2.0d * Math . PI ) * ( 1.0d / 12.0d ) * ( M / 60.d ) ; final var beta = ( 2.0d * Math . PI ) * ( M / 60.0d ) ; final var theta = Math . abs ( alpha - beta ) ; if ( Double . compare ( theta , 0.0d ) = = 0 ) { System . out . printf ( " % 1.12f \ n " , Math . abs ( A - B ) ) ; return ; } if ( Double . compare ( theta , Math . PI ) = = 0 ) { System . out . printf ( " % 1.12f \ n " , A + B ) ; } else { final var gamma = theta > Math . PI ? 2 * Math . PI - theta : theta ; final var C = Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2.0d * A * B * Math . cos ( gamma ) ; final var c = Math . sqrt ( C ) ; System . out . printf ( " % 1.12f \ n " , c ) ; } } } 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 . Scanner ; 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 ( ) ; 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 [ ] intArray = new int [ n ] ; int count = 1 ; for ( int i = 0 ; i < n ; i + + ) { intArray [ i ] = sc . nextInt ( ) ; } int min = intArray [ 0 ] ; for ( int i = 1 ; i < intArray . length ; i + + ) { if ( min > intArray [ i ] ) { min = intArray [ 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 ( ) ; 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 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int SC = 0 , FC = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int tmp = sc . nextInt ( ) ; if ( tmp = = 5 ) FC + + ; else if ( tmp = = 7 ) SC + + ; } String ans = " NO " ; if ( FC = = 2 & & SC = = 1 ) ans = " YES " ; System . out . println ( ans ) ; return ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int s = sc . nextInt ( ) + sc . nextInt ( ) ; System . out . println ( s = = 0 ? 0 : s / Math . abs ( s ) ) ; } } 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 ; for ( int i = 0 ; i < n ; i + + ) { String a = sc . next ( ) ; if ( a . equals ( " Y " ) ) { c + + ; } } if ( c ! = 0 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } sc . close ( ) ; } } 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 [ ] array = new int [ 5 ] ; for ( int i = 0 ; i < array . length ; i + + ) { array [ i ] = in . nextInt ( ) ; } int k = in . nextInt ( ) ; String ans = " Yay ! " ; for ( int i = 0 ; i < array . length ; i + + ) { for ( int j = i + 1 ; j < array . length ; j + + ) { if ( array [ j ] - array [ i ] > k ) { ans = " : ( " ; break ; } } } 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 ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int [ ] c = new int [ 6 ] ; for ( int i = 0 ; i < 9 ; i + + ) { int a = scn . nextInt ( ) ; if ( i < 3 ) { c [ 2 * i ] + = a ; c [ 2 * i + 1 ] + = a ; } else { if ( i = = 3 ) { c [ 2 ] + = a ; c [ 4 ] + = a ; } if ( i = = 4 ) { c [ 0 ] + = a ; c [ 5 ] + = a ; } if ( i = = 5 ) { c [ 1 ] + = a ; c [ 3 ] + = a ; } if ( i = = 6 ) { c [ 3 ] + = a ; c [ 5 ] + = a ; } if ( i = = 7 ) { c [ 1 ] + = a ; c [ 4 ] + = a ; } if ( i = = 8 ) { c [ 0 ] + = a ; c [ 2 ] + = a ; } } } boolean ans = true ; for ( int i = 0 ; i < 6 ; i + + ) { ans & = ( c [ i ] = = c [ 0 ] ) ; } 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 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 ( k > = e - a ? " Yay ! " : " : ( " ) ; } } import java . util . * ; import java . io . * ; class Main { void solve ( ) { int a = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) , d = in . nextInt ( ) , e = in . nextInt ( ) ; int k = in . nextInt ( ) ; out . println ( e - a < = k ? " Yay ! " : " : ( " ) ; } 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 ( ) ; } } 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 ! = 17 ) { System . out . println ( " NO " ) ; return ; } if ( a = = 5 ) { if ( b = = 5 | | b = = 7 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; return ; } if ( a = = 7 ) { if ( b = = 5 ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; return ; } 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 . next ( ) ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( n < ( int ) Math . round ( Math . pow ( 2 , i ) ) ) break ; ans = ( int ) Math . round ( Math . pow ( 2 , 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 ( ) ; int S = sc . nextInt ( ) ; int k = 0 ; int ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { k = S - i - j ; if ( ( k < = K ) & & ( k > = 0 ) ) { 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 cnt5 = 0 , cnt7 = 0 ; for ( int i = 0 ; i < 3 ; + + i ) { int x = sc . nextInt ( ) ; if ( x = = 5 ) + + cnt5 ; else if ( x = = 7 ) + + cnt7 ; } System . out . println ( ( cnt5 = = 2 & & cnt7 = = 1 ) ? " YES " : " NO " ) ; sc . close ( ) ; } } import java . io . * ; import java . util . * ; class Main { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static FastScanner sc = new FastScanner ( br ) ; static PrintWriter out = new PrintWriter ( System . out ) ; static Random rnd = new Random ( ) ; public static void main ( String args [ ] ) throws Exception { int k = sc . nextInt ( ) , s = sc . nextInt ( ) , ans = 0 ; for ( int i = 0 ; i < = k ; i + + ) { for ( int j = 0 ; j < = k ; j + + ) { int curr = s - i - j ; if ( curr > = 0 & & curr < = k ) { ans + + ; } } } out . println ( ans ) ; out . close ( ) ; } } class FastScanner { BufferedReader in ; StringTokenizer st ; public FastScanner ( BufferedReader in ) { this . in = in ; } public String nextToken ( ) throws Exception { while ( st = = null | | ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } public String next ( ) throws Exception { return nextToken ( ) . toString ( ) ; } public int nextInt ( ) throws Exception { return Integer . parseInt ( nextToken ( ) ) ; } public long nextLong ( ) throws Exception { return Long . parseLong ( nextToken ( ) ) ; } public double nextDouble ( ) throws Exception { return Double . parseDouble ( nextToken ( ) ) ; } } import java . util . Scanner ; 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 = = 17 ) { 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 . PrintStream ; 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 A = in . nextInt ( ) ; int B = in . nextInt ( ) ; int H = in . nextInt ( ) ; int M = in . 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 . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; public class Main { static int X = 0 ; static int Y = 0 ; static int Z = 0 ; static int answer = 0 ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( new InputStreamReader ( System . in ) ) ; int K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; sc . close ( ) ; setNumber ( K , S ) ; execute ( K , S ) ; System . out . println ( answer ) ; } static void setNumber ( int k , int s ) { if ( k > = s ) { X = s ; return ; } else { X = k ; s = s - k ; if ( k > = s ) { Y = s ; return ; } else { Y = k ; Z = s - k ; return ; } } } static void execute ( int K , int S ) { int check = 0 ; int x = X ; int y = Y ; int z = Z ; for ( ; x > = Math . ceil ( ( double ) S / 3 ) ; x -- ) { for ( ; y > = z ; y -- ) { if ( x > = y ) { check = checkCombi ( x , y , z ) ; if ( check = = 0 ) { answer + = 6 ; } else if ( check = = 2 ) { answer + = 3 ; } else if ( check = = 3 ) { answer + = 1 ; } } z + + ; } Y + + ; y = Y ; z = Z ; } } static int checkCombi ( int x , int y , int z ) { if ( ( x = = y ) & & ( x = = z ) ) { return 3 ; } else if ( ( x = = y ) | | ( x = = z ) | | ( y = = z ) ) { return 2 ; } else { return 0 ; } } } import java . util . Scanner ; import java . util . Arrays ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; String result ; for ( int cnt = 0 ; cnt < 3 ; cnt + + ) { nums [ cnt ] = sc . nextInt ( ) ; } Arrays . sort ( nums ) ; result = ( nums [ 0 ] = = 5 & & nums [ 1 ] = = 5 & & nums [ 2 ] = = 7 ) ? " YES " : " NO " ; 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 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 + + ) { if ( A [ j ] < = T [ i ] & & T [ i ] < = B [ j ] ) for ( int k = 0 ; k < N ; k + + ) { if ( 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 void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; sc . nextLine ( ) ; String b = sc . nextLine ( ) ; String p = " P " ; String w = " W " ; String g = " G " ; String y = " Y " ; int result1 = b . indexOf ( p ) ; if ( result1 ! = - 1 ) { result1 = 1 ; } else { result1 = 0 ; } int result2 = b . indexOf ( w ) ; if ( result2 ! = - 1 ) { result2 = 1 ; } else { result2 = 0 ; } int result3 = b . indexOf ( g ) ; if ( result3 ! = - 1 ) { result3 = 1 ; } else { result3 = 0 ; } int result4 = b . indexOf ( y ) ; if ( result4 ! = - 1 ) { result4 = 1 ; } else { result4 = 0 ; } int c = result1 + result2 + result3 + result4 ; if ( c = = 3 ) { System . out . println ( " Three " ) ; } else if ( c = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " ERROR " ) ; } } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = scanner . nextInt ( ) ; } int [ ] [ ] min = new int [ n ] [ n ] ; for ( int i = 0 ; i < n ; i + + ) { min [ i ] [ 0 ] = a [ i ] ; for ( int j = 1 ; j < n ; j + + ) { min [ i ] [ j ] = Math . min ( min [ i ] [ j - 1 ] , a [ ( i + n - j ) % n ] ) ; } } long ans = Long . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { long time = i * x ; for ( int j = 0 ; j < n ; j + + ) { time + = min [ j ] [ i ] ; } ans = Math . min ( ans , time ) ; } 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 + + ) { c [ 0 ] [ i ] = sc . nextInt ( ) ; c [ 1 ] [ i ] = sc . nextInt ( ) ; c [ 2 ] [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < 3 ; i + + ) { for ( int j = 1 ; j < 3 ; j + + ) { if ( c [ i - 1 ] [ j - 1 ] - c [ i ] [ j - 1 ] ! = c [ i - 1 ] [ j ] - c [ i ] [ j ] ) { System . out . println ( " No " ) ; System . exit ( 0 ) ; } } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { 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 . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] pos = new int [ 5 ] ; for ( int i = 0 ; i < pos . length ; i + + ) { pos [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; boolean judge = true ; int search = 4 ; for ( ; 0 < search ; search -- ) { for ( int i = search - 1 ; 0 < = i ; i -- ) { if ( k < ( pos [ search ] - pos [ i ] ) ) { judge = false ; } } } if ( judge ) { 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 count = 1 ; int min = sc . nextInt ( ) ; for ( int i = 1 ; i < n ; i + + ) { int tmp = sc . nextInt ( ) ; if ( tmp < = min ) { count + + ; min = tmp ; } } System . out . println ( count ) ; } } 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 ( ) ; } int cnt = 1 ; int min = p [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { if ( p [ i ] < = min ) { cnt + + ; min = p [ i ] ; } } 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 ans = 1 ; if ( n < 2 ) 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 ; System . out . println ( ans ) ; } } import java . util . * ; import java . util . stream . Collectors ; import java . io . * ; import java . nio . charset . StandardCharsets ; public class Main { int N ; int [ ] P ; List < Integer > results = new ArrayList < > ( ) ; 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 { N = Integer . parseInt ( in . readLine ( ) ) ; String [ ] tokens = in . readLine ( ) . split ( " " ) ; P = new int [ N ] ; for ( int i = 0 ; i < N ; + + i ) { P [ i ] = Integer . parseInt ( tokens [ i ] ) ; } } void calc ( ) { results . add ( P [ 0 ] ) ; int prevMin = P [ 0 ] ; for ( int i = 1 ; i < N ; + + i ) { if ( prevMin > = P [ i ] ) { results . add ( P [ i ] ) ; prevMin = P [ i ] ; } } } void showResult ( ) { System . out . println ( results . size ( ) ) ; } } import java . util . * ; 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 ( ) . charAt ( 0 ) = = ' Y ' ) ans = " Four " ; 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 h = stdIn . nextInt ( ) ; int m = stdIn . nextInt ( ) ; double thour = 30 * h + 30 * m / 60.0 ; double mhour = 6 * m ; double kakudo = ( Math . abs ( thour - mhour ) ) < 180 ? Math . abs ( thour - mhour ) : 360 - ( Math . abs ( thour - mhour ) ) ; double tmp = b * b + a * a - ( 2 * a * b * Math . cos ( Math . toRadians ( kakudo ) ) ) ; System . out . println ( Math . sqrt ( tmp ) ) ; } } 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 ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( 0 < = s - ( i + j ) & & s - ( i + j ) < = k ) cnt + + ; } } out . println ( cnt ) ; } } 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 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 . 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 ( ) ) ; int max = 0 ; for ( int i = 2 ; i < = n ; i = i * 2 ) { max = Math . max ( max , i ) ; } System . out . println ( n = = 1 ? 1 : max ) ; } } 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 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 . * ; 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 x = Math . max ( 0 , S - 2 * K ) ; x < = Math . min ( K , S ) ; x + + ) { int left = S - x ; ans + = Math . min ( K , left ) - Math . max ( 0 , left - K ) + 1 ; } System . out . println ( ans ) ; } } 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 j = 0 ; j < = K ; j + + ) { if ( ( S - i - j > = 0 ) & & ( S - i - j < = K ) ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . math . BigDecimal ; import java . math . MathContext ; 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 c ; double x = 30.0 * h + 30.0 * m / 60.0 ; double y = 6.0 * m ; double z = Math . abs ( x - y ) ; BigDecimal r = BigDecimal . valueOf ( 2.0 * a * b * Math . cos ( Math . toRadians ( z ) ) ) ; BigDecimal a2 = BigDecimal . valueOf ( a * a ) ; BigDecimal b2 = BigDecimal . valueOf ( b * b ) ; BigDecimal c2 = a2 . add ( b2 ) . subtract ( r ) ; MathContext mc = new MathContext ( 10 ) ; BigDecimal c1 = c2 . sqrt ( mc ) ; System . out . println ( c1 . doubleValue ( ) ) ; } } 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 ) { if ( b = = 5 ) { if ( c = = 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( b = = 7 ) { if ( c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } else if ( a = = 7 ) { if ( b = = 5 ) { if ( c = = 5 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } else { System . out . println ( " NO " ) ; } } } import java . util . * ; 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 kaku = 0 ; double h _ kaku = h * 30 ; if ( m ! = 0 ) { h _ kaku + = m * 0.5 ; } double m _ kaku = m * 6 ; kaku = Math . min ( h _ kaku - m _ kaku , 360 - ( h _ kaku - m _ kaku ) ) ; double ans = 0 ; if ( kaku ! = 90 ) { ans = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( kaku * ( Math . PI / 180 ) ) ; } else { ans = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * 0 ; } 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 k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int count = 0 ; int sub = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { sub = s - ( x + y ) ; if ( 0 < = sub & & sub < = k ) { count + + ; } } } System . out . print ( count ) ; } } 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 ) ) ; String N = br . readLine ( ) ; String [ ] Ns = new String [ 3 ] ; Ns = N . split ( " " ) ; int five = 0 ; int seven = 0 ; if ( Ns [ 0 ] . equals ( " 5 " ) ) { five + + ; } else if ( Ns [ 0 ] . equals ( " 7 " ) ) { seven + + ; } if ( Ns [ 1 ] . equals ( " 5 " ) ) { five + + ; } else if ( Ns [ 1 ] . equals ( " 7 " ) & & seven = = 0 ) { seven + + ; } if ( Ns [ 2 ] . equals ( " 5 " ) & & five < 2 ) { five + + ; } else if ( Ns [ 2 ] . equals ( " 7 " ) & & seven = = 0 ) { 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 scan = new Scanner ( System . in ) ; int k = scan . nextInt ( ) ; int s = scan . nextInt ( ) ; int x = 0 ; int y = 0 ; int z = s - ( x + y ) ; int yz = y + z ; int count = 0 ; for ( x = 0 ; x < = k ; x + + ) { for ( y = 0 ; y < = k ; y + + ) { if ( x + y < = s & & x + y + k > = s ) { count + + ; } } } if ( s = = k * 3 ) { count = 1 ; } System . out . println ( count ) ; } } 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 [ 4 ] ; int n = scan . nextInt ( ) ; while ( n -- > 0 ) { String temp = scan . next ( ) ; switch ( temp ) { case " G " : arr [ 0 ] + + ; break ; case " W " : arr [ 1 ] + + ; break ; case " Y " : arr [ 2 ] + + ; break ; case " P " : arr [ 3 ] + + ; break ; } } int ans = 0 ; for ( int i : arr ) if ( i > 0 ) ans + + ; switch ( ans ) { 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 ; } } } 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 sum5 = 0 ; int sum7 = 0 ; if ( A = = 5 ) { sum5 + + ; } else if ( A = = 7 ) { sum7 + + ; } if ( B = = 5 ) { sum5 + + ; } else if ( B = = 7 ) { sum7 + + ; } if ( C = = 5 ) { sum5 + + ; } else if ( C = = 7 ) { sum7 + + ; } if ( sum5 = = 2 & & sum7 = = 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 tc = new Scanner ( System . in ) ; int a , b , c , d , e , k , soma1 , soma2 , soma3 , soma4 , soma5 , soma6 , soma7 , soma8 , soma9 , soma10 ; a = tc . nextInt ( ) ; b = tc . nextInt ( ) ; c = tc . nextInt ( ) ; d = tc . nextInt ( ) ; e = tc . nextInt ( ) ; k = tc . nextInt ( ) ; if ( ( a < b ) & & ( b < c ) & & ( c < d ) & & ( d < e ) ) { soma1 = b - a ; soma2 = c - a ; soma3 = d - a ; soma4 = e - a ; soma5 = c - b ; soma6 = d - b ; soma7 = e - b ; soma8 = d - c ; soma9 = e - c ; soma10 = e - d ; if ( ( soma1 < = k ) & & ( soma2 < = k ) & & ( soma3 < = k ) & & ( soma4 < = k ) & & ( soma5 < = k ) & & ( soma6 < = k ) & & ( soma7 < = k ) & & ( soma8 < = k ) & & ( soma9 < = k ) & & ( soma10 < = 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 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 ( 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 ) ; int n = sc . nextInt ( ) ; int p [ ] = new int [ n ] ; int num ; int count = 1 ; for ( int i = 0 ; i < n ; + + i ) { p [ i ] = sc . nextInt ( ) ; } num = p [ 0 ] ; for ( int i = 1 ; i < p . length ; + + i ) { if ( p [ i ] < num ) { count + = 1 ; num = 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 A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double e = ( 60 * H + M ) * 0.5 - M * 6 ; double r = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( e ) ) ) ; System . out . println ( r ) ; } } import java . util . * ; 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 ( ) ; if ( ( a1 > b1 & & a1 * t1 + a2 * t2 > b1 * t1 + b2 * t2 ) | | ( b1 > a1 & & a1 * t1 + a2 * t2 < b1 * t1 + b2 * t2 ) ) { System . out . println ( 0 ) ; } else if ( a1 * t1 + a2 * t2 = = b1 * t1 + b2 * t2 ) { System . out . println ( " infinity " ) ; } else { long kk = 0 ; if ( ( Math . abs ( a1 * t1 - b1 * t1 ) % Math . abs ( a1 * t1 + a2 * t2 - ( b1 * t1 + b2 * t2 ) ) ) = = 0 ) { kk = - 1 ; } System . out . println ( kk + 1 + 2 * ( Math . abs ( a1 * t1 - b1 * t1 ) / Math . abs ( a1 * t1 + a2 * t2 - ( b1 * t1 + b2 * t2 ) ) ) ) ; } } } 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 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 " ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] num = new String [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { num [ i ] = sc . next ( ) ; } Arrays . sort ( num ) ; StringBuilder s = new StringBuilder ( 4 ) ; for ( String sss : num ) s . append ( sss ) ; if ( " 1479 " . equals ( s . toString ( ) ) ) { 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 [ ] a = br . readLine ( ) . split ( " " ) ; int n5 = 0 ; int n7 = 0 ; for ( int i = 0 ; i < a . length ; i + + ) { if ( Integer . parseInt ( a [ i ] ) = = 5 ) n5 + + ; if ( Integer . parseInt ( a [ i ] ) = = 7 ) n7 + + ; } if ( n5 = = 2 & & n7 = = 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 num [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } int cnt5 = 0 ; int cnt7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( num [ i ] = = 5 ) cnt5 + + ; else if ( num [ i ] = = 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 go = 0 ; int seven = 0 ; int a = sc . nextInt ( ) ; if ( a = = 5 ) go + + ; if ( a = = 7 ) seven + + ; int b = sc . nextInt ( ) ; if ( b = = 5 ) go + + ; if ( b = = 7 ) seven + + ; int c = sc . nextInt ( ) ; if ( c = = 5 ) go + + ; if ( c = = 7 ) seven + + ; String ans = " NO " ; if ( ( go = = 2 ) & & ( seven = = 1 ) ) ans = " YES " ; System . out . println ( ans ) ; } } import java . util . Scanner ; import java . lang . 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 ( ) ; scan . close ( ) ; double rateH = ( double ) ( 60 * H + M ) / 720 ; double rateM = ( double ) M / 60 ; double rateDiff = Math . abs ( rateH - rateM ) ; if ( rateDiff > 0.5 ) { rateDiff = 1 - rateDiff ; } System . out . println ( Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( 2 * Math . PI * rateDiff ) ) ) ; } } import java . util . * ; import java . io . * ; public class Main { static boolean [ ] [ ] used ; static int [ ] ans ; public static void main ( String [ ] args ) throws Exception { FastScanner sc = new FastScanner ( System . in ) ; int [ ] a = sc . nextIntArray ( 5 ) ; int k = sc . nextInt ( ) ; Arrays . sort ( a ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } 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 . 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 = { Math . abs ( a - b ) , Math . abs ( b - c ) , Math . abs ( c - a ) } ; Arrays . sort ( d ) ; System . out . println ( d [ 0 ] + d [ 1 ] ) ; } } 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 = 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 ( ) ; List < Long > plus = new ArrayList < Long > ( ) ; long sum = 0 ; int num = 0 ; for ( int i = 0 ; i < n ; i + + ) { long dif = a [ i ] - b [ i ] ; if ( dif < 0 ) { sum - = dif ; num + + ; } else plus . add ( dif ) ; } if ( num = = 0 ) { System . out . println ( 0 ) ; return ; } int res = num ; Collections . sort ( plus , Collections . reverseOrder ( ) ) ; long p = 0 ; for ( int i = 0 ; i < plus . size ( ) ; i + + ) { p + = plus . get ( i ) ; res + + ; if ( p > = sum ) break ; } if ( p > = sum ) System . out . println ( res ) ; else System . out . println ( - 1 ) ; } } 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 count = 0 ; for ( int X = 0 ; X < = K ; X + + ) { for ( int Y = 0 ; Y < = K ; Y + + ) { if ( S - X - Y < = K & & S - X - Y > = 0 ) count + + ; } } System . out . println ( 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 ] ; a [ 0 ] = scan . nextInt ( ) ; a [ 1 ] = scan . nextInt ( ) ; a [ 2 ] = scan . nextInt ( ) ; Arrays . sort ( a ) ; System . out . println ( Math . abs ( a [ 2 ] - a [ 1 ] ) + Math . abs ( a [ 1 ] - a [ 0 ] ) ) ; } } import static java . lang . System . in ; import static java . lang . System . out ; import java . io . * ; import java . util . * ; public class Main { static final double EPS = 1e-10 ; static final double INF = 1L < < 31 ; static final double PI = Math . PI ; public static Scanner sc = new Scanner ( in ) ; StringBuilder sb = new StringBuilder ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; public void run ( ) throws IOException { String input ; String [ ] inputArray ; input = br . readLine ( ) ; inputArray = input . split ( " " ) ; int n = Integer . valueOf ( inputArray [ 0 ] ) ; int [ ] a = new int [ n ] ; long ans = 0L ; a [ 0 ] = Integer . valueOf ( br . readLine ( ) ) ; ans + = ( a [ 0 ] - 1 ) ; int m = 1 ; for ( int i = 1 ; i < n ; i + + ) { a [ i ] = Integer . valueOf ( br . readLine ( ) ) ; if ( a [ i ] = = m + 1 ) m + + ; else if ( a [ i ] > m + 1 ) { ans + = ( a [ i ] - 1 ) / ( m + 1 ) ; } } sb . append ( ans ) ; ln ( sb ) ; } public static void main ( String [ ] args ) throws IOException { new Main ( ) . run ( ) ; } public static void ln ( Object obj ) { out . println ( obj ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a _ h = sc . nextInt ( ) ; int b _ m = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double dh = ( h * 60 + m ) * 2 * Math . PI / ( 12 * 60 ) ; double hx = a _ h * Math . cos ( dh ) ; double hy = a _ h * Math . sin ( dh ) ; double dm = m * 2 * Math . PI / 60 ; double mx = b _ m * Math . cos ( dm ) ; double my = b _ m * Math . sin ( dm ) ; double dx = mx - hx ; double dy = my - hy ; double result = Math . sqrt ( dx * dx + dy * dy ) ; System . out . println ( result ) ; } } import java . util . * ; 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 ( ) , " " , 32 * 1024 * 1024 ) ; thread . start ( ) ; } @ Override public void run ( ) { final Scanner scanner = new Scanner ( System . in ) ; solve ( scanner ) ; } static void solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . next ( ) ) ; int min = Integer . MAX _ VALUE , ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int n = Integer . parseInt ( scanner . next ( ) ) ; if ( n < min ) { ans + + ; min = n ; } } 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 ) ; int times = 0 ; int count = 0 ; int n = sc . nextInt ( ) ; int test = n ; int i = 1 ; int counter = 0 ; while ( n > 0 ) { if ( n % 2 = = 0 ) { while ( test % 2 = = 0 ) { test / = 2 ; times + + ; } if ( count < times ) { count = times ; } times = 0 ; } n -- ; test = n ; } while ( counter < count ) { i = i * 2 ; counter + + ; } System . out . println ( i ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int first = sc . nextInt ( ) ; int second = sc . nextInt ( ) ; int third = sc . nextInt ( ) ; int bunsetu5 = 0 ; int bunsetu7 = 0 ; if ( first = = 5 ) { bunsetu5 + + ; } else if ( first = = 7 ) { bunsetu7 + + ; } if ( second = = 5 ) { bunsetu5 + + ; } else if ( second = = 7 ) { bunsetu7 + + ; } if ( third = = 5 ) { bunsetu5 + + ; } else if ( third = = 7 ) { bunsetu7 + + ; } if ( bunsetu5 = = 2 & & bunsetu7 = = 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 max = 0 ; int min = 100000 ; for ( int i = 0 ; i < 5 ; i + + ) { int 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 . Scanner ; 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 ( ) ; int flag = 1 ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { int d = x [ i ] - x [ j ] ; if ( Math . abs ( d ) > k ) { flag = 0 ; break ; } } } if ( flag = = 0 ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String [ ] s = new String [ n ] ; boolean hantei = true ; for ( int i = 0 ; i < n ; i + + ) { s [ i ] = scan . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) { hantei = false ; } } if ( hantei = = true ) { 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 . 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 + + ) { ans + = Math . max ( Math . min ( k , s - x ) - Math . max ( 0 , s - x - k ) + 1 , 0 ) ; } 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 ans = 1 ; int ansCount = 0 ; for ( int i = 1 ; i < = N ; i + + ) { if ( i % 2 ! = 0 ) { continue ; } int tmp = i ; int count = 0 ; while ( true ) { if ( tmp % 2 = = 0 ) { count + + ; tmp = tmp / 2 ; } else { break ; } } if ( count > ansCount ) { ans = i ; ansCount = count ; } } System . out . println ( ans ) ; } } import java . util . * ; import java . io . * ; import java . text . * ; import java . lang . * ; import java . math . * ; public class Main { 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 " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ant = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { ant [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; boolean isCom = true ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( Math . abs ( ant [ i ] - ant [ j ] ) > k ) { isCom = false ; } } } System . out . println ( isCom ? " 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 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 . * ; import java . math . BigDecimal ; 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 ( ) ; BigDecimal AA = new BigDecimal ( A ) ; BigDecimal BB = new BigDecimal ( B ) ; BigDecimal HH = new BigDecimal ( H ) ; BigDecimal MM = new BigDecimal ( M ) ; BigDecimal ans2 ; BigDecimal kaku ; BigDecimal mkaku ; BigDecimal hkaku ; BigDecimal AA2 ; BigDecimal BB2 ; BigDecimal CC ; BigDecimal DD ; double dkaku ; double dans2 ; mkaku = MM . multiply ( BigDecimal . valueOf ( 6 ) ) ; hkaku = HH . multiply ( BigDecimal . valueOf ( 30 ) ) ; hkaku = hkaku . add ( BigDecimal . valueOf ( ( double ) M / 2 ) ) ; kaku = mkaku . subtract ( hkaku ) ; dkaku = Math . abs ( Math . toRadians ( kaku . doubleValue ( ) ) ) ; AA2 = AA . multiply ( AA ) ; BB2 = BB . multiply ( BB ) ; CC = AA2 . add ( BB2 ) ; DD = BigDecimal . valueOf ( Math . cos ( dkaku ) ) ; DD = DD . multiply ( BigDecimal . valueOf ( 2 ) ) ; DD = DD . multiply ( AA ) ; DD = DD . multiply ( BB ) ; ans2 = CC . subtract ( DD ) ; dans2 = ans2 . doubleValue ( ) ; double ans = Math . sqrt ( dans2 ) ; 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 ( ) ; System . out . println ( a * b * c = = 175 & & a + b + c = = 17 ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int numArrasy [ ] = new int [ num ] ; for ( int i = 0 ; i < num ; i + + ) { numArrasy [ i ] = sc . nextInt ( ) ; } int count = 1 ; int tmp = numArrasy [ 0 ] ; for ( int i = 0 ; i < num ; i + + ) { if ( tmp > numArrasy [ i ] ) { count + + ; } tmp = Math . min ( tmp , numArrasy [ 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 ans = " Three " ; for ( int i = 0 ; i < n ; i + + ) { if ( sc . next ( ) . equals ( " Y " ) ) { ans = " Four " ; break ; } } System . out . println ( ans ) ; System . exit ( 0 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; boolean f1 = false ; boolean f7 = false ; boolean f9 = false ; boolean f4 = false ; for ( int i = 0 ; i < 4 ; i + + ) { int test = sc . nextInt ( ) ; if ( test = = 1 ) { f1 = true ; } if ( test = = 7 ) { f7 = true ; } if ( test = = 9 ) { f9 = true ; } if ( test = = 4 ) { f4 = true ; } } if ( f1 & & f7 & & f9 & & f4 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; 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 ( ) ; 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 in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( in . readLine ( ) ) ; String [ ] str = in . readLine ( ) . split ( " " ) ; int [ ] p = new int [ n ] ; int min = 100000 * 2 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = Integer . parseInt ( str [ i ] ) ; min = Math . min ( p [ i ] , min ) ; if ( p [ i ] > min ) count + + ; } System . out . println ( n - count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; sc . close ( ) ; for ( int i = 0 ; i < 8 ; i + + ) { if ( n < Math . pow ( 2 , i ) ) { System . out . println ( ( int ) Math . pow ( 2 , i - 1 ) ) ; return ; } } } } 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 [ ] a = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } int k = Integer . parseInt ( br . readLine ( ) ) ; boolean flag = false ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > k ) { flag = true ; break ; } } } System . out . println ( flag ? " : ( " : " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] nyu = sc . nextLine ( ) . split ( " " ) ; int [ ] num = new int [ 3 ] ; num [ 0 ] = Integer . parseInt ( nyu [ 0 ] ) ; num [ 1 ] = Integer . parseInt ( nyu [ 1 ] ) ; num [ 2 ] = Integer . parseInt ( nyu [ 2 ] ) ; Arrays . sort ( num ) ; System . out . println ( num [ 2 ] - num [ 0 ] ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long K = sc . nextLong ( ) ; long S = sc . nextLong ( ) ; long 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 . 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 five = 0 , seven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int x = in . nextInt ( ) ; if ( x = = 5 ) five + + ; else if ( x = = 7 ) seven + + ; } if ( five = = 2 & & seven = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } 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 ans = 1 ; int N = sc . nextInt ( ) ; while ( ans * 2 < = N ) ans * = 2 ; System . out . println ( ans ) ; } public static void main ( String [ ] args ) { new Main ( ) ; } } 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 . * ; 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 akakudo = ( H * 30 + M * 0.5 ) % 360 ; double bkakudo = ( M * 6 ) % 360 ; double ckakudo = Math . abs ( akakudo - bkakudo ) ; if ( ckakudo > = 180 ) { ckakudo = 360 - ckakudo ; } else { ckakudo = ckakudo ; } double a = ( double ) A ; double b = ( double ) B ; double c = Math . sqrt ( ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * ( Math . cos ( Math . toRadians ( ckakudo ) ) ) ) ) ; System . out . println ( c ) ; } } import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { ArrayList < Integer > array = new ArrayList < > ( ) ; int point = 1 ; Scanner scan = new Scanner ( System . in ) ; for ( int i = 0 ; i < 3 ; i + + ) { array . add ( scan . nextInt ( ) ) ; } Collections . sort ( array , Comparator . reverseOrder ( ) ) ; for ( int search : array ) { if ( search = = 5 ) { point * = 5 ; } else if ( search = = 7 ) { point * = 7 ; } } if ( point = = 5 * 5 * 7 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . ArrayList ; import java . util . Comparator ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; 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 < > ( ) ; list . add ( sc . nextInt ( ) ) ; list . add ( sc . nextInt ( ) ) ; list . add ( sc . nextInt ( ) ) ; int fi = 0 ; int se = 0 ; for ( int i : list ) { if ( i = = 5 ) { fi + = 1 ; } else if ( i = = 7 ) { se + = 1 ; } } if ( fi = = 2 & & se = = 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 ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double theta1 = 30.0d * ( h + ( m / 60.0D ) ) ; double theta2 = 6.0d * m ; double theta = Math . toRadians ( theta2 - theta1 ) ; double c = Math . sqrt ( Math . pow ( a , 2.0D ) + Math . pow ( b , 2.0D ) - 2.0D * a * b * Math . cos ( theta ) ) ; System . out . println ( String . format ( " % .20f " , c ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; boolean i = false ; boolean j = false ; boolean k = false ; String [ ] s = new String [ N ] ; for ( int l = 0 ; l < N ; l + + ) { s [ l ] = sc . next ( ) ; } for ( int l = 0 ; l < N ; l + + ) { if ( s [ l ] . equals ( " P " ) ) { i = true ; } else if ( s [ l ] . equals ( " W " ) ) { j = true ; } else if ( s [ l ] . equals ( " G " ) ) { k = true ; } else { i = false ; j = false ; k = false ; break ; } } if ( i = true & & j & & k ) System . out . println ( " Three " ) ; else if ( ! i & & ! j & & ! k ) System . out . println ( " Four " ) ; sc . close ( ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . next ( ) ; } Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( a [ i ] ) ; } if ( set . size ( ) = = 4 ) { 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 [ ] 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 . * ; 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 kaku = 0.0 ; kaku = Math . min ( Math . abs ( ( 30 * H + 0.5 * M ) - 6 * M ) , ( 6 * M - ( 30 * H + 0.5 * M ) ) ) ; double kekka = 0 ; kekka = ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - ( 2 * A * B ) * Math . cos ( Math . toRadians ( kaku ) ) ) ; kekka = Math . sqrt ( kekka ) ; System . out . print ( kekka ) ; sc . close ( ) ; } } import java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = 0 ; while ( n > 0 ) { n / = 2 ; k + = 1 ; } System . out . println ( 1 < < ( k - 1 ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] C1 = new int [ 3 ] ; int [ ] C2 = new int [ 3 ] ; int [ ] C3 = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { C1 [ i ] = sc . nextInt ( ) ; C2 [ i ] = sc . nextInt ( ) ; C3 [ i ] = sc . nextInt ( ) ; } if ( sol ( C1 ) ! = sol ( C2 ) | | sol ( C2 ) ! = sol ( C3 ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } private static int sol ( int [ ] C ) { Arrays . sort ( C ) ; int sum = 0 ; for ( int n : C ) { sum + = n ; } return sum - C [ 0 ] * C . length ; } } import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; long N = gl ( ) ; for ( long h = 1 ; h < = 3500 ; h + + ) { for ( long n = 1 ; n < = 3500 ; n + + ) { long l = 1 ; long r = 3500 ; while ( r - l > 1 ) { long w = ( l + r ) / 2 ; long wl = 4 * h * n * w ; long wr = N * ( n * w + h * w + h * n ) ; if ( wl = = wr ) { System . out . println ( h + " " + n + " " + w ) ; return ; } else if ( wl < wr ) { l = w ; } else { r = w ; } } } } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = 3 ; int nums [ ] = new int [ n ] ; for ( int j = 0 ; j < nums . length ; j + + ) { nums [ j ] = sc . nextInt ( ) ; } int cnt1 = 0 ; int cnt2 = 0 ; for ( int i = 0 ; i < nums . length ; i + + ) { if ( nums [ i ] = = 5 ) { cnt1 + + ; } else if ( nums [ i ] = = 7 ) { cnt2 + + ; } else { break ; } } if ( cnt1 = = 2 & & cnt2 = = 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 m = sc . nextInt ( ) ; long [ ] x = new long [ 100001 ] ; int a = 1000000007 ; if ( Math . abs ( n - m ) > 1 ) { System . out . println ( ' 0' ) ; return ; } x [ 0 ] = 1 ; for ( int i = 1 ; i < = 100000 ; i + + ) x [ i ] = x [ i - 1 ] * i % a ; long ans = x [ n ] * x [ m ] % a ; if ( n = = m ) ans = ans * 2 % a ; System . out . println ( ans ) ; return ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ans = 1 ; int ansi = 0 ; for ( int i = 1 ; i < = n ; i + + ) { int tmp = i ; int cnt = 0 ; while ( tmp % 2 = = 0 ) { int x = tmp / 2 ; tmp = x ; cnt + + ; if ( ansi < = cnt ) { ansi = cnt ; ans = i ; } } } System . out . println ( ans ) ; } } import java . io . File ; 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 ( ) ; sc . nextLine ( ) ; String [ ] ary = sc . nextLine ( ) . split ( " " ) ; boolean flg _ 3 = true ; for ( String str : ary ) { if ( str . equals ( " Y " ) ) { flg _ 3 = false ; } } System . out . println ( flg _ 3 ? " Three " : " Four " ) ; } } import java . util . Scanner ; public class Main { static long solve ( long T1 , long T2 , long A1 , long A2 , long B1 , long B2 ) { long LA = T1 * A1 + T2 * A2 ; long LB = T1 * B1 + T2 * B2 ; if ( LA = = LB ) { return - 1 ; } if ( A1 > B1 & & A2 > B2 ) { return 0 ; } if ( B1 > A1 & & B2 > A2 ) { return 0 ; } if ( A1 < B1 & & A2 > B2 ) { if ( LA < LB ) { return 0 ; } long lead = LA - LB ; long LA1 = T1 * A1 ; long LB1 = T1 * B1 ; long k = ( LB1 - LA1 ) / lead ; if ( ( LB1 - LA1 ) % lead = = 0 ) { return 2 * k ; } else { return 2 * k + 1 ; } } if ( A1 > B1 & & A2 < B2 ) { if ( LA > LB ) { return 0 ; } long lead = LB - LA ; long LA1 = T1 * A1 ; long LB1 = T1 * B1 ; long k = ( LA1 - LB1 ) / lead ; if ( ( LA1 - LB1 ) % lead = = 0 ) { return 2 * k ; } else { return 2 * k + 1 ; } } return - 1 ; } 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 ret = solve ( T1 , T2 , A1 , A2 , B1 , B2 ) ; if ( ret < 0 ) { System . out . println ( " infinity " ) ; } else { System . out . println ( ret ) ; } } } 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 sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S - i - j > = 0 & & S - i - j < = K ) { sum + + ; } } } 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 ( ) ; int [ ] P = new int [ N ] ; int ans = 1 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < N ; i + + ) { if ( P [ i - 1 ] > = P [ i ] ) { ans + + ; } else { P [ i ] = P [ i - 1 ] ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; int sum = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = scanner . nextInt ( ) ; sum + = c [ i ] [ j ] ; } } if ( sum % 3 = = 0 & & sum / 3 = = c [ 0 ] [ 0 ] + c [ 1 ] [ 1 ] + c [ 2 ] [ 2 ] ) { 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 line [ ] = br . readLine ( ) . split ( " " ) ; int k = Integer . parseInt ( line [ 0 ] ) ; int s = Integer . parseInt ( line [ 1 ] ) ; 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 . io . * ; import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; System . out . println ( four ( n , sc ) ) ; } public static String four ( int n , Scanner s ) { for ( int i = 0 ; i < n ; i + + ) { String curr = s . next ( ) ; if ( curr . equals ( " Y " ) ) return " Four " ; } return " Three " ; } } import java . util . * ; public class Main { public static void main ( String ... args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] map = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 9 ; i + + ) { map [ i / 3 ] [ i % 3 ] = sc . nextInt ( ) ; } for ( int a1 = 0 ; a1 < = 100 ; a1 + + ) { int b1 = map [ 0 ] [ 0 ] - a1 ; int b2 = map [ 0 ] [ 1 ] - a1 ; int b3 = map [ 0 ] [ 2 ] - a1 ; int a2 = map [ 1 ] [ 0 ] - b1 ; int a3 = map [ 2 ] [ 0 ] - b1 ; if ( map [ 1 ] [ 1 ] = = a2 + b2 & & map [ 1 ] [ 2 ] = = a2 + b3 & & map [ 2 ] [ 1 ] = = a3 + b2 & & map [ 2 ] [ 2 ] = = a3 + b3 ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; try { long k = scanner . nextLong ( ) ; long s = scanner . nextLong ( ) ; long ans = 0 ; for ( long x = 0 ; x < = k ; x + + ) { for ( long y = 0 ; y < = k ; y + + ) { long z = s - x - y ; if ( 0 < = z & & z < = k ) ans + + ; } } System . out . println ( ans ) ; } finally { scanner . close ( ) ; } } } public class Main { public static void main ( String [ ] args ) { java . util . Scanner c = new java . util . Scanner ( System . in ) ; int k = c . nextInt ( ) , s = c . nextInt ( ) ; System . out . println ( java . util . stream . IntStream . range ( 0 , k + 1 ) . map ( x - > s - x + 1 - Math . min ( s - x + 1 , Math . max ( 0 , ( s - x - k ) * 2 ) ) ) . sum ( ) ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = 5 ; int [ ] antenna = new int [ N ] ; for ( int n = 0 ; n < N ; n + + ) antenna [ n ] = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) for ( int j = i + 1 ; j < N ; j + + ) { if ( Math . abs ( antenna [ i ] - antenna [ j ] ) > K ) { System . out . println ( " : ( " ) ; System . exit ( 0 ) ; } } 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 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 ! " ) ; return ; } System . out . println ( " : ( " ) ; } } public class Main { private static java . util . Scanner scanner = new java . util . Scanner ( System . in ) ; public static void main ( String [ ] args ) { int max1 = 100 , max2 = 100 , max3 = 100 , a [ ] = new int [ 9 ] ; for ( int i = 0 ; i < 3 ; i + + ) { max1 = Math . min ( max1 , a [ i * 3 ] = scanner . nextInt ( ) ) ; max2 = Math . min ( max2 , a [ i * 3 + 1 ] = scanner . nextInt ( ) ) ; max3 = Math . min ( max3 , a [ i * 3 + 2 ] = scanner . nextInt ( ) ) ; } System . out . println ( ( a [ 0 ] - max1 = = a [ 1 ] - max2 & & a [ 1 ] - max2 = = a [ 2 ] - max3 ) & & ( a [ 3 ] - max1 = = a [ 4 ] - max2 & & a [ 4 ] - max2 = = a [ 5 ] - max3 ) & & ( a [ 6 ] - max1 = = a [ 7 ] - max2 & & a [ 7 ] - max2 = = a [ 8 ] - max3 ) ? " Yes " : " 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 + + ) { int lastOne = s - i - j ; if ( lastOne > = 0 & & lastOne < = 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 ) ; StringBuilder sb = new StringBuilder ( ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int a = 1000000007 ; long ans = 1 ; if ( Math . abs ( n - m ) = = 1 ) { for ( int i = 1 ; i < = n ; i + + ) { ans = ans * i % a ; } for ( int i = 1 ; i < = m ; i + + ) { ans = ans * i % a ; } System . out . println ( ans ) ; } else if ( Math . abs ( n - m ) = = 0 ) { for ( int i = 1 ; i < = n ; i + + ) { ans = ans * i % a ; } for ( int i = 1 ; i < = m ; i + + ) { ans = ans * i % a ; } ans = ( ans * 2 ) % a ; System . out . println ( ans ) ; } else { System . out . println ( 0 ) ; } } } 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 . 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 ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; double result = 0 ; double theta = ( PI / 180 ) * ( h * 360 / 12 + m * 30 / 60 - m * 360 / 60 ) ; result = a * a + b * b - 2 * a * b * cos ( theta ) ; result = sqrt ( result ) ; 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 ( ) ; 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 . 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 count = 0 ; if ( b - a < = k ) { if ( c - a < = k ) { if ( d - a < = k ) { if ( e - a < = k ) { if ( c - b < = k ) { if ( d - b < = k ) { if ( e - b < = k ) { if ( d - c < = k ) { if ( e - c < = k ) { if ( e - d < = k ) { count + + ; } } } } } } } } } } if ( count = = 0 ) { System . out . print ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . IOException ; import java . io . InputStream ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws IOException { new Main ( ) . execute ( System . in ) ; } public void execute ( InputStream in ) { Scanner sc = new Scanner ( in ) ; List < Integer > list = Arrays . asList ( sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) ) ; int k = sc . nextInt ( ) ; for ( int i = 0 ; i < list . size ( ) - 1 ; i + + ) { int a = list . get ( i ) ; for ( int j = 1 ; j < list . size ( ) ; j + + ) { int b = list . get ( j ) ; if ( b - a > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } 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 ( ) ) ; Integer K = Integer . parseInt ( st . nextToken ( ) ) ; Integer S = Integer . parseInt ( st . nextToken ( ) ) ; long ans = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( i + j > S ) continue ; if ( S - i - j < = K ) ans + + ; } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = 0 ; int B = 0 ; int C ; int [ ] [ ] Card = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { Card [ i ] [ j ] = scan . nextInt ( ) ; } } A = Card [ 0 ] [ 0 ] - Card [ 0 ] [ 1 ] ; B = Card [ 0 ] [ 0 ] - Card [ 0 ] [ 2 ] ; C = Card [ 0 ] [ 1 ] - Card [ 0 ] [ 2 ] ; for ( int i = 1 ; i < 3 ; i + + ) { if ( A ! = Card [ i ] [ 0 ] - Card [ i ] [ 1 ] | | B ! = Card [ i ] [ 0 ] - Card [ i ] [ 2 ] | | C ! = Card [ i ] [ 1 ] - Card [ i ] [ 2 ] ) { System . out . println ( " No " ) ; return ; } } System . out . println ( " Yes " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n < 2 ) { System . out . println ( n ) ; } else if ( n < 4 ) { System . out . println ( 2 ) ; } else if ( n < 8 ) { System . out . println ( 4 ) ; } else if ( n < 16 ) { System . out . println ( 8 ) ; } else if ( n < 32 ) { System . out . println ( 16 ) ; } else if ( n < 64 ) { System . out . println ( 32 ) ; } else { System . out . println ( 64 ) ; } } } import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final long N = scanner . nextInt ( ) ; for ( long n = 1 ; n < = 3500 ; n + + ) { for ( long h = 1 ; h < = 3500 ; h + + ) { final long l = 4 * h * n - N * n - N * h ; if ( l = = 0 ) { continue ; } long w = N * n * h / l ; if ( w > 0 & & 4 * n * h * w = = N * ( n * h + h * w + w * n ) ) { System . out . println ( h + " " + n + " " + w ) ; return ; } } } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; int f = 0 ; int s = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < 3 ; i + + ) { if ( a [ i ] = = 5 ) { f + + ; } else if ( a [ i ] = = 7 ) { s + + ; } } if ( f = = 2 & & s = = 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 ( ) ; String [ ] arrays = { " P " , " W " , " G " , " Y " } ; boolean [ ] arrayb = { false , false , false , false } ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; for ( int j = 0 ; j < 4 ; j + + ) { if ( s . equals ( arrays [ j ] ) ) { arrayb [ j ] = true ; } } } if ( arrayb [ 0 ] & & arrayb [ 1 ] & & arrayb [ 2 ] & & arrayb [ 3 ] ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Arrays ; import java . util . Scanner ; public class Main { 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 ) ; if ( a [ 0 ] = = 5 & & a [ 1 ] = = 5 & & a [ 2 ] = = 7 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; sc . close ( ) ; } void debug ( Object ... o ) { System . out . println ( Arrays . deepToString ( o ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { String answer = " Three " ; Scanner sc = new Scanner ( System . in ) ; int hina = sc . nextInt ( ) ; int p = 0 ; int w = 0 ; int g = 0 ; int y = 0 ; String tmp ; for ( int i = 0 ; i < hina ; i + + ) { tmp = sc . next ( ) ; switch ( tmp ) { case " P " : if ( p > 0 ) break ; p + + ; break ; case " W " : if ( w > 0 ) break ; w + + ; break ; case " G " : if ( g > 0 ) break ; g + + ; break ; case " Y " : if ( y > 0 ) break ; y + + ; break ; } if ( p + w + g + y = = 4 ) { answer = " Four " ; break ; } } System . out . println ( answer ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { @ SuppressWarnings ( " resource " ) Scanner sc = new Scanner ( System . in ) ; int [ ] arr = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( arr ) ; boolean is575 = ( arr [ 0 ] = = 5 & & arr [ 1 ] = = 5 & & arr [ 2 ] = = 7 ) ; System . out . println ( is575 ? " YES " : " NO " ) ; } } 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 ( ) ; 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 . 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 ( ) ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } br . close ( ) ; long ans = 0 ; int x = 1 ; for ( int i = 0 ; i < n ; i + + ) { if ( a [ i ] = = x ) { x + + ; } ans + = ( a [ i ] - 1 ) / x ; if ( x = = 1 ) { x + + ; } } 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 [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) P [ i ] = scanner . nextInt ( ) ; int min = P [ 0 ] ; int count = 1 ; for ( int i = 1 ; i < N ; i + + ) { if ( P [ i ] < min ) count + + ; min = Math . min ( 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 = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int ab = Math . abs ( a - b ) ; int bc = Math . abs ( b - c ) ; int ca = Math . abs ( c - a ) ; int ans = ab + bc + ca - Math . max ( ab , Math . max ( bc , ca ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] p = new int [ 5 ] ; int k ; for ( int i = 0 ; i < 5 ; i + + ) { p [ i ] = scanner . nextInt ( ) ; } k = scanner . nextInt ( ) ; boolean ans = true ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i ; j < 5 ; j + + ) { if ( p [ j ] - p [ i ] > k ) { ans = false ; } } } System . out . println ( ans ? " Yay ! " : " : ( " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; double a = sc . nextFloat ( ) ; double b = sc . nextFloat ( ) ; double h = sc . nextFloat ( ) ; double m = sc . nextFloat ( ) ; double tanshin = h * 5 + ( m / 12 ) ; double kakudo = 0 ; if ( m > tanshin ) { kakudo = ( m - tanshin ) * 6 ; } else { kakudo = ( tanshin - m ) * 6 ; } if ( kakudo = = 0 ) { System . out . println ( Math . abs ( a - b ) ) ; return ; } if ( kakudo > 180 ) { kakudo = 360 - kakudo ; } double answer = Math . sqrt ( ( a * a ) + ( b * b ) - 2 * a * b * Math . cos ( Math . toRadians ( kakudo ) ) ) ; System . out . println ( answer ) ; } } 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 hour = h / 12 + m / 60 * ( 360 / 12 ) / 360 ; double minutes = m / 60 ; double angle = hour < minutes ? 360 * ( minutes - hour ) : 360 * ( hour - minutes ) ; double ansSquare = Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ; System . out . println ( Math . sqrt ( ansSquare ) ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int w _ diffs [ ] = new int [ 2 ] ; int h _ diffs [ ] = new int [ 2 ] ; int m [ ] [ ] = new int [ 3 ] [ 3 ] ; boolean con = true ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { m [ i ] [ j ] = sc . nextInt ( ) ; } } w _ diffs [ 0 ] = m [ 0 ] [ 1 ] - m [ 0 ] [ 0 ] ; w _ diffs [ 1 ] = m [ 0 ] [ 2 ] - m [ 0 ] [ 1 ] ; h _ diffs [ 0 ] = m [ 1 ] [ 0 ] - m [ 0 ] [ 0 ] ; h _ diffs [ 1 ] = m [ 2 ] [ 0 ] - m [ 1 ] [ 0 ] ; for ( int i = 1 ; i < 3 & & con ; i + + ) { for ( int j = 0 ; j < 2 ; j + + ) { if ( m [ i ] [ j + 1 ] - m [ i ] [ j ] ! = w _ diffs [ j ] ) con = false ; if ( m [ j + 1 ] [ i ] - m [ j ] [ i ] ! = h _ diffs [ j ] ) con = false ; } } if ( con ) 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 ( ) ; boolean hasY = false ; for ( int i = 0 ; i < n ; i + + ) { char ch = sc . next ( ) . charAt ( 0 ) ; if ( ch = = ' Y ' ) { hasY = true ; break ; } } System . out . println ( hasY ? " 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 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 + + ; } } } System . out . println ( 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 ] ; 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 = new int [ 3 ] ; int [ ] b = new int [ 3 ] ; for ( int j = 0 ; j < 3 ; j + + ) a [ j ] = c [ j ] [ 0 ] - i ; for ( int j = 0 ; j < 3 ; j + + ) b [ j ] = c [ 0 ] [ j ] - a [ 0 ] ; boolean ok = true ; for ( int j = 0 ; j < 3 ; j + + ) { for ( int k = 0 ; k < 3 ; k + + ) { if ( c [ j ] [ k ] ! = a [ j ] + b [ k ] ) ok = false ; } } if ( ok ) { System . out . println ( " Yes " ) ; return ; } } System . out . println ( " No " ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashSet ; 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 ( ) ; HashSet < Character > set = new HashSet < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { String s = scan . next ( ) ; char c = s . toCharArray ( ) [ 0 ] ; set . add ( c ) ; } if ( set . size ( ) = = 3 ) { System . out . println ( " Three " ) ; } else { System . out . println ( " Four " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] arr = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; + + i ) { arr [ i ] = in . nextInt ( ) ; } Arrays . sort ( arr ) ; int ans = 0 ; for ( int i = 1 ; i < 3 ; + + i ) { ans + = Math . abs ( arr [ i ] - arr [ i - 1 ] ) ; } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] g ) { Scanner s = new Scanner ( System . in ) ; System . out . println ( s . nextInt ( ) + s . nextInt ( ) + s . nextInt ( ) > 18 ? " NO " : " YES " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String [ ] tmpString = sc . nextLine ( ) . split ( " " ) ; int K = Integer . parseInt ( tmpString [ 0 ] ) ; int S = Integer . parseInt ( tmpString [ 1 ] ) ; int count = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { int total = S - i - j ; if ( total > = 0 & & total < = 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 ( ) ; double Mangle = ( m * 360.0 ) / 60.0 ; double Hangle = ( h * 60.0 + m ) * 360.0 / ( 12.0 * 60.0 ) ; double MHangle = 0 ; if ( Hangle - Mangle > 180 ) { MHangle = 360 - ( Hangle - Mangle ) ; } else { MHangle = Hangle - Mangle ; } double cosA = Math . cos ( MHangle * ( Math . PI / 180.0 ) ) ; double answer = Math . sqrt ( ( a * a ) + ( b * b ) - ( 2 * a * b * cosA ) ) ; System . out . println ( answer ) ; } } import java . util . * ; 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 + 1 ; i + + ) { for ( int j = 0 ; j < K + 1 ; j + + ) { if ( S - ( i + j ) < = K & & 0 < = S - ( i + j ) ) { c + = 1 ; } } } System . out . println ( c ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . util . ArrayList ; import java . util . List ; import java . util . stream . Collectors ; import java . util . HashSet ; 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 kakudo = Math . abs ( H * 30 + 30 * ( M / 60 ) - M * 6 ) ; if ( kakudo > 360 - kakudo ) { kakudo = 360 - kakudo ; } System . out . println ( Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( kakudo ) ) ) ) ; } } 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 . MAX _ VALUE ; for ( int i = 1 ; i < = n ; i + + ) { a [ i ] = sc . nextInt ( ) ; } for ( int k = 0 ; k < n ; k + + ) { Long cost = ( long ) k * x ; for ( int i = 1 ; i < = n ; i + + ) { if ( k = = 0 ) { b [ i ] [ k ] = a [ i ] ; } else { 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 ; 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 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 + + ) { flag = true ; if ( P [ i ] < pre _ min ) { sum + = 1 ; pre _ min = P [ i ] ; } } System . out . print ( sum ) ; } } 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 = 1000000007 ; if ( Math . abs ( N - M ) > = 2 ) { System . out . println ( " 0 " ) ; return ; } long ans = 1 ; for ( long i = 2 ; i < = N ; + + i ) { ans * = i ; ans % = MOD ; } for ( long i = 2 ; i < = M ; + + i ) { ans * = i ; ans % = MOD ; } if ( Math . abs ( N - M ) = = 0 ) { ans * = 2 ; if ( ans > = MOD ) ans - = MOD ; } System . out . println ( ans ) ; return ; } } 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 tsum = t1 * a1 + t2 * a2 ; long asum = t1 * b1 + t2 * b2 ; if ( tsum = = asum ) { System . out . println ( " infinity " ) ; return ; } if ( asum > tsum ) { long tmp = a1 ; a1 = b1 ; b1 = tmp ; tmp = a2 ; a2 = b2 ; b2 = tmp ; } if ( b1 < a1 ) { System . out . println ( 0 ) ; return ; } long delta1 = ( b1 - a1 ) * t1 ; long delta2 = Math . abs ( asum - tsum ) ; System . out . println ( ( delta1 / delta2 ) * 2 + ( delta1 % delta2 > 0 ? 1 : 0 ) ) ; } } 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 ) ; } boolean result = seen . containsKey ( 5 ) & & seen . containsKey ( 7 ) & & seen . get ( 5 ) = = 2 & & seen . get ( 7 ) = = 1 ; System . out . println ( result ? " YES " : " NO " ) ; } } import java . util . Scanner ; 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 ] ) ; int H = Integer . parseInt ( lines [ 2 ] ) ; int M = Integer . parseInt ( lines [ 3 ] ) ; double radianChoshin = 6 * M ; double radianTanshin = 30 * H + 0.5 * M ; double radian = Math . abs ( radianChoshin - radianTanshin ) ; double ans = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( radian ) ) ) ; System . out . println ( ans ) ; } } 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 ) ; String line1 = sc . nextLine ( ) ; List < String > lines1 = Arrays . asList ( line1 . split ( " " ) ) ; Integer K = Integer . parseInt ( lines1 . get ( 0 ) ) ; Integer S = Integer . parseInt ( lines1 . get ( 1 ) ) ; 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 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 ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; String colorNumber = " Three " ; int a = 0 ; for ( int i = 0 ; i < N ; i + + ) { String str = sc . next ( ) ; if ( str . equals ( " Y " ) ) a = 1 ; if ( a = = 1 ) { colorNumber = " Four " ; break ; } } System . out . println ( colorNumber ) ; } } import java . util . Scanner ; class Main { int k ; int s ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; Main m = new Main ( sc ) ; m . solve ( ) ; sc . close ( ) ; } Main ( Scanner sc ) { k = sc . nextInt ( ) ; s = sc . nextInt ( ) ; } void solve ( ) { int ans = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k ; y + + ) { if ( ( s - ( x + y ) < = k ) & & ( s - ( x + y ) > = 0 ) ) 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 ( ) ; 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 stdIn = new Scanner ( System . in ) ; int a = stdIn . nextInt ( ) ; int b = stdIn . nextInt ( ) ; int c = stdIn . nextInt ( ) ; int z = 0 , y = 0 , x = 0 ; if ( a = = 5 ) z + + ; else y + + ; if ( b = = 5 ) { z + + ; } else { y + + ; } if ( c = = 5 ) z + + ; else y + + ; if ( z = = 2 & & y = = 1 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int K = cin . nextInt ( ) ; int S = cin . nextInt ( ) ; int c = 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 ) { c + + ; } } } System . out . println ( c ) ; } } 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 Ax = A * Math . sin ( Math . PI * ( ( 60 * H ) + M ) / 360 ) ; double Ay = A * Math . cos ( Math . PI * ( ( 60 * H ) + M ) / 360 ) ; double Bx = B * Math . sin ( Math . PI * M / 30 ) ; double By = B * Math . cos ( Math . PI * M / 30 ) ; double d _ square = ( Ax - Bx ) * ( Ax - Bx ) + ( Ay - By ) * ( Ay - By ) ; double d = Math . sqrt ( d _ square ) ; System . out . println ( d ) ; } } 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 ten _ a = h * 30 + m * 0.5 ; double ten _ b = m * 6 ; double ax = Math . cos ( Math . toRadians ( ten _ a ) ) * a ; double ay = Math . sin ( Math . toRadians ( ten _ a ) ) * a ; double bx = Math . cos ( Math . toRadians ( ten _ b ) ) * b ; double by = Math . sin ( Math . toRadians ( ten _ b ) ) * b ; double ans = ( Math . sqrt ( Math . pow ( ( ax - bx ) , 2 ) + Math . pow ( ( ay - by ) , 2 ) ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . ArrayList ; class Main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int N = scanner . nextInt ( ) ; String sugar = " a " ; for ( int i = 0 ; i < N ; i + + ) { sugar = scanner . next ( ) ; if ( sugar . equals ( " Y " ) ) { System . out . println ( " Four " ) ; break ; } } if ( ! ( sugar . equals ( " Y " ) ) ) System . out . println ( " Three " ) ; } } import java . util . Scanner ; 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 H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double h = ( double ) H / 12.0 ; h + = ( double ) M / 60.0 / 12.0 ; double m = ( double ) M / 60.0 ; double rad = Math . PI * 2 * ( h - m ) ; double rsq = ( A * A ) + ( B * B ) - ( 2 * A * B * Math . cos ( rad ) ) ; System . out . println ( Math . sqrt ( rsq ) ) ; } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . Arrays ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _ main ( String [ ] args ) { Scanner sc = new Scanner ( in ) ; int N = sc . nextInt ( ) ; int [ ] A = nextIntArray ( sc , N ) ; int [ ] B = nextIntArray ( sc , N ) ; sc . close ( ) ; int [ ] d = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { d [ i ] = A [ i ] - B [ i ] ; } Arrays . sort ( d ) ; int ans = 0 ; long sum = 0 ; for ( int i = 0 ; i < N ; i + + ) { if ( d [ i ] < 0 ) { sum + = d [ i ] ; ans + + ; } } for ( int i = N - 1 ; i > = 0 ; i -- ) { if ( sum > = 0 ) { break ; } if ( d [ i ] > 0 ) { sum + = d [ i ] ; ans + + ; } } if ( sum < 0 ) { out . println ( - 1 ) ; } else { out . println ( ans ) ; } } public static void main ( String [ ] args ) { new Main ( ) . _ main ( args ) ; } @ SuppressWarnings ( " unused " ) private int [ ] nextIntArray ( Scanner sc , int n ) { int [ ] result = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { result [ i ] = sc . nextInt ( ) ; } return 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 + + ) { int z = S - x - y ; if ( 0 < = z & & z < = K ) { c + = 1 ; } } } System . out . println ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int count = 0 ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; for ( int i = 0 ; i < = k ; i + + ) { for ( int w = 0 ; w < = k ; w + + ) { if ( s - i - w > = 0 & & s - i - w < = k ) { count + + ; } } } System . out . print ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 5 ] ; boolean possible = true ; for ( int i = 0 ; i < 5 ; i + + ) { num [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( ! ( num [ j ] - num [ i ] < = k ) ) possible = false ; } } if ( possible ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( final String [ ] args ) { final Scanner scanner = new Scanner ( System . in ) ; final int n = scanner . nextInt ( ) ; int min = 200001 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { final int p = scanner . nextInt ( ) ; if ( p < = min ) { count + + ; min = p ; } } System . out . println ( count ) ; } } 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 ans = 0 , N = Math . max ( n , m ) , M = Math . min ( n , m ) , Mod = 1000000007L , a = 1 , b = 1 ; for ( int i = 1 ; i < = N ; i + + ) { a = ( a * i ) % Mod ; } for ( int i = 1 ; i < = M ; i + + ) { b = ( b * i ) % Mod ; } if ( N - M > 1 ) { ans = 0 ; } if ( N - M = = 1 ) { ans = ( a * b ) % Mod ; } if ( N = = M ) { ans = ( a * b ) % Mod ; ans = ( 2 * ans ) % Mod ; } System . out . println ( ans ) ; } } import java . util . Scanner ; import java . util . ArrayList ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String str = scanner . nextLine ( ) ; int five = 0 ; int seven = 0 ; String [ ] numbers = str . split ( " " ) ; for ( String num : numbers ) { if ( num . equals ( " 5 " ) ) { five + + ; } else if ( num . equals ( " 7 " ) ) { seven + + ; } } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . CharArrayReader ; import java . lang . reflect . Array ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < Integer > arr = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) arr . add ( sc . nextInt ( ) ) ; int k = sc . nextInt ( ) ; Collections . sort ( arr ) ; if ( arr . get ( 4 ) - arr . get ( 0 ) > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int N , D , ans = 0 ; Scanner sc = new Scanner ( System . in ) ; D = sc . nextInt ( ) ; N = sc . nextInt ( ) ; int temperature [ ] = new int [ D ] ; int min [ ] = new int [ N ] ; int max [ ] = new int [ N ] ; int show [ ] = new int [ N ] ; int showreminder [ ] [ ] = new int [ D ] [ N ] ; for ( int i = 0 ; i < D ; i + + ) { temperature [ i ] = sc . nextInt ( ) ; } for ( int j = 0 ; j < N ; j + + ) { min [ j ] = sc . nextInt ( ) ; max [ j ] = sc . nextInt ( ) ; show [ j ] = sc . nextInt ( ) ; } for ( int i = 1 ; i < D ; i + + ) { for ( int j = 0 ; j < N ; j + + ) { if ( min [ j ] < = temperature [ i ] & & max [ j ] > = temperature [ i ] ) { for ( int k = 0 ; k < N ; k + + ) { if ( min [ k ] < = temperature [ i - 1 ] & & max [ k ] > = temperature [ i - 1 ] ) { if ( showreminder [ i ] [ j ] < showreminder [ i - 1 ] [ k ] + Math . abs ( show [ k ] - show [ j ] ) ) { showreminder [ i ] [ j ] = showreminder [ i - 1 ] [ k ] + Math . abs ( show [ k ] - show [ j ] ) ; } } } } } } for ( int i = 0 ; i < N ; i + + ) { if ( ans < showreminder [ D - 1 ] [ i ] ) { ans = showreminder [ D - 1 ] [ 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 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 " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int fiveCnt = 0 ; int sevenCnt = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int a = Integer . parseInt ( sc . next ( ) ) ; if ( a = = 5 ) { fiveCnt + + ; } else if ( a = = 7 ) { sevenCnt + + ; } } if ( fiveCnt = = 2 & & sevenCnt = = 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 A [ ] = new int [ N ] ; int B [ ] = new int [ N ] ; long sum _ of _ A = 0 , sum _ of _ B = 0 ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = sc . nextInt ( ) ; sum _ of _ A + = A [ i ] ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; sum _ of _ B + = B [ i ] ; } if ( sum _ of _ A < sum _ of _ B ) { System . out . println ( " -1 " ) ; return ; } long sum _ of _ lack = 0 ; int lack _ count = 0 ; List < Integer > li = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i + + ) { if ( A [ i ] = = B [ i ] ) continue ; if ( A [ i ] < B [ i ] ) { sum _ of _ lack + = B [ i ] - A [ i ] ; lack _ count + + ; } else { li . add ( A [ i ] - B [ i ] ) ; } } li . sort ( ( a , b ) - > b - a ) ; long add _ sum = 0 ; for ( int k = 0 ; k < li . size ( ) ; k + + ) { if ( add _ sum > = sum _ of _ lack ) { System . out . println ( lack _ count + k ) ; return ; } add _ sum + = li . get ( k ) ; } System . out . println ( lack _ count + li . size ( ) ) ; } } import java . util . * ; 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 ( ) ; final double rad _ per _ min _ 720 = 11 * 2 * Math . PI ; int min = h * 60 + m ; double rad _ dif = rad _ per _ min _ 720 * min / 720 ; double c _ pow = a * a + b * b - 2 * a * b * Math . cos ( rad _ dif ) ; double c = Math . sqrt ( c _ pow ) ; System . out . println ( c ) ; } } 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 array [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 3 ; i + + ) { array [ i ] = sc . nextInt ( ) ; if ( array [ i ] = = 5 ) { Count5 + + ; } else if ( array [ 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 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 . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] a = new int [ 3 ] [ 3 ] ; int [ ] x = new int [ 3 ] ; int [ ] y = new int [ 3 ] ; int max = Integer . MIN _ VALUE ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { a [ i ] [ j ] = sc . nextInt ( ) ; if ( a [ i ] [ j ] > max ) { max = a [ i ] [ j ] ; } } } String f = " Yes " ; x [ 0 ] = 0 ; for ( int j = 0 ; j < 3 ; j + + ) { y [ j ] = a [ 0 ] [ j ] - x [ 0 ] ; } for ( int j = 0 ; j < 3 ; j + + ) { x [ j ] = a [ j ] [ 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 ] ) { f = " No " ; } } } System . out . println ( f ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int [ ] [ ] List = 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 + + ) { List [ i ] [ j ] = sc . nextInt ( ) ; } } a [ 0 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { b [ i ] = List [ 0 ] [ i ] - a [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = List [ i ] [ 0 ] - b [ 0 ] ; } for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( List [ i ] [ j ] ! = a [ i ] + b [ j ] ) { 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 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 ; class Main { static Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int K = in . nextInt ( ) , S = in . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( i + j > = S - K & & i + j < = S ) { sum + + ; } } } System . out . println ( sum ) ; } } import java . util . List ; import java . util . Scanner ; public class Main { static Scanner scanner ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int a = gi ( ) ; int b = gi ( ) ; int c = gi ( ) ; int d = gi ( ) ; int e = gi ( ) ; int k = gi ( ) ; if ( e - a > k ) { System . out . print ( " : ( " ) ; } else { System . out . print ( " Yay ! " ) ; } } 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 . Arrays ; import java . util . Collections ; import java . util . Scanner ; public class Main { private static int solve ( int N , int [ ] A , int [ ] B ) { Integer [ ] buf = new Integer [ N ] ; long required = 0 ; int minus = 0 ; int plus = 0 ; for ( int i = 0 ; i < N ; i + + ) { buf [ i ] = 0 ; int diff = B [ i ] - A [ i ] ; if ( diff < = 0 ) { buf [ i ] = - 1 * diff ; plus + = 1 ; } else { required + = diff ; minus + = 1 ; } } if ( minus = = 0 ) { return 0 ; } Arrays . sort ( buf , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < plus ; i + + ) { required - = buf [ i ] ; if ( required < = 0 ) { return ( i + 1 ) + minus ; } } return - 1 ; } 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 ( ) ; } int ans = solve ( N , A , B ) ; System . out . println ( ans ) ; } } import java . util . * ; class Main { static int A ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] map = { 1 , 9 , 7 , 4 } ; boolean [ ] visit = new boolean [ 4 ] ; boolean flag = false ; for ( int i = 0 ; i < 4 ; i + + ) { int A = scan . nextInt ( ) ; for ( int j = 0 ; j < 4 ; j + + ) { if ( A = = map [ j ] ) { visit [ j ] = true ; } } } for ( int i = 0 ; i < 4 ; i + + ) { if ( ! visit [ i ] ) flag = true ; } if ( flag ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } } import java . util . * ; class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) , ans = 0 ; int [ ] p = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) p [ i ] = sc . nextInt ( ) ; int m = p [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { m = Math . min ( m , p [ i ] ) ; if ( m = = 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 = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; double H = sc . nextInt ( ) ; double M = sc . nextInt ( ) ; double hRad = - ( ( H / 12 ) * 2 + ( M / 60 ) / 6 ) * Math . PI ; double mRad = - ( M / 60 ) * 2 * Math . PI ; double hX = Math . cos ( hRad ) * A ; double hY = Math . sin ( hRad ) * A ; double mX = Math . cos ( mRad ) * B ; double mY = Math . sin ( mRad ) * B ; double distance = Math . sqrt ( Math . pow ( hX - mX , 2 ) + Math . pow ( hY - mY , 2 ) ) ; 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 [ ] array = { Integer . parseInt ( sc . nextLine ( ) ) , Integer . parseInt ( sc . nextLine ( ) ) , Integer . parseInt ( sc . nextLine ( ) ) , Integer . parseInt ( sc . nextLine ( ) ) , Integer . parseInt ( sc . nextLine ( ) ) } ; int k = Integer . parseInt ( sc . nextLine ( ) ) ; boolean flag = false ; for ( int i = 0 ; i < array . length - 1 ; i + + ) { for ( int j = i + 1 ; j < array . length ; j + + ) { if ( Math . abs ( array [ i ] - array [ j ] ) > k ) { flag = true ; break ; } } if ( flag ) break ; } if ( ! flag ) { 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 = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; if ( 3 * k < s ) { System . out . println ( " " ) ; System . exit ( 0 ) ; } int r = 0 ; for ( int x = 0 ; x < = k ; x + + ) { for ( int y = 0 ; y < = k & & y < = s - x ; y + + ) { if ( 0 < = s - x - y & & s - x - y < = k ) { r + + ; } } } System . out . println ( r ) ; } } 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 ( ) ; if ( h = = 12 & & m = = 0 ) { System . out . println ( " 0 " ) ; } else { double t = ( h * 60 + m ) * 360 / ( 12 * 60 ) ; double l = m * 360 / 60 ; double ang = t - l ; double coss = Math . cos ( Math . toRadians ( ang ) ) ; double ans = Math . sqrt ( a * a + b * b - 2 * a * b * coss ) ; 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 scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; int [ ] P = new int [ N ] ; int count = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = scan . nextInt ( ) ; if ( min > P [ i ] ) { count + + ; min = P [ i ] ; } } scan . close ( ) ; 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 . nextInt ( ) ; double b = sc . nextInt ( ) ; double h = sc . nextInt ( ) ; double m = sc . nextInt ( ) ; double angle _ h = ( 30 * h ) + 0.5 * m ; double angle _ m = 6 * m ; double angle = 0 ; if ( angle _ h < angle _ m ) { angle = angle _ m - angle _ h ; } else { angle = angle _ h - angle _ m ; } double ans = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( ans ) ; } } 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 ] ; int i ; String c , d ; boolean flag = false ; for ( i = 0 ; i < n ; i + + ) { c = stdin . next ( ) ; s [ i ] = c ; } for ( i = 0 ; i < n ; i + + ) { d = s [ i ] ; if ( d . contains ( " Y " ) ) flag = true ; } if ( flag ) 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 [ ] a = { sc . nextInt ( ) , sc . nextInt ( ) , 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 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 . * ; 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 . Arrays ; import java . util . List ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int first = scanner . nextInt ( ) ; int second = scanner . nextInt ( ) ; int third = scanner . nextInt ( ) ; List < Integer > list = Arrays . asList ( first , second , third ) ; int count5 = 0 ; int count7 = 0 ; for ( int value : list ) { if ( value = = 5 ) { count5 + + ; } if ( value = = 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 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 b1 = c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 0 ] - c [ 0 ] [ 1 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 1 ] ; boolean b2 = c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] = = c [ 1 ] [ 0 ] - c [ 1 ] [ 2 ] & & c [ 0 ] [ 0 ] - c [ 0 ] [ 2 ] = = c [ 2 ] [ 0 ] - c [ 2 ] [ 2 ] ; boolean b3 = c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 1 ] [ 1 ] & & c [ 0 ] [ 0 ] - c [ 1 ] [ 0 ] = = c [ 0 ] [ 2 ] - c [ 1 ] [ 2 ] ; boolean b4 = c [ 0 ] [ 0 ] - c [ 2 ] [ 0 ] = = c [ 0 ] [ 1 ] - c [ 2 ] [ 1 ] & & c [ 0 ] [ 0 ] - c [ 2 ] [ 0 ] = = c [ 0 ] [ 2 ] - c [ 2 ] [ 2 ] ; if ( b1 & & b2 & & b3 & & b4 ) { 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 ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; List < String > stock = new ArrayList < String > ( ) ; for ( int i = 0 ; i < N ; i + + ) { String hinaarare = sc . next ( ) ; if ( stock . contains ( hinaarare ) = = false ) { stock . add ( hinaarare ) ; } } if ( stock . 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 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 ) { Main main = new Main ( ) ; main . run ( ) ; } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int counterfive = 0 ; int counterseven = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int buf = sc . nextInt ( ) ; if ( buf = = 5 ) { counterfive + + ; } else if ( buf = = 7 ) { counterseven + + ; } } if ( counterfive = = 2 & & counterseven = = 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 = 5 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int k = Integer . parseInt ( sc . next ( ) ) ; String ans = " Yay ! " ; if ( a [ 4 ] - a [ 0 ] > k ) ans = " : ( " ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { static int [ ] [ ] grid ; static int [ ] left ; static int [ ] top ; static int size = 3 ; public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) ; grid = new int [ size ] [ size ] ; left = new int [ size ] ; top = new int [ size ] ; for ( int i = 0 ; i < size ; i + + ) { for ( int j = 0 ; j < size ; j + + ) grid [ i ] [ j ] = x . nextInt ( ) ; } for ( int i = 0 ; i < size ; i + + ) { left [ i ] = grid [ i ] [ 0 ] ; top [ i ] = grid [ 0 ] [ i ] ; } boolean good = true ; int curdiff , nowdiff ; for ( int i = 1 ; i < size ; i + + ) { if ( ! good ) break ; curdiff = grid [ i ] [ 0 ] - top [ 0 ] ; for ( int j = 1 ; j < size ; j + + ) { nowdiff = grid [ i ] [ j ] - top [ j ] ; if ( nowdiff ! = curdiff ) { good = false ; break ; } } } for ( int i = 1 ; i < size ; i + + ) { if ( ! good ) break ; curdiff = grid [ 0 ] [ i ] - left [ 0 ] ; for ( int j = 1 ; j < size ; j + + ) { nowdiff = grid [ j ] [ i ] - left [ j ] ; if ( nowdiff ! = curdiff ) { good = false ; break ; } } } if ( good ) 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 ( ) ; } for ( int i = 0 ; i < N ; i + + ) { B [ i ] = sc . nextInt ( ) ; } int ans = solve2 ( N , A , B ) ; System . out . println ( ans ) ; } private static int solve2 ( int N , int [ ] A , int [ ] B ) { int count = 0 ; int [ ] C = new int [ N ] ; long sum = 0 ; long negative = 0 ; for ( int i = 0 ; i < N ; i + + ) { C [ i ] = A [ i ] - B [ i ] ; sum + = C [ i ] ; if ( C [ i ] < 0 ) { negative + = C [ i ] ; count + + ; C [ i ] = 0 ; } } if ( sum < 0 ) return - 1 ; Arrays . sort ( C ) ; for ( int i = N - 1 ; i > = 0 ; i -- ) { if ( C [ i ] = = 0 | | negative > = 0 ) break ; negative + = C [ i ] ; count + + ; } return 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 [ ] P = new int [ N + 1 ] ; for ( int i = 1 ; i < = N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; int ans = 1 ; int min = P [ 1 ] ; for ( int i = 2 ; i < = N ; i + + ) { min = Math . min ( min , P [ i ] ) ; if ( P [ i ] < = min ) { ans + + ; } } System . out . println ( ans ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { static int [ ] [ ] memo ; public static int hoge ( int current , int n , String last ) { return 0 ; } public static void main ( String [ ] args ) throws IOException { BufferedReader bf = null ; bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a , e , k ; String str ; str = bf . readLine ( ) ; a = Integer . parseInt ( str ) ; str = bf . readLine ( ) ; str = bf . readLine ( ) ; str = bf . readLine ( ) ; str = bf . readLine ( ) ; e = Integer . parseInt ( str ) ; str = bf . readLine ( ) ; k = Integer . parseInt ( str ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . util . * ; import java . math . * ; public class Main { static final int MOD = 1 _ 000 _ 000 _ 007 ; static final int INF = 1 _ 000 _ 000 _ 000 ; static final int MAX = 10 _ 000 _ 000 ; static long [ ] fact = new long [ 100 ] ; 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 ( ) ; h * = 30 ; m * = 6 ; double rad = h - m ; rad + = ( double ) m / 12 ; if ( rad > 180 ) rad - = 360 ; if ( rad < 0 ) rad * = - 1 ; rad = rad * Math . PI / 180 ; double ans = a * a + b * b - 2 * a * b * Math . cos ( rad ) ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . Scanner ; import java . util . Arrays ; import java . lang . Integer ; import java . lang . Math ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String tokens1 [ ] = scanner . nextLine ( ) . split ( " " ) ; String tokens2 [ ] = scanner . nextLine ( ) . split ( " " ) ; int min = Integer . parseInt ( tokens2 [ 0 ] ) ; int count = 1 ; for ( int i = 1 ; i < tokens2 . length ; i + + ) { int val = Integer . parseInt ( tokens2 [ i ] ) ; if ( val < = min ) { count + + ; } min = Math . min ( min , val ) ; } System . out . print ( 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 = = 5 & & B = = 5 ) { if ( C = = 7 ) { System . out . print ( " YES " ) ; } } else if ( B = = 5 & & C = = 5 ) { if ( A = = 7 ) { System . out . print ( " YES " ) ; } } else if ( C = = 5 & & A = = 5 ) { if ( B = = 7 ) { System . out . print ( " YES " ) ; } } else { System . out . print ( " NO " ) ; } sc . close ( ) ; } } import java . util . * ; import java . io . * ; public class Main { void solve ( ) { int n = in . nextInt ( ) ; for ( int a = 1 ; a < = 3500 ; a + + ) { for ( int b = a ; b < = 3500 ; b + + ) { long num = 4 * a * b - n * b - n * a ; long denom = 1L * a * b * n ; if ( num > 0 & & denom % num = = 0 ) { out . println ( a + " " + b + " " + ( denom / num ) ) ; return ; } } } } FastScanner in ; PrintWriter out ; void run ( ) { in = new FastScanner ( ) ; out = new PrintWriter ( System . out ) ; solve ( ) ; out . close ( ) ; } class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } public FastScanner ( String s ) { try { br = new BufferedReader ( new FileReader ( s ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } public String nextToken ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( nextToken ( ) ) ; } public long nextLong ( ) { return Long . parseLong ( nextToken ( ) ) ; } public double nextDouble ( ) { return Double . parseDouble ( nextToken ( ) ) ; } } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) , 1 ) ; String s ; String sl [ ] ; int c [ ] [ ] = new int [ 3 ] [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { sl = r . readLine ( ) . split ( " " ) ; for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = Integer . parseInt ( sl [ j ] ) ; } } int a [ ] = new int [ 3 ] ; int b [ ] = new int [ 3 ] ; boolean f = true ; for ( int i = 0 ; i < 2 ; i + + ) { int z = c [ i ] [ 0 ] - c [ i + 1 ] [ 0 ] ; for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] - c [ i + 1 ] [ j ] ! = z ) { f = false ; } } } for ( int i = 0 ; i < 2 ; i + + ) { int z = c [ 0 ] [ i ] - c [ 0 ] [ i + 1 ] ; for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ j ] [ i ] - c [ j ] [ i + 1 ] ! = z ) { f = false ; } } } System . out . println ( f ? " Yes " : " No " ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { Main instance = new Main ( ) ; sc = instance . new Scanner ( ) ; instance . solve ( ) ; } private void solve ( ) { int [ ] antena = new int [ 5 ] ; int k ; String result = " Yay ! " ; try { for ( int i = 0 ; i < 5 ; i + + ) antena [ i ] = sc . nextInt ( ) ; k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antena [ j ] - antena [ i ] > k ) { result = " : ( " ; break ; } } } System . out . println ( result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private class Scanner { String [ ] s ; int i ; BufferedReader br ; String regex = " " ; public Scanner ( ) { s = new String [ 0 ] ; i = 0 ; br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } @ Override protected void finalize ( ) throws Throwable { try { super . finalize ( ) ; } finally { destruction ( ) ; } } private void destruction ( ) throws IOException { if ( br ! = null ) br . close ( ) ; } public String next ( ) throws IOException { if ( i < s . length ) return s [ i + + ] ; String st = br . readLine ( ) ; while ( st = = " " ) st = br . readLine ( ) ; s = st . split ( regex , 0 ) ; i = 0 ; return s [ i + + ] ; } public int nextInt ( ) throws NumberFormatException , IOException { return Integer . parseInt ( next ( ) ) ; } public Long nextLong ( ) throws NumberFormatException , IOException { return Long . parseLong ( next ( ) ) ; } public Double nextDouble ( ) throws NumberFormatException , IOException { return Double . parseDouble ( next ( ) ) ; } } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner f = new FastScanner ( ) ; int [ ] powers = { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 } ; int n = f . nextInt ( ) ; int j = 0 ; for ( int i = 0 ; i < powers . length ; i + + ) { if ( powers [ i ] > n ) { j = i ; break ; } } System . out . println ( powers [ j - 1 ] ) ; } public static class FastScanner { BufferedReader br ; StringTokenizer st ; public FastScanner ( String s ) { try { br = new BufferedReader ( new FileReader ( s ) ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } public FastScanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String nextToken ( ) { while ( st = = null | | ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } String nextLine ( ) { st = null ; try { return br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return null ; } int nextInt ( ) { return Integer . parseInt ( nextToken ( ) ) ; } long nextLong ( ) { return Long . parseLong ( nextToken ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( nextToken ( ) ) ; } } } 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 count = 0 ; int min = Integer . MAX _ VALUE ; for ( int i = 0 ; i < n ; i + + ) { if ( p [ i ] < min ) { count + + ; min = p [ i ] ; } } out ( count ) ; } static long gcd ( long a , long b ) { return ( b = = 0 ) ? a : gcd ( b , a % b ) ; } static int gcd ( int a , int b ) { return ( b = = 0 ) ? a : gcd ( b , a % b ) ; } static void out ( String info ) { System . out . println ( info ) ; } static void out ( int info ) { System . out . println ( info ) ; } static void out ( double info ) { System . out . println ( info ) ; } static void out ( long info ) { System . out . println ( info ) ; } } 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 A = Integer . parseInt ( st . nextToken ( ) ) ; int B = Integer . parseInt ( st . nextToken ( ) ) ; int H = Integer . parseInt ( st . nextToken ( ) ) ; int M = Integer . parseInt ( st . nextToken ( ) ) ; int mins = 60 * H + M ; double M _ angle = M * 6 ; double H _ angle = mins * 0.5 ; double x1 = A * Math . cos ( Math . toRadians ( H _ angle ) ) ; double y1 = A * Math . sin ( Math . toRadians ( H _ angle ) ) ; double x2 = B * Math . cos ( Math . toRadians ( M _ angle ) ) ; double y2 = B * Math . sin ( Math . toRadians ( M _ angle ) ) ; System . out . println ( Math . sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) ) ; } } 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 ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } 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 c = scn . nextInt ( ) ; int count5 = 0 ; int count7 = 0 ; if ( a = = 5 ) count5 + + ; if ( a = = 7 ) count7 + + ; if ( b = = 5 ) count5 + + ; if ( b = = 7 ) count7 + + ; if ( c = = 5 ) count5 + + ; if ( c = = 7 ) count7 + + ; String ans = " NO " ; if ( count5 = = 2 & & count7 = = 1 ) ans = " YES " ; 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 ) ; long n = sc . nextLong ( ) ; long m = sc . nextLong ( ) ; long ans = 0 ; long N = Math . max ( n , m ) ; long M = Math . min ( n , m ) ; long Mod = 1000000007L ; long a = 1 ; long b = 1 ; for ( int i = 1 ; i < = N ; i + + ) { a = ( a * i ) % Mod ; } for ( int i = 1 ; i < = M ; i + + ) { b = ( b * i ) % Mod ; } if ( N - M > 1 ) { ans = 0 ; } if ( N - M = = 1 ) { ans = ( a * b ) % Mod ; } if ( N = = M ) { ans = ( a * b ) % Mod ; ans = ( 2 * ans ) % Mod ; } 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 . 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 ; for ( i = 0 ; i < = k ; i + + ) { for ( j = 0 ; j < = k ; j + + ) { if ( 0 < = s - ( i + j ) & & s - ( i + j ) < = k ) cnt + + ; } } out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int adis1 = 0 ; int adis2 = 0 ; int bdis1 = 0 ; int bdis2 = 0 ; int [ ] [ ] nums = new int [ 3 ] [ 3 ] ; String answer = " Yes " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { nums [ i ] [ j ] = scan . nextInt ( ) ; } } adis1 = nums [ 1 ] [ 0 ] - nums [ 0 ] [ 0 ] ; adis2 = nums [ 2 ] [ 0 ] - nums [ 1 ] [ 0 ] ; for ( int j = 1 ; j < 3 ; j + + ) { if ( nums [ 1 ] [ j ] - nums [ 0 ] [ j ] ! = adis1 ) { answer = " No " ; } if ( nums [ 2 ] [ j ] - nums [ 1 ] [ j ] ! = adis2 ) { answer = " No " ; } } bdis1 = nums [ 0 ] [ 1 ] - nums [ 0 ] [ 0 ] ; bdis2 = nums [ 0 ] [ 2 ] - nums [ 0 ] [ 1 ] ; for ( int i = 0 ; i < 3 ; i + + ) { if ( nums [ i ] [ 1 ] - nums [ i ] [ 0 ] ! = bdis1 ) { answer = " No " ; } if ( nums [ i ] [ 2 ] - nums [ i ] [ 1 ] ! = bdis2 ) { answer = " No " ; } } System . out . println ( answer ) ; } } import java . util . Scanner ; 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 ] = = 0 ) { System . out . println ( ans ) ; return ; } 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 ( ) ; return ; } } import java . io . * ; import java . util . Arrays ; import java . util . StringTokenizer ; public class Main { public static PrintWriter out ; public static FastScanner in ; private void solve ( ) { int [ ] hash = new int [ 11 ] ; Arrays . fill ( hash , 0 ) ; for ( int i = 0 ; i < 3 ; i + + ) { hash [ in . nextInt ( ) ] + + ; } if ( hash [ 5 ] = = 2 & & hash [ 7 ] = = 1 ) { out . print ( " YES " ) ; return ; } out . print ( " NO " ) ; } private void runIO ( ) { in = new FastScanner ( ) ; out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; solve ( ) ; out . close ( ) ; } private static class FastScanner { BufferedReader bufferedReader ; StringTokenizer stringTokenizer ; private FastScanner ( ) { bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } private String next ( ) { if ( stringTokenizer = = null | | ! stringTokenizer . hasMoreElements ( ) ) { try { stringTokenizer = new StringTokenizer ( bufferedReader . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return stringTokenizer . nextToken ( ) ; } private int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } private long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } private String nextLine ( ) { String ret = " " ; try { ret = bufferedReader . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return ret ; } } public static void main ( String [ ] args ) { new Main ( ) . runIO ( ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) { BufferedReader in _ stream ; String in _ str ; String [ ] in _ str _ split ; int in _ N ; String [ ] in _ S ; int cnt ; boolean is _ four ; try { in _ stream = new BufferedReader ( new InputStreamReader ( System . in ) ) ; in _ str = new String ( in _ stream . readLine ( ) ) ; in _ N = Integer . parseInt ( in _ str ) ; in _ str = new String ( in _ stream . readLine ( ) ) ; in _ S = in _ str . split ( " " ) ; is _ four = false ; for ( cnt = 0 ; cnt < in _ N ; cnt + + ) { if ( in _ S [ cnt ] . equals ( " Y " ) ) { is _ four = true ; break ; } } if ( is _ four ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } } 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 minute = H * 60 + M ; double angle = minute * 5.5 ; double radian = Math . PI * angle / 180.0 ; double distance = Math . sqrt ( A * A + B * B - 2.0 * A * B * Math . cos ( radian ) ) ; System . out . println ( distance ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveB ( ) ; } private void solveA ( ) { Scanner scanner = null ; String wk = " " ; try { scanner = new Scanner ( System . in ) ; wk = scanner . next ( ) ; System . out . println ( wk . replaceAll ( " , " , " " ) ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; int numK = 0 ; int s = 0 ; try { scanner = new Scanner ( System . in ) ; numK = scanner . nextInt ( ) ; s = scanner . nextInt ( ) ; int startK = 0 ; if ( numK < = s / 3 ) { startK = numK ; } int res = 0 ; for ( int i = 0 ; i < = numK ; i + + ) { for ( int j = 0 ; j < = numK ; j + + ) { if ( s - i - j < 0 ) { break ; } else if ( s - i - j < = numK ) { res + + ; } } } System . out . println ( res ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int lineAB = 0 ; int lineBC = 0 ; int lineCA = 0 ; try { scanner = new Scanner ( System . in ) ; lineAB = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int lineAB = 0 ; int lineBC = 0 ; int lineCA = 0 ; try { scanner = new Scanner ( System . in ) ; lineAB = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; long n = input . nextLong ( ) ; long s = f ( n ) ; System . out . println ( s ) ; } private static long f ( long n ) { if ( n = = 0 ) return 2 ; return ( f ( n - 1 ) * 2 ) + 2 ; } } import java . util . Scanner ; public class Main { private static final String YES = " Yay ! " ; private static final String NO = " : ( " ; public static String process ( int a , int b , int c , int d , int e , int k ) { return ( ( e - a ) < = k ) ? YES : NO ; } 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 ( ) ; final String result = process ( a , b , c , d , e , k ) ; output ( result ) ; } private static void output ( String result ) { System . out . println ( result ) ; } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . PriorityQueue ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { solve ( System . in , System . out ) ; } static void solve ( InputStream is , PrintStream os ) { Scanner scan = new Scanner ( is ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int H = scan . nextInt ( ) ; int M = scan . nextInt ( ) ; double ax = A * Math . cos ( Math . toRadians ( 30 * H + M / 2.0 ) ) ; double ay = A * Math . sin ( Math . toRadians ( 30 * H + M / 2.0 ) ) ; double bx = B * Math . cos ( Math . toRadians ( 6 * M ) ) ; double by = B * Math . sin ( Math . toRadians ( 6 * M ) ) ; double ans = Math . sqrt ( ( ax - bx ) * ( ax - bx ) + ( ay - by ) * ( ay - by ) ) ; os . 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 ( ) ; int S = sc . nextInt ( ) ; int count = 0 ; for ( int p = 0 ; p < = K ; p + + ) { for ( int q = 0 ; q < = K ; q + + ) { if ( S - p - q < = K & & 0 < = S - p - q ) { 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 sum = 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 ) ) sum + + ; } } System . out . println ( sum ) ; } } import java . util . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; if ( N = = 1 ) N = 1 ; else if ( N > = 2 & & N < = 3 ) N = 2 ; else if ( N > = 4 & & N < = 7 ) N = 4 ; else if ( N > = 8 & & N < = 15 ) N = 8 ; else if ( N > = 16 & & N < = 31 ) N = 16 ; else if ( N > = 32 & & N < = 63 ) N = 32 ; else if ( N > = 64 & & N < = 101 ) N = 64 ; System . out . print ( N ) ; System . out . println ( ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int limit = scan . nextInt ( ) ; int sum = scan . nextInt ( ) ; int i , j ; int count = 0 ; for ( i = 0 ; i < = limit ; i + + ) { for ( j = 0 ; j < = limit ; j + + ) { if ( sum - i - j < = limit & & sum - i - j > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } 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 n = sc . nextInt ( ) ; int p [ ] = new int [ n + 1 ] ; p [ 0 ] = Integer . MAX _ VALUE ; int min [ ] = new int [ n + 1 ] ; min [ 0 ] = p [ 0 ] ; for ( int i = 1 ; i < = n ; i + + ) { p [ i ] = sc . nextInt ( ) ; min [ i ] = Math . min ( min [ i - 1 ] , p [ i ] ) ; } int cnt = 0 ; for ( int i = 1 ; i < = n ; i + + ) { if ( min [ i - 1 ] > = p [ i ] ) { cnt + + ; } } System . out . println ( cnt ) ; 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 d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int K = sc . nextInt ( ) ; if ( K > = 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 ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } import java . io . * ; import java . util . * ; import java . util . function . * ; final class Solver { static final Solver INSTANCE = new Solver ( ) ; void solve ( Supplier < String > sc ) { int A = Integer . parseInt ( sc . get ( ) ) ; int B = Integer . parseInt ( sc . get ( ) ) ; int H = Integer . parseInt ( sc . get ( ) ) ; int M = Integer . parseInt ( sc . get ( ) ) ; long minutes = H * 60L + M ; double degH = minutes / 12 . ; double degM = minutes ; var deg = Math . abs ( degH - degM ) * Math . PI / 30 ; var x2 = A * A + B * B - 2 * A * B * Math . cos ( deg ) ; System . out . printf ( " % .11f " , Math . pow ( x2 , 0.5 ) ) ; System . out . println ( ) ; } } class Main { public static void main ( String ... args ) { System . setOut ( new PrintStream ( new BufferedOutputStream ( System . out ) ) ) ; var reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver . INSTANCE . solve ( new Supplier < > ( ) { StringTokenizer line ; public String get ( ) { while ( line = = null | | ! line . hasMoreTokens ( ) ) try { line = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } return line . nextToken ( ) ; } } ) ; System . out . 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 = = 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 { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; if ( sc . nextInt ( ) * sc . nextInt ( ) * sc . nextInt ( ) = = 175 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . io . InputStream ; import java . io . PrintStream ; import java . util . Scanner ; public class Main { InputStream in = System . in ; PrintStream out = System . out ; public void _ main ( String [ ] args ) { Scanner sc = new Scanner ( 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 ( " Yay ! " ) ; } else { out . println ( " : ( " ) ; } sc . close ( ) ; } public static void main ( String [ ] args ) { new Main ( ) . _ main ( args ) ; } } 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 rad = 2 * Math . PI * ( H + M / 60.0 ) / 12 - 2 * Math . PI * M / 60 ; double C = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( rad ) ) ; System . out . println ( 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 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 . 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 answer = 0.00 ; double omega = 6 * M - 30 * H - 0.5 * M ; if ( omega > = 0 ) { if ( omega > = 180 ) { omega = 360 - omega ; } else { } } else { if ( omega < = - 180 ) { omega = 360 + omega ; } else { } } double radian = Math . toRadians ( omega ) ; answer = A * A + B * B - 2 * A * B * Math . cos ( radian ) ; answer = Math . sqrt ( answer ) ; System . out . println ( answer ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . HashMap ; 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 a1 = scan . nextInt ( ) ; int a2 = scan . nextInt ( ) ; int a3 = scan . nextInt ( ) ; int a4 = scan . nextInt ( ) ; boolean [ ] digits = new boolean [ 10 ] ; digits [ a1 ] = true ; digits [ a2 ] = true ; digits [ a3 ] = true ; digits [ a4 ] = true ; if ( digits [ 1 ] & & digits [ 4 ] & & digits [ 7 ] & & digits [ 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 count = 0 ; int a [ ] = new int [ 9 ] ; int N = sc . nextInt ( ) ; int temp = 1 ; for ( int i = 0 ; i < a . length ; i + + ) { a [ i ] = temp ; temp * = 2 ; } for ( int i = a . length - 1 ; i > = 0 ; i -- ) { if ( a [ i ] < = N ) { System . out . println ( a [ i ] ) ; return ; } } } } 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 d = sc . nextInt ( ) ; int e = sc . nextInt ( ) ; int f = sc . nextInt ( ) ; int [ ] arr = { a , b , c , d , e } ; Arrays . sort ( arr ) ; if ( ( e - a ) < = f ) 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 ; int tmp = 0 ; for ( int i = 1 ; i < = N ; + + i ) { int num = i ; int cnt = 0 ; while ( true ) { if ( num % 2 = = 0 ) { cnt + + ; num / = 2 ; } else { break ; } } if ( cnt > tmp ) { tmp = cnt ; ans = i ; } } System . out . println ( ans ) ; } } import java . io . * ; 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 ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; Solver . INSTANCE . solve ( new Iterator < String > ( ) { private StringTokenizer tokenizer ; public boolean hasNext ( ) { return true ; } public String next ( ) { if ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } } return tokenizer . nextToken ( ) ; } } ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = " " ; int strN = 1 ; for ( int i = 0 ; i < strN ; i + + ) { line + = br . readLine ( ) + " " ; } String [ ] param = line . split ( " " ) ; AtoZString ( param ) ; } static void AtoZString ( String [ ] param ) { int K = Integer . parseInt ( param [ 0 ] ) ; int S = Integer . parseInt ( param [ 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 > = 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 A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double result = 0 ; int minute = M + 60 * H ; double radianA = 0.5 * minute ; double radianB = 6 * minute ; while ( radianB > = 360 ) { radianB = radianB - 360 ; } result = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( Math . abs ( radianA - radianB ) ) ) ) ; 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double hourX = Math . sin ( ( h + m / 60.0 ) / 6.0 * Math . PI ) * a ; double hourY = Math . cos ( ( h + m / 60.0 ) / 6.0 * Math . PI ) * a ; double minX = Math . sin ( m / 30.0 * Math . PI ) * b ; double minY = Math . cos ( m / 30.0 * Math . PI ) * b ; double ans = Math . sqrt ( ( hourX - minX ) * ( hourX - minX ) + ( hourY - minY ) * ( hourY - minY ) ) ; System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int min = 2000001 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; if ( P [ i ] < = min ) { ans + + ; if ( P [ i ] < min ) { min = P [ i ] ; } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int [ ] [ ] grid = new int [ 3 ] [ 3 ] ; Scanner sc = new Scanner ( System . in ) ; for ( int row = 0 ; row < 3 ; row + + ) { for ( int col = 0 ; col < 3 ; col + + ) { grid [ row ] [ col ] = sc . nextInt ( ) ; } } int aDiff1 = grid [ 0 ] [ 0 ] - grid [ 0 ] [ 1 ] ; int aDiff2 = grid [ 0 ] [ 1 ] - grid [ 0 ] [ 2 ] ; int bDiff1 = grid [ 0 ] [ 0 ] - grid [ 1 ] [ 0 ] ; int bDiff2 = grid [ 1 ] [ 0 ] - grid [ 2 ] [ 0 ] ; if ( ( grid [ 1 ] [ 0 ] - aDiff1 ! = grid [ 1 ] [ 1 ] ) | | ( grid [ 1 ] [ 1 ] - aDiff2 ! = grid [ 1 ] [ 2 ] ) | | ( grid [ 2 ] [ 0 ] - aDiff1 ! = grid [ 2 ] [ 1 ] ) | | ( grid [ 2 ] [ 1 ] - aDiff2 ! = grid [ 2 ] [ 2 ] ) | | ( grid [ 0 ] [ 1 ] - bDiff1 ! = grid [ 1 ] [ 1 ] ) | | ( grid [ 1 ] [ 1 ] - bDiff2 ! = grid [ 2 ] [ 1 ] ) | | ( grid [ 0 ] [ 2 ] - bDiff1 ! = grid [ 1 ] [ 2 ] ) | | ( grid [ 1 ] [ 2 ] - bDiff2 ! = grid [ 2 ] [ 2 ] ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Integer num = new Scanner ( System . in ) . nextInt ( ) ; int nowNum = 1 ; while ( nowNum * 2 < = num ) { nowNum * = 2 ; } System . out . println ( nowNum ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num [ ] = new int [ 3 ] ; int sev = 0 ; int fiv = 0 ; String ans ; for ( int i = 0 ; i < 3 ; + + i ) { num [ i ] = sc . nextInt ( ) ; if ( num [ i ] = = 7 ) sev + + ; else if ( num [ i ] = = 5 ) fiv + + ; } if ( sev = = 1 & & fiv = = 2 ) ans = " YES " ; else ans = " NO " ; System . out . println ( ans ) ; } } 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 . toRadians ( Math . abs ( angH - angM ) ) ; double c = 0 ; c = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( ang ) ) ; System . out . print ( c ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int N = scn . nextInt ( ) ; int min = N + 1 ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { int a = scn . nextInt ( ) ; if ( min > = a ) { min = a ; ans + + ; } } System . out . println ( ans ) ; } } 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 ( ) ; } } String ans = " Yes " ; boolean bl = true ; 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 ] | | c [ i ] [ j ] - c [ i + 1 ] [ j ] ! = c [ i ] [ j + 1 ] - c [ i + 1 ] [ j + 1 ] ) { ans = " No " ; break ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { String line = null ; try ( Scanner sc = new Scanner ( System . in ) ) { line = sc . nextLine ( ) ; String [ ] tmpArray = line . split ( " " ) ; int cntFive = 0 ; int cntSeven = 0 ; for ( String tmpStr : tmpArray ) { if ( tmpStr . equals ( " 5 " ) ) { cntFive + + ; } else if ( tmpStr . equals ( " 7 " ) ) { cntSeven + + ; } } String result = " NO " ; if ( cntFive = = 2 & & cntSeven = = 1 ) { result = " YES " ; } System . out . println ( result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } 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 ( ) ) ; } } sc . close ( ) ; 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 ] ; String ans = " Yes " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( a [ i ] + b [ j ] ! = C [ i ] [ j ] ) { ans = " No " ; } } } System . out . println ( ans ) ; } } import java . util . Scanner ; class Main { private static double findTheta ( int h , int m ) { double x = 2 * Math . PI / 12 * ( h + m / 60.0 ) ; double y = 2 * Math . PI / 60 * m ; return Math . abs ( x - y ) ; } private static double findC ( int a , int b , double theta ) { double c2 = a * a + b * b - 2 * a * b * Math . cos ( theta ) ; return Math . sqrt ( c2 ) ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a , b , h , m ; a = in . nextInt ( ) ; b = in . nextInt ( ) ; h = in . nextInt ( ) ; m = in . nextInt ( ) ; double theta = findTheta ( h , m ) ; System . out . println ( findC ( a , b , theta ) ) ; } } 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 . * ; 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 ( ) ) ; double radH = - Math . toRadians ( ( H + M / 60D ) * 30D ) + 90D ; double radM = - Math . toRadians ( M * 6D ) + 90D ; double hX = A * Math . cos ( radH ) ; double hY = A * Math . sin ( radH ) ; double mX = B * Math . cos ( radM ) ; double mY = B * Math . sin ( radM ) ; double distance = Math . sqrt ( ( hX - mX ) * ( hX - mX ) + ( hY - mY ) * ( hY - mY ) ) ; System . out . println ( distance ) ; } } import java . util . Arrays ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] task = new int [ 3 ] ; int ans = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { task [ i ] = sc . nextInt ( ) ; } Arrays . sort ( task ) ; for ( int i = 0 ; i < 2 ; i + + ) { ans + = Math . abs ( task [ i ] - task [ i + 1 ] ) ; } 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 ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Map < Character , List < Integer > > charIndexMap = new HashMap < Character , List < Integer > > ( ) ; Map < Integer , Integer > golemMap = new HashMap < Integer , Integer > ( ) ; 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 ( " : ( " ) ; return ; } System . out . println ( " Yay ! " ) ; } } import java . util . * ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] input = new int [ 3 ] ; int fiveCount = 0 ; int sevenCount = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { input [ i ] = sc . nextInt ( ) ; if ( input [ i ] = = 5 & & fiveCount < 2 ) { fiveCount + + ; } else if ( input [ i ] = = 7 & & sevenCount < 1 ) { sevenCount + + ; } else { 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 ( ) ; long sum = 0 , count = 0 , flag = 0 , max = - 999999 , min = 99999 ; long [ ] array = new long [ a ] ; String buff ; for ( int i = 0 ; i < a ; i + + ) { buff = sc . next ( ) ; if ( buff . equals ( " P " ) ) { array [ 0 ] + + ; } else if ( buff . equals ( " G " ) ) { array [ 1 ] + + ; } else if ( buff . equals ( " Y " ) ) { array [ 2 ] + + ; } else { array [ 3 ] + + ; } } for ( int i = 0 ; i < a ; i + + ) { if ( array [ i ] ! = 0 ) count + + ; } if ( count = = 3 ) System . out . println ( " Three " ) ; if ( count = = 4 ) System . out . println ( " Four " ) ; } public static int sample ( int n ) { return n ; } } 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 = i + 1 ; j < 5 ; j + + ) { if ( a [ j ] - a [ i ] > 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 k = sc . nextInt ( ) ; int t = sc . nextInt ( ) ; int count = 0 ; for ( int i = 0 ; i < = k & & i < = t ; i + + ) { for ( int j = 0 ; j < = k & & i + j < = t ; j + + ) { if ( t - ( 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 = 5 * 5 * 7 ; if ( A * B * C = = product ) { 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 ; 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 . Arrays ; import java . util . Comparator ; import java . util . Scanner ; 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 ( ) , " " , 32 * 1024 * 1024 ) ; thread . start ( ) ; } @ Override public void run ( ) { final Scanner scanner = new Scanner ( System . in ) ; solve ( scanner ) ; } static void solve ( Scanner scanner ) { int N = Integer . parseInt ( scanner . next ( ) ) ; int [ ] A = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { A [ i ] = Integer . parseInt ( scanner . next ( ) ) ; } 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 ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int maxTimes = 0 ; int number = 1 ; for ( int i = 1 ; i < = n ; i + + ) { int temp = 0 ; int num = i ; while ( num % 2 = = 0 ) { num = num / 2 ; temp + + ; } if ( temp > maxTimes ) { maxTimes = temp ; number = i ; } } System . out . println ( number ) ; } } 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 n = Integer . parseInt ( br . readLine ( ) ) ; String [ ] s = br . readLine ( ) . split ( " " ) ; int array [ ] = new int [ s . length ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = Integer . parseInt ( s [ i ] ) ; } int min = Integer . MAX _ VALUE ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { if ( array [ i ] < min ) { count + + ; min = array [ 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 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 ( z < = k & & z > = 0 ) { count + + ; } } } System . out . println ( count ) ; } } import java . io . PrintWriter ; import java . util . * ; public class Main { void run ( ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double thetaA = 30 * h + 0.5 * m ; double thetaB = 6 * m ; double theta = thetaA - thetaB ; double x = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( theta * Math . PI / 180 ) ) ; System . out . println ( x ) ; out . flush ( ) ; } void debug ( Object ... os ) { System . err . println ( Arrays . deepToString ( os ) ) ; } public static void main ( String [ ] args ) { new Main ( ) . run ( ) ; } } 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 ( ) ; } int k = sc . nextInt ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { if ( Math . abs ( arr [ i ] - arr [ j ] ) > k ) { System . out . println ( " : ( " ) ; return ; } } } System . out . println ( " Yay ! " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int sum = 0 ; int min = - 1 ; ArrayList < Integer > a = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < n ; i + + ) { int b = scan . nextInt ( ) ; int [ ] g = put ( b , min ) ; sum + = g [ 0 ] ; min = g [ 1 ] ; } System . out . println ( sum ) ; } public static int [ ] put ( int a , int b ) { int [ ] g = new int [ 2 ] ; if ( b = = - 1 ) { g [ 1 ] = a ; g [ 0 ] = 1 ; return g ; } if ( a < = b ) { g [ 1 ] = a ; g [ 0 ] = 1 ; return g ; } g [ 1 ] = b ; g [ 0 ] = 0 ; return g ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { new Main ( ) . solveB ( ) ; } private void solveA ( ) { Scanner scanner = null ; String wk = " " ; try { scanner = new Scanner ( System . in ) ; wk = scanner . next ( ) ; System . out . println ( wk . replaceAll ( " , " , " " ) ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } private void solveB ( ) { Scanner scanner = null ; int numK = 0 ; int s = 0 ; try { scanner = new Scanner ( System . in ) ; numK = scanner . nextInt ( ) ; s = scanner . nextInt ( ) ; int startK = 0 ; if ( numK < = s / 3 ) { startK = numK ; } int res = 0 ; for ( int i = 0 ; i < = numK ; i + + ) { for ( int j = 0 ; j < = numK ; j + + ) { if ( s - i - j < 0 ) { break ; } startK = s - i - j ; for ( int k = startK ; k < = numK ; k + + ) { if ( i + j + k = = s ) { res + + ; break ; } } } } System . out . println ( res ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } private void solveC ( ) { Scanner scanner = null ; int lineAB = 0 ; int lineBC = 0 ; int lineCA = 0 ; try { scanner = new Scanner ( System . in ) ; lineAB = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } private void solveD ( ) { Scanner scanner = null ; int lineAB = 0 ; int lineBC = 0 ; int lineCA = 0 ; try { scanner = new Scanner ( System . in ) ; lineAB = scanner . nextInt ( ) ; System . out . println ( " " ) ; } finally { if ( scanner ! = null ) { scanner . close ( ) ; } } } } import java . util . * ; import java . lang . Math ; 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 stack ; int start = 0 ; if ( s - 2 * k > 0 ) start = s - 2 * k ; int end = k ; if ( s < k ) end = s ; for ( int x = 0 ; x < = k ; x + + ) { stack = s - x ; if ( stack < = 2 * k & & stack > = 0 ) { if ( stack < = k ) count + = stack + 1 ; else count + = k - ( stack - k ) + 1 ; } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { var 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 ( ) ) ; double x = Math . toRadians ( Math . abs ( h * 30 + m * 0.5 - m * 6 ) ) ; double ans = Math . sqrt ( a * a + b * b - ( 2 * a * b * Math . cos ( x ) ) ) ; 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 ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; } int count = 0 ; int minium = P [ 0 ] ; for ( int i = 0 ; i < N ; i + + ) { if ( P [ i ] < = minium ) { minium = P [ i ] ; count + + ; } } System . out . println ( count ) ; } } import java . util . Scanner ; final class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int a , b , c , d , e , k ; a = stdIn . nextInt ( ) ; b = stdIn . nextInt ( ) ; c = stdIn . nextInt ( ) ; d = stdIn . nextInt ( ) ; e = stdIn . nextInt ( ) ; k = stdIn . nextInt ( ) ; if ( e - a < = k ) { 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 [ ] [ ] c = new int [ 3 ] [ 3 ] ; int max = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { c [ i ] [ j ] = sc . nextInt ( ) ; max = Math . max ( c [ i ] [ j ] , max ) ; } } for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { for ( int k = 0 ; k < = max ; k + + ) { if ( c [ 1 ] [ 0 ] - c [ 0 ] [ 0 ] = = j - i & & c [ 1 ] [ 0 ] - c [ 2 ] [ 0 ] = = j - k ) { if ( c [ 1 ] [ 1 ] - c [ 0 ] [ 1 ] = = j - i & & c [ 1 ] [ 1 ] - c [ 2 ] [ 1 ] = = j - k ) { if ( c [ 1 ] [ 2 ] - c [ 0 ] [ 2 ] = = j - i & & c [ 1 ] [ 2 ] - c [ 2 ] [ 2 ] = = j - k ) { System . out . println ( " Yes " ) ; return ; } } } } } } 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 [ ] ant = new int [ 5 ] ; boolean ans = false ; for ( int i = 0 ; i < 5 ; i + + ) { ant [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; if ( ( Math . abs ( ant [ 0 ] - ant [ 1 ] ) > k ) | | ( Math . abs ( ant [ 0 ] - ant [ 2 ] ) > k ) | | ( Math . abs ( ant [ 0 ] - ant [ 3 ] ) > k ) | | ( Math . abs ( ant [ 0 ] - ant [ 4 ] ) > k ) | | ( Math . abs ( ant [ 1 ] - ant [ 2 ] ) > k ) | | ( Math . abs ( ant [ 1 ] - ant [ 3 ] ) > k ) | | ( Math . abs ( ant [ 1 ] - ant [ 4 ] ) > k ) | | ( Math . abs ( ant [ 2 ] - ant [ 3 ] ) > k ) | | ( Math . abs ( ant [ 2 ] - ant [ 4 ] ) > k ) | | ( Math . abs ( ant [ 3 ] - ant [ 4 ] ) > k ) ) ans = true ; sc . close ( ) ; System . out . println ( ans ? " : ( " : " 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 cnt = 0 ; if ( a = = 5 ) cnt + + ; if ( b = = 5 ) cnt + + ; if ( c = = 5 ) cnt + + ; if ( a + b + c = = 17 & & cnt = = 2 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = Integer . parseInt ( sc . next ( ) ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = sc . next ( ) ; } Set < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { set . add ( a [ i ] ) ; } if ( set . size ( ) = = 4 ) { 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 N = sc . nextInt ( ) ; for ( int i = 0 ; i < N ; i + + ) { String arare = sc . next ( ) ; if ( arare . equals ( " Y " ) ) { System . out . println ( " Four " ) ; return ; } } System . out . println ( " Three " ) ; } } 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 br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a [ ] = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = Integer . parseInt ( br . readLine ( ) ) ; } int k = Integer . parseInt ( br . readLine ( ) ) ; if ( a [ 4 ] - a [ 0 ] > k ) { System . out . println ( " : ( " ) ; return ; } 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 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 [ ] nums = new int [ 3 ] , rep = new int [ 2 ] ; rep [ 0 ] = 0 ; rep [ 1 ] = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { nums [ i ] = sc . nextInt ( ) ; if ( nums [ i ] = = 5 ) { rep [ 0 ] + + ; } else if ( nums [ i ] = = 7 ) { rep [ 1 ] + + ; } } if ( rep [ 0 ] = = 2 & & rep [ 1 ] = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . HashMap ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter wr = new PrintWriter ( System . out ) ; String str = br . readLine ( ) . trim ( ) ; StringTokenizer stk = new StringTokenizer ( str ) ; int n = Integer . parseInt ( stk . nextToken ( ) ) ; HashMap < String , Integer > hm = new HashMap < > ( ) ; str = br . readLine ( ) . trim ( ) ; stk = new StringTokenizer ( str ) ; for ( int i = 0 ; i < n ; i + + ) { String s = stk . nextToken ( ) ; hm . put ( s , 1 ) ; } if ( hm . size ( ) = = 3 ) System . out . println ( " Three " ) ; else if ( hm . size ( ) = = 4 ) System . out . println ( " Four " ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int cnt = 0 ; 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 k = S - i - j ; if ( 0 < = k & & k < = K ) cnt + + ; } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scr = new Scanner ( System . in ) ; int A = scr . nextInt ( ) ; int B = scr . nextInt ( ) ; int H = scr . nextInt ( ) ; int M = scr . nextInt ( ) ; double H1 = ( H * 60 + M ) * 0.5 ; double M1 = M * 6 ; double KK ; if ( H1 < M1 ) { KK = M1 - H1 ; } else { KK = H1 - M1 ; } double Theta = Math . cos ( Math . toRadians ( KK ) ) ; double ans = A * A + B * B - 2 * B * A * Theta ; 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 a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double c = 0.0 ; double aa = 0.5 * ( h * 60 + m ) ; double bb = 6 * m ; double cc = Math . abs ( aa - bb ) ; if ( cc > 180 ) { cc = 360 - cc ; } double cos = Math . cos ( Math . toRadians ( cc ) ) ; c = Math . sqrt ( Math . pow ( a , 2 ) + Math . pow ( b , 2 ) - 2 * a * b * cos ) ; System . out . println ( c ) ; } } 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 set = new HashSet ( ) ; int ans = 0 ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( ! set . contains ( s ) ) { set . add ( s ) ; 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 scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; int h = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double rad = Math . PI * 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 . Arrays ; 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 [ ] 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 . 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 . HashMap ; import java . util . Map ; import java . util . Map . Entry ; 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 ans = 1 ; Map < Long , Long > map = primeNumMap ( p ) ; for ( Entry < Long , Long > entry : map . entrySet ( ) ) { long e = entry . getValue ( ) ; if ( e > = n ) { long a = e / n ; ans * = Math . pow ( entry . getKey ( ) , a ) ; } } System . out . println ( ans ) ; } static Map < Long , Long > primeNumMap ( long m ) { Map < Long , Long > map = new HashMap < > ( ) ; for ( long i = 2 ; i < = m ; i + + ) { if ( m % i = = 0 ) { while ( m % i = = 0 ) { m / = i ; if ( m = = 1 ) { if ( map . containsKey ( i ) ) { map . put ( i , map . get ( i ) + 1 ) ; } else { map . put ( i , 1l ) ; } return map ; } else { if ( map . containsKey ( i ) ) { map . put ( i , map . get ( i ) + 1 ) ; } else { map . put ( i , 1l ) ; } } } if ( isPrimeNum ( m ) ) { if ( map . containsKey ( m ) ) { map . put ( m , map . get ( m ) + 1 ) ; } else { map . put ( m , 1l ) ; } return map ; } } } return map ; } static boolean isPrimeNum ( long m ) { boolean ans = true ; for ( int i = 2 ; i < = Math . sqrt ( m ) ; i + + ) { if ( m % i = = 0 ) { return false ; } } return ans ; } } 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 ( ) ) ; } public static void main ( String [ ] args ) { for ( int i = 0 ; i < N ; i + + ) { D [ i ] = A [ i ] - B [ i ] ; } if ( Arrays . stream ( D ) . sum ( ) < 0 ) { System . out . println ( - 1 ) ; return ; } if ( Arrays . stream ( D ) . allMatch ( i - > i > = 0 ) ) { System . out . println ( 0 ) ; return ; } long ans = Arrays . stream ( D ) . filter ( i - > i < 0 ) . count ( ) ; long shortage = Arrays . stream ( D ) . filter ( i - > i < 0 ) . sum ( ) ; long [ ] remains = Arrays . stream ( D ) . filter ( i - > i > 0 ) . sorted ( ) . toArray ( ) ; for ( int i = remains . length - 1 ; i > = 0 ; i -- ) { shortage + = remains [ i ] ; ans + + ; if ( shortage > = 0 ) { break ; } } System . out . println ( 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 ( ) ; scan . close ( ) ; double aDeg = ( ( double ) h / 12 * 360 + ( double ) m / 60 * 30 ) % 360 ; double bDeg = ( ( double ) m / 60 * 360 ) % 360 ; double deg = Math . abs ( aDeg - bDeg ) ; double answer = Math . sqrt ( a * a + b * b - 2 * a * b * Math . cos ( Math . toRadians ( deg ) ) ) ; System . out . println ( answer ) ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextInt ( ) ; OUT : for ( long i = 1 ; i < = 3500 ; i + + ) { for ( long j = 1 ; j < = 3500 ; j + + ) { long k = Math . round ( ( double ) ( n * i * j ) / ( double ) ( 4 * i * j - n * i - n * j ) ) ; if ( k > 0 & & 4 * i * j * k = = n * ( i * j + j * k + k * i ) ) { System . out . printf ( " % d % d % d " , i , j , k ) ; break OUT ; } } } sc . close ( ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { int n ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; + + i ) { arr [ i ] = sc . nextInt ( ) ; } long max _ now = arr [ 0 ] ; int ans = 1 ; for ( int i = 1 ; i < n ; + + i ) { if ( arr [ i ] < = max _ now ) { ans + + ; } max _ now = Math . min ( max _ now , arr [ 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 ( ) ; int cnt = 0 ; int [ ] nums = new int [ 4 ] ; String [ ] colors = { " P " , " W " , " G " , " Y " } ; for ( int i = 0 ; i < n ; i + + ) { String s = sc . next ( ) ; for ( int j = 0 ; j < 4 ; j + + ) { if ( s . equals ( colors [ j ] ) ) { nums [ j ] + = 1 ; } } } for ( int nu : nums ) { if ( nu > 0 ) { cnt + + ; } } if ( cnt = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } 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 ( ) ) ; int count ; int max = 0 ; int ans = 1 ; int a ; for ( int i = 2 ; i < = n ; i + + ) { a = i ; count = 0 ; while ( a % 2 = = 0 ) { count + + ; a / = 2 ; } 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 ) ; int [ ] a = new int [ 3 ] ; int five _ count = 0 ; int seven _ count = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = Integer . valueOf ( sc . next ( ) ) . intValue ( ) ; if ( a [ i ] = = 5 ) { five _ count + + ; } else if ( a [ i ] = = 7 ) { seven _ count + + ; } } if ( seven _ count = = 1 & & five _ count = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int [ ] arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = s . nextInt ( ) ; } int maxd = s . nextInt ( ) ; String status = " Yay ! " ; outerloop : for ( int j = 0 ; j < 4 ; j + + ) { for ( int l = j + 1 ; l < 5 ; l + + ) { if ( arr [ l ] - arr [ j ] > maxd ) { status = " : ( " ; break outerloop ; } } } System . out . print ( status ) ; } } 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 ( ) ) ; System . out . println ( a [ a . length - 1 ] - a [ 0 ] < = k ? " 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 ; while ( ( int ) Math . pow ( 2 , count ) < = n ) { count + + ; } System . out . println ( ( int ) Math . pow ( 2 , count - 1 ) ) ; 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 ] ; boolean bl = false ; for ( int i = 0 ; i < N ; i + + ) { s [ i ] = sc . next ( ) ; if ( s [ i ] . equals ( " Y " ) ) bl = true ; } System . out . println ( bl = = true ? " Four " : " Three " ) ; } } import java . util . Scanner ; import java . util . StringJoiner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long N = sc . nextLong ( ) ; long h = 1 ; long n = 1 ; long w = 1 ; boolean found = false ; for ( int i = 3500 ; i > 0 ; i -- ) { for ( int j = 3500 ; j > 0 ; j -- ) { long k1 = N * i * j ; long k2 = 4 * i * j - N * ( i + j ) ; if ( k2 > 0 & & k1 % k2 = = 0 ) { h = i ; n = j ; w = k1 / k2 ; found = true ; break ; } } if ( found ) { break ; } } StringJoiner sj = new StringJoiner ( " " ) ; sj . add ( String . valueOf ( h ) ) ; sj . add ( String . valueOf ( n ) ) ; sj . add ( String . valueOf ( w ) ) ; System . out . println ( sj ) ; } } 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 [ ] line = br . readLine ( ) . split ( " " ) ; int num1 = Integer . parseInt ( line [ 0 ] ) ; int num2 = Integer . parseInt ( line [ 1 ] ) ; int num3 = Integer . parseInt ( line [ 2 ] ) ; if ( num1 = = 5 & & num2 = = 5 & & num3 = = 7 ) { System . out . println ( " YES " ) ; } else if ( num1 = = 5 & & num2 = = 7 & & num3 = = 5 ) { System . out . println ( " YES " ) ; } else if ( num1 = = 7 & & num2 = = 5 & & num3 = = 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 a1 , a2 , a3 , b1 , b2 , b3 ; 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 res = " No " ; for ( a1 = 0 ; a1 < = grid [ 0 ] [ 0 ] ; a1 + + ) { b1 = grid [ 0 ] [ 0 ] - a1 ; b2 = grid [ 0 ] [ 1 ] - a1 ; b3 = grid [ 0 ] [ 2 ] - a1 ; a2 = grid [ 1 ] [ 0 ] - b1 ; a3 = grid [ 2 ] [ 0 ] - b1 ; if ( a2 + b2 = = grid [ 1 ] [ 1 ] & & a2 + b3 = = grid [ 1 ] [ 2 ] & & a3 + b2 = = grid [ 2 ] [ 1 ] & & a3 + b3 = = grid [ 2 ] [ 2 ] ) res = " Yes " ; } System . out . println ( res ) ; } } 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 K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int count = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { if ( x + y > S ) { break ; } if ( S - ( x + y ) < = K ) { count + + ; } } } out . println ( count ) ; } } 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 { Scanner sc = new Scanner ( System . in ) ; final int MOD = 1000000007 ; final int MAX = Integer . MAX _ VALUE ; final long LMAX = Long . MAX _ VALUE ; int len = ( int ) 1e6 + 1 ; void doIt ( ) { int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double argA = Math . PI * ( double ) H / 6.0 + Math . PI * ( double ) M / 6.0 / 60.0 ; double argB = Math . PI * ( double ) M / 30.0 ; double Ax = A * Math . cos ( argA ) ; double Ay = A * Math . sin ( argA ) ; double Bx = B * Math . cos ( argB ) ; double By = B * Math . sin ( argB ) ; double ans = Math . sqrt ( ( Ax - Bx ) * ( Ax - Bx ) + ( Ay - By ) * ( Ay - By ) ) ; System . out . println ( ans ) ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } 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 static int div ( int n ) { int res = 0 ; while ( n % 2 = = 0 ) { res + + ; n = n / 2 ; } return res ; } public void solve ( int testNumber , Scanner sn , PrintWriter out ) { int n = sn . nextInt ( ) ; int res = 0 ; int m = 1 ; int i = 2 ; for ( ; i < = n ; i + + ) { if ( res < div ( i ) ) { res = div ( i ) ; m = i ; } } out . println ( m ) ; } } } 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 ) { int a = nums [ 3 ] * 100 + ( nums [ 1 ] + nums [ 4 ] ) * 10 + nums [ 0 ] + nums [ 2 ] + nums [ 5 ] ; int b = nums [ 6 ] * 100 + nums [ 7 ] * 10 + nums [ 8 ] ; if ( a = = b ) 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 ; } } import java . util . Scanner ; public class Main { private static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int k = scanner . nextInt ( ) ; int s = scanner . nextInt ( ) ; int answer = 0 ; for ( int x = 0 ; x < = k ; x + + ) answer + = ( s - x + 1 ) - Math . min ( s - x + 1 , Math . max ( 0 , ( ( s - x - k ) * 2 ) ) ) ; 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 ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( a ) ; int [ ] b = { 5 , 5 , 7 } ; if ( Arrays . toString ( a ) . equals ( Arrays . toString ( 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 ( ) ; double HDo = H * 60 + M ; HDo = HDo / ( double ) 2 ; double MDo = M * 6 ; double Sa = HDo - MDo ; HDo = Math . PI * Sa / 180 ; double C2 = A * A + B * B - 2 * A * B * Math . cos ( HDo ) ; System . out . println ( Math . sqrt ( C2 ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int data [ ] = new int [ 10 ] ; int x = 0 ; for ( int i = 1 ; i < 10 ; i + + ) { data [ i ] = scan . nextInt ( ) ; } for ( int a = 0 ; a < 101 ; a + + ) { for ( int b = 0 ; b < 101 ; b + + ) { for ( int c = 0 ; c < 101 ; c + + ) { for ( int d = 0 ; d < 101 ; d + + ) { if ( data [ 1 ] = = a + d & & data [ 4 ] = = b + d & & data [ 7 ] = = c + d ) { for ( int e = 0 ; e < 101 ; e + + ) { if ( data [ 2 ] = = a + e & & data [ 5 ] = = b + e & & data [ 8 ] = = c + e ) { for ( int f = 0 ; f < 101 ; f + + ) { if ( data [ 3 ] = = a + f & & data [ 6 ] = = b + f & & data [ 9 ] = = c + f ) { System . out . println ( " Yes " ) ; return ; } } } } } } } } } System . out . println ( " No " ) ; } } import java . util . ArrayDeque ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . util . Queue ; import java . util . Scanner ; public class Main { static int a1 [ ] = { 0 , - 1 , 0 , 1 } ; static int b1 [ ] = { - 1 , 0 , 1 , 0 } ; private static Scanner sc = new Scanner ( System . in ) ; static void p ( String ans ) { System . out . println ( ans ) ; } ; static void p ( int ans ) { System . out . println ( ans ) ; } ; static void p ( long ans ) { System . out . println ( ans ) ; } ; static void p ( double ans ) { System . out . println ( ans ) ; } ; static int K ; public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int maxCtn = 0 ; int maxAns = 1 ; int ctn = 0 ; for ( int i = 1 ; i < = N ; i + + ) { int v = i ; while ( v % 2 ! = 1 ) { v = v / 2 ; ctn + + ; } if ( maxCtn < ctn ) { maxCtn = ctn ; maxAns = i ; } ctn = 0 ; } p ( maxAns ) ; } } import java . util . Scanner ; public class Main { static public void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int [ ] p = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { p [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; String ret = " Yay ! " ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( p [ j ] - p [ i ] > k ) ret = " : ( " ; } } System . out . println ( ret ) ; } } import java . math . * ; import java . util . * ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws FileNotFoundException { new Main ( ) . run ( ) ; } class SegTree { int n = 1 ; int [ ] v ; public SegTree ( int n ) { while ( this . n < n ) this . n * = 2 ; v = new int [ 2 * this . n - 1 ] ; } void set ( int k ) { v [ k ] = 1 ; while ( k > 0 ) { k = ( k - 1 ) / 2 ; v [ k ] = v [ 2 * k + 1 ] + v [ 2 * k + 2 ] ; } } int query ( int a , int b ) { return query ( 0 , n , a , b , 0 ) ; } int query ( int l , int r , int a , int b , int k ) { if ( r < = a | | b < = l ) return 0 ; else if ( a < = l & & r < = b ) return v [ k ] ; else { int vl = query ( l , ( l + r ) / 2 , a , b , 2 * k + 1 ) ; int vr = query ( ( l + r ) / 2 , r , a , b , 2 * k + 2 ) ; return vl + vr ; } } } void run ( ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] P = new int [ N ] ; int min = Integer . MAX _ VALUE / 3 ; int ans = 0 ; for ( int i = 0 ; i < N ; + + i ) { P [ i ] = sc . nextInt ( ) ; -- P [ i ] ; if ( min > = P [ i ] ) + + ans ; min = Math . min ( min , P [ i ] ) ; } System . out . println ( ans ) ; } static void tr ( Object ... objects ) { System . out . println ( Arrays . deepToString ( objects ) ) ; } } import java . util . * ; public class Main { 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 ) ; return ; } int ans = 1 ; for ( int i = 2 ; Math . pow ( i , n ) < = p ; i + + ) { if ( p % Math . pow ( i , n ) = = 0 ) { ans = i ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; void doIt ( ) { long n = sc . nextLong ( ) ; long p = sc . nextLong ( ) ; if ( n = = 1 ) { System . out . println ( p ) ; return ; } int len = ( int ) Math . ceil ( Math . pow ( p , 1.0 / n ) ) ; boolean [ ] prime = makePrime ( len ) ; long ans = 1 ; long [ ] f = new long [ len + 1 ] ; Arrays . fill ( f , 0 ) ; for ( int i = 2 ; i < = len ; i + + ) { if ( prime [ i ] ) { while ( p % i = = 0 ) { f [ i ] + + ; p / = i ; } ans * = Math . pow ( i , f [ i ] / n ) ; } } System . out . println ( ans ) ; } boolean [ ] makePrime ( int n ) { boolean [ ] p = new boolean [ n + 1 ] ; Arrays . fill ( p , true ) ; p [ 0 ] = false ; p [ 1 ] = false ; for ( int i = 2 ; i < = n ; i + + ) { if ( p [ i ] ) { for ( int j = i + i ; j < = n ; j + = i ) { p [ j ] = false ; } } } return p ; } public static void main ( String [ ] args ) { new Main ( ) . doIt ( ) ; } } 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 ; 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 Main { public static void main ( String [ ] args ) { new Solver ( ) . solve ( new Scanner ( System . in ) ) ; } private static final String ex = " 7 7 5 " ; } class Solver { Solver ( ) { } void solve ( Scanner scanner ) { String [ ] split = scanner . nextLine ( ) . split ( " " ) ; int count5 = 0 ; int count7 = 0 ; for ( int i = 0 ; i < split . length ; i + + ) { if ( split [ i ] . equals ( " 5 " ) ) count5 + + ; if ( split [ i ] . 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 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 = 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 . 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 temp _ max = p [ 0 ] ; int cnt = 1 ; for ( int i = 1 ; i < N ; i + + ) { if ( temp _ max > p [ i ] ) { temp _ max = p [ i ] ; cnt + + ; } } System . out . print ( 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 [ 5 ] ; for ( int i = 0 ; i < 5 ; + + i ) a [ i ] = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; sc . close ( ) ; String ans [ ] = { " : ( " , " Yay ! " } ; int an = 1 ; if ( a [ 4 ] - a [ 0 ] > k ) an = 0 ; System . out . println ( ans [ an ] ) ; } } 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 count = 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 ) { 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 ( ) ; sc . close ( ) ; int cnt = 0 ; for ( int x = 0 ; x < = K ; x + + ) { for ( int y = 0 ; y < = K ; y + + ) { int t = S - x - y ; if ( t > = 0 & & t < = 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 [ ] [ ] 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 ] = Integer . parseInt ( sc . next ( ) ) ; } } String ans = " No " ; for ( int i = 0 ; i < = 100 ; i + + ) { a [ 0 ] = i ; b [ 0 ] = c [ 0 ] [ 0 ] - i ; b [ 1 ] = c [ 0 ] [ 1 ] - i ; b [ 2 ] = c [ 0 ] [ 2 ] - i ; a [ 1 ] = c [ 1 ] [ 0 ] - b [ 0 ] ; a [ 2 ] = c [ 2 ] [ 0 ] - b [ 0 ] ; if ( c [ 1 ] [ 1 ] = = a [ 1 ] + b [ 1 ] & & c [ 1 ] [ 2 ] = = a [ 1 ] + b [ 2 ] & & c [ 2 ] [ 1 ] = = a [ 2 ] + b [ 1 ] & & c [ 2 ] [ 2 ] = = a [ 2 ] + b [ 2 ] ) { ans = " Yes " ; break ; } } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int lenHour = scn . nextInt ( ) , lenMin = scn . nextInt ( ) ; double hour = scn . nextDouble ( ) / 6 * Math . PI , min = scn . nextDouble ( ) / 30 * Math . PI ; hour + = min / 12 ; System . out . println ( Math . sqrt ( lenHour * lenHour + lenMin * lenMin - 2 * lenMin * lenHour * Math . cos ( min - hour ) ) ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; sc . nextLine ( ) ; String str = sc . nextLine ( ) ; sc . close ( ) ; System . out . println ( ( str . indexOf ( " Y " ) ! = - 1 ) ? " Four " : " Three " ) ; } } 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 [ ] strs = br . readLine ( ) . split ( " " ) ; int five = 0 ; int seven = 0 ; for ( int i = 0 ; i < strs . length ; i + + ) { int n = Integer . parseInt ( strs [ i ] ) ; if ( n = = 5 ) five + + ; 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 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 . InputStreamReader ; import java . util . HashMap ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int [ ] antena = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { antena [ i ] = scan . nextInt ( ) ; } int k = scan . nextInt ( ) ; boolean found = false ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antena [ j ] - antena [ i ] > k ) { found = true ; break ; } } } System . out . println ( found ? " : ( " : " Yay ! " ) ; } } import java . io . * ; import java . text . * ; import java . util . * ; public class Main { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int array [ ] = new int [ 5 ] ; String msg = " Yay ! " ; for ( int i = 0 ; i < 5 ; i + + ) { array [ i ] = sc . nextInt ( ) ; } int tag = sc . nextInt ( ) ; Arrays . sort ( array ) ; if ( array [ 4 ] - array [ 0 ] > tag ) { msg = " : ( " ; } System . out . println ( msg ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] fromAnt ; fromAnt = new int [ 5 ] ; int [ ] toAnt ; toAnt = new int [ 5 ] ; 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 . Scanner ; 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 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 ; if ( max = = 7 ) { if ( min = = 5 ) { if ( a + b + c - max - min = = 5 ) { 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 ( ) ; double Ad = ( double ) A ; int B = sc . nextInt ( ) ; double Bd = ( double ) B ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double arg , C ; arg = ( double ) H * 30.0 + ( double ) M * 0.5 - ( double ) M * 6.0 ; C = Math . sqrt ( Ad * Ad + Bd * Bd - 2.0 * Ad * Bd * Math . cos ( Math . toRadians ( arg ) ) ) ; System . out . println ( 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 ( ) ; 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 " ) ; } } 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 ; if ( A > 0 ) { System . out . println ( " 1 " ) ; } else if ( A = = 0 ) { System . out . println ( " 0 " ) ; } else { System . out . println ( " -1 " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; String str [ ] = new String [ 100 ] ; for ( int i = 0 ; i < n ; i + + ) { str [ i ] = scan . next ( ) ; } int ans = 0 ; String str1 = " Y " ; for ( int i = 0 ; i < n ; i + + ) { if ( str [ i ] . equals ( str1 ) ) { ans = 1 ; } } if ( ans = = 1 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } 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 ( ) ; 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 " ) ; } } import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; String answer = " : ( " ; ArrayList < Integer > b = new ArrayList < > ( ) ; for ( int i = 0 ; i < 6 ; i + + ) { b . add ( scan . nextInt ( ) ) ; } int c = b . get ( 5 ) ; b . remove ( 5 ) ; if ( b . get ( 4 ) - b . get ( 0 ) < = c ) { answer = " Yay ! " ; } else { answer = " : ( " ; } PrintWriter out = new PrintWriter ( System . out ) ; out . println ( answer ) ; out . flush ( ) ; scan . close ( ) ; } } 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 sumA = 0 ; for ( int i = 0 ; i < N ; i + + ) { a [ i ] = sc . nextLong ( ) ; sumA + = a [ i ] ; } long [ ] b = new long [ N ] ; long sumB = 0 ; for ( int i = 0 ; i < N ; i + + ) { b [ i ] = sc . nextLong ( ) ; sumB + = b [ i ] ; } if ( sumA < sumB ) { System . out . println ( - 1 ) ; return ; } long [ ] sa = new long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { sa [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( sa ) ; int count = 0 ; long sum = 0 ; while ( sa [ count ] < 0 ) { sum + = Math . abs ( sa [ count ] ) ; count + + ; } int endIndex = sa . length - 1 ; while ( sum > 0 ) { sum - = sa [ endIndex ] ; endIndex -- ; count + + ; } 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 a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int [ ] task = { a , b , c } ; Arrays . sort ( task ) ; int result = ( task [ 2 ] - task [ 1 ] ) + ( task [ 1 ] - task [ 0 ] ) ; System . out . println ( result ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = Arrays . asList ( sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) ) ; Collections . sort ( list ) ; System . out . println ( list . get ( 2 ) - list . get ( 0 ) ) ; } } 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 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 a1 = 0 ; a1 < = 100 ; a1 + + ) { 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 " ) ; 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 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 + + ) { int tmp = s - i - j ; if ( tmp > = 0 & & tmp < = 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 ( ) ; int [ ] S = new int [ ] { a , b , c , d , e } ; int max = S [ 0 ] ; int min = S [ 0 ] ; for ( int i = 0 ; i < S . length ; i + + ) { int v = S [ i ] ; if ( v > max ) { max = v ; } if ( v < min ) { min = v ; } } 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 ( ) ; for ( int i = 0 ; ; i + + ) { if ( Math . pow ( 2 , i ) < = n ) { continue ; } else { System . out . println ( ( int ) Math . pow ( 2 , i - 1 ) ) ; return ; } } } } 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 [ ] array = { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 101 } ; for ( int i = 0 ; i < array . length ; i + + ) { if ( array [ i ] > N ) { System . out . println ( array [ i - 1 ] ) ; break ; } } } } import java . util . * ; import static java . lang . System . * ; 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 [ 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 [ 1 ] [ 1 ] = = c [ 3 ] [ 2 ] - c [ 1 ] [ 2 ] & & c [ 3 ] [ 1 ] - c [ 1 ] [ 1 ] = = c [ 3 ] [ 3 ] - c [ 1 ] [ 3 ] ) { out . println ( " Yes " ) ; } else { out . println ( " No " ) ; } } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int a , b = 0 , c = 0 , i ; for ( i = 0 ; i < 3 ; i + + ) { a = stdIn . nextInt ( ) ; if ( a = = 5 ) b + + ; else if ( a = = 7 ) c + + ; } System . out . print ( b = = 2 & & c = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; 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 ( ) ; } } sc . close ( ) ; 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 ] ; String answer = " Yes " ; for ( int i = 0 ; i < 3 ; i + + ) { for ( int j = 0 ; j < 3 ; j + + ) { if ( c [ i ] [ j ] ! = a [ i ] + b [ j ] ) { answer = " No " ; } } } 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 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 ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int ns [ ] = new int [ n ] ; int min ; int nc = 1 ; boolean edge ; boolean edge2 = true ; for ( int i = 0 ; i < n ; i + + ) ns [ i ] = sc . nextInt ( ) ; min = ns [ 0 ] ; if ( min ! = 1 ) { for ( int i = 0 ; i < n & & edge2 ; i + + ) { edge = true ; if ( ns [ i ] = = 1 ) { nc + + ; edge2 = false ; } else if ( min > ns [ i ] ) { nc + + ; min = ns [ i ] ; } } } System . out . println ( nc ) ; } } 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 ; } if ( num1 = = num2 ) { if ( a > b ) { System . out . println ( a - b ) ; return ; } else if ( b > a ) { System . out . println ( b - a ) ; return ; } else if ( a = = b ) { System . out . println ( 0 ) ; return ; } } 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 . 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 ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; } static class TaskB { public void solve ( int testNumber , FastReader in , PrintWriter out ) { int n = in . nextInt ( ) ; out . println ( Integer . highestOneBit ( n ) ) ; } } static class FastReader { BufferedReader reader ; StringTokenizer st ; public FastReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; st = null ; } public String next ( ) { while ( st = = null | | ! st . hasMoreTokens ( ) ) { try { String line = reader . readLine ( ) ; if ( line = = null ) { return null ; } st = new StringTokenizer ( line ) ; } catch ( Exception e ) { throw new RuntimeException ( ) ; } } return st . nextToken ( ) ; } public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } } } 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 [ ] shortages = Arrays . stream ( D ) . filter ( i - > i < 0 ) . toArray ( ) ; long shortage = Arrays . stream ( shortages ) . sum ( ) ; int ans = shortages . length ; long [ ] remains = Arrays . stream ( D ) . filter ( i - > i > 0 ) . sorted ( ) . toArray ( ) ; for ( int i = remains . length - 1 ; i > = 0 ; i -- ) { if ( shortage > = 0 ) break ; shortage + = remains [ i ] ; ans + + ; } if ( shortage < 0 ) { ans = - 1 ; } System . out . println ( ans ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int [ ] inputs = new int [ 3 ] ; inputs [ 0 ] = scanner . nextInt ( ) ; inputs [ 1 ] = scanner . nextInt ( ) ; inputs [ 2 ] = scanner . nextInt ( ) ; scanner . close ( ) ; int count5 = 0 ; int count7 = 0 ; for ( int input : inputs ) { if ( input = = 5 ) { count5 + + ; } else if ( input = = 7 ) { count7 + + ; } else { break ; } } if ( count5 = = 2 & & count7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . io . * ; import java . util . * ; public class Main implements Runnable { private void solve ( ) throws IOException { int K = nextInt ( ) ; int S = nextInt ( ) ; long ret = 0L ; for ( int a = 0 ; a < = K ; + + a ) { for ( int b = 0 ; b < = K ; + + b ) { if ( a + b > S ) continue ; int left = S - ( a + b ) ; if ( left < = K ) + + ret ; } } writer . println ( ret ) ; } 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 ( ) ) ; } short nextShort ( ) throws IOException { return Short . parseShort ( nextToken ( ) ) ; } String nextToken ( ) throws IOException { while ( tokenizer = = null | | ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } } 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 hx = a * Math . cos ( Math . toRadians ( 90.0 - ( 30.0 * h + 0.5 * m ) ) ) ; double hy = a * Math . sin ( Math . toRadians ( 90.0 - ( 30.0 * h + 0.5 * m ) ) ) ; double mx = b * Math . cos ( Math . toRadians ( 90.0 - ( 6.0 * m ) ) ) ; double my = b * Math . sin ( Math . toRadians ( 90.0 - ( 6.0 * m ) ) ) ; double rad = Math . sqrt ( ( mx - hx ) * ( mx - hx ) + ( my - hy ) * ( my - hy ) ) ; System . out . println ( rad ) ; } } 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 ah = 360D / 12D * ( ( double ) h + ( double ) m / 60D ) ; double am = 360D / 60D * ( double ) m ; double vecHX = Math . sin ( Math . toRadians ( ah ) ) * ( double ) a ; double vecHY = Math . cos ( Math . toRadians ( ah ) ) * ( double ) a ; double vecMX = Math . sin ( Math . toRadians ( am ) ) * ( double ) b ; double vecMY = Math . cos ( Math . toRadians ( am ) ) * ( double ) b ; double d = Math . hypot ( Math . abs ( vecHX - vecMX ) , Math . abs ( vecHY - vecMY ) ) ; ; System . out . println ( d ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int min = 2000001 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { int tmp = sc . nextInt ( ) ; if ( min > tmp ) { min = tmp ; count + + ; } } System . out . println ( count ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new PrintStream ( System . out ) ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; long k = Integer . parseInt ( st . nextToken ( ) ) ; long [ ] arr = new long [ n ] ; st = new StringTokenizer ( f . readLine ( ) ) ; for ( int i = 0 ; i < n ; i + + ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } long ans = Long . MAX _ VALUE ; long [ ] min = new long [ n ] ; Arrays . fill ( min , Long . MAX _ VALUE ) ; for ( int j = 0 ; j < n ; j + + ) { long sum = 0 ; for ( int i = 0 ; i < n ; i + + ) { int nexidx = i - j ; nexidx + = n ; nexidx % = n ; min [ i ] = Math . min ( min [ i ] , arr [ nexidx ] ) ; sum + = min [ i ] ; } ans = Math . min ( ans , k * j + sum ) ; } System . out . print ( ans ) ; f . close ( ) ; out . close ( ) ; } } class pair implements Comparable < pair > { int num ; int idx ; public int compareTo ( pair other ) { return num - other . num ; } pair ( int a , int b ) { num = a ; idx = b ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int min = sc . nextInt ( ) ; int max = min ; for ( int i = 0 ; i < 4 ; i + + ) { int num = sc . nextInt ( ) ; if ( num < min ) { min = num ; } else { if ( num > max ) { max = num ; } } } int dif = max - min ; if ( dif > sc . nextInt ( ) ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } sc . close ( ) ; } } 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 ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int a = Integer . parseInt ( st . nextToken ( ) ) ; int b = Integer . parseInt ( st . nextToken ( ) ) ; int c = Integer . parseInt ( st . nextToken ( ) ) ; int [ ] kk = new int [ 11 ] ; kk [ a ] + + ; kk [ b ] + + ; kk [ c ] + + ; System . out . println ( kk [ 5 ] = = 2 & & kk [ 7 ] = = 1 ? " YES " : " NO " ) ; } } import java . util . * ; import java . math . * ; class Main { public static void main ( String [ ] args ) { Scanner reader = new Scanner ( System . in ) ; int a = reader . nextInt ( ) ; int b = reader . nextInt ( ) ; int h = reader . nextInt ( ) ; int m = reader . nextInt ( ) ; int min = h * 60 + m ; double aRad = ( double ) ( 0.5 * min % 360 ) * Math . PI / 180 ; double bRad = ( double ) ( 6 * min % 360 ) * Math . PI / 180 ; double ax = a * Math . sin ( aRad ) ; double ay = a * Math . cos ( aRad ) ; double bx = b * Math . sin ( bRad ) ; double by = b * Math . cos ( bRad ) ; double len = Math . pow ( ax - bx , 2 ) + Math . pow ( ay - by , 2 ) ; double lenans = Math . sqrt ( len ) ; System . out . println ( lenans ) ; } } 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 ( ) ; if ( Math . abs ( a - b ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( a - c ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( a - d ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( a - e ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( b - c ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( b - d ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( b - e ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( c - d ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( c - e ) > k ) System . out . println ( " : ( " ) ; else if ( Math . abs ( e - d ) > k ) System . out . println ( " : ( " ) ; else System . out . println ( " Yay ! " ) ; } } 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 ( ) ; if ( e - a > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } 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 ( ) ; sc . nextInt ( ) ; sc . nextInt ( ) ; 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 n = sc . nextInt ( ) ; int ans = 1 ; while ( true ) { if ( ans * 2 > n ) { break ; } ans * = 2 ; } System . out . println ( ans ) ; sc . close ( ) ; } } import java . io . * ; import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ; 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 ( ) ; if ( A + B + C = = 17 & & A * B + B * C + C * A = = 95 & & A * B * C = = 175 ) { 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 ) ; Set < String > set = new HashSet < > ( ) ; int num = sc . nextInt ( ) ; for ( int i = 0 ; i < num ; i + + ) { String s = sc . next ( ) ; set . add ( s ) ; } if ( set . size ( ) = = 4 ) { System . out . println ( " Four " ) ; } else { System . out . println ( " Three " ) ; } } } import java . util . Scanner ; import java . util . ArrayList ; import java . util . HashSet ; import java . lang . Integer ; import java . lang . StringBuilder ; import java . lang . Math ; public class Main { public static int calc ( int max , int target ) { int cnt = 0 ; for ( int i = 0 ; i < = max ; i + + ) { for ( int j = 0 ; j < = max ; j + + ) { int sum = i + j ; int k = target - sum ; if ( k < = max & & k > = 0 ) { cnt + + ; } } } return cnt ; } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int K = in . nextInt ( ) ; int S = in . nextInt ( ) ; int result = calc ( K , S ) ; 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 [ ] 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 ( Math . abs ( 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 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 K = sc . nextInt ( ) ; int S = sc . nextInt ( ) ; int Z = 0 ; int count = 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 . util . * ; class Main { public static void main ( String [ ] $ ) { Scanner s = new Scanner ( System . in ) ; int a [ ] = new int [ 4 ] ; Arrays . setAll ( a , i - > s . nextInt ( ) ) ; Arrays . sort ( a ) ; int [ ] b = { 1 , 4 , 7 , 9 } ; System . out . println ( Arrays . equals ( a , b ) ? " YES " : " NO " ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String InStr = scan . nextLine ( ) ; String [ ] AryStr = InStr . split ( " " ) ; long cnt5 = 0 ; long cnt7 = 0 ; int i = 0 ; while ( i < = 2 ) { if ( AryStr [ i ] . equals ( " 5 " ) ) { cnt5 + + ; } if ( AryStr [ i ] . equals ( " 7 " ) ) { cnt7 + + ; } i + + ; } if ( cnt5 = = 2 & & cnt7 = = 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 ( ) ; 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 . * ; public class Main { 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 ( " : ( " ) ; return ; } 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 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 . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ ] ans = new int [ 4 ] ; for ( int j = 0 ; j < 4 ; j + + ) ans [ j ] = 0 ; String cate = " null " ; int num = 0 ; for ( int i = 0 ; i < N ; i + + ) { String s = sc . next ( ) ; if ( s . equals ( " G " ) ) ans [ 0 ] = 1 ; else if ( s . equals ( " W " ) ) ans [ 1 ] = 1 ; else if ( s . equals ( " P " ) ) ans [ 2 ] = 1 ; else if ( s . equals ( " Y " ) ) ans [ 3 ] = 1 ; } for ( int j = 0 ; j < 4 ; j + + ) { if ( ans [ j ] = = 1 ) num + + ; } if ( num = = 3 ) cate = " Three " ; else if ( num = = 4 ) cate = " Four " ; System . out . println ( cate ) ; } } import java . util . * ; class Main { 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 ) ; return ; } long res = 1 ; for ( int i = 2 ; Math . pow ( i , n ) < = p ; i + + ) { if ( p % Math . pow ( i , n ) = = 0 ) res = i ; } System . out . println ( res ) ; } } 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 mi = H * 60 + M ; double kakuA = 0.5 * mi ; double kakuB = ( 6 * mi ) % 360 ; double kaku = Math . abs ( kakuA - kakuB ) ; if ( kaku > 180 ) kaku = 360 - kaku ; double dd = A * A + B * B - 2 * A * B * Math . cos ( Math . toRadians ( kaku ) ) ; System . out . print ( Math . sqrt ( dd ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; PriorityQueue < Integer > q = new PriorityQueue < Integer > ( ) ; int cnt = 0 ; for ( int i = 0 ; i < N ; i + + ) { int P = sc . nextInt ( ) ; q . add ( P ) ; if ( q . peek ( ) = = P ) 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 count = 0 ; while ( N ! = 1 ) { N / = 2 ; count + + ; } System . out . println ( pow ( count ) ) ; } static int pow ( int n ) { int pow = 1 ; for ( int idx = 0 ; idx < n ; idx + + ) pow * = 2 ; return pow ; } } import java . util . * ; 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 f1 , f9 , f7 , f4 ; f1 = Arrays . stream ( N ) . anyMatch ( a - > a = = 1 ) ; f9 = Arrays . stream ( N ) . anyMatch ( a - > a = = 9 ) ; f7 = Arrays . stream ( N ) . anyMatch ( a - > a = = 7 ) ; f4 = Arrays . stream ( N ) . anyMatch ( a - > a = = 4 ) ; String result = ( f1 & & f9 & & f7 & & f4 ) ? " YES " : " NO " ; 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 ( ) ; 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 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 { static int [ ] arr ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; arr = new int [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { arr [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; System . out . println ( check ( k ) ) ; } static String check ( int k ) { for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < 5 ; j + + ) { int x = Math . abs ( arr [ i ] - arr [ j ] ) ; if ( k < x ) { return " : ( " ; } } } return " Yay ! " ; } } import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; int test = 1 ; int currentHighestDivisible = 0 ; int currentWinner = 1 ; while ( test < = x ) { int testDividedByTwo = test ; int testFactorsOfTwo = 0 ; while ( testDividedByTwo % 2 = = 0 ) { testFactorsOfTwo + = 1 ; testDividedByTwo = testDividedByTwo / 2 ; } if ( testFactorsOfTwo > currentHighestDivisible ) { currentWinner = test ; currentHighestDivisible = testFactorsOfTwo ; test + = 1 ; } else { test + = 1 ; } } System . out . println ( currentWinner ) ; } } 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 ( ) ; System . out . println ( Math . sqrt ( A * A + B * B - 2.0 * A * B * Math . cos ( 2.0 * Math . PI * ( H / 12.0 + M / 12.0 / 60.0 - M / 60.0 ) ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; long next = 2 ; for ( int i = 0 ; i < x ; i + + ) { next = ( next + 1 ) * 2 ; } System . out . println ( next ) ; } } 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 [ ] cnt = new int [ 11 ] ; cnt [ ni ( ) ] + + ; cnt [ ni ( ) ] + + ; cnt [ ni ( ) ] + + ; System . out . println ( cnt [ 5 ] = = 2 & & cnt [ 7 ] = = 1 ? " YES " : " NO " ) ; } 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 [ ] P = new int [ N ] ; int count = 0 ; int min = N + 1 ; for ( int i = 0 ; i < N ; i + + ) { P [ i ] = sc . nextInt ( ) ; if ( min > P [ i ] ) { min = P [ i ] ; 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 = Integer . parseInt ( sc . next ( ) ) ; int b = Integer . parseInt ( sc . next ( ) ) ; int c = Integer . parseInt ( sc . next ( ) ) ; int five = 0 ; int seven = 0 ; if ( a = = 5 ) { five + + ; } else { seven + + ; } if ( b = = 5 ) { five + + ; } else { seven + + ; } if ( c = = 5 ) { five + + ; } else { seven + + ; } if ( five = = 2 & & seven = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 java . util . Arrays ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int N = scan . nextInt ( ) ; char [ ] fukuro = new char [ N ] ; boolean [ ] judge = new boolean [ 4 ] ; int count = 0 ; for ( int i = 0 ; i < N ; i + + ) { fukuro [ i ] = scan . next ( ) . charAt ( 0 ) ; } Arrays . fill ( judge , false ) ; for ( int i = 0 ; i < N ; i + + ) { if ( fukuro [ i ] = = ' P ' ) { judge [ 0 ] = true ; } if ( fukuro [ i ] = = ' W ' ) { judge [ 1 ] = true ; } if ( fukuro [ i ] = = ' G ' ) { judge [ 2 ] = true ; } if ( fukuro [ i ] = = ' Y ' ) { judge [ 3 ] = true ; } } for ( int i = 0 ; i < 4 ; i + + ) { if ( judge [ i ] ) { count + + ; } } if ( count = = 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 A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; double tan = H * 30 + M * 0.5 ; double tyou = M * 6 ; double kakdo = Math . abs ( tan - tyou ) ; double yogen = A * A + B * B - 2 * A * B * Math . cos ( kakdo * ( Math . PI / 180 ) ) ; double sqrt _ yogen = Math . sqrt ( yogen ) ; System . out . println ( sqrt _ yogen ) ; } } import java . util . * ; class Main { static double pi = Math . PI ; public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double a = ( double ) sc . nextInt ( ) ; double b = ( double ) sc . nextInt ( ) ; double h = ( double ) sc . nextInt ( ) ; double m = ( double ) sc . nextInt ( ) ; double theta = ( h / 6.0 - 11.0 * m / 360.0 ) * pi ; double tmp = a * a + b * b - 2.0 * a * b * Math . cos ( theta ) ; System . out . println ( Math . sqrt ( tmp ) ) ; } } import 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 = 1 ; int i = 0 ; while ( true ) { if ( Math . pow ( 2 , i ) < = N ) { m = ( int ) Math . pow ( 2 , i ) ; i + + ; } else { break ; } } 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 ( ) ) ; } } 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 ( ) ; scan . close ( ) ; 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 { static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { double A = sc . nextDouble ( ) ; double B = sc . nextDouble ( ) ; double H = sc . nextDouble ( ) ; double M = sc . nextDouble ( ) ; double thetaH = 2 * Math . PI * ( H + M / 60 ) / 12 ; double thetaM = 2 * Math . PI * M / 60 ; double theta = Math . abs ( thetaH - thetaM ) ; double distance = Math . sqrt ( A * A + B * B - 2 * A * B * Math . cos ( theta ) ) ; System . out . println ( distance ) ; } } 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 [ ] 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 " ) ; } scan . close ( ) ; } } 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 ( ) ; long sum = 0 ; long cnt = 2 ; long a = scan . nextLong ( ) ; if ( a > = 2 ) { sum + = a - 1 ; } for ( int i = 1 ; i < n ; i + + ) { a = scan . nextLong ( ) ; long b = a / cnt ; if ( cnt = = a ) { cnt + + ; b = 0 ; } else if ( a % cnt = = 0 ) { b -- ; } sum + = b ; } 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; double hour = 0.5 * ( 60 * h + m ) ; double min = 6 * m ; double angle = hour - min ; if ( hour < min ) { angle = 360 - min + hour ; } double ans = a * a + b * b - 2 * a * b * Math . cos ( angle / 180 * Math . PI ) ; System . out . println ( String . format ( " % .20f " , Math . sqrt ( ans ) ) ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int pm = 1000000 ; int ans = 0 ; for ( int i = 0 ; i < n ; i + + ) { int p = sc . nextInt ( ) ; if ( p < = pm ) { ans + + ; pm = p ; } } 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 ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; int H = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; sc . close ( ) ; double ans = 0 ; double X = Math . abs ( ( M * 6 ) - ( ( H * 30 ) + ( M * 0.5 ) ) ) ; if ( X > 180 ) { X = 360 - X ; } double cos = Math . cos ( Math . toRadians ( X ) ) ; ans = a * a + b * b - 2 * a * b * cos ; System . out . println ( Math . sqrt ( ans ) ) ; } } import java . util . ArrayList ; import java . util . Scanner ; public class Main { 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 ( ) ; scanner . close ( ) ; boolean canCommuFlg = true ; for ( int i = 1 ; i < valList . size ( ) ; i + + ) { if ( canCommuFlg = = false ) break ; for ( int j = 0 ; j < i ; j + + ) { if ( valList . get ( i ) - valList . get ( j ) > k ) { canCommuFlg = false ; break ; } } } if ( canCommuFlg = = true ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } 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 ( ) ; 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 ( ) ; } int [ ] sa = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { sa [ i ] = a [ i ] - b [ i ] ; } Arrays . sort ( sa ) ; int dif = 0 ; long fusoku = 0 ; boolean bre1 = false ; for ( int i = 0 ; i < n ; i + + ) { if ( sa [ i ] > = 0 ) { bre1 = true ; break ; } dif + + ; fusoku + = sa [ i ] ; } if ( ! bre1 ) { System . out . println ( - 1 ) ; } else { boolean bre2 = false ; for ( int i = n - 1 ; i > = 0 ; i -- ) { if ( fusoku > = 0 ) { bre2 = true ; break ; } fusoku + = sa [ i ] ; dif + + ; } if ( ! bre2 ) { System . out . println ( - 1 ) ; } else { System . out . println ( dif ) ; } } } } 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 ans = ( A [ 1 ] - A [ 0 ] ) + ( A [ 2 ] - A [ 1 ] ) ; System . out . println ( ans ) ; } } import java . util . * ; 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 max = 1 ; long pmax = P ; if ( N = = 1 ) { System . out . println ( P ) ; return ; } for ( long i = 1 ; num < = P ; i + + ) { if ( P % num = = 0 ) { max = i ; } num = ( long ) Math . pow ( i + 1 , N ) ; } System . out . println ( max ) ; } } 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 ( ) ; Judgment ( A , B , C ) ; } static void Judgment ( 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 " ) ; } } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; if ( n % 2 = = 1 ) n - = 1 ; int max = 0 , a , count , ans = 1 ; for ( int i = 2 ; i < = n ; i + = 2 ) { count = 0 ; 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 ) ; int k = sc . nextInt ( ) ; int s = sc . nextInt ( ) ; int a = 0 ; for ( int x = 0 ; x < = k ; + + x ) { for ( int y = 0 ; y < = k ; + + y ) { if ( s - x - y > = 0 & & s - x - y < = 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 ) ; double a = sc . nextDouble ( ) ; double b = sc . nextDouble ( ) ; double h = sc . nextDouble ( ) ; double m = sc . nextDouble ( ) ; sc . close ( ) ; double aw = h * 30.0 + m * 0.5 ; double bw = m * 6.0 ; double w = aw - bw ; double cos = Math . cos ( Math . toRadians ( w ) ) ; if ( Math . abs ( cos ) > Math . pow ( 1.0 , - 17 ) ) { cos = 0.0 ; } double ans = a * a + b * b - 2.0 * 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 a [ ] = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ; int problem1 = a [ 0 ] - a [ 1 ] ; int problem2 = a [ 1 ] - a [ 2 ] ; int ans = Math . abs ( problem1 ) + Math . abs ( problem2 ) ; System . out . println ( ans ) ; } } 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 ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int i = scanner . nextInt ( ) ; int factorial = 1 ; while ( factorial < = i ) { factorial * = 2 ; } System . out . println ( factorial / 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 h = sc . nextInt ( ) ; int c = 1 ; for ( int i = 1 ; i < n ; i + + ) { int a = sc . nextInt ( ) ; if ( h > = a ) c + + ; h = Math . min ( a , h ) ; } 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 ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . * ; import java . util . * ; import java . math . * ; import java . util . concurrent . * ; class Main { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static FastScanner sc = new FastScanner ( br ) ; static PrintWriter out = new PrintWriter ( System . out ) ; static Random rnd = new Random ( ) ; static long mod = ( long ) ( 1e9 + 7 ) ; public static void main ( String args [ ] ) throws Exception { int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; if ( Math . abs ( n - m ) > 1 ) { out . println ( 0 ) ; } else { long val1 = 1 , val2 = 1 ; for ( int i = 1 ; i < = n ; i + + ) { val1 = ( val1 * i ) % mod ; } for ( int i = 1 ; i < = m ; i + + ) { val2 = ( val2 * i ) % mod ; } long curr = ( n = = m ? 2 : 1 ) , res = ( val1 * val2 * curr ) % mod ; out . println ( res ) ; } out . close ( ) ; } private static class FastScanner { BufferedReader in ; StringTokenizer st ; public FastScanner ( BufferedReader in ) { this . in = in ; } public String nextToken ( ) throws Exception { while ( st = = null | | ! st . hasMoreTokens ( ) ) { st = new StringTokenizer ( in . readLine ( ) ) ; } return st . nextToken ( ) ; } public String next ( ) throws Exception { return nextToken ( ) . toString ( ) ; } public int nextInt ( ) throws Exception { return Integer . parseInt ( nextToken ( ) ) ; } public long nextLong ( ) throws Exception { return Long . parseLong ( nextToken ( ) ) ; } public double nextDouble ( ) throws Exception { return Double . parseDouble ( nextToken ( ) ) ; } } } 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 angle = Math . abs ( M * 6.0 - 0.5 * ( 60 * H + M ) ) ; double length = Math . sqrt ( Math . pow ( A , 2 ) + Math . pow ( B , 2 ) - 2 * A * B * Math . cos ( Math . toRadians ( angle ) ) ) ; System . out . println ( length ) ; } } public final class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int h = s . nextInt ( ) ; int m = s . nextInt ( ) ; double angle = Math . abs ( ( double ) ( 60 * h - 11 * m ) / ( double ) 2 ) ; angle = Math . toRadians ( angle ) ; double ans = Math . sqrt ( a * a + b * b - ( 2 * a * b * Math . cos ( angle ) ) ) ; System . out . println ( ans ) ; } } import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . * ; import java . lang . Math . * ; 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 ) ; HashMap < Integer , Integer > mem = new HashMap < > ( ) ; int k = in . nextInt ( ) ; int s = in . nextInt ( ) ; int x = Math . min ( s , k ) ; int total = 0 ; for ( int i = 0 ; i < = x ; i + + ) { for ( int j = 0 ; j < = x ; j + + ) { int sum = i + j ; if ( sum < = s & & sum + x > = s ) total + + ; } } System . out . print ( total ) ; } } import java . io . * ; import java . util . * ; import java . math . * ; public class Main { public Main ( ) { Scanner sc = new Scanner ( System . in ) ; int N [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i + + ) { N [ i ] = sc . nextInt ( ) ; } int [ ] ans = new int [ ] { 1 , 7 , 9 , 4 } ; boolean [ ] frag = new boolean [ ] { false , false , false , false } ; loop1 : for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = 0 ; j < 4 ; j + + ) { if ( ans [ i ] = = N [ j ] ) { continue loop1 ; } } System . out . println ( " NO " ) ; return ; } System . out . println ( " YES " ) ; } public static void main ( String [ ] args ) { Main main = new Main ( ) ; } } 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 ] ; for ( int i = 0 ; i < n ; i + + ) { p [ i ] = sc . nextInt ( ) ; } int ans = 1 ; boolean [ ] b = new boolean [ n ] ; b [ 0 ] = true ; int j = 0 ; for ( int i = 1 ; i < n ; i + + ) { if ( b [ j ] ) { if ( p [ i ] < = p [ j ] ) { b [ i ] = true ; j = i ; ans + + ; } else { b [ i ] = false ; } } } System . out . println ( ans ) ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; int n = cin . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) a [ i ] = cin . nextInt ( ) ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) b [ i ] = cin . nextInt ( ) ; int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) c [ i ] = a [ i ] - b [ i ] ; Arrays . sort ( c ) ; int i = 0 , mi = 0 ; int j = n - 1 , mj = n - 1 ; while ( c [ i ] < 0 & & i < j ) { int m = Math . min ( - c [ i ] , c [ j ] ) ; c [ i ] + = m ; mi = i + 1 ; if ( c [ i ] = = 0 ) + + i ; c [ j ] - = m ; mj = j - 1 ; if ( c [ j ] = = 0 ) -- j ; } if ( c [ i ] > = 0 ) { System . out . println ( n - ( mj - mi + 1 ) ) ; } else { System . out . println ( - 1 ) ; } } } import java . util . * ; public class Main { static Scanner scanner = new Scanner ( System . in ) ; public static void main ( String [ ] $ ) { int n = scanner . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; long aSum = 0 ; for ( int i = 0 ; i < n ; i + + ) { aSum + = a [ i ] = scanner . nextInt ( ) ; } long bSum = 0 ; long r = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i + + ) { b [ i ] = scanner . nextInt ( ) ; bSum + = b [ i ] ; if ( a [ i ] < b [ i ] ) { count + + ; r + = b [ i ] - a [ i ] ; } a [ i ] = Math . max ( 0 , a [ i ] - b [ i ] ) ; } if ( aSum < bSum ) { System . out . println ( - 1 ) ; } else { Arrays . sort ( a ) ; for ( int i = n - 1 ; i > = 0 & & a [ i ] ! = 0 ; i -- ) { if ( r < = 0 ) { break ; } count + + ; r - = a [ i ] ; } System . out . println ( count ) ; } } } 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 > = 0 ) res = 1 ; else if ( H < - 1 * R ) res = - 1 ; else res = 0 ; System . out . println ( res ) ; } } 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 ; while ( ans < = n ) { ans = ans * 2 ; } System . out . println ( ans / 2 ) ; } } import java . io . * ; class Main { 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 . util . Scanner ; 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 . 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 SumOfThreeIntegers { 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 . * ; 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 tmpb = c * 60 + d ; int tmpa = a * 60 + b ; int tmpc = tmpb - tmpa ; int tmpd = tmpc / e ; int tmpx = tmpc - e ; System . out . println ( tmpx ) ; } } 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 tmpb = c * 60 + d ; int tmpa = a * 60 + b ; int tmpc = tmpb - tmpa ; int tmpd = tmpc / e ; int tmpx = tmpc - e ; System . out . println ( tmpx ) ; } } public class Main { public static void main ( String [ ] args ) { x = Input . getInt ( ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextLine ( ) ; System . out . println ( x * x * x ) ; } } 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 . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . time . LocalDate ; import java . time . format . DateTimeFormatter ; import java . util . Scanner ; public void Main ( ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int count = sc . nextInt ( ) ; double x = 0.0 ; String u = " " ; double sum = 0 ; for ( int i = 0 ; i < count ; i + + ) { x = sc . nextDouble ( ) ; u = sc . nextLine ( ) . trim ( ) ; if ( u . equals ( " JPY " ) ) { sum + = x ; } else { x = x * 380000.0 ; sum + = x ; } } System . out . println ( sum ) ; } import java . util . Scanner ; public class TrainingCamp { public static void main ( String [ ] args ) { Scanner a = new Scanner ( System . in ) ; int N = a . nextInt ( ) ; double power = 1 ; for ( int i = 1 ; i < = N ; i + + ) { power = ( power * i ) % 100000000 + 7 ; } System . out . println ( power ) ; } } class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int num = Integer . parseInt ( br . readLine ( ) ) ; int answer = num * num * num ; } } public class { public static void main ( String [ ] args ) { System . out . println ( y = x * * 3 ) print int ( y ) } } public class Sample2 { public static void main ( String [ ] args ) { int k = e - a ; if ( k < = 15 ) { System . out . print ( " Yay ! " ) ; } else { System . out . print ( " : ( " ) ; } } } import java . io . * ; import java . util . * ; public class j1000 { public static void main ( String [ ] args ) throws IOException { Scanner cin = new Scanner ( System . in ) ; while ( cin . hasNext ( ) ) { final int a = cin . nextInt ( ) ; final int b = cin . nextInt ( ) ; System . out . println ( a + b ) ; } } } ( defun area ( h w ) ( * h w ) ) ( write ( max ( area ( read ) ( read ) ) ( area ( read ) ( read ) ) ) ) import java . util . * ; public class sample { public static void main ( String [ ] args ) { System . out . println ( " 整数を入力してください . " ) ; Scanner sc = new Sca n n e ( System in ; int A = sc. n extInt ( ) ; i t B = s .n e xtInt ( ) ; i t C = s .n e xtInt ( ) ; i t X = s .n e xtInt ( ) ; i t c t = 0 ; sc.clos e ( ) fo ( i t i 0 ; i < = A ; i + + { f r ( n t j = ; < = ; j + + { f r ( n t k = ; < = ; k + + { i i * 0 + j 10 0 + k 5 = X n + + ; } } } } ys e m o t.p ri n l ( n ) } } import java . util . Scanner ; class main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int x ; x = scan . nextInt ( int x ) ; x = x * x * x ; System . out . println ( y ) ; } } public class ITP1 _ 1 _ B { int calc ( int x ) { int y = x * x * x ; return y ; } public static void main ( String args [ ] ) { System . out . println ( calc ( x ) ) ; } } zzz zzz import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int [ 8 ] [ 2 ] array = new int [ ] [ ] ; 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 ; } } 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 . BufferedReader 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 ; } } class Main { public static void main ( String args [ ] ) { int i = Integer . toString ( args [ 0 ] ) ; System . out . println ( Integer . toString ( i * i * i ) ) ; } } 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 if ( CardB = = CardA ) { s = " Draw " ; } System . out . println ( s ) ; 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 V = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int W = scanner . nextInt ( ) ; int T = scanner . nextInt ( ) ; int A = abs ( a ) ; int B = abs ( b ) ; int k = 0 ; if ( A < B ) { k = B - A ; } else { k = A - B ; } int As = V * T ; int Bs = W * T ; int s = As - Bs ; if ( k < = s ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } scanner . close ( ) ; } } import java . io . * ; import java . util . * ; import static java . lang . Math . * ; public class Solution { long X ; static long MX = 100000000000007L ; List < Long > ps , ns ; void solve ( ) { ps = new ArrayList < > ( ) ; ns = new ArrayList < > ( ) ; ps . add ( 0L ) ; ns . add ( 0L ) ; for ( long a = 1 ; pow ( a , 5 ) < MX ; a + + ) { ps . add ( ( long ) pow ( a , 5 ) ) ; } for ( long a = - 1 ; pow ( a , 5 ) * - 1 < MX ; a -- ) { ns . add ( ( long ) pow ( a , 5 ) ) ; } for ( int i = 0 ; i < ps . size ( ) ; i + + ) { for ( int j = i ; j < ps . size ( ) ; j + + ) { long ai = ps . get ( i ) , aj = ps . get ( j ) ; if ( aj - ai = = X ) { System . out . println ( j + " " + i ) ; return ; } } } for ( int i = 0 ; i < ps . size ( ) ; i + + ) { for ( int j = 0 ; j < ns . size ( ) ; j + + ) { long ai = ps . get ( i ) , aj = ns . get ( j ) ; if ( ai - aj = = X ) { System . out . println ( i + " " + j * - 1 ) ; return ; } } } } public Solution ( ) throws Exception { Scanner sc = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; X = sc . nextLong ( ) ; solve ( ) ; } static public void main ( String [ ] args ) throws Exception { Solution m = new Solution ( ) ; } } public class Sample2 { public static void main ( String [ ] args ) { int a = 0 ; int e = 0 ; 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 ) { 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 . * ; 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 . 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 ; 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 . subString ( i ) = = " 1 " ) count + + ; } System . out . println ( count ) ; } } 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 ; class Main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int e = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; if ( e - a < = k ) { System . out . println ( " Yay ! " ) ; } else { System . out . println ( " : ( " ) ; } } } class Main { public static void main ( String args [ ] ) { int x ; System . out . read ( " % d " , & x ) ; System . out . println ( x * x * x ) ; } } 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 ) ; } } 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 . 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 ( ) ) ; x * = x * = x ; System . out . println ( x ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( 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 ; } } import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; public class ProductAndGCD { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long k = sc . nextLong ( ) ; long num = sc . nextLong ( ) ; List < Integer > primes = primeFactor ( num ) ; List < Integer > oks = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < primes . size ( ) ; i + + ) { if ( primes . lastIndexOf ( primes . get ( i ) ) - i + 1 > = k ) { oks . add ( primes . get ( i ) ) ; } i = primes . lastIndexOf ( primes . get ( i ) ) ; } long ans = 1 ; for ( long pr : oks ) { ans * = pr ; } System . out . println ( ans ) ; } static long gcd ( long m , long n ) { if ( m < n ) return gcd ( n , m ) ; if ( n = = 0 ) return m ; return gcd ( n , m % n ) ; } static long lcm ( long m , long n ) { return m * n / gcd ( m , n ) ; } public static final List < Integer > primeFactor ( long num ) { final List < Integer > list = new ArrayList < Integer > ( ) ; if ( num < 2 ) { return list ; } while ( num ! = 1 & & num % 2 = = 0 ) { list . add ( 2 ) ; num > > > = 1 ; } for ( int i = 3 ; i * i < = num ; i + = 2 ) { while ( num % i = = 0 ) { list . add ( i ) ; num / = i ; } } if ( num ! = 1 ) { list . add ( ( int ) num ) ; } return list ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { 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 = = 2 & & counterFor5 = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . io . FileNotFoundException ; import java . util . Scanner ; class Test { public static void main ( String [ ] args ) throws FileNotFoundException { Scanner scanner = new Scanner ( System . in ) ; scanner . nextInt ( ) ; int citys = scanner . nextInt ( ) ; int [ ] ca = new int [ citys ] ; int [ ] ys = new int [ citys ] ; for ( int i = 0 ; i < citys ; i + + ) { ca [ i ] = scanner . nextInt ( ) ; ys [ i ] = scanner . nextInt ( ) ; } for ( int i = 0 ; i < citys ; i + + ) { int num = ca [ i ] ; int seq = getseq ( num , ys [ i ] , ca , ys ) ; System . out . println ( getFullNumber ( num ) + getFullNumber ( seq ) ) ; } } private 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 ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int nextInt = sc . nextInt ( ) ; System . out . println ( nextInt * nextInt * nextInt ) ; } } public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int d = s . nextInt ( ) ; int i = 0 ; int j = 0 ; int k = 0 ; int sum = 0 ; int judgeSum = 0 ; for ( i = 0 ; i < n ; i + + ) { int [ ] [ ] x = new int [ n ] [ d ] ; for ( j = 0 ; j < d ; j + + ) { x [ i ] [ j ] = s . nextInt ( ) ; } if ( i ! = 0 ) { for ( k = 0 ; k < j ; k + + ) { sum = 0 ; if ( j ! = k ) { for ( int m = 0 ; m < d ; m + + ) { int sa = x [ j ] [ m ] - x [ k ] [ m ] ; int jijou = sa * sa ; sum + = jijou ; } } judgeSum = ( Math . sqrt ( sum ) * 10 ) % 10 = = 0 ? 1 : 0 ; } } } System . out . println ( judgeSum ) ; } } 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 . * ; 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 ( cs [ 0 ] = = ' 0' ) break ; int s = 0 ; for ( int i = 0 ; i < sc . length ; i + + ) { s + = cs [ i ] - ' 0' ; } System . out . println ( s ) ; } } } import java . util . Scanner ; public class main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int n = scanner . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( n , 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 . 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 Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int y = 200 * ( N / 15 ) ; int x = 800 * N ; int receivedPrice = x - y ; System . out . println ( receivedPrice ) ; } } package test ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class test { public static void main ( String [ ] args ) { try { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x ; x = buf . readLine ( ) ; int y = Integer . parseInt ( x ) ; int z = y * y * y ; System . out . println ( z ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class test15 { public static void main ( String [ ] args ) throws NumberFormatException , IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; double a = Double . parseDouble ( in . readLine ( ) ) ; double b = a ; System . out . println ( ( int ) Math . pow ( a , b ) ) ; } } public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) if ( x < 0 | | x > 100 ) { return - 1 ; } 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 . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( System . in ) ; int x = java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } class Main { public static void main ( String [ ] args ) { int x ; System . out . println ( x ^ 3 ) ; } } 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 ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; int intNum = num * num * num ; System . out . println ( intNum ) ; } } 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 ) ; String line = sc . nextLine ( ) ; System . out . println ( line * line * line ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int x = kbd . nextInt ( ) ; int ans = x * x * x ; System . out . println ( ans ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > points = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i + + ) { points . add ( sc . nextInt ( ) ) ; } int min = points . get ( 0 ) ; for ( int p : points ) { min = Math . min ( p , min ) ; } int max = points . get ( 0 ) ; for ( int p : points ) { max = Math . max ( p , max ) ; } System . out . println ( max - min ) ; } } import java . util . * ; public class ABC123A { public static void main ( String [ ] args ) { int [ ] a = null ; int dis ; boolean is = true ; Scanner sc = new Scanner ( System . in ) ; while ( a = = null | | a [ 0 ] < 0 | | a [ 1 ] < 0 | | a [ 2 ] < 0 | | a [ 3 ] < 0 | | a [ 4 ] < 0 | | a [ 5 ] < 0 | | a [ 0 ] > 123 | | a [ 1 ] > 123 | | a [ 2 ] > 123 | | a [ 3 ] > 123 | | a [ 4 ] > 123 | | a [ 5 ] > 123 | | a [ 0 ] > a [ 1 ] | | a [ 1 ] > a [ 2 ] | | a [ 2 ] > a [ 3 ] | | a [ 3 ] > a [ 4 ] ) { for ( int i = 0 ; i < 6 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } } for ( int i = 0 ; i < 6 ; i + + ) { dis = a [ i + 1 ] - a [ i ] ; if ( dis > a [ 5 ] ) { System . out . println ( " : ( " ) ; i = 6 ; is = false ; } } if ( is ) { System . out . println ( " Yay ! " ) ; } } } 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 = = q75 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } import java . util . Scanner ; public class A042 { 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 count = 0 ; if ( A = = 5 | | A = = 7 ) { count + + ; } if ( A = = 7 ) { if ( B = = 5 ) { count + + ; } } else if ( A = = 5 ) { if ( B = = 5 | | B = = 7 ) { count + + ; } } if ( A = = 7 & & B = = 5 ) { if ( C = = 5 ) { count + + ; } } else if ( A = = 5 & & B = = 7 ) { if ( C = = 5 ) { count + + ; } } else if ( A = = 5 & & B = = 5 ) { if ( C = = 7 ) { count + + ; } } if ( count = = 3 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 ) ; } } print ( int ( input ( ) ) * * 2 ) public class Main { public static void main ( String [ ] args ) { String a = new java . util . Scanner ( System . in ) . nextLine ( ) ; String b = new java . util . Scanner ( System . in ) . nextLine ( ) ; String 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 " ) ; } } } package miniexamenes ; import java . util . Scanner ; public class Programdornovato7 { public static void main ( String [ ] args ) { Scanner sc1 = new Scanner ( System . in ) ; int a = sc1 . nextInt ( ) ; if ( a > = 1 & & a < = 100 ) { System . out . println ( a * a ) ; } } } public class Main { public static void main ( Strings [ ] args ) { int x ; x = 2 ; system . out . println ( x * x * x ) ; } } mport java . io . * ; public class OneCardPoker { public static void main ( String [ ] args ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String str ; int checkn = ( int ) ' ' ; String [ ] s = new String [ 2 ] ; int [ ] a = new int [ 2 ] ; try { str = r . readLine ( ) ; s [ 0 ] = str . substring ( 0 , str . indexOf ( checkn ) ) ; s [ 1 ] = str . substring ( str . indexOf ( checkn ) + 1 , str . length ( ) ) ; } catch ( IOException e ) { System . out . println ( e ) ; } for ( int i = 0 ; i < 2 ; i + + ) { a [ i ] = Integer . parseInt ( s [ i ] ) ; if ( a [ i ] = = 1 ) { a [ i ] = 14 ; } } if ( a [ 0 ] > a [ 1 ] ) { System . out . println ( " Alice " ) ; } else if ( a [ 0 ] = = a [ 1 ] ) { System . out . println ( " Draw " ) ; } else { System . out . println ( " Bob " ) ; } } } import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Scanner ; import java . util . SplittableRandom ; public class Main { public static void main ( String [ ] args ) { int N = sc . nextInt ( ) ; int count = 0 ; List < int > intlist = new List < int > ( ) ; for ( int i = 0 ; i < N ; i + + ) { intList . add ( sc . nextInt ( ) ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( intList . get ( i ) ! = intList . get ( i + 2 ) ) { count + + ; } } System . out . print ( count ) ; } } improt 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 ( n * 3 ) ; } } import java . util . Scanner ; public class main { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; int x = scanner . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public final class rect { 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 = a * b ; int f = c * d ; System . out . println ( Math . max ( e , f ) ) ; } } class sanjou { public static void main ( String [ ] args ) { int a = 2 ; int a = a * a * a System . out . println ( a ) ; } } import java . util . * ; public class Main { Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int array [ ] = { sc . nextInt ( ) , sc . nextInt ( ) , sc . nextInt ( ) } ; Arrays . sort ( array ) ; System . out . print ( array [ 0 ] = = 5 & & array [ 1 ] = = 5 & & array [ 2 ] = = 7 ? " Yes " : " No " ) ; } } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; long a = sc . nextInt ( ) ; long b = 1 ; for ( int i = 1 ; i < = a ; i + + ) { b * = i ; } a = b % ( long ) 10000000000 ; System . out . println ( a ) ; } } import java . util . Scanner ; public class L1 _ 2 { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; int z = ( int ) Math . pow ( x , 3 ) ; System . out . println ( z ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int x = in . nextInt ( ) ; System . out . pritnln ( 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 NumberFormatException , IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; long x = Long . parseLong ( br . readLine ( ) ) ; 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 . readLine ( ) . split ( " " ) ; 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 ) ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner x = new Scanner ( System . in ) ; System . out . println ( ( x * x ) * x ) ; } } import java . io . * ; public class XCubic { public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = in . readLine ( ) ; Integer result = ( int ) Math . pow ( Integer . parseInt ( input ) , 3 ) ; System . out . println ( result ) ; } } 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 . io . * ; import java . util . * ; public class ABC127b { public static void main ( String [ ] arg ) { Scanner scan = new Scanner ( System . in ) ; int r = Integer . parseInt ( scan . next ( ) ) ; int d = Integer . parseInt ( scan . next ( ) ) ; int x = Integer . parseInt ( scan . next ( ) ) ; for ( int i = 0 ; i < 10 ; i + + ) { x = r * x - d ; System . out . println ( x ) ; } } } public class Main { public static void main ( String [ ] args ) throws Exception { InputStreamReader isr = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( isr ) ; String buf = br . readLine ( ) ; double x = Double . parseDouble ( buf ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } 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 . util . * ; public 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 ( ) ; 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 " ) ; } } # include < string > # include < vector > # include < stdlib . h > # include < iostream > int main ( int argc , char * * argv ) { int n ; std : : cin > > n ; int spent = n * 800 ; int tmpn = n ; int discountFactor = 0 ; while ( tmpn > 15 ) { tmpn / = 15 ; discountFactor + + ; } std : : cout < < spent - 200 * discountFactor < < std : : endl ; return 0 ; } import java . util . Scanner ; public class ITP1 _ 1 _ B { @ SuppressWarnings ( " resource " ) public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int num = scanner . nextInt ( ) ; System . out . println ( num * num * num ) ; } } import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; 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 = sdf . parse ( " 2019 / 04 / 30 " ) ; if ( formatDate . before ( heiseiDate ) ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } } ; import java . util . Arrays ; import java . util . Scanner ; public class D { static int [ ] [ ] town ; public static void main ( String [ ] args ) throws Exception { final Scanner sc = new Scanner ( System . in ) ; final int N = sc . nextInt ( ) ; town = new int [ N ] [ 2 ] ; for ( int i = 0 ; i < town . length ; i + + ) { town [ i ] [ 0 ] = sc . nextInt ( ) ; town [ i ] [ 1 ] = sc . nextInt ( ) ; } final int [ ] perm = new int [ N ] ; Arrays . fill ( perm , - 1 ) ; final double total = perm ( perm , 0 ) ; int fact = 1 ; for ( int i = 2 ; i < = N ; i + + ) { fact * = i ; } System . out . println ( total / fact ) ; } static double perm ( int [ ] perm , int depth ) { if ( depth = = perm . length ) { return totalLength ( perm , town ) ; } double ret = 0 ; for ( int i = 0 ; i < perm . length ; i + + ) { if ( perm [ i ] ! = - 1 ) { continue ; } perm [ i ] = depth ; ret + = perm ( perm , depth + 1 ) ; perm [ i ] = - 1 ; } return ret ; } private static double totalLength ( final int [ ] perm , final int [ ] [ ] town ) { double ret = 0 ; for ( int i = 0 ; i < perm . length - 1 ; i + + ) { ret + = len ( town [ perm [ i ] ] , town [ perm [ i + 1 ] ] ) ; } return ret ; } static double len ( int [ ] a , int [ ] b ) { return Math . sqrt ( ( a [ 0 ] - b [ 0 ] ) * ( a [ 0 ] - b [ 0 ] ) + ( a [ 1 ] - b [ 1 ] ) * ( a [ 1 ] - b [ 1 ] ) ) ; } } 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 . * ; 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 + = 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 . * ; 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 ( i = 0 ; 2 ; i + + ) { input = list . get ( i ) ; ans = ans + input ; } System . out . println ( ans ) ; } } 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 ) ) ; } } package day1 ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class day1 { public static void main ( String [ ] args ) { try { BufferedReader buf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String x ; x = buf . readLine ( ) ; int y = Integer . parseInt ( x ) ; int z = y ^ 3 ; System . out . println ( z ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; while ( true ) { int x = sc . nextInt ( ) ; if ( x = = 0 ) break ; boolean can = true ; int sum = 0 ; while ( can ) { if ( x < 10 ) { sum + = x ; System . out . println ( sum ) ; can = false ; } else { sum + = x % 10 ; x = ( x - x % 10 ) / 10 ; } } } } } 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 ( ) ; } } 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 Main { public static void main ( String [ ] args ) { scanner sc = new Scanner ( System . in ) ; int k = Integer . parseInt ( in . next ( ) ) ; int s = Integer . parseInt ( 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 ) ; } } 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 . * ; 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 h = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int time = h * 60 + m ; double w = ( double ) ( time % 360 * 5.5 ) ; final double d = w ; while ( w > 0 ) { r = w / 360 ; w = w - r * 360 ; } double len = Math . sqrt ( a * a + b * b - 2 * a * b * ( Math . cos ( w / 180 * ( Math . PI ) ) ) ) ; System . out . println ( len ) ; } } 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 ) . intValue ( ) ) ; } } 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 max = Math . max ( a * b , c * d ) ; System . out . print ( max ) ; } } s = input ( ) if s < = ' 2019 / 04 / 30 ' : print ( " Heisei " ) else : print ( " TBD " ) 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 ) ; } } class HelloServlet { public static void main ( String args [ ] ) throws IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = new String ( in . readLine ( ) ) ; int i = Integer . parseInt ( s ) ; if ( i > 0 | | i < 101 ) { System . out . print ( i * i * i ) ; } } } import java . io . * ; public class Main { public static void main ( String [ ] args ) thorows IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = in . readLine ( ) ; System . out . println ( a * a * a ) } } 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 . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = Integer . parseInt ( sc . next ( ) ) ; int D = Integer . parseInt ( sc . next ( ) ) ; int [ ] [ ] point = new int [ N ] [ D ] ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = 0 ; j < D ; j + + ) { point [ i ] [ j ] = Integer . parseInt ( sc . next ( ) ) ; } } int counter = 0 ; for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { int tmpSum = 0 ; for ( int k = 0 ; k < D ; k + + ) { tmpSum + = Math . pow ( point [ i ] [ k ] - point [ j ] [ k ] , 2 ) ; } if ( isPerfectSquare ( tmpSum ) ) { counter + + ; } } } System . out . println ( counter ) ; } private static boolean isPerfectSquare ( int n ) { if ( n < 0 ) return false ; int tst = Math . round ( ( Math . sqrt ( n ) + 0.5 ) ; return tst * tst = = n ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] a ) { Scanner x = new Scanner ( System . in ) ; int a = x . nextInt ( ) ; double b = 3 ; int c = ( int ) Math . pow ( a , b ) ; System . out . println ( c ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = System . in . read ( ) ; System . out . println ( x * x * 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 * x * x ) ; } } 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 ( ) ; double x = ( a + b ) / 2 ; System . out . print ( Math . seil ( x ) ) ; } } 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 ] ; } 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String t = sc . next ( ) ; String [ ] strArray = new String [ t . length ( ) ] ; for ( int i = 0 ; i < t . length ( ) ; i + + ) { String str = String . valueOf ( str . charAt ( i ) ) ; strArray [ i ] = str ; } for ( int i = 0 ; i < strArray . length ; i + + ) { if ( strArray [ i ] = = " ? " ) { strArray [ i ] = = " D " ; } StringBuffer buf = new StringBuffer ( ) ; buf . append ( strArray [ i ] ) ; } System . out . println ( buf . toString ( ) ) ; } } 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 ) ) ; } } import java . util . Scanner ; public class Cubed { public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int x = stdin . nextInt ( ) ; if ( 1 < = x & & 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 ) ; try { String x = sc . Int ( ) ; SimpleDateFormat sdFormat = new SimpleDateFormat ( " yyyy / MM / dd hh : mm : ss " ) ; Date date = sdFormat . parse ( strDate ) ; String str = new SimpleDateFormat ( " yyyy-MM-dd hh : mm : ss " ) . format ( date ) ; if ( str < = 2019 / 04 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } } catch ( ParseException e ) { e . printStackTrace ( ) ; } } } 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 ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = Integer . parseInt ( br ) ; x = x * x * x ; System . out . println ( x ) ; } } public class Main { public static void main ( String [ ] args ) { String a = new java . util . Scanner ( System . in ) . nextLine ( ) ; String b = new java . util . Scanner ( System . in ) . nextLine ( ) ; String c = new java . util . Scanner ( System . in ) . nextLine ( ) ; switch ( a b c ) { case 7 5 5 : System . out . println ( " YES " ) ; break ; case 5 7 5 : Ssytem . out . println ( " YES " ) break ; case 5 5 7 : Ssytem . out . println ( " YES " ) break ; default : Ssytem . out . print ( " NO " ) ; } } } class main { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int x ; x = scan . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x ^ 3 ) ; } } class Main { public static void main ( String [ ] args ) { int x , y ; y = x * x * x ; System . out . println ( " % d % d " , & x , & y ) ; } } public class For3 { public static void main ( String [ ] args ) { int x = 2 ; int answer = x * x * x ; for ( int i = 0 ; x < i ; i + + ) { System . out . print ( x + " ? ? ? 3 ? ? ? ? ? ? ? ? ? " ) ; System . out . println ( answer ) ; } } } public class main { public static void main ( String [ ] args ) { int x = math . pow ( 2 , 3 ) ; System . out . println ( " x " ) ; } } import java . util . Scanner ; public class TravelingAtCoDeerProblem { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; scan . nextLine ( ) ; String [ ] ary = scan . nextLine ( ) . split ( " " ) ; scan . close ( ) ; int max = Integer . parseInt ( ary [ 0 ] ) ; int min = max ; int value ; for ( int i = 1 ; i < ary . length ; i + + ) { value = Integer . parseInt ( ary [ i ] ) ; if ( max < value ) { max = value ; } if ( value < min ) { min = value ; } } System . out . println ( max - min ) ; } } 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 . Scanner ; public class Test { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int r = scanner . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( r , 2 ) ) ; } } import java . util . Scanner ; class Test2 { 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 ) ) ; } } private 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 ; } private 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 ; } } public class Main { public static void main ( String [ ] args ) { 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 . 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 ( " % .10f " , result ) ; } } public class AOJ2 { int x = 1 ; public static void main ( int x ) { System . out . println ( " x * x * x " ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; int result ; x = ( int ) System . in ; result = x ^ 3 ; System . out . println ( result ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int [ ] num = new int [ 4 ] ; Scanner scn = new Scanner ( System . in ) ; num [ 0 ] = scn . nextInt ( ) ; num [ 1 ] = scn . nextInt ( ) ; num [ 2 ] = scn . nextInt ( ) ; num [ 3 ] = scn . nextInt ( ) ; System . out . println ( num [ 0 ] * num [ 1 ] > num [ 2 ] * num [ 3 ] ? num [ 0 ] * num [ 1 ] : num [ 2 ] * num [ 3 ] ) ; } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { BufferedResder 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 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 / 6 * Math . PI - ( double ) M / 30 * Math . PI ) ; 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 < 0 ? - ( double ) answer : answer ) ; } } package main import ( " fmt " " time " ) const ( yyyymmdd = " 2006 / 01 / 02 " ) func main ( ) { var dateS , res string _ , _ = fmt . Scan ( & dateS ) res = solveA ( dateS ) fmt . Println ( res ) } func solveA ( dateS string ) string { t1 , _ : = time . Parse ( yyyymmdd , dateS ) t2 , _ : = time . Parse ( yyyymmdd , " 2019 / 04 / 30 " ) if t1 . Unix ( ) < = t2 . Unix ( ) { return " Heisei " } else { return " TBD " } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throw IOExpection { 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 ) { int x ; Scanner scan = new Scanner ( System . in ) ; x = scan . nextInt ( ) ; x = x * x * x ; System . out . println ( x ) ; } } import java . util . * ; import java . io . * ; 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 . * ; 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 ( Bob ) ; } elseif ( A > B ) { System . out . println ( Alice ) ; } else ( A = B ) { System . out . println ( Draw ) ; } public class test { 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 . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M [ ] = new int [ N ] ; int s = 0 ; for ( int i = 0 ; i < N ; i + + ) { M [ i ] = sc . nextInt ( ) ; s = s + 1 ; if ( M [ i ] = = 1 ) { break ; } } int x = 0 ; for ( int j = 0 ; j < s ; j + + ) { int L = M [ j ] ; int R = M [ j ] ; int Y = ( j - j % 2 ) / 2 ; for ( int k = 0 ; k < = Y ; k + + ) { L = Math . min ( L , M [ Y - k ] ) ; if ( L = = M [ Y - k ] ) { break ; } else { for ( k = 0 ; k < = Y ; k + + ) { R = Math . min ( R , M [ j - k ] ) ; if ( R = = M [ j - k ] ) { break ; } } if ( R = = M [ j ] ) { x = x + 1 ; } else { x = x ; } } } System . out . println ( x + 1 ) ; } } 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 ( ) ; System . out . println ( ( int ) Math . ceiling ( ( a + b ) / 2 ) ) ; } } 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 . containsKey ( 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 . Arrays ; import java . util . HashMap ; import java . util . Map . Entry ; import java . util . Scanner ; import java . util . TreeMap ; public class ABC113C { 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 ] ; HashMap < Integer , TreeMap < Integer , Integer > > localGovernment = new HashMap < > ( ) ; String [ ] ans = new String [ M ] ; for ( int i = 0 ; i < M ; i + + ) { P [ i ] = sc . nextInt ( ) ; Y [ i ] = sc . nextInt ( ) ; localGovernment . computeIfAbsent ( P [ i ] , key - > new TreeMap < > ( ) ) . put ( Y [ i ] , i ) ; } localGovernment . forEach ( ( k , v ) - > { int i = 1 ; for ( Entry < Integer , Integer > tree : v . entrySet ( ) ) { ans [ tree . getValue ( ) ] = String . format ( " % 06d " , k ) + String . format ( " % 06d " , i + + ) ; } } ) ; Arrays . stream ( ans ) . forEach ( System . out : : println ) ; sc . close ( ) ; } } import java . util . * ; public class Main { private static Scanner sc = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = sc . nextInt ( ) ; long t = sc . nextLong ( ) ; long a = sc . nextLong ( ) ; long nt = 0 , na = 0 ; for ( int i = 1 ; i < n ; i + + ) { T = sc . nextLong ( ) ; A = sc . nextLong ( ) ; long m = Math . max ( ( t - 1 ) / T + 1 , ( a - 1 ) / A + 1 ) ; t = T * m ; a = A * m ; } System . out . println ( t + a ) ; } } import java . util . Scanner ; public class Main { static Long T [ ] ; static Long A [ ] ; static Long TA [ ] ; static Long TT [ ] ; static int N ; static Long ans = 0 ; public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; N = sc . nextInt ( ) ; T = new Long [ N ] ; TT = new Long [ N ] ; TA = new Long [ N ] ; A = new Long [ N ] ; for ( int i = 0 ; i < N ; i + + ) { T [ i ] = sc . nextLong ( ) ; A [ i ] = sc . nextLong ( ) ; } 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 ) { Long 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 ; } } public class HelloWorld { public static void main ( String [ ] args ) { double x = 2 ; double y = 3 ; System . out . println ( Math . pow ( x , y ) ) ; } } public class Main { public static void main ( String [ ] args ) { double x ; double exponent = 3d ; double num = Math . pow ( x , exponent ) ; System . out . printf ( " % .0f \ n " , num ) ; } } import java . lang . Math . * ; import java . util . * ; 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 scala . io . StdIn . { readLine , readInt } object Main extends App { val x = readInt println ( x * x * x ) } import java . util . Scanner ; public class Iroha { 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 class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; System . out . println ( k * k * k ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String input = br . readLine ; String [ ] param = input . split ( " " ) ; int x = Integer . parseInt ( param [ 0 ] ) ; double ans = Math . pow ( x , 3 ) ; System . out . println ( ( int ) ans ) ; } } 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 ) ) ; } } import java . util . * ; 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 ( t * ( v - w ) > = Math . pow ( a - b ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } class Main { public static void main ( String [ ] args ) System . out . println ( x * x * x ) ; } } class Main { public static void main ( String [ ] args ) { x = 1 ; y = x * x * x ; System . out . println ( y ) ; } } 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 . 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 . println ( Integer . parseInt ( line ) ^ 3 ) ; in . close ( ) ; } catch ( Exception e ) { e . getStackTrace ( ) ; System . exit ( - 1 ) ; } } } import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; public class A { 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 . * ; import java . lang . * ; import java . io . * ; import java . math . * ; public class codeforces { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; System . out . println ( t * t ) ; } } 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 . io . * ; class Main { public static void main ( String argv [ ] ) { int x ; BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( d . readLine ( ) ) ; x = x * x ; System . out . println ( x ) ; } } 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 . 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 ) ; public class Main { 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 . 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 ] ) { count + + ; } } System . out . println ( count ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner n = new Scanner ( System . in ) ; for ( int i = 0 ; i < n ; i + + ) { int dec = n . nextInt ( ) ; for ( int j = n . length ( ) - 1 ; j < = 0 ; j -- ) { dec [ j ] = dec [ j ] ^ dec [ j + 1 ] ; } } System . out . println ( dec ) ; } } class Main { public static void main ( String [ ] args ) { for ( x = 2 , y = > 27 , x * x ) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? System . out . println ( x ) ; } } 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 num1 = 0 ; long num2 = 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 ( ) { 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 ) ; } } } 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 " ) ; } } } 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 . io * public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader b = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = b ^ 3 ; System . out . println ( x ) ; } } import java . util . Scanner ; public class practice { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int A = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; if ( A > B ) { System . out . println ( " Alice " ) ; } else if ( A < B ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Draw " ) ; } } } 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 ) ; } } import java . util . Scanner ; public class Haiku { public static void main ( String [ ] args ) { String result = " NO " ; 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 ) ) { result = " YES " ; } System . out . println ( result ) ; } } import java . util . * ; public class X _ Cubic { 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 ) ; } } 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 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 ) ; } } 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 div168 { 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 th = ( double ) ( h * 60 + m ) / 720 * 2 * Math . PI ; double tm = ( double ) ( m / 60 ) * 2 * Math . PI ; double xh = a * Math . cos ( th ) ; double yh = a * Math . sin ( th ) ; double xm = b * Math . cos ( tm ) ; double ym = b * Math . sin ( tm ) ; double dx = xh - xm ; double dy = yh - ym ; double ans = ( ( dx * dx ) + ( dy * dy ) ) ; double ans1 = Math . sqrt ( ans ) ; System . out . printf ( " % .10f \ n " , ans1 ) ; } } # include < stdio . h > # define uint unsigned int inline 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 [ ] ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextint ( ) ; int b = sc . nextInt ( ) ; if ( ( a + b ) % 2 = 0 ) { System . out . println ( ( a + b ) / 2 ) ; } else { System . out . println ( ( a + b ) / 2 + 1 ) ; } } } package ABC _ B ; import java . util . Arrays ; import java . util . Scanner ; public class IrohaLovesStrings { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int l = sc . nextInt ( ) ; String [ ] array = new String [ n ] ; for ( int i = 0 ; i < n ; i + + ) { array [ i ] = sc . next ( ) ; } Arrays . sort ( array ) ; for ( int i = 0 ; i < n ; i + + ) { System . out . print ( array [ i ] ) ; } } } import java . util . * ; public class D { static final long MOD = 1000000007L ; static final int WIDTH = 64 ; static final long [ ] BIN _ EXPS = buildBinExps ( ) ; static Scanner sc = new Scanner ( System . in ) ; static int n = 0 ; public static void main ( String [ ] args ) { n = sc . nextInt ( ) ; int [ ] [ ] binaries = new int [ n ] [ WIDTH ] ; for ( int i = 0 ; i < n ; + + i ) { binaries [ i ] = getBinary ( sc . nextLong ( ) ) ; } long ans = 0L ; for ( int iw = 0 ; iw < WIDTH ; + + iw ) { long z = count0 ( binaries , iw ) ; long prod = z * ( n - z ) % MOD ; ans + = prod * BIN _ EXPS [ iw ] % MOD ; ans % = MOD ; } System . out . println ( ans ) ; } static long [ ] buildBinExps ( ) { long [ ] res = new long [ WIDTH ] ; for ( int i = 0 ; i < WIDTH ; + + i ) { res [ i ] = ( i = = 0 ) ? 1L : 2L * res [ i - 1 ] % MOD ; } return res ; } static int [ ] getBinary ( long num ) { int [ ] res = new int [ WIDTH ] ; for ( int i = 0 ; i < WIDTH ; + + i ) { res [ i ] = ( num % 2L = = 1L ) ? 1 : 0 ; num / = 2L ; } return res ; } static long count0 ( int [ ] [ ] binaries , int iw ) { long res = 0L ; for ( int id = 0 ; id < n ; + + id ) { if ( binaries [ id ] [ iw ] = = 0 ) + + res ; } return res ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) , b = scan . nextInt ( ) ; String [ ] ABC = new int [ a ] ; String small = ABC [ 0 ] ; String output = " " ; for ( int x : ABC ) { ABC [ x ] = scan . next ( ) ; } for ( int i = 1 ; i < ABC . length ; i + + ) { for ( int x = 1 ; x < ABC . length ; x + + ) if ( small > ABC [ x ] ) small = ABC [ x ] ; output + = small ; } System . out . println ( small ) ; } } 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 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 ! " ) ; } } 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 . readLine ( ) . 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 " ) ; } } } import java . util . * ; public class a { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int [ ] nums = new int [ 3 ] ; for ( int i = 0 ; i < 3 ; i + + ) nums [ i ] = in . nextInt ( ) ; int fives = 0 , sevens = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( nums [ i ] = = 5 ) fives + + ; if ( nums [ i ] = = 7 ) sevens + + ; } if ( sevens = = 1 & & fives = = 2 ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } } class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { 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 ; 1 = < x = < 100 ; System . out . println ( " x * x * x " ) ; } } import java . io . * ; 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 . util . Scanner ; public class A { 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 . Scanner ; public class MySample { 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 sum = 0 ; if ( a = = 5 | | a = = 7 ) { sum + = a ; } if ( b = = 5 | | b = = 7 ) { sum + = b ; } if ( c = = 5 | | c = = 7 ) { sum + = c ; } if ( sum = = 17 ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } scan . close ( ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scan = new Scanner ( System . in ) ; try { int n = scan . nextInt ( ) ; System . out . println ( ( int ) Math . pow ( n , 3 ) ) ; } catch ( IOExcepton e ) { e . printStackTrace ( ) ; } finally ( Exception e ) { e . printStackTrace ( ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner stdIn = new Scanner ( System . in ) ; int n = stdIn . nextInt ( ) ; long m = stdIn . nextLong ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i + + ) { a [ i ] = stdIn . nextLong ( ) ; } for ( long i = 0 ; i < ) stdIn . close ( ) ; } } 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 . charAt ( i ) = = ' ? ' ) { if ( sb . charAt ( i + 1 ) = = ' D ' ) { sb . append ( ' P ' ) ; } else { sb . append ( ' D ' ) ; } } } System . out . pritnln ( sb . substring ( 1 , sb . length ( ) - 1 ) ) ; } } import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int s , o , k , flag ; for ( s = 0 ; s < 5 ; s + + ) { A [ s ] = sc . nextInt ( ) ; } flag = 0 ; for ( s = 0 ; s < 4 ; s + + ) { for ( o = s + 1 ; o < 5 ; o + + ) { if ( k < sum ( A [ s ] , A [ o ] ) ) { flag = 1 ; break ; } } if ( flag = = 1 ) { break ; } } if ( flag = = 0 ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } public static int sum ( int a , int b ) { if ( a > b ) return a - b ; else return b - a ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int xRatio [ ] = new int [ n ] ; int yRatio [ ] = new int [ n ] ; int x [ ] = new int [ n ] ; int y [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { xRatio [ i ] = sc . nextInt ( ) ; yRatio [ i ] = sc . nextInt ( ) ; } sc . close ( ) ; x [ 0 ] = xRatio [ 0 ] ; y [ 0 ] = yRatio [ 0 ] ; for ( int i = 1 ; i < n ; i + + ) { double ratio1 = Math . ceil ( ( double ) x [ i - 1 ] / xRatio [ i ] ) ; double ratio2 = Math . ceil ( ( double ) y [ i - 1 ] / yRatio [ i ] ) ; double ratio = Math . max ( ratio1 , ratio2 ) ; x [ i ] = ( int ) xRatio [ i ] * ( int ) ratio ; y [ i ] = ( int ) yRatio [ i ] * ( int ) ratio ; } System . out . println ( x [ i ] + y [ i ] ) ; } } 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 ) ; } long dis = ( long ) Math . abs ( a - b ) ; long num = v - w ; num * = t ; if ( num > = dis ) { 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 ) ; String a = sc . nextLine ( ) ; while ( true ) { if ( a . equals ( " 0 " ) ) break ; int sum = 0 ; for ( int a = 0 ; i < a . lenght ( ) ; i + + ) { sum + = Character . getNumericValue ( a . charAt ( i ) ) ; } System . out . println ( sum ) ; } } } public class Main { public static void main ( String [ ] args ) { int x ; x > = 1 & & x < = 100 ; System . out . println ( x * x * x ) ; } } public class X { public static void main ( String [ ] args ) { int x = 3 ; x = x ^ 3 ; System . out . println ( x ) ; } } import java . util . * ; public class AtCoder _ 0127 _ B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int r = input . nextInt ( ) ; int d = input . nextInt ( ) ; int x = input . nextInt ( ) ; int result = 0 ; for ( int i = 0 ; i < 10 ; i + + ) { result = ( r * x ) - d ; System . out . println ( result ) ; x = result ; } input . close ( ) ; } } 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 ( ) ; long sa = Math . abs ( a - b ) ; long kyori = ( v - w ) * t ; if ( kyori > = sa ) { 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 a = sc . nextInt ( ) ; long v = sc . nextInt ( ) ; long b = sc . nextInt ( ) ; long w = sc . nextInt ( ) ; long t = sc . nextInt ( ) ; long sa = Math . abs ( a - b ) ; long kyori = v - w ; if ( kyori * t > = sa ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } class Main { public static void main ( String [ ] args ) { int intInputData = Integer . Parse ( System . in . read ( ) ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } import java . io . * ; class Main { 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 . 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 ) ; } } public class XCubic { public static void main ( String [ ] args ) { int x = x * x * x System . out . println ( 1 ? ? ? x ? ? ? 100 ) ; } } import java . util . * ; public class KeyenceChallenge { 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 [ ] 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 ) ; } } class Main { public static void main ( String [ ] args ) { int intInputData = Integer . parseInt ( System . in . read ( ) ) ; int intResult = intInputData ^ 3 ; System . out . println ( " " + intResult ) ; } } 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 i = 0 ; i < 2 ; 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 ) ; } } 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 Hr = 0 ; double Mr = 0 ; double R = 0 ; double result = 0 ; double tmp = 0 ; double ang = ( H * 60 + M ) * 360 / ( 12 * 60 ) - m * 360 / 60 ; if ( ang > 180 ) { ang = 360 - ang ; } result = A * A + B * B - ( 2 * A * B * Math . cos ( Math . toRadians ( ang ) ) ) ; result = Math . sqrt ( result ) ; System . out . println ( result ) ; } } 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 ) ; } } import java . util . * ; import java . lang . * ; import java . io . * ; class Codechef { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner SC = new Scanner ( System . in ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 0 ; int a , b , c , d ; a = SC . nextInt ( ) ; b = SC . nextInt ( ) ; c = SC . nextInt ( ) ; d = SC . nextInt ( ) ; int f = ( a * b ) ; int g = ( c * d ) ; int ans = ( int ) ( Math . max ( f , g ) ) ; pw . println ( ans ) ; pw . close ( ) ; } } public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( ) ; System . out . print ( str * str * str ) ; } 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 . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int [ ] A = new int [ 5 ] ; int s , o , k , flag ; for ( s = 0 ; s < 5 ; s + + ) { A [ s ] = sc . nextInt ( ) ; } flag = 0 ; for ( s = 0 ; s < 4 ; s + + ) { for ( o = s + 1 ; o < 5 ; o + + ) { if ( k < sum ( A [ s ] , A [ o ] ) ) { flag = 1 ; break ; } } if ( flag = = 1 ) { break ; } } if ( flag = = 0 ) System . out . println ( " Yay ! " ) ; else System . out . println ( " : ( " ) ; } public static int sum ( a , b ) { if ( a > b ) return a - b ; else return b - a ; } } 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 ) ; } } public class Main { public static void main ( String [ ] args ) { System . out . print ( math . pow ( x , 3 ) ) ; } } class main { public static void ( String [ ] args ) { int x = math . pow ( 2 , 3 ) ; System . out . println ( " x " ) ; } } import java . io . * ; import java . util . * ; public class OneCardPoker { 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 " ) ; } } } import java . util . Scanner ; public class Main02 { 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 static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int cnt1 = 0 ; int cnt2 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { int num = scan . nextInt ( ) ; if ( num = = 5 ) { cnt1 + + ; } else if ( num = = 7 ) { cnt2 + + ; } } if ( cnt1 = = 2 & & cnt2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } scan . close ( ) ; } public class main { public static void main ( String [ ] args ) { java . util . Scanner scan = new java . util . Scanner ( System . in ) ; int x = scan . nextInt ( ) ; System . out . println ( x * x * x ) ; } } class main1 { public void Main ( ) { String S ; if ( ( int ) S < 2019 / 4 / 30 ) { System . out . println ( " Heisei " ) ; } else { System . out . println ( " TBD " ) ; } return ; } } import java . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int min = x [ 0 ] ; int max = x [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > x [ i ] ) { min = x [ i ] ; } if ( max < x [ i ] ) { max = x [ i ] ; } } int total = 0 int st = 50000 ; for ( int i = min ; i < = max ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { total + = ( x [ j ] - i ) * ( x [ j ] - i ) ; if ( j = = n - 1 & & st > total ) { st = total ; total = 0 ; } else { total = 0 ; } } } System . out . println ( st ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String Nb1 = scan . next ( ) ; int N = Integer . valueOf ( Nb1 ) ; String Nb1 = scan . next ( ) ; int M = Integer . valueOf ( Nb2 ) ; int [ ] nb1 = new int [ M ] ; int [ ] nb2 = new int [ M ] ; for ( int i = 0 ; i < M ; i + + ) { nb1 [ i ] = scan . nextInt ( ) ; nb2 [ i ] = scan . nextInt ( ) ; } int count = 0 ; for ( int j = 0 ; j < N ; j + + ) { int v1 = nb1 [ j ] ; int v2 = nb2 [ j ] ; for ( int i = j ; i < N ; i + + ) { if ( nb2 [ i ] < v1 | | v2 < nb [ i ] ) { count + + ; } } } System . out . println ( count ) ; } } import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { int 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 " ) ; } Scanner scan3 = new Scanner ( System . in ) ; int C = scan3 . nextInt ( ) ; if ( A + B + C = = 17 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } else { System . out . println ( " NO " ) ; } } public class Main { public static void main ( string [ ] args ) { int x ; System . out . println ( x * x * x ) ; } } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; List < Integer > list = new ArrayList < > ( ) ; for ( int i = 0 ; sc . hasNext ( ) ; i + + ) { list . add ( sc . nextInt ( ) ) ; } int n5 = 0 ; int n7 = 0 ; for ( int n : list ) { if ( n = = 5 ) { n5 + + ; } if ( n = = 7 ) { n7 + + ; } } System . out . println ( n5 = = 2 & & n7 = = 1 ? " YES " : " NO " ) ; } import java . util . Scanner ; class Main { public static void main ( String args [ ] ) { Scanner scan = New Scanner ( System . in ) ; int x ; x = scan . nextInt ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; import java . io . * ; public class A91 { 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 ( ) ) ; if ( a + b > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } sc . close ( ) ; } } 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 . util . Scanner ; public class ITP1 _ 1 _ B { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int x = Integer . parseInt ( scan . next ( ) ) ; System . out . println ( x * x * x ) ; } } class main { public static void main ( Strings arg [ ] ) { int i = 0 ; int x = 3 ; i = x * x * x ; System . out . println ( i ) ; } # include < stdio . h > int main ( ) { int x , seki ; scanf ( " % d " , & x ) ; seki = x * x * x ; printf ( " % d ? \ n " , seki ) ; return 0 ; } 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 ArrayList [ 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 ; } } } public class Main { public static void main ( String [ ] args ) { int x ; x * = 3 ; 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 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 ) { int a = 0 ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = reader . readLine ( ) ; a = Integer . parseInt ( line ) ; System . out . println ( a ) ; } } inport java . util . scanner public class main ( ) { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; } } import java . util . Scanner ; public cladd Main { ppublic 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 ) { int x ; int y = x * x * x ; } } 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 ( 3 ) ; x = Integer . parseInt ( buf ) ; 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 ( ) ; if ( A < B ) { if ( A = = 1 ) { System . out . priln ( " Alice " ) ; } else { System . out . println ( " Bob " ) ; } } else if ( A > B ) { if ( B = = 1 ) { System . out . println ( " Bob " ) ; } else { System . out . println ( " Alice " ) ; } } else { System . out . println ( " Draw " ) ; } } } public class Main { public static void main ( String [ ] args ) { int year = Integer . valueOf ( args [ 0 ] . substring ( 0 , 3 ) ) ; int month = Integer . valueOf ( args [ 0 ] . substring ( 5 , 6 ) ) ; int day = Integer . valueOf ( 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 main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . nextLine ( ) ; 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 count = 0 ; List < int > intlist = new List < int > ( ) ; for ( int i = 0 ; i < N ; i + + ) { intList . add ( sc . nextInt ( ) ) ; } for ( int i = 0 ; i < N ; i + + ) { if ( intList . get ( i ) ! = intList . get ( i + 2 ) ) { count + + ; } } System . out . print ( count ) ; } } 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 ) ; sc . close ( ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String x = sc . next ( ) ; if ( x < = 2019 / 04 / 30 ) System . out . println ( " Heisei " ) ; else System . out . println ( " TBD " ) ; } } import java . util . Scanner ; public class abc051 { 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 k = 0 ; k < = K ; k + + ) { if ( i + j + k = = S ) { ans + + ; } } } } System . out . println ( ans ) ; } } 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 " ) ; input1 . close ( ) ; } } public class Main { import java . util . Date ; public static void main ( String [ ] args ) { int year = Integer . valueOf ( args [ 0 ] . substring ( 0 , 3 ) ) ; int month = Integer . valueOf ( args [ 0 ] . substring ( 5 , 6 ) ) ; int day = Integer . valueOf ( 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 Restaurant { public int calcPrice ( int x ) { int res = 0 ; res = 800 * x - 200 * ( x / 15 ) ; return res ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; while ( true ) { System . out . println ( scan . nextInt ( ) . equals ( null ) ? break : scan . nextInt ( ) + scan . nextInt ( ) ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner in = ndew Scanner ( System . in ) ; int x = Integer . purseInt ( in . next ( ) ) ; System . out . println ( x * x * x ) ; } } Public class Main { public static void main ( String [ ] args ) { int x = 2 ; int ruikei = x * x * x ; System . out . println ( ruikei ) ; } } import java . util . * ; public class Intro29 { 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 ) ; int n = Integer . parseInt ( ch ) ; sum + = n ; } list . add ( sum ) ; } for ( int n : list ) { System . out . println ( n ) ; } } } # include < cstdio > # include < cstring > # include < cstdlib > # include < cmath > # include < ctime > # include < cassert > # include < string > # include < algorithm > # include < vector > # include < queue > # include < stack > # include < functional > # include < iostream > # include < iomanip > # include < map > # include < set > # include < list > # include < limits > # include < numeric > # include < utility > # include < deque > # include < valarray > # include < unordered _ set > # include < unordered _ map > # include < regex > # include < array > # include < bitset > # include < complex > # include < string > # include < tuple > using namespace std ; using ll = long long ; const int INF = 1e9 ; const ll MOD = 1e9 + 7 ; int main ( ) { int a , b ; cin > > a > > b ; if ( a < = 5 ) cout < < 0 < < endl ; else if ( a < = 12 ) cout < < b / 2 < < endl ; else cout < < b < < endl ; return 0 ; } import java . util . * ; class Main { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int fee = 0 ; if ( a > = 13 ) { fee = b ; } else if ( a > = 6 ) { fee = b / 2 ; } else if ( a < 5 ) { fee = 0 ; } System . out . print ( fee ) ; } public class Main { public static void main ( String [ ] argc ) { 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 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 " ) ; } } mport 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 ( ) ; double ab = a + b ; int ans = ( int ) Math . ceil ( ab / 2 ) ; System . out . println ( ans ) ; 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 ( ) ; Integer . parseInt ( s ) ; System . out . println ( s * s * s ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Main { private static Scanner sc ; public static void main ( String [ ] args ) { Main instance = new Main ( ) ; sc = instance . new Scanner ( ) ; instance . solve ( ) ; } private void solve ( ) { int [ ] antena = new int [ 5 ] ; int k ; String result = " Yay ! " ; try { for ( int i = 0 ; i < 5 ; i + + ) antena [ i ] = sc . nextInt ( ) ; k = sc . nextInt ( ) ; for ( int i = 0 ; i < 4 ; i + + ) { for ( int j = i + 1 ; j < 5 ; j + + ) { if ( antena [ j ] - antena [ i ] > k ) { result = " : ( " ; break ; } } } System . out . println ( result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } private class Scanner { String [ ] s ; int i ; BufferedReader br ; String regex = " " ; public Scanner ( ) { s = new String [ 0 ] ; i = 0 ; br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } @ Override protected void finalize ( ) throws Throwable { try { super . finalize ( ) ; } finally { destruction ( ) ; } } private void destruction ( ) throws IOException { if ( br ! = null ) br . close ( ) ; } public String next ( ) throws IOException { if ( i < s . length ) return s [ i + + ] ; String st = br . readLine ( ) ; while ( st = = " " ) st = br . readLine ( ) ; s = st . split ( regex , 0 ) ; i = 0 ; return s [ i + + ] ; } public int nextInt ( ) throws NumberFormatException , IOException { return Integer . parseInt ( next ( ) ) ; } public Long nextLong ( ) throws NumberFormatException , IOException { return Long . parseLong ( next ( ) ) ; } public Double nextDouble ( ) throws NumberFormatException , IOException { return Double . parseDouble ( next ( ) ) ; } } 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 = Integer . parseInt ( bu f ) ; S stem.o u t.p r intln ( x ) ; } } 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 ) ; } } 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 ) ; } } 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 ) ; } class Main { BufferReader br = new BufferReader ; int x = Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } import java . io . * ; import java . util . * ; public class Main { @ SuppressWarnings ( " unchecked " ) 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 ArrayList [ V ] ; for ( int i = 0 ; i < V ; i + + ) { edges [ i ] = new ArrayList < Edge > ( ) ; } } 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 . util . Scanner ; public class FerrisWheel { 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 . io ; public class Main { public static void main ( String [ ] args ) { int x ; int xCubic ; x = buf . readLine ( ) ; xCubic = x ^ 3 ; System . out . println ( xCubic ) ; } } 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 ( ) ; } } } } 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 . * ; public class Main { public static void main ( String [ ] args ) throws Exception { Scanner scn = new Scanner ( System . in ) ; int x = scn . nextDouble ( ) ; int a = 0 , b = 0 ; boolean flg = true ; while ( flg ) { for ( b = 0 ; b > = ( - Math . pow ( x , ( 1 / 5 ) ) ) ; 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 . io . * ; class Main public { 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 . 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 . readLine ( ) . 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 " ) } } } 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 ) ; } } } class Main { public static void main ( String args [ ] ) { int x = 0 ; DataInputStream d = new DataInputStream ( System . in ) ; x = d ; x = x ^ 2 ; System . out . println ( x ) ; } } package beginnerContest123 ; 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 ( ) ; } } class Main { public static void main ( String [ ] args ) { int x = 2 ; System . out . println ( x * x * x ) ; System . out . println ( " " ) ; int x = 3 ; System . out . println ( x * x * x ) ; } } 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 . 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 . Scanner ; public class Main { 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 . Scanner ; public class Abc052A { 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 . Scanner ; class X _ Cubic { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int x = scan . nextInt ( ) ; if ( x = = 1 ) System . out . println ( x ) ; else System . out . println ( x * x * x ) ; return 0 ; } } import java . util . * ; class Main { 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 ] ; } } } } package javaapplication127 ; import java . util . * ; public class JavaApplication127 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int cost = n * 800 ; int ref = ( n / 15 ) * 200 ; int y = cost - ref ; System . out . println ( y ) ; } } 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 - = 180 ; } 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 . Map ; import java . util . Scanner ; public class Main { static Scanner scanner ; static int [ ] C ; static int [ ] [ ] A ; public static void main ( String [ ] args ) { scanner = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; a [ 0 ] = gi ( ) ; a [ 1 ] = gi ( ) ; a [ 2 ] = gi ( ) ; Arrays . parallelSort ( a ) ; System . out . println ( a [ 2 ] - 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 ( ) ) ; } } public class Main ( ) { public static int cube ( int x ) { return x * x * x ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; System . out . println ( cube ( p ) ) ; } } # include < iostream > # include < vector > # include < deque > # include < cmath > # include < map > # include < set > # include < unordered _ set > # include < algorithm > # include " iomanip " using namespace std ; int main ( ) { int k , s , count = 0 ; cin > > k > > s ; for ( int i = 0 ; i < = min ( k , s ) ; i + + ) { for ( int j = 0 ; j < = min ( s - j , k ) ; j + + ) { for ( int l = 0 ; l < = min ( s - j - i , k ) ; l + + ) { if ( i + j + l = = s ) { count + + ; } } } } cout < < count ; return 0 ; } 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 . readLine ( ) . split ( " " ) ; 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 ) ; } } import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { 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 ( ) ; } 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 ; } } 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 Solution { public static int Square ( int a ) { int ans = ( int ) Math . pow ( a , 2 ) ; return ans ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; System . out . println ( Square ( a ) ) ; } } import java . util . * ; import java . io . * ; public class Solution { public static void main ( String [ ] args ) { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; int N = in . nextInt ( ) ; Num [ ] original = new Num [ N ] ; Num [ ] sorted = new Num [ N ] ; for ( int i = 0 ; i < N ; i + + ) { int n = in . nextInt ( ) ; original [ i ] = new Num ( i , n ) ; sorted [ i ] = new Num ( i , n ) ; } Arrays . sort ( sorted ) ; Map < Integer , Integer > order = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < N ; i + + ) { order . put ( sorted [ i ] . index , i ) ; } for ( int i = 0 ; i < N ; i + + ) { int index = order . get ( original [ i ] . index ) ; if ( index < N / 2 ) { System . out . println ( sorted [ N / 2 ] . n ) ; } else { System . out . println ( sorted [ N / 2 - 1 ] . n ) ; } } } } class Num implements Comparable < Num > { int index ; int n ; public Num ( int index , int n ) { this . index = index ; this . n = n ; } @ Override public int compareTo ( Num o ) { return this . n - o . n ; } } 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 [ ] t = new int [ 5 ] ; int [ ] p = new int [ 5 ] ; int min = 700 ; for ( int i = 0 ; i < 5 ; i + + ) { t [ i ] = Integer . parseInt ( sc . next ( ) ) ; } for ( int i = 0 ; i < 5 ; i + + ) { p [ i ] = i ; } Function < Integer , Integer > order = ( i ) - > t [ i ] % 10 = = 0 ? t [ i ] : t [ i ] + ( 10 - ( t [ i ] % 10 ) ) ; do { int sum = 0 ; for ( int i = 0 ; i < 4 ; i + + ) { sum + = order . apply ( p [ i ] ) ; } sum + = t [ p [ 4 ] ] ; min = Math . min ( min , sum ) ; } while ( nextPermutation ( p ) ) ; out . println ( min ) ; out . flush ( ) ; } } 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 ) { 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 class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int x = scn . nextInt ( ) ; System . out . println ( x * x * x ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . nextLine ( ) . toCharArray ( ) ; char [ ] t = sc . nextLine ( ) . toCharArray ( ) ; Arrays . sort ( s ) ; Arrays . sort ( t ) ; StringBuilder revercseT = new StringBuilder ( ) ; revercseT . append ( t ) ; revercseT . reverse ( ) ; System . out . println ( String . valueOf ( s ) . compareTo ( revercseT . toString ( ) ) < 0 ? " Yes " : " No " ) ; } } mport java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int judgement5 = 0 ; int judgement7 = 0 ; int [ ] number = new int [ 3 ] ; for ( int i = 0 ; i < number . length ; i + + ) { number [ i ] = sc . nextInt ( ) ; } for ( int i : number ) { if ( i = = 5 ) { judgement5 + + ; } else if ( i = = 7 ) { judgement7 + + ; } } if ( judgement5 = = 2 & & judgement7 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } public class main { public static void main { int x ; System . out . println ( x * x * x ) ; } } public class XCubic { public static void main ( String [ ] args ) { int i = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( i * i * i ) ; } } import java . util . Scanner ; public class Circle { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int i = scanner . nextInt ( ) ; System . out . println ( i * i ) ; } } 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 ) ; } } class Circle { public static void main ( String [ ] args ) int r ; int ratio = r * r ; Systam . out . println ( ratio ) ; } public 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 ) ; } } } package Jugs . AtCoder ; import java . util . HashMap ; import java . util . Map ; 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 ; } private static int solution _ 1 ( 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 C { 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 . * ; public class Main { static void bubbleSort ( int [ ] arr ) { int n = arr . length ; int temp = 0 ; a 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 . * ; public class Main { public void main ( String [ ] args ) { Scanner stdIn = new Scanner ( System . in ) ; int [ ] a = new int [ 3 ] ; count5 = 0 ; 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 . 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 ans = a + ( ( b - 1 ) / 10 ) * 10 + ( ( c - 1 ) / 10 ) * 10 + ( ( d - 1 ) / 10 ) * 10 + ( ( e - 1 ) / 10 ) * 10 ; ans = Math . min ( ans , int ans = b + ( ( a - 1 ) / 10 ) * 10 + ( ( c - 1 ) / 10 ) * 10 + ( ( d - 1 ) / 10 ) * 10 + ( ( e - 1 ) / 10 ) * 10 ) ; ans = Math . min ( ans , int ans = c + ( ( a - 1 ) / 10 ) * 10 + ( ( b - 1 ) / 10 ) * 10 + ( ( d - 1 ) / 10 ) * 10 + ( ( e - 1 ) / 10 ) * 10 ) ; ans = Math . min ( ans , int ans = d + ( ( a - 1 ) / 10 ) * 10 + ( ( c - 1 ) / 10 ) * 10 + ( ( b - 1 ) / 10 ) * 10 + ( ( e - 1 ) / 10 ) * 10 ) ; ans = Math . min ( ans , int ans = e + ( ( a - 1 ) / 10 ) * 10 + ( ( c - 1 ) / 10 ) * 10 + ( ( d - 1 ) / 10 ) * 10 + ( ( b - 1 ) / 10 ) * 10 ) ; System . out . println ( ans ) ; } } 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 ( ) ; Ststem . out . println ( x * x * x ) ; } } class Main ( ) { public static int cube ( int x ) { return x * x * x ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; System . out . println ( cube ( p ) ) ; } } class main { public static void main ( Strings arg [ ] ) { int x = 3 ; System . out . println ( x * x * x ) ; } } 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 ) ) ; int x = 0 ; for ( ; ; ) { 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 ( ) ; } } public class Main { public static void main ( String [ ] args ) { int x = i ; i > = 1 & & i < = 100 ; System . out . println ( x * x * x ) ; } } 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 . lang . Math ; public class Main { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( ( int ) Math . pow ( x , 3 ) ) ; } package test ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; public class Test { 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 . 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 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 + + ) { for ( int j = 1 ; j < i + 1 ; j + + ) { flag = true ; if ( P [ i ] > pre _ min ) { flag = false ; break ; } } if ( flag = = true ) { sum + = 1 ; pre _ min = P [ i ] ; } } System . out . print ( sum ) ; } } 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 { System . out . println ( " No " ) ; } } else if ( A > B ) { if ( A - ( V * T ) > = B - ( W * T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } if ( A + ( V * T ) < = B + ( W * T ) ) { 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 a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; for ( int i = 1 ; i < a ; i + + ) { for ( int j = 1 ; j < b ; j + + ) { if ( a = = 1 | | a > b ) { System . out . println ( " Alice " ) ; } else if ( b = = 1 | | b > a ) { System . out . println ( " Bob " ) ; } else if ( a = = b ) { System . out . println ( " Draw " ) ; } } } } } 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 ) ) ; int x = 0 ; while ( true ) { 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 . util . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scnnaer ( 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 < s - i ; j + + ) { if ( n - i - j < = k & & n - j - k > = 0 ) { sum + + ; } } } System . out . println ( sum ) ; } } 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 ; for ( 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 " ) ; } } } public static void main ( String [ ] args ) { int r = 100 ; int Circle = r * r * 3.14 ; System . out . print ( Circle + " 倍です " ) ; } import java . util . Scanner ; public class ABC { 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 ( ) ; } } class Main { public static void main ( String [ ] args ) { int = x ; x = 2 ; System . out . println ( x \ n x * x \ n x * x * x \ n ) ; } } 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 ; long n _ m = Math . abs ( N - M ) ; long l = ( Long ) Math . pow ( 10 , 9 ) + 7 ; 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 % l ) ; } } import java . io . IOException ; import java . util . Scanner ; public class Main { static double cross ( double x1 , double x2 , double y1 , double y2 , double xp , double yp ) { return ( x2 - x1 ) * ( yp - y2 ) - ( y2 - y1 ) * ( xp - x2 ) ; public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; while ( sc . hasNext ( ) ) { final double x1 = sc . nextDouble ( ) ; final double y1 = sc . nextDouble ( ) ; final double x2 = sc . nextDouble ( ) ; final double y2 = sc . nextDouble ( ) ; final double x3 = sc . nextDouble ( ) ; final double y3 = sc . nextDouble ( ) ; final double xp = sc . nextDouble ( ) ; final double yp = sc . nextDouble ( ) ; double c1 = cross ( x1 , x2 , y1 , y2 , xp , yp ) ; double c2 = cross ( x2 , x3 , y2 , y3 , xp , yp ) ; double c3 = cross ( x3 , x1 , y3 , y1 , xp , yp ) ; if ( ( c1 > 0 & & c2 > 0 & & c3 > 0 ) | | ( c1 < 0 & & c2 < 0 & & c3 < 0 ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } } class Main { public static void main ( String args [ ] ) { x = 3 ; System . out . println ( Integer . parsInt ( Math . pow ( x , 3 ) ) ; } } import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { solve ( ) ; } static void solve ( ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; if ( k = = 1 ) { System . out . println ( 0 ) ; } else { System . out . println ( ( n - ( k - 1 ) - 1 ) ) ; } } } public class X _ Cubic { public static void main ( String args [ ] ) { int numInput = Integer . parseInt ( args [ 0 ] ) ; int result = numInput * numInput * numInput ; System . out . println ( result ) ; } } 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 . lang . * ; public class Main { 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 Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a = in . nextInt ( ) , b = in . nextInt ( ) , c = in . nextInt ( ) ; if ( a + b > = c ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; in . close ( ) ; } } import java . io . IOException ; import java . util . Scanner ; public class Main1 { public static void main ( String args [ ] ) throws IOException { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; System . out . println ( n * n * n ) ; } } import java . io . * ; 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 . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String line = br . readLine ( ) ; int num = Integer . parseInt ( line ) ; int sum ; sum = num * num * num ; System . out . println ( sum ) ; } } 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 if { 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 [ 5 ] ; for ( int i = 0 ; i < 5 ; i + + ) { a [ i ] = sc . nextInt ( ) ; } int k = sc . nextInt ( ) ; int maxDist = 0 ; for ( i = 0 ; i < 4 ; i + + ) { if ( maxDist < a [ i + 1 ] - a [ i ] ) { maxDist = a [ i + 1 ] - a [ i ] ; } } if ( maxDist > k ) { System . out . println ( " : ( " ) ; } else { System . out . println ( " Yay ! " ) ; } } } import java . io . * ; import java . util . * ; 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 [ ] arr = new int [ N ] ; int [ ] dp = new int [ N ] ; dp [ 0 ] = 1 ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; arr [ 0 ] = Integer . parseInt ( st . nextToken ( ) ) ; for ( int i = 1 ; i < N ; i + + ) { arr [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; int tmp = ( arr [ i - 1 ] + 1 ) / 2 ; if ( tmp % 2 ! = 0 ) { tmp + + ; } if ( tmp > dp [ i - 1 ] ) ans + = d [ i - 1 ] ; else { ans + = tmp ; arr [ i ] * = ( - 2 * tmp ) ; } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int H = sc . nextInt ( ) ; int W = sc . nextInt ( ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; ifif ( ( H - h ) % 2 = = 0 | | ( W - w ) % 2 = = 0 ) System . out . println ( " No " ) ; System . out . println ( " Yes " ) ; long s = Math . max ( 1 , ( h - 1 ) * ( w - 1 ) ) ; long x = ( - 1 ) * h * w / s ; for ( int i = 0 ; i < H ; + + i ) { for ( int j = 0 ; j < W - 1 ; j + + ) { if ( i % h = = 0 | | j % w = = 0 ) System . out . print ( 1 + " " ) ; else System . out . print ( x + " " ) ; } System . out . println ( 1 ) ; } return ; } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( Systee . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; A = new char [ N ] [ N ] ; for ( int i = 0 ; i < N ; i + + ) A [ i ] = sc . next ( ) . toCharArray ( ) ; B = new char [ M ] [ M ] ; for ( int i = 0 ; i < M ; i + + ) B [ i ] = sc . next ( ) . toCharArray ( ) ; for ( int ii = 0 ; ii < = N - M ; ii + + ) { for ( int jj = 0 ; jj < = N - M ; jj + + ) { if ( match ( ii , jj ) ) { System . out . println ( " Yes " ) ; return ; } } } System . out . println ( " No " ) ; } public static boolean match ( int ii , int jj ) { for ( int i = 0 ; i < M ; i + + ) { for ( int j = 0 ; j < M ; j + + ) { if ( A [ i + ii ] [ j + jj ] ! = B [ i ] [ j ] ) return false ; } } return true ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { int result ; Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; double PI = 3.14 ; result = r * r * PI / 1 * 1 * PI ; System . out . println ( " result " ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner c = new Scanner ( System . in ) ; String [ ] str1 = c . nextLine ( ) . split ( " " ) ; String [ ] str2 = c . nextLine ( ) . split ( " " ) ; String str3 = c . nextLine ( ) ; long position1 = Long . parseLong ( str1 [ 0 ] ) + ( Long . parseLong ( str1 [ 1 ] ) * Long . parseLong ( str3 ) ) ; long position2 = Long . parseLong ( str2 [ 0 ] ) + ( Long . parseLong ( str2 [ 1 ] ) * Long . parseLong ( str3 ) ) ; if ( position1 > = position2 ) { 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 + 1 ; x + + ) { for ( int y = 0 ; x < k + 1 ; x + + ) { for ( int z = 0 ; x < k + 1 ; x + + ) { if ( x + y + z = = s ) { ans + + ; } } } } System . out . println ( ans ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String ST = next ( ) ; StringBuilder S = new StringBuilder ( ST ) ; for ( int i = 0 ; i < S . length ( ) ; i + + ) { if ( S . charAt ( i ) = = ' ? ' ) { if ( S . charAt ( i - 1 ) = = ' P ' ) { S . setCharAt ( i , ' D ' ) ; } else if ( S . charAt ( i - 1 ) = = ' D ' ) { S . setCharAt ( i , ' P ' ) ; } } } System . out . println ( S ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { 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 = = 2 & & counterFor5 = = 1 ) { System . out . println ( " Yes " ) } else { System . out . println ( " No " ) } } } public class test2 { public static void main ( String [ ] args ) { int x = 2 ; x = x * x * x ; System . out . println ( x ) ; } } import static java . lang . System . out ; import java . io . BufferedReader ; import java . io . InputStreamReader ; class Main { public static void main ( String ... args ) throws Exception { BufferedReader stdin = new BufferedReader ( new InputStreamReader ( System . in ) ) ; stdin . lines ( ) . mapToInt ( Integer : : parseInt ) . mapToInt ( v - > Math . pow ( v , 3d ) ) . forEach ( out : : println ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; int i ; int ans = 1 ; x = Integer . parseInt ( args [ 0 ] ) ; for ( i = 0 ; i < 3 ; i + + ) { ans = ans * x ; } System . out . printf ( ans ? \ n ) ; } } import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String t = sc . next ( ) ; String [ ] strArray = new String [ t . length ( ) ] ; for ( int i = 0 ; i < t . length ( ) ; i + + ) { String str = String . valueOf ( str . charAt ( i ) ) ; strArray [ i ] = str ; } for ( int i = 0 ; i < strArray . length ; i + + ) { if ( strArray [ i ] = = " ? " ) { strArray [ i ] = " D " ; } StringBuffer buf = new StringBuffer ( ) ; buf . append ( strArray [ i ] ) ; } System . out . println ( buf . toString ( ) ) ; } } public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . println ( " input " ) ; 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 = Integer . parseInt ( sc . next ( ) ) ; final int MOD = 1000000007 ; long [ ] num = new long [ n ] ; long sum = 0 ; int [ ] count = new int [ 60 ] ; for ( int i = 0 ; i < n ; i + + ) { num [ i ] = Long . parseLong ( sc . next ( ) ) ; for ( int j = 0 ; j < 60 ; j + + ) { count [ j ] + = ( 1 & ( num [ i ] > > j ) ) ; } } for ( int i = 0 ; i < 60 ; i + + ) { sum + = ( count [ i ] * ( n - count [ i ] ) % MOD ) * ( 1L < < i ) % MOD ) % MOD ; sum % = MOD ; } System . out . println ( sum ) ; } } class Main { public static void main ( String [ ] args ) { int x ; x = x * x * x ; System . out . println ( x ) ; } } public class mean { public static void main ( Atring [ ] 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 ) ; } } } import java . io . * ; class Main { public static void main { 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 . * ; class Main { public static void main ( String [ ] args ) { 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 " ) ; } } } class Main { public static void main ( String [ ] args ) BufferedReader reader = new BufferdReader ( new InputStreamReader ( System . in ) ) ; try { 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 A = nextInt ( ) ; int B = nextInt ( ) ; int C = nextInt ( ) ; int D = nextInt ( ) ; if ( A * B < = C * D ) System . out . println ( ) ; if ( C * D < A * B ) System . out . println ( ) ; } } 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 ( ) ; if ( v < = w ) { System . out . print ( " NO " ) ; } if ( v > w ) { int dist = Math . abs ( a - b ) ; int dif = v - w ; if ( dist / dif < = t ) { System . out . print ( " YES " ) ; } else { System . out . print ( " NO " ) ; } } } import java . util . Scanner ; 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 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } package AtCoder ; import java . util . Scanner ; public class abc123a { 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 ( " : ( " ) ; } } } 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 . text . SimpleDateFormat ; import java . util . Date ; import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) throws Exception { 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 JavaSampleClass { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String day = scan . next ( ) ; int year = Integer . parseInt ( day . substring ( 0 , 4 ) ) ; int mon = Integer . parseInt ( day . substring ( 5 , 7 ) ) ; if ( year > = 2019 & & mon > = 5 ) { System . out . println ( " TBD " ) ; } else System . out . println ( " Heisei " ) ; } } 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 V = scan . nextInt ( ) ; int B = scan . nextInt ( ) ; int W = scan . nextInt ( ) ; int T = scan . nextInt ( ) ; if ( A < B ) { if ( A + ( V * T ) < B + ( W * T ) ) { System . out . println ( " No " ) ; } else { System . out . println ( " Yes " ) ; } } else if ( A + ( V * T ) > = B + ( W * T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } else if ( B < A ) { if ( B - ( W * T ) > = A - ( V * T ) ) { 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 ) ; Systmem . out . println ( sc . nextInt ( ) ^ 3 ) ; } } import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; 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 . * ; 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 ( A + " " + B ) ; } } import java . io . * ; public class enn { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; try { String line = reader . readLine ( ) ; double r = Integer . parseInt ( line ) ; System . out . printf ( " % 6f % 6f " , 2 * Math . PI * r , Math . PI * r * r ) ; } catch ( IOException e ) { System . out . println ( e ) ; } } } import java . io . BufferedReader ; import java . io . InputStreamReader ; public class L _ 1 _ 2 { 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 ) ; } } } package test ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; 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 . 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 ( Math . abs ( N - M ) < 2 ) { for ( long i = N ; i = 0 ; i -- ) { sum _ N * = i ; } for ( long j = M ; j = 0 ; j -- ) { sum _ M * = j ; } } System . out . println ( sum _ N * sum _ M ) ; } } 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 ) ; } } inport java . util . scanner public class main ( ) { public static void main ( ) { Scanner sc = new Scanner ( System . in ) ; int x = sc . nextInt ( ) ; System . out . println ( X * x * x ) ; } } import java . util . * ; public class D { static final long MOD = 1000000007L ; static final int WIDTH = 64 ; static final long [ ] BIN _ EXPS = buildBinExps ( WIDTH ) ; static Scanner sc = new Scanner ( System . in ) ; static int n = 0 ; public static void main ( String [ ] args ) { n = sc . nextInt ( ) ; int [ ] [ ] binaries = new int [ n ] [ WIDTH ] ; for ( int i = 0 ; i < n ; + + i ) { binaries [ i ] = getBinary ( sc . nextLong ( ) ) ; } long ans = 0L ; for ( int iw = 0 ; iw < WIDTH ; + + iw ) { int z = count0 ( binaries , iw ) ; ans + = z * ( n - z ) % MOD * BIN _ EXPS [ iw ] % MOD ; ans % = MOD ; } System . out . println ( ans ) ; } static long [ ] buildBinExps ( int w ) { long [ ] res = new long [ w ] ; for ( int i = 0 ; i < w ; + + i ) { res [ i ] = ( i = = 0 ) ? 1L : 2L * res [ i - 1 ] % MOD ; } return res ; } static int [ ] getBinary ( long num ) { int [ ] res = new int [ WIDTH ] ; for ( int i = 0 ; i < WIDTH ; + + i ) { res [ i ] = ( num % 2L = = 1L ) ? 1 : 0 ; num / = 2L ; } return res ; } static int count0 ( int [ ] [ ] binaries , int iw ) { int res = 0 ; for ( int id = 0 ; id < n ; + + id ) { if ( binaries [ id ] [ iw ] = = 0 ) + + res ; } return res ; } } public class Restraint { public static void Main ( String [ ] args ) { int eatLunch = 0 ; int price = 0 ; Scanner sc = new Scanner ( System . in ) ; while ( true ) { eatLunch = sc . nextInt ( ) ; if ( eatLunch = < 100 ) { break ; } price = eatLunch * 800 ; if ( eatLunch = < 15 ) { price = price - ( ( eatLunch / 15 ) * 200 ) ; } System . out . println ( price ) ; } } 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 ( " ? ? ¨ ? ? ? ? ? ? " ) ; import java . io . * ; class Main { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = r . readLine ( ) ; Integer . parseInt ( s ) ; System . out . println ( x * x * x ) ; } } h import java . util . * ; 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 ) throws IOException { System . out . print ( " 数字を入力して下さい : " ) ; BufferedReader br = n w BufferedRead r ( e In utStreamReader ( Sys em.in ) ) ; String i n = br. r ea d L i e ( ) ; d ub e x = Math.po w ( I teger. a s Int ( i n ) , 3 ) ; Sys t em.out.p r in t l ( ( i t ) x ) ; } } 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 . util . * ; import java . io . * ; public class Cube { public static void main ( String [ ] args ) { int x ; Scanner sc = new Scanner ( new InputStreamReader ( System . in ) ) ; x = sc . nextInt ( ) ; System . out . println ( x * x * x ) ; sc . close ( ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) throws IOException { InputStreamReader is = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( is ) ; System . out . println ( " ? ? ? ? ? ? ? ? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? . " ) ; int x = 0 ; x = br . readLine ( ) ; for ( int i = 0 ; i < 2 ; i + + ) { x * = x ; } System . out . println ( x ) ; } } import java . util . * ; import java . io . * ; import java . lang . Math ; public class Ants { public static void main ( String [ ] args ) { Scanner cin = new Scanner ( System . in ) ; ArrayList < Integer > a = new ArrayList < Integer > ( 6 ) ; for ( int i = 0 ; i < 6 ; i + + ) { a . add ( cin . nextInt ( ) ) ; } for ( int i = 0 ; i < a . size ( ) - 1 ; i + + ) { for ( int j = 0 ; j < a . size ( ) - 1 ; j + + ) { if ( Math . abs ( a . get ( i ) - a . get ( j ) ) > a . get ( 5 ) ) { 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 ) ; int n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int [ ] array = { n1 , n2 , n3 } ; int matchCount = 0 ; Arrays . stream ( array ) . collect ( Collectors . groupingBy ( s - > s ) ) . forEach ( ( k , v ) - > if ( k = = 5 ) { if ( v . size ( ) = = 2 ) { matchCount + = 1 ; } } else if ( k = = 7 ) { if ( v . size ( ) = = 1 ) { matchCount + = 1 ; } } ) ; if ( matchCount = = 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 " ) ; } } } n = gets . to _ i puts n * n import java . util . Scanner ; public class Main2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( k = = 1 ) { System . out . println ( 0 ) ; } else { int out = n - k ; System . out . println ( out ) ; } } } int x = 2 ; System . out . print ( ( int ) Math . pow ( x , 3 ) ) ; import java . util . Scanner ; public class Main190526 { public static void main ( String args [ ] ) { Scanner scanner = new Scanner ( System . in ) ; try { int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ; int c = scanner . nextInt ( ) ; String text = scanner . next ( ) ; int sum = a + b + c ; System . out . println ( sum + " " + text ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; } finally { scanner . close ( ) ; } } } import java . util . Scanner ; import java . util . Arrays ; public class atcode { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; System . out . print ( " Nを入力 : " ) ; int n = sc. e t nt ( ) ; int [ ] n ms = ew i t n ] ; for ( i n t i = 0 ; u m . e gth ; i + + ) { u ms [ ] = sc . n e t nt ( ) ; } de f ( n ums ) ; pub l i tatic oid de ( int n , i nt [ n ms ) { int n n- ; n c o u t ; nt [ ] c ; f o r in t i = 0 ; ; + ) { e = e i t nx ] co u nt = nx-1 ; f r ( i n t l = 0 ; ; + ) { f ( l = i ) { ce c o n -- ] = nu ms [ ] } } A r r y . ort ( ce ) ; if ( n x 2 ! = ) { Sy t e . ut.pri n tln ( ce [ nx / 2 ] ) ; } e l s e yste . ut.pri n tln ( ce [ nx-1 / 2 ] ) ; } } } } 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 ( ) ; tolal = coinVal + coinVal2 ; if ( total > = toyPrice ) { System . out . println ( " yes " ) ; } else { System . out . println ( " no " ) ; } } } public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( input ) . useDelimiter ( " \ \ s * fish \ \ s * " ) ; System . out . println ( ( int ) Math . pow ( Integer . parseInt ( s . nextInt ( ) ) , 3 ) ) ; } } import java . io . IOException ; class Main { public static void main ( String [ ] args ) throws IOException { DataInputStream d = new DataInputStream ( System . in ) ; int x = d . read ( ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } 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 ) ; } } } } class Main { public static void main ( String [ ] args ) { int x ; int sum = 0 ; sum = x * x * x ; System . out . println ( sum ) ; } } import java . util . * ; import java . time . * ; import java . time . format . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String str = sc . next ( ) ; DateTimeFormatter = DateTimeFormatter . ofPattern ( " yyyy / MM / dd " ) ; LocalDate d = LocalDate . parse ( str , f ) ; LocalDate reiwa = LocalDate . parse ( " 2019 / 04 / 30 " , f ) ; if ( d . isAfter ( reiwa ) ) System . out . println ( " TBD " ) ; else System . out . println ( " Heisei " ) ; } } 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 . Scanner ; class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] x = new int [ n ] ; for ( int i = 0 ; i < n ; i + + ) { x [ i ] = sc . nextInt ( ) ; } int min = x [ 0 ] ; int max = x [ 0 ] ; for ( int i = 0 ; i < n ; i + + ) { if ( min > x [ i ] ) { min = x [ i ] ; } if ( max < x [ i ] ) { max = x [ i ] ; } } int st = 50000 ; for ( int i = min ; i < = max ; i + + ) { for ( int j = 0 ; j < n ; j + + ) { int total + = ( x [ j ] - i ) * ( x [ j ] - i ) ; if ( j = = n - 1 & & st > total ) { st = total ; } } } System . out . println ( st ) ; } } int N = sc . nextInt ( ) ; int [ ] X = new int [ N ] ; int [ ] Y = new int [ N ] ; double sum = 0 ; int time = 1 ; int n = 1 ; for ( int i = N - 1 ; i > 0 ; i -- ) time * = i ; for ( int i = N ; i > 0 ; i -- ) n * = i ; time * = 2 ; for ( int i = 0 ; i < N ; i + + ) { X [ i ] = sc . nextInt ( ) ; Y [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < N ; i + + ) { for ( int j = i + 1 ; j < N ; j + + ) { double x = Math . pow ( X [ i ] - X [ j ] , 2 ) ; double y = Math . pow ( Y [ i ] - Y [ j ] , 2 ) ; double dis = Math . sqrt ( x + y ) * time ; sum + = dis ; } } sum / = n ; System . out . println ( sum ) ; import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = reader . nextInt ( ) ; System . out . println ( n * n * n ) ; } } 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 " ) ; } } } class main { public static void main ( String args [ ] ) { BufferedReader br = new BufferedReader ( ) ; String str = br . readLine ( ) ; System . out . print ( str * str * str ) ; } } 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 { System . out . println ( " No " ) ; } } else if ( A > B ) { if ( A - ( V * T ) > = B - ( W * T ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } } public class main { public static void main ( String [ ] args ) { int x ; int kekka ; x = 2 ; kekka = x * x ; System . out . println ( kekka ) ; } } 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 . io . Scanner ; import java . util . Scanner ; class Main { public static void main ( String [ ] args ) ( Scanner scan = new Scanner ( ststem . in ) ; int x = scan . nextInt ( ) ; 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 = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( Math . pow ( x , 3 ) ) ; } } import java . util . * ; class test { public static void main ( String [ ] args ) { } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double Pai = 3.141592653589793238462643383279 ; 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 . 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 - a * 500 - b * 100 > = 0 ) { int nd _ c = ( x - a * 500 - b * 100 ) % 50 ; } else { break ; } if ( nd _ c < c ) { cnt + + ; } } } System . out . println ( cnt ) ; } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( System . in ) ; int x = java . io . Integer . parseInt ( br . readLine ( ) ) ; x = x * x * x ; System . out . println ( x ) ; } } 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 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 lcm = lcm ( v , w ) ; if ( w > = v ) { System . out . println ( " NO " ) ; return ; } if ( Math . abs ( a - b ) < = ( v - w ) * t ) { System . out . println ( " YES " ) ; return ; } System . out . println ( " NO " ) ; } } 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 ) ; } } class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int num = scanner . nextInt ( ) ; System . out . print ( num * num * num ) ; } } import java . util . * ; public class Mainfifthjune { 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 . 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 ( " 入出力エラーです " ) ; } } } public class Main { 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 . * ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = nextInt ( ) ; System . out . println ( n * n ) ; } } 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 ) ) ; System . out . println ( ( int ) Math . pow ( Integer . parseInt ( br . readLine ( ) ) , 3 ) ) ; } class Main { public static main 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 n1 = sc . nextInt ( ) ; int n2 = sc . nextInt ( ) ; int n3 = sc . nextInt ( ) ; int [ ] array = { n1 , n2 , n3 } ; int match1 = 0 ; int match2 = 0 ; for ( int val : array ) { if ( val = = 5 ) { match1 + + ; } else if ( val = = 7 ) { match2 + + ; } } if ( match1 = = 2 & & match2 = = 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } class Main { public static void main ( String [ ] args ) { int x ; x ? ? ? 100 ; x ? ? § ; * x * x ; ystem. o ut. p rintln ( x ) ; public class Main { public static void main ( String [ ] args ) { int x = 2 ; if ( x > = 1 | | x < = 100 ) { result = x * x * x ; System . out . println ( result ) ; } } } import java . util . * ; class 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 cnt = 0 ; int sum = 0 ; for ( int a = 0 ; a < = A ; a + + ) { for ( int b = 0 ; b < = B ; b + + ) { for ( int c = 0 ; c < = C ; c + + ) { sum = 500 * a + 100 * b + 50 * c ; if ( sum = = X ) { cnt + + ; } sum = 0 ; } } } System . out . println ( cnt ) ; } } import java . util . Scanner ; public class Main { public static void main ( String [ ] Args ) { Scanner sc = new Scanner ( System . in ) ; int [ ] ant = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i + + ) { int ant [ i ] = Integer . parseInt ( sc . next ( ) ) ; } int result = 0 ; boolean hantei = false ; for ( int i = 0 ; i < 5 ; i + + ) { for ( int j = 0 ; j < i ; i + + ) { result = ant [ i ] - ant [ j ] ; if ( result < ant [ 5 ] ) { system . out . print ( ' : ( ' ) ; hantei = true ; break ; } } } if ( ! hantei ) { system . out . print ( ' Yay ! ' ) ; } } } import java . util . Scanner ; public classMain { public static voidmain ( String [ ] args ) { Scanner sc = newScanner ( System . in ) ; intx = sc . nextInt ( ) ; intanswer = x * x * x ; System . out . println ( answer ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) { BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int x = input . readLine ( ) ; x = x ^ 3 ; System . out . println ( 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 ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; Long [ ] in = new Long [ a ] ; double d = 0 ; Long e = d - d ; 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 . 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 = br . readLine ( ) ; System . out . println ( Integer . parseInt ( Math . pow ( x , 3 ) ) ) ; } } 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 ; } } } } } } public class Main ( ) { public int cube ( int x ) { return x * x * x ; } public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int p = scanner . nextInt ( ) ; System . out . println ( cube ( p ) ) ; } } 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 ) { 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 . * ; 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 . out . println ( " Yay ! " ) ; } } 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 . * ; 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 ; } } } public class Main { public static void main ( String [ ] args ) { int n = ( new Scanner ( System . in ) ) . nextInt ( ) ; System . out . println ( Math . pow ( n , 3 ) ) ; } } import java . io . * ; class prob11b { public static void main ( String args [ ] ) { int x , bb ; try { BufferedReader d = new BufferedReader ( new InputStreamReader ( System . in ) ) ; x = Integer . parseInt ( d . readLine ( ) ) ; bb = x * x * x ; System . out . println ( bb ) ; } } } class Main { public static void main ( String [ ] args ) throws IOException { int x = 8 ; System . out . println ( x ) ; } } class Circle { public static void main ( String [ ] args ) { int r ; int ratio = r * r ; Systam . out . println ( ratio ) ; } } import java . lang . Math ; public class ITP1 _ 1 _ B { public static void main ( String [ ] args ) { int x = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( pow ( x , 3 ) ) ; } } import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { 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 = = 2 & & counterFor5 = = 1 ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } } import java . util . Scanner ; public class Main { public static void main ( String [ ] ar ) { Scanner sc = new Scanner ( System . in ) ; int cnt = 0 ; int k = sc . nextInt ( ) , def = sc . nextInt ( ) ; int x = 0 , y = 0 , z = def ; if ( x < = k & & y < = k & & z < = k ) { + + cnt ; } while ( true ) { z = def - x ; y = 0 ; while ( true ) { if ( x < = k & & y < = k & & z < = k ) { + + cnt ; } if ( z = = 0 ) { break ; } -- z ; + + y ; } + + x ; } System . out . println ( cnt ) ; } } import java . util . Scanner ; public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; double Pai = 3.141592653589793238462643383279 ; 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 . util . Scanner ; public class cubic { 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 ; 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 " ) ; } import java . util . * ; import java . io . InputStreamReader ; import java . io . BufferedReader ; class B123 { public static void main ( String [ ] args ) throws Exception { System . out . println ( " Hello Codiva " ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; ArrayList < Integer > arr = new ArrayList < > ( ) ; for ( int i = 0 ; i < 5 ; i + + ) { arr . add ( Integer . parseInt ( br . readLine ( ) ) ) ; } Collections . sort ( arr , new Comparator < Integer > ( ) { public int compare ( Integer e1 , Integer e2 ) { if ( ( e1 % 10 ! = 0 ) & & ( e2 % 10 = = 0 ) ) { return 1 ; } else if ( ( e1 % 10 = = 0 ) & & ( e2 % 10 ! = 0 ) ) { return - 1 ; } else { return - 1 ; } } } ) ; System . out . println ( arr ) ; Collections . sort ( arr , new Comparator < Integer > ( ) { public int compare ( Integer e1 , Integer e2 ) { if ( e1 % 10 = = 0 & & e2 % 10 ! = 0 | | ( e2 % 10 = = 0 & & e1 % 10 ! = 0 ) | | e1 % 10 = = 0 | | e2 % 10 = = 0 ) { return - 1 ; } else { if ( e1 % 10 < e2 % 10 ) { return 1 ; } else { return - 1 ; } } } } ) ; int sum = 0 ; System . out . println ( arr ) ; for ( int i = 0 ; arr . isEmpty ( ) ! = true ; ) { sum + = arr . remove ( i ) ; if ( arr . isEmpty ( ) ) { break ; } else if ( sum % 10 ! = 0 ) { sum + = ( 10 - ( sum % 10 ) ) ; } } System . out . println ( sum ) ; } } 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 " ) ; } } 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 [ ] ) { int x ; InputStreamReader sir = new InputStreamReader ( System . in ) ; BufferReader br = new BufferReader ( isr ) ; String but = br . readLine ( ) ; x = Integer . parseInt ( but ) ; if ( a > = 0 & & a = < 100 ) { x = x * x * x ; } } } 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 static 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 . 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 ; } } # include < bits / stdc + + . h > using namespace std ; # define int long long int K , S , ans = 0 ; signed main ( ) { cin > > K > > S ; for ( int i = 0 ; i < = K ; i + + ) { for ( int j = 0 ; j < = K ; j + + ) { if ( S > = i + j & & S - i - j < = K ) { ans + + ; } } } cout < < ans < < endl ; return 0 ; } 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 Main9 { 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 = = 17 & product = = 175 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } 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 ) ; } } } class Main { public static void main ( String [ ] args ) throws java . io . IOException { System . out . println ( Math . pow ( System . in . read ( ) , 3 ) ; } } 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 = a ; int Max = a ; System . out . println ( Max - Min ) ; } } } import java . io . * ; class Main { public static void main ( String [ ] args ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; System . out . println ( n * n * n ) ; } } 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 ) { Scanner sc = new Scanner ( System . in ) ; int p = sc . nextInt ( ) ; System . out . println ( p * p * p ) ; } } import java . util . Scanner ; class Xcubic { public static void main ( String [ ] args ) { int x ; Scanner scanner = new Scanner ( System . in ) ; int x = scanner . 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 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 ) ; } } } import java . util . * ; class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int A = can . nextInt ( ) ; int B = scan . nextInt ( ) ; int C = scan . nextInt ( ) ; if ( A + B > = C ) { System . out . println ( " Yes " ) ; } else ( A + B < C ) { System . out . println ( " No " ) ; } } } import java . io . * ; class Main { 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 ) ; } } 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 . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner s = new Scanner ( input ) . useDelimiter ( " \ \ s * fish \ \ s * " ) ; System . out . println ( ( int ) Math . pow ( Integer . parseInt ( s . nextInt ( ) ) , 3 ) ) ; s . close ( ) ; } } import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; class TestClass { public static void main ( String args [ ] ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String name = br . readLine ( ) ; String st [ ] = name . split ( " " ) ; int a = Integer . parseInt ( st [ 0 ] ) ; int b = Integer . parseInt ( st [ 1 ] ) ; if ( a < = 5 ) { System . out . println ( 0 ) ; } else if ( a > = 6 & & a < = 12 ) { System . out . println ( b / 2 ) ; } else if ( a > = 12 ) { System . out . println ( b ) ; } } } package test ; public class X _ Cubic { public static void main ( String [ ] args ) { int a = Integer . parseInt ( args [ 0 ] ) ; System . out . println ( Math . pow ( a , 3 ) ) ; } } import java . util . * ; 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 cost = Math . abs ( Math . max ( math . max ( a1 , a2 ) , a3 ) - Math . min ( math . min ( a1 , a2 ) , a3 ) ) ; System . out . println ( cost ) ; } } class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int reports = sc . nextInt ( ) ; long takahashi = sc . nextLong ( ) ; long aoki = sc . nextLong ( ) ; for ( int i = 1 ; i < reports ; i + + ) { long next _ takahashi = sc . nextLong ( ) ; long next _ aoki = sc . nextLong ( ) ; long multiplier = Math . max ( takahashi / next _ takahashi , aoki / next _ aoki ) ; while ( next _ aoki * multiplier > aoki | | next _ takahashi * multiplier > takahashi ) { multiplier + + ; } takahashi = next _ takahashi * multiplier ; aoki = next _ aoki * multiplier ; } System . out . println ( takahashi + aoki ) ; } } import java . io . * ; public class Main { public static void main ( String [ ] args ) thorows IOException { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int a = in . readLine ( ) ; System . out . println ( a * a * a ) ; } } 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 [ ] ranges = new Integer ( ) [ count ] ; int range = 0 ; for ( int i = 0 ; i < count ; i + + ) { range + = ( index - new Integer ( scanLine [ i ] ) ) * ( index - new Integer ( scanLine [ i ] ) ) } System . out . println ( range ) ; } } import java . util . * ; public class Main { static public void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int line = sc . nextInt ( ) ; int count5 = 0 , count7 = 0 ; for ( int i = 0 ; i < 3 ; i + + ) { if ( line [ i ] = = 5 ) { count5 + + ; } else if ( line [ i ] = = 7 ) { count7 + + ; } else { System . out . println ( " NO " ) ; } } if ( count5 = = 2 & & count7 = = 1 ) System . out . println ( " YES " ) ; else { System . out . println ( " NO " ) ; } } } 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 . * ; public 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 i ; int pow = 1 ; for ( i = 1 ; i < = N ; i + + ) { pow = pow * i ; double ans = ( double ) pow % ( Math . pow ( 10.0 , 9.0 ) + 7.0 ) ; } System . out . println ( ( int ) ans ) ; } } 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 . * ; 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 ; int sum = 0 ; for ( int i = 0 ; i < x . length ( ) ; i + + ) { sum + = Integer . parseInt ( x [ i ] ) ; } System . out . printtln ( sum ) ; } } } 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 ( ) ; } } public class Main { public static void main ( String [ ] args ) { int x ; 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 ans = 0 ; for ( int i = 0 ; i < 5 ; i + + ) { int i = sc . nextInt ( ) ; if ( i % 10 = = 0 ) { ans + = i ; } else { while ( i % 10 ! = 0 ) { i + + ; } if ( i % 10 = = 0 ) { ans + = i ; } } } System . out . println ( ans ) ; } } public 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 ) ^ 3 ; System . out . println ( x ) ; } }